indicating that the kernel does not recognize this value.
.SS Duplicating a file descriptor
.TP
-.BR F_DUPFD \~(\f[I]int\f[])
-Duplicate the file descriptor
-.I fd
-using the lowest-numbered available file descriptor greater than or equal to
-.IR arg .
-This is different from
-.BR dup2 (2),
-which uses exactly the file descriptor specified.
-.IP
-On success, the new file descriptor is returned.
-.IP
-See
-.BR dup (2)
-for further details.
-.TP
-.BR F_DUPFD_CLOEXEC "\~(\f[I]int\f[]; since Linux 2.6.24)"
-As for
-.BR F_DUPFD ,
-but additionally set the
-close-on-exec flag for the duplicate file descriptor.
-Specifying this flag permits a program to avoid an additional
-.BR fcntl ()
-.B F_SETFD
-operation to set the
-.B FD_CLOEXEC
-flag.
-For an explanation of why this flag is useful,
-see the description of
-.B O_CLOEXEC
-in
-.BR open (2).
+.BR F_DUPFD (2const)
+.TQ
+.BR F_DUPFD_CLOEXEC (2const)
.SS File descriptor flags
The following operations manipulate the flags associated with
a file descriptor.
Duplicated file descriptors
(made with
.BR dup (2),
-.BR fcntl (F_DUPFD),
+.BR F_DUPFD (2const),
.BR fork (2),
etc.) refer to the same open file description, and thus
share the same file status flags.
or via a duplicate of the file descriptor created by
.BR fork (2),
.BR dup (2),
-.BR fcntl ()
-.BR F_DUPFD ,
+.BR F_DUPFD (2const),
and so on) are always compatible:
if a new lock is placed on an already locked region,
then the existing lock is converted to the new lock type.
.SH RETURN VALUE
For a successful call, the return value depends on the operation:
.TP
-.B F_DUPFD
-The new file descriptor.
-.TP
.B F_GETFD
Value of file descriptor flags.
.TP
.B EINVAL
.I op
is
-.B F_DUPFD
-and
-.I arg
-is negative or is greater than the maximum allowable value
-(see the discussion of
-.B RLIMIT_NOFILE
-in
-.BR getrlimit (2)).
-.TP
-.B EINVAL
-.I op
-is
.B F_SETSIG
and
.I arg
.I l_pid
was not specified as zero.
.TP
-.B EMFILE
-.I op
-is
-.B F_DUPFD
-and the per-process limit on the number of open file descriptors
-has been reached.
-.TP
.B ENOLCK
Too many segment locks open, lock table is full, or a remote locking
protocol failed (e.g., locking over NFS).
SVr4, 4.3BSD, POSIX.1-2001.
.P
Only the operations
-.BR F_DUPFD ,
.BR F_GETFD ,
.BR F_SETFD ,
.BR F_GETFL ,
with the value 500 or greater, or
.B _POSIX_C_SOURCE
with the value 200809L or greater.)
-.P
-.B F_DUPFD_CLOEXEC
-is specified in POSIX.1-2008.
-(To get this definition, define
-.B _POSIX_C_SOURCE
-with the value 200809L or greater, or
-.B _XOPEN_SOURCE
-with the value 700 or greater.)
.SH NOTES
-The errors returned by
-.BR dup2 (2)
-are different from those returned by
-.BR F_DUPFD .
-.\"
.SS File locking
The original Linux
.BR fcntl ()
--- /dev/null
+.\" Copyright, the authors of the Linux man-pages project
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.TH F_DUPFD 2const (date) "Linux man-pages (unreleased)"
+.SH NAME
+F_DUPFD,
+F_DUPFD_CLOEXEC
+\-
+duplicate a file descriptor
+.SH LIBRARY
+Standard C library
+.RI ( libc ,\~ \-lc )
+.SH SYNOPSIS
+.nf
+.B #include <fcntl.h>
+.P
+.BI "int fcntl(int " fd ", F_DUPFD, int " arg );
+.BI "int fcntl(int " fd ", F_DUPFD_CLOEXEC, int " arg );
+.fi
+.SH DESCRIPTION
+.SS Duplicating a file descriptor
+.TP
+.BR F_DUPFD \~(\f[I]int\f[])
+Duplicate the file descriptor
+.I fd
+using the lowest-numbered available file descriptor greater than or equal to
+.IR arg .
+This is different from
+.BR dup2 (2),
+which uses exactly the file descriptor specified.
+.IP
+On success, the new file descriptor is returned.
+.IP
+See
+.BR dup (2)
+for further details.
+.TP
+.BR F_DUPFD_CLOEXEC "\~(\f[I]int\f[]; since Linux 2.6.24)"
+As for
+.BR F_DUPFD ,
+but additionally set the
+close-on-exec flag for the duplicate file descriptor.
+Specifying this flag permits a program to avoid an additional
+.BR fcntl ()
+.B F_SETFD
+operation to set the
+.B FD_CLOEXEC
+flag.
+For an explanation of why this flag is useful,
+see the description of
+.B O_CLOEXEC
+in
+.BR open (2).
+.SH RETURN VALUE
+The new file descriptor.
+.P
+On error, \-1 is returned, and
+.I errno
+is set to indicate the error.
+.SH ERRORS
+See
+.BR fcntl (2).
+.TP
+.B EINVAL
+.I op
+is
+.B F_DUPFD
+and
+.I arg
+is negative or is greater than the maximum allowable value
+(see the discussion of
+.B RLIMIT_NOFILE
+in
+.BR getrlimit (2)).
+.TP
+.B EMFILE
+.I op
+is
+.B F_DUPFD
+and the per-process limit on the number of open file descriptors
+has been reached.
+.SH VERSIONS
+POSIX.1-2024 specifies
+.BR F_DUPFD_CLOFORK ,
+but Linux doesn't support them.
+.SH STANDARDS
+POSIX.1-2008.
+.SH HISTORY
+.TP
+.B F_DUPFD
+SVr4, 4.3BSD, POSIX.1-2001.
+.TP
+.B F_DUPFD_CLOEXEC
+POSIX.1-2008.
+(To get this definition, define
+.B _POSIX_C_SOURCE
+with the value 200809L or greater, or
+.B _XOPEN_SOURCE
+with the value 700 or greater.)
+.SH NOTES
+The errors returned by
+.BR dup2 (2)
+are different from those returned by
+.BR F_DUPFD .
+.SH SEE ALSO
+.BR dup2 (2),
+.BR fcntl (2)