From owner-freebsd-emulation Mon Jan 29 21:35:55 2001 Delivered-To: freebsd-emulation@freebsd.org Received: from palrel3.hp.com (palrel3.hp.com [156.153.255.226]) by hub.freebsd.org (Postfix) with ESMTP id 229EC37B698 for ; Mon, 29 Jan 2001 21:35:36 -0800 (PST) Received: from adlmail.cup.hp.com (adlmail.cup.hp.com [15.0.100.30]) by palrel3.hp.com (Postfix) with ESMTP id A7E0D815; Mon, 29 Jan 2001 21:35:35 -0800 (PST) Received: from cup.hp.com (p1000181.nsr.hp.com [15.109.0.181]) by adlmail.cup.hp.com (8.9.3 (PHNE_18546)/8.9.3 SMKit7.02) with ESMTP id VAA03962; Mon, 29 Jan 2001 21:35:33 -0800 (PST) Message-ID: <3A7652A0.BF5F7DB8@cup.hp.com> Date: Mon, 29 Jan 2001 21:35:28 -0800 From: Marcel Moolenaar Organization: Hewlett-Packard X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: Martin Blapp Cc: freebsd-emulation@FreeBSD.ORG Subject: Re: [PATCH] Staroffice Network Problem solved References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Martin Blapp wrote: > > Can you review this and commit it to STABLE and CURRENT ? This > unbreaks the staroffice network code. :-)))) > > --- linux_socket.c Sat Jan 20 20:54:47 2001 > +++ linux_socket.c.new Sun Jan 21 02:59:44 2001 > @@ -454,7 +454,7 @@ > return (error); > > p->p_retval[0] = stat; > - return (0); > + return (EISCONN); > } > } This code is executes when the native connect(2) returns EISCONN. Can you test the following patch. It removes the special handling when connect(2) returns EISCONN. Index: linux_socket.c =================================================================== RCS file: /home/ncvs/src/sys/compat/linux/linux_socket.c,v retrieving revision 1.25 diff -u -r1.25 linux_socket.c --- linux_socket.c 2000/12/19 00:24:25 1.25 +++ linux_socket.c 2001/01/30 05:30:56 @@ -404,61 +404,7 @@ bsd_args.s = linux_args.s; bsd_args.name = (caddr_t)linux_args.name; bsd_args.namelen = linux_args.namelen; - error = connect(p, &bsd_args); - if (error == EISCONN) { - /* - * Linux doesn't return EISCONN the first time it occurs, - * when on a non-blocking socket. Instead it returns the - * error getsockopt(SOL_SOCKET, SO_ERROR) would return on BSD. - */ - struct fcntl_args /* { - int fd; - int cmd; - int arg; - } */ bsd_fcntl_args; - struct getsockopt_args /* { - int s; - int level; - int name; - caddr_t val; - int *avalsize; - } */ bsd_getsockopt_args; - void *status, *statusl; - int stat, statl = sizeof stat; - caddr_t sg; - - /* Check for non-blocking */ - bsd_fcntl_args.fd = linux_args.s; - bsd_fcntl_args.cmd = F_GETFL; - bsd_fcntl_args.arg = 0; - error = fcntl(p, &bsd_fcntl_args); - if (error == 0 && (p->p_retval[0] & O_NONBLOCK)) { - sg = stackgap_init(); - status = stackgap_alloc(&sg, sizeof stat); - statusl = stackgap_alloc(&sg, sizeof statusl); - - if ((error = copyout(&statl, statusl, sizeof statl))) - return (error); - - bsd_getsockopt_args.s = linux_args.s; - bsd_getsockopt_args.level = SOL_SOCKET; - bsd_getsockopt_args.name = SO_ERROR; - bsd_getsockopt_args.val = status; - bsd_getsockopt_args.avalsize = statusl; - - error = getsockopt(p, &bsd_getsockopt_args); - if (error) - return (error); - - if ((error = copyin(status, &stat, sizeof stat))) - return (error); - - p->p_retval[0] = stat; - return (0); - } - } - - return (error); + return (connect(p, &bsd_args)); } #ifndef __alpha__ -- Marcel Moolenaar mail: marcel@cup.hp.com / marcel@FreeBSD.org tel: (408) 447-4222 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message