Created
May 13, 2013 20:03
-
-
Save postwait/5571042 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/usr/src/man/man3socket/socket.3socket b/usr/src/man/man3socket/socket.3socket | |
| index be280b0..9fe144b 100644 | |
| --- a/usr/src/man/man3socket/socket.3socket | |
| +++ b/usr/src/man/man3socket/socket.3socket | |
| @@ -100,6 +100,26 @@ is similar in purpose to the \fBO_CLOEXEC\fR flag to \fBopen\fR(2). | |
| .RE | |
| .sp | |
| +.ne 2 | |
| +.na | |
| +\fB\fBSOCK_NDELAY\fR\fR | |
| +.ad | |
| +.RS 12n | |
| +Creates the socket with the \fBO_NDELAY\fR flag set, causing the socket to | |
| +provide nonblocking semantics as described for \fBO_NDELAY\fR in \fBopen\fR(2). | |
| +.RE | |
| + | |
| +.sp | |
| +.ne 2 | |
| +.na | |
| +\fB\fBSOCK_NONBLOCK\fR\fR | |
| +.ad | |
| +.RS 12n | |
| +Creates the socket with the \fBO_NONBLOCK\fR flag set, causing the socket to | |
| +provide nonblocking semantics as described for \fBO_NONBLOCK\fR in \fBopen\fR(2). | |
| +.RE | |
| + | |
| +.sp | |
| .LP | |
| There must be an entry in the \fBnetconfig\fR(4) file for at least each | |
| protocol family and type required. If a non-zero protocol has been specified | |
| @@ -264,6 +284,15 @@ The protocol type is not supported by the address family. | |
| The socket type is not supported by the protocol. | |
| .RE | |
| +.sp | |
| +.ne 2 | |
| +.na | |
| +\fB\fBEINVAL\fR\fR | |
| +.ad | |
| +.RS 19n | |
| +One or more of the specified flags is not supported. | |
| +.RE | |
| + | |
| .SH ATTRIBUTES | |
| .sp | |
| .LP | |
| diff --git a/usr/src/uts/common/fs/sockfs/socksyscalls.c b/usr/src/uts/common/fs/sockfs/socksyscalls.c | |
| index fa55a4f..bd5977a 100644 | |
| --- a/usr/src/uts/common/fs/sockfs/socksyscalls.c | |
| +++ b/usr/src/uts/common/fs/sockfs/socksyscalls.c | |
| @@ -109,6 +109,10 @@ so_socket(int family, int type_w_flags, int protocol, char *devpath, | |
| int type; | |
| type = type_w_flags & SOCK_TYPE_MASK; | |
| + type_w_flags &= ~SOCK_TYPE_MASK; | |
| + if (type_w_flags & ~(SOCK_CLOEXEC|SOCK_NDELAY|SOCK_NONBLOCK)) | |
| + return (set_errno(EINVAL)); | |
| + | |
| if (devpath != NULL) { | |
| char *buf; | |
| size_t kdevpathlen = 0; | |
| @@ -140,6 +144,14 @@ so_socket(int family, int type_w_flags, int protocol, char *devpath, | |
| /* | |
| * Now fill in the entries that falloc reserved | |
| */ | |
| + if (type_w_flags & SOCK_NDELAY) { | |
| + so->so_state |= SS_NDELAY; | |
| + fp->f_flag |= FNDELAY; | |
| + } | |
| + if (type_w_flags & SOCK_NONBLOCK) { | |
| + so->so_state |= SS_NONBLOCK; | |
| + fp->f_flag |= FNONBLOCK; | |
| + } | |
| mutex_exit(&fp->f_tlock); | |
| setf(fd, fp); | |
| if ((type_w_flags & SOCK_CLOEXEC) != 0) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment