Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/linux/common commit fix to PR7072: emulate linux ...
details: https://anonhg.NetBSD.org/src/rev/147b3e9ff977
branches: trunk
changeset: 467484:147b3e9ff977
user: sommerfe <sommerfe%NetBSD.org@localhost>
date: Thu Mar 25 04:26:45 1999 +0000
description:
commit fix to PR7072: emulate linux non-blocking connect behavior more correctly
diffstat:
sys/compat/linux/common/linux_socket.c | 46 +++++++++++++++++++++++++++++-
sys/compat/linux/common/linux_socketcall.c | 4 +-
sys/compat/linux/common/linux_socketcall.h | 3 +-
3 files changed, 49 insertions(+), 4 deletions(-)
diffs (99 lines):
diff -r 02b2776f1f74 -r 147b3e9ff977 sys/compat/linux/common/linux_socket.c
--- a/sys/compat/linux/common/linux_socket.c Thu Mar 25 04:22:04 1999 +0000
+++ b/sys/compat/linux/common/linux_socket.c Thu Mar 25 04:26:45 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_socket.c,v 1.18 1998/10/04 00:02:43 fvdl Exp $ */
+/* $NetBSD: linux_socket.c,v 1.19 1999/03/25 04:26:45 sommerfe Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -60,6 +60,7 @@
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/device.h>
+#include <sys/protosw.h>
#include <sys/syscallargs.h>
@@ -490,3 +491,46 @@
SCARG(&ia, data) = SCARG(uap, data);
return sys_ioctl(p, &ia, retval);
}
+
+int
+linux_sys_connect(p, v, retval)
+ register struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ int error;
+
+ register struct sys_connect_args /* {
+ syscallarg(int) s;
+ syscallarg(const struct sockaddr *) name;
+ syscallarg(unsigned int) namelen;
+ } */ *uap = v;
+
+ error = sys_connect (p, v, retval);
+
+ if (error == EISCONN) {
+ struct file *fp;
+ register struct socket *so;
+ int s, state, prflags;
+
+ if (getsock(p->p_fd, SCARG(uap, s), &fp)!= 0)
+ return EISCONN;
+
+ s = splsoftnet();
+ so = (struct socket *)fp->f_data;
+ state = so->so_state;
+ prflags = so->so_proto->pr_flags;
+ splx(s);
+ /*
+ * We should only let this call succeed once per
+ * non-blocking connect; however we don't have
+ * a convenient place to keep that state..
+ */
+ if ((state & SS_NBIO) && (state & SS_ISCONNECTED) &&
+ (prflags & PR_CONNREQUIRED))
+ return 0;
+ }
+
+ return error;
+}
+
diff -r 02b2776f1f74 -r 147b3e9ff977 sys/compat/linux/common/linux_socketcall.c
--- a/sys/compat/linux/common/linux_socketcall.c Thu Mar 25 04:22:04 1999 +0000
+++ b/sys/compat/linux/common/linux_socketcall.c Thu Mar 25 04:26:45 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_socketcall.c,v 1.18 1998/10/04 00:02:44 fvdl Exp $ */
+/* $NetBSD: linux_socketcall.c,v 1.19 1999/03/25 04:26:45 sommerfe Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
case LINUX_SYS_bind:
return sys_bind(p, (void *)&lda, retval);
case LINUX_SYS_connect:
- return sys_connect(p, (void *)&lda, retval);
+ return linux_sys_connect(p, (void *)&lda, retval);
case LINUX_SYS_listen:
return sys_listen(p, (void *)&lda, retval);
case LINUX_SYS_accept:
diff -r 02b2776f1f74 -r 147b3e9ff977 sys/compat/linux/common/linux_socketcall.h
--- a/sys/compat/linux/common/linux_socketcall.h Thu Mar 25 04:22:04 1999 +0000
+++ b/sys/compat/linux/common/linux_socketcall.h Thu Mar 25 04:26:45 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_socketcall.h,v 1.4 1998/10/04 00:02:44 fvdl Exp $ */
+/* $NetBSD: linux_socketcall.h,v 1.5 1999/03/25 04:26:45 sommerfe Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -235,6 +235,7 @@
int linux_sys_recvfrom __P((struct proc *, void *, register_t *));
int linux_sys_setsockopt __P((struct proc *, void *, register_t *));
int linux_sys_getsockopt __P((struct proc *, void *, register_t *));
+int linux_sys_connect __P((struct proc *, void *, register_t *));
__END_DECLS
# endif /* !_KERNEL */
Home |
Main Index |
Thread Index |
Old Index