Module Name: src
Committed By: christos
Date: Thu Feb 14 21:57:59 UTC 2013
Modified Files:
src/sys/kern: uipc_socket.c uipc_syscalls.c
Log Message:
PR/47569: Valery Ushakov: SOCK_NONBLOCK does not work because it does not
set SS_NBIO.
XXX: there are too many flags that mean the same thing in too many places,
and too many flags that mean the same thing and are different.
To generate a diff of this commit:
cvs rdiff -u -r1.212 -r1.213 src/sys/kern/uipc_socket.c
cvs rdiff -u -r1.159 -r1.160 src/sys/kern/uipc_syscalls.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/uipc_socket.c
diff -u src/sys/kern/uipc_socket.c:1.212 src/sys/kern/uipc_socket.c:1.213
--- src/sys/kern/uipc_socket.c:1.212 Mon Oct 8 15:20:45 2012
+++ src/sys/kern/uipc_socket.c Thu Feb 14 16:57:58 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_socket.c,v 1.212 2012/10/08 19:20:45 pooka Exp $ */
+/* $NetBSD: uipc_socket.c,v 1.213 2013/02/14 21:57:58 christos Exp $ */
/*-
* Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.212 2012/10/08 19:20:45 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.213 2013/02/14 21:57:58 christos Exp $");
#include "opt_compat_netbsd.h"
#include "opt_sock_counters.h"
@@ -585,6 +585,8 @@ fsocreate(int domain, struct socket **so
fp->f_data = so;
fd_affix(curproc, fp, fd);
*fdout = fd;
+ if (flags & SOCK_NONBLOCK)
+ so->so_state |= SS_NBIO;
}
return error;
}
Index: src/sys/kern/uipc_syscalls.c
diff -u src/sys/kern/uipc_syscalls.c:1.159 src/sys/kern/uipc_syscalls.c:1.160
--- src/sys/kern/uipc_syscalls.c:1.159 Wed Feb 13 20:00:07 2013
+++ src/sys/kern/uipc_syscalls.c Thu Feb 14 16:57:59 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_syscalls.c,v 1.159 2013/02/14 01:00:07 riastradh Exp $ */
+/* $NetBSD: uipc_syscalls.c,v 1.160 2013/02/14 21:57:59 christos Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.159 2013/02/14 01:00:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.160 2013/02/14 21:57:59 christos Exp $");
#include "opt_pipe.h"
@@ -234,6 +234,8 @@ do_sys_accept(struct lwp *l, int sock, s
((flags & SOCK_NOSIGPIPE) ? FNOSIGPIPE : 0);
fp2->f_ops = &socketops;
fp2->f_data = so2;
+ if (flags & SOCK_NONBLOCK)
+ so2->so_state |= SS_NBIO;
error = soaccept(so2, nam);
so2->so_cred = kauth_cred_dup(so->so_cred);
sounlock(so);
@@ -424,6 +426,8 @@ makesocket(struct lwp *l, file_t **fp, i
(*fp)->f_type = DTYPE_SOCKET;
(*fp)->f_ops = &socketops;
(*fp)->f_data = so;
+ if (flags & SOCK_NONBLOCK)
+ so->so_state |= SS_NBIO;
return 0;
}