Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jan 2001 21:35:28 -0800
From:      Marcel Moolenaar <marcel@cup.hp.com>
To:        Martin Blapp <mb@imp.ch>
Cc:        freebsd-emulation@FreeBSD.ORG
Subject:   Re: [PATCH] Staroffice Network Problem solved
Message-ID:  <3A7652A0.BF5F7DB8@cup.hp.com>
References:  <Pine.BSF.4.21.0101210304100.8609-100000@levais.imp.ch>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A7652A0.BF5F7DB8>