On Wed, Sep 21, 2016 at 6:23 PM, Michael McConville <[email protected]> wrote:
> The current version is somewhat awkward and forgets to mention that
> errno is set. I adapted the paragraph found in most other system call
> man pages.
There are six syscalls that return an fd on success...and their
manpages all have totally different wording for the return value.
Whee.
accept
The call returns -1 on error. If it succeeds, it returns a non-negative
integer that is a descriptor for the accepted socket.
fhopen
Upon successful completion, fhopen() returns the file descriptor for the
opened file, while fhstat() and fhstatfs() return 0. Otherwise, -1 is
returned and errno is set to indicate the error.
kqueue
kqueue() creates a new kernel event queue and returns a file descriptor.
If there was an error creating the kernel event queue, a value of -1 is
returned and errno set.
open
If successful, open() returns a non-negative integer, termed a file
descriptor. Otherwise, a value of -1 is returned and errno is set to
indicate the error.
openat: same manpage as open but totally unmentioned in the RETURN
VALUES section
socket
A -1 is returned if an error occurs, otherwise the return value is a
descriptor referencing the socket.
<sigh> Some consistency that doesn't sacrifice clarity would be nice...