From ed09120acd9027de514d8baf004f8604f7d7452b Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Wed, 8 Apr 2020 10:28:45 +0200 Subject: [PATCH] accept.2, epoll_create.2, inotify_add_watch.2, open.2, open_by_handle_at.2, pidfd_open.2, dirfd.3, posix_openpt.3, shm_open.3: Fix clumsy wording around "nonnegative file descriptors" Reported-by: Christian Brauner Signed-off-by: Michael Kerrisk --- man2/accept.2 | 4 ++-- man2/epoll_create.2 | 2 +- man2/inotify_add_watch.2 | 2 +- man2/open.2 | 3 ++- man2/open_by_handle_at.2 | 2 +- man2/pidfd_open.2 | 2 +- man3/dirfd.3 | 4 +++- man3/posix_openpt.3 | 2 +- man3/shm_open.3 | 2 +- 9 files changed, 13 insertions(+), 10 deletions(-) diff --git a/man2/accept.2 b/man2/accept.2 index a4bebd214..30e2b5645 100644 --- a/man2/accept.2 +++ b/man2/accept.2 @@ -169,8 +169,8 @@ flag in for reasons why this may be useful. .SH RETURN VALUE On success, -these system calls return a nonnegative integer that is a file descriptor -for the accepted socket. +these system calls return a file descriptor +for the accepted socket (a nonnegative integer). On error, \-1 is returned, .I errno is set appropriately, and diff --git a/man2/epoll_create.2 b/man2/epoll_create.2 index 7dc88960f..3be7d225b 100644 --- a/man2/epoll_create.2 +++ b/man2/epoll_create.2 @@ -78,7 +78,7 @@ for reasons why this may be useful. .SH RETURN VALUE On success, these system calls -return a nonnegative file descriptor. +return a file descriptor (a nonnegative integer). On error, \-1 is returned, and .I errno is set to indicate the error. diff --git a/man2/inotify_add_watch.2 b/man2/inotify_add_watch.2 index f7b3cd75d..87eae03c4 100644 --- a/man2/inotify_add_watch.2 +++ b/man2/inotify_add_watch.2 @@ -77,7 +77,7 @@ the object for which the event occurred. .SH RETURN VALUE On success, .BR inotify_add_watch () -returns a nonnegative watch descriptor. +returns a watch descriptor (a nonnegative integer). On error, \-1 is returned and .I errno is set appropriately. diff --git a/man2/open.2 b/man2/open.2 index 452ef29ef..783480f55 100644 --- a/man2/open.2 +++ b/man2/open.2 @@ -962,7 +962,8 @@ It is separate documented, in .BR openat (), and .BR creat () -return the new file descriptor, or \-1 if an error occurred +return the new file descriptor (a nonnegative integer), +or \-1 if an error occurred (in which case, .I errno is set appropriately). diff --git a/man2/open_by_handle_at.2 b/man2/open_by_handle_at.2 index 795db795a..afcb39647 100644 --- a/man2/open_by_handle_at.2 +++ b/man2/open_by_handle_at.2 @@ -279,7 +279,7 @@ On success, returns 0, and .BR open_by_handle_at () -returns a nonnegative file descriptor. +returns a file descriptor (a nonnegative integer). .PP In the event of an error, both system calls return \-1 and set .I errno diff --git a/man2/pidfd_open.2 b/man2/pidfd_open.2 index 8c4635508..225a7479a 100644 --- a/man2/pidfd_open.2 +++ b/man2/pidfd_open.2 @@ -47,7 +47,7 @@ currently, this argument must be specified as 0. .SH RETURN VALUE On success, .BR pidfd_open () -returns a nonnegative file descriptor. +returns a file descriptor (a nonnegative integer). On error, \-1 is returned and .I errno is set to indicate the cause of the error. diff --git a/man3/dirfd.3 b/man3/dirfd.3 index e75fd272a..7df36ae4b 100644 --- a/man3/dirfd.3 +++ b/man3/dirfd.3 @@ -63,7 +63,9 @@ It will be automatically closed when .BR closedir (3) is called. .SH RETURN VALUE -On success, a nonnegative file descriptor is returned. +On success, +.BR dirfd () +returns a file descriptor (a nonnegative integer). On error, \-1 is returned, and .I errno is set to indicate the cause of the error. diff --git a/man3/posix_openpt.3 b/man3/posix_openpt.3 index 8b5176bcd..7eb7acaff 100644 --- a/man3/posix_openpt.3 +++ b/man3/posix_openpt.3 @@ -62,7 +62,7 @@ Do not make this device the controlling terminal for the process. .SH RETURN VALUE On success, .BR posix_openpt () -returns a nonnegative file descriptor which is the lowest +returns a file descriptor (a nonnegative integer) which is the lowest numbered unused file descriptor. On failure, \-1 is returned, and .I errno diff --git a/man3/shm_open.3 b/man3/shm_open.3 index 675d44df9..2be0209f4 100644 --- a/man3/shm_open.3 +++ b/man3/shm_open.3 @@ -170,7 +170,7 @@ was specified, in which case a new, distinct object is created). .SH RETURN VALUE On success, .BR shm_open () -returns a nonnegative file descriptor. +returns a file descriptor (a nonnegative integer). On failure, .BR shm_open () returns \-1.