Module Name: src Committed By: wiz Date: Mon Jun 27 08:21:08 UTC 2011
Modified Files: src/lib/libc/gen: popen.3 src/lib/libc/stdio: fopen.3 src/lib/libc/sys: accept.2 dup.2 fcntl.2 pipe.2 recv.2 socketpair.2 Log Message: Various minor improvements. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/lib/libc/gen/popen.3 cvs rdiff -u -r1.25 -r1.26 src/lib/libc/stdio/fopen.3 cvs rdiff -u -r1.27 -r1.28 src/lib/libc/sys/accept.2 cvs rdiff -u -r1.22 -r1.23 src/lib/libc/sys/dup.2 \ src/lib/libc/sys/socketpair.2 cvs rdiff -u -r1.38 -r1.39 src/lib/libc/sys/fcntl.2 cvs rdiff -u -r1.23 -r1.24 src/lib/libc/sys/pipe.2 cvs rdiff -u -r1.28 -r1.29 src/lib/libc/sys/recv.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/gen/popen.3 diff -u src/lib/libc/gen/popen.3:1.17 src/lib/libc/gen/popen.3:1.18 --- src/lib/libc/gen/popen.3:1.17 Sun Jun 26 16:42:41 2011 +++ src/lib/libc/gen/popen.3 Mon Jun 27 08:21:07 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: popen.3,v 1.17 2011/06/26 16:42:41 christos Exp $ +.\" $NetBSD: popen.3,v 1.18 2011/06/27 08:21:07 wiz Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -81,7 +81,7 @@ is present in the .Fa type string, the file descriptor used internally is set to be closed on -.Xr exec 2 . +.Xr exec 3 . .Pp The .Fa command Index: src/lib/libc/stdio/fopen.3 diff -u src/lib/libc/stdio/fopen.3:1.25 src/lib/libc/stdio/fopen.3:1.26 --- src/lib/libc/stdio/fopen.3:1.25 Sun Jun 26 16:42:41 2011 +++ src/lib/libc/stdio/fopen.3 Mon Jun 27 08:21:07 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: fopen.3,v 1.25 2011/06/26 16:42:41 christos Exp $ +.\" $NetBSD: fopen.3,v 1.26 2011/06/27 08:21:07 wiz Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -105,7 +105,7 @@ .St -ansiC extension. .Pp -the letter +The letter .Dq e in the mode string sets the close-on-exec flag in the file descriptors of the newly opened file files; if the operation fails, @@ -202,6 +202,9 @@ is set to indicate the error. .Sh ERRORS .Bl -tag -width Er +.It Bq Er EFTYPE +The file is not a regular file and the character ``f'' is specified +in the mode. .It Bq Er EINVAL The .Fa mode @@ -211,9 +214,6 @@ or .Fn freopen was invalid. -.It Bq Er EFTYPE -The file is not a regular file and the character ``f'' is specified -in the mode. .El .Pp The Index: src/lib/libc/sys/accept.2 diff -u src/lib/libc/sys/accept.2:1.27 src/lib/libc/sys/accept.2:1.28 --- src/lib/libc/sys/accept.2:1.27 Sun Jun 26 16:42:41 2011 +++ src/lib/libc/sys/accept.2 Mon Jun 27 08:21:07 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: accept.2,v 1.27 2011/06/26 16:42:41 christos Exp $ +.\" $NetBSD: accept.2,v 1.28 2011/06/27 08:21:07 wiz Exp $ .\" .\" Copyright (c) 1983, 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -151,7 +151,9 @@ .Pp It can also temporarily replace the signal mask of the calling thread if .Fa sigmask -is a non-null pointer, then the +is a +.Pf non- Dv NULL +pointer, then the .Fn paccept function shall replace the signal mask of the caller by the set of signals pointed to by @@ -159,10 +161,11 @@ before waiting for a connection, and shall restore the signal mask of the calling thread before returning. .Sh RETURN VALUES -The +The .Fn accept and -.Fn paccept calls return \-1 on error. +.Fn paccept +calls return \-1 on error. If they succeed, they return a non-negative integer that is a descriptor for the accepted socket. .Sh COMPATIBILITY Index: src/lib/libc/sys/dup.2 diff -u src/lib/libc/sys/dup.2:1.22 src/lib/libc/sys/dup.2:1.23 --- src/lib/libc/sys/dup.2:1.22 Sun Jun 26 16:42:41 2011 +++ src/lib/libc/sys/dup.2 Mon Jun 27 08:21:08 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: dup.2,v 1.22 2011/06/26 16:42:41 christos Exp $ +.\" $NetBSD: dup.2,v 1.23 2011/06/27 08:21:08 wiz Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -123,8 +123,8 @@ .Va errno indicates the cause of the error. .Sh ERRORS -.Fn dup -.Fn dup2 +.Fn dup , +.Fn dup2 , and .Fn dup3 fail if: Index: src/lib/libc/sys/socketpair.2 diff -u src/lib/libc/sys/socketpair.2:1.22 src/lib/libc/sys/socketpair.2:1.23 --- src/lib/libc/sys/socketpair.2:1.22 Sun Jun 26 16:42:41 2011 +++ src/lib/libc/sys/socketpair.2 Mon Jun 27 08:21:08 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: socketpair.2,v 1.22 2011/06/26 16:42:41 christos Exp $ +.\" $NetBSD: socketpair.2,v 1.23 2011/06/27 08:21:08 wiz Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -53,9 +53,9 @@ .Fa protocol . The descriptors used in referencing the new sockets are returned in -.Fa sv Ns [0] +.Fa sv[0] and -.Fa sv Ns [1] . +.Fa sv[1] . The two sockets are indistinguishable. .Pp The Index: src/lib/libc/sys/fcntl.2 diff -u src/lib/libc/sys/fcntl.2:1.38 src/lib/libc/sys/fcntl.2:1.39 --- src/lib/libc/sys/fcntl.2:1.38 Sun Jun 26 16:42:41 2011 +++ src/lib/libc/sys/fcntl.2 Mon Jun 27 08:21:08 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: fcntl.2,v 1.38 2011/06/26 16:42:41 christos Exp $ +.\" $NetBSD: fcntl.2,v 1.39 2011/06/27 08:21:08 wiz Exp $ .\" .\" Copyright (c) 1983, 1993 .\" The Regents of the University of California. All rights reserved. @@ -81,8 +81,9 @@ system calls. .El .It Dv F_DUPFD_CLOEXEC -Same as F_DUPFD, but sets the close-on-exec property on the file descriptor -created. +Same as +.Dv F_DUPFD , +but sets the close-on-exec property on the file descriptor created. .It Dv F_GETFD Get the close-on-exec flag associated with the file descriptor .Fa fd @@ -318,6 +319,28 @@ request fails or blocks respectively when another process has existing locks on bytes in the specified region and the type of any of those locks conflicts with the type specified in the request. +.Sh RETURN VALUES +Upon successful completion, the value returned depends on +.Fa cmd +as follows: +.Bl -tag -width F_GETOWNX -offset indent +.It Dv F_DUPFD +A new file descriptor. +.It Dv F_GETFD +Value of flag (only the low-order bit is defined). +.It Dv F_GETFL +Value of flags. +.It Dv F_GETOWN +Value of file descriptor owner. +.It Dv F_MAXFD +Value of the highest file descriptor open by the process. +.It other +Value other than \-1. +.El +.Pp +Otherwise, a value of \-1 is returned and +.Va errno +is set to indicate the error. .Sh COMPATIBILITY This interface follows the completely stupid semantics of .At V @@ -366,28 +389,6 @@ would cause a deadlock and fails with an .Er EDEADLK error. -.Sh RETURN VALUES -Upon successful completion, the value returned depends on -.Fa cmd -as follows: -.Bl -tag -width F_GETOWNX -offset indent -.It Dv F_DUPFD -A new file descriptor. -.It Dv F_GETFD -Value of flag (only the low-order bit is defined). -.It Dv F_GETFL -Value of flags. -.It Dv F_GETOWN -Value of file descriptor owner. -.It Dv F_MAXFD -Value of the highest file descriptor open by the process. -.It other -Value other than \-1. -.El -.Pp -Otherwise, a value of \-1 is returned and -.Va errno -is set to indicate the error. .Sh ERRORS .Fn fcntl will fail if: Index: src/lib/libc/sys/pipe.2 diff -u src/lib/libc/sys/pipe.2:1.23 src/lib/libc/sys/pipe.2:1.24 --- src/lib/libc/sys/pipe.2:1.23 Sun Jun 26 16:42:41 2011 +++ src/lib/libc/sys/pipe.2 Mon Jun 27 08:21:08 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: pipe.2,v 1.23 2011/06/26 16:42:41 christos Exp $ +.\" $NetBSD: pipe.2,v 1.24 2011/06/27 08:21:08 wiz Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -82,7 +82,7 @@ returns a zero count. .Pp The -.Fn pipe2 +.Fn pipe2 function behaves exactly like .Fn pipe @@ -109,10 +109,6 @@ .Fn pipe2 calls will fail if: .Bl -tag -width Er -.It Bq Er EMFILE -Too many descriptors are active. -.It Bq Er ENFILE -The system file table is full. .It Bq Er EFAULT The .Fa fildes @@ -120,6 +116,10 @@ The reliable detection of this error cannot be guaranteed; when not detected, a signal may be delivered to the process, indicating an address violation. +.It Bq Er EMFILE +Too many descriptors are active. +.It Bq Er ENFILE +The system file table is full. .El .Sh SEE ALSO .Xr sh 1 , Index: src/lib/libc/sys/recv.2 diff -u src/lib/libc/sys/recv.2:1.28 src/lib/libc/sys/recv.2:1.29 --- src/lib/libc/sys/recv.2:1.28 Sun Jun 26 16:42:41 2011 +++ src/lib/libc/sys/recv.2 Mon Jun 27 08:21:08 2011 @@ -1,4 +1,4 @@ -.\" $NetBSD: recv.2,v 1.28 2011/06/26 16:42:41 christos Exp $ +.\" $NetBSD: recv.2,v 1.29 2011/06/27 08:21:08 wiz Exp $ .\" .\" Copyright (c) 1983, 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -234,10 +234,24 @@ .Sh ERRORS The calls fail if: .Bl -tag -width Er +.It Bq Er EAGAIN +The socket is marked non-blocking, and the receive operation +would block, or +a receive timeout had been set, +and the timeout expired before data were received. .It Bq Er EBADF The argument .Fa s is an invalid descriptor. +.It Bq Er EFAULT +The receive buffer pointer(s) point outside the process's +address space. +.It Bq Er EINTR +The receive was interrupted by delivery of a signal before +any data were available. +.It Bq Er EINVAL +The total length of the I/O is more than can be expressed by the ssize_t +return value. .It Bq Er ENOTCONN The socket is associated with a connection-oriented protocol and has not been connected (see @@ -248,20 +262,6 @@ The argument .Fa s does not refer to a socket. -.It Bq Er EAGAIN -The socket is marked non-blocking, and the receive operation -would block, or -a receive timeout had been set, -and the timeout expired before data were received. -.It Bq Er EINTR -The receive was interrupted by delivery of a signal before -any data were available. -.It Bq Er EFAULT -The receive buffer pointer(s) point outside the process's -address space. -.It Bq Er EINVAL -The total length of the I/O is more than can be expressed by the ssize_t -return value. .El .Pp .Fn recvmsg