diff options
author | tegge <tegge@FreeBSD.org> | 2003-02-23 23:00:28 +0000 |
---|---|---|
committer | tegge <tegge@FreeBSD.org> | 2003-02-23 23:00:28 +0000 |
commit | 2072a48a930c2b549b7493b3354db648823352c5 (patch) | |
tree | f24afbb199e2afa2dea1e2c8e5c3489579d4d507 /sys/kern | |
parent | 9e9a8e4f69fd3a29422980ec3afff8db3d1b4335 (diff) | |
download | FreeBSD-src-2072a48a930c2b549b7493b3354db648823352c5.zip FreeBSD-src-2072a48a930c2b549b7493b3354db648823352c5.tar.gz |
Sync new socket nonblocking/async state with file flags in accept().
PR: 1775
Reviewed by: mbr
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/uipc_syscalls.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 6a6203f..a27b193 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -54,6 +54,7 @@ #include <sys/proc.h> #include <sys/fcntl.h> #include <sys/file.h> +#include <sys/filio.h> #include <sys/mount.h> #include <sys/mbuf.h> #include <sys/protosw.h> @@ -258,6 +259,7 @@ accept1(td, uap, compat) int fd; u_int fflag; pid_t pgid; + int tmp; mtx_lock(&Giant); fdp = td->td_proc->p_fd; @@ -346,6 +348,11 @@ accept1(td, uap, compat) nfp->f_ops = &socketops; nfp->f_type = DTYPE_SOCKET; FILE_UNLOCK(nfp); + /* Sync socket nonblocking/async state with file flags */ + tmp = fflag & FNONBLOCK; + (void) fo_ioctl(nfp, FIONBIO, &tmp, td->td_ucred, td); + tmp = fflag & FASYNC; + (void) fo_ioctl(nfp, FIOASYNC, &tmp, td->td_ucred, td); sa = 0; error = soaccept(so, &sa); if (error) { |