]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
man/man2/fcntl.2, man/man2const/F_GETFL.2const: Split F_{G,S}ETFL from fcntl(2)
authorAlejandro Colomar <alx@kernel.org>
Sat, 12 Jul 2025 13:53:29 +0000 (15:53 +0200)
committerAlejandro Colomar <alx@kernel.org>
Sat, 19 Jul 2025 22:41:10 +0000 (00:41 +0200)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
man/man2/fcntl.2
man/man2const/F_GETFL.2const [new file with mode: 0644]

index 78e2c74e48131a48a4faad7a07864ffe9aa7cd09..ef2b053b2201cbc82bd4f9f62b0ee6445cc8c29a 100644 (file)
@@ -56,54 +56,10 @@ indicating that the kernel does not recognize this value.
 .TQ
 .BR F_SETFD (2const)
 .SS File status flags
-Each open file description has certain associated status flags,
-initialized by
-.BR open (2)
-.\" or
-.\" .BR creat (2),
-and possibly modified by
-.BR fcntl ().
-Duplicated file descriptors
-(made with
-.BR dup (2),
-.BR F_DUPFD (2const),
-.BR fork (2),
-etc.) refer to the same open file description, and thus
-share the same file status flags.
-.P
-The file status flags and their semantics are described in
-.BR open (2).
-.TP
-.BR F_GETFL \~(\f[I]void\f[])
-Return (as the function result)
-the file access mode and the file status flags;
-.I arg
-is ignored.
 .TP
-.BR F_SETFL \~(\f[I]int\f[])
-Set the file status flags to the value specified by
-.IR arg .
-File access mode
-.RB ( O_RDONLY ", " O_WRONLY ", " O_RDWR )
-and file creation flags
-(i.e.,
-.BR O_CREAT ", " O_EXCL ", " O_NOCTTY ", " O_TRUNC )
-in
-.I arg
-are ignored.
-On Linux, this operation can change only the
-.BR O_APPEND ,
-.BR O_ASYNC ,
-.BR O_DIRECT ,
-.BR O_NOATIME ,
-and
-.B O_NONBLOCK
-flags.
-It is not possible to change the
-.B O_DSYNC
-and
-.B O_SYNC
-flags; see BUGS, below.
+.BR F_GETFL (2const)
+.TQ
+.BR F_SETFL (2const)
 .SS Advisory record locking
 Linux implements traditional ("process-associated") UNIX record locks,
 as standardized by POSIX.
@@ -612,8 +568,7 @@ is specified as
 As well as setting the file descriptor owner,
 one must also enable generation of signals on the file descriptor.
 This is done by using the
-.BR fcntl ()
-.B F_SETFL
+.BR F_SETFL (2const)
 operation to set the
 .B O_ASYNC
 file status flag on the file descriptor.
@@ -1500,9 +1455,6 @@ and no individual absolute meaning should be attributed to them.
 .SH RETURN VALUE
 For a successful call, the return value depends on the operation:
 .TP
-.B F_GETFL
-Value of file status flags.
-.TP
 .B F_GETLEASE
 Type of lease held on file descriptor.
 .TP
@@ -1665,11 +1617,6 @@ and the soft or hard user pipe limit has been reached; see
 .BR pipe (7).
 .TP
 .B EPERM
-Attempted to clear the
-.B O_APPEND
-flag on a file that has the append-only attribute set.
-.TP
-.B EPERM
 .I op
 was
 .BR F_ADD_SEALS ,
@@ -1722,8 +1669,6 @@ are Linux-specific.
 SVr4, 4.3BSD, POSIX.1-2001.
 .P
 Only the operations
-.BR F_GETFL ,
-.BR F_SETFL ,
 .BR F_GETLK ,
 .BR F_SETLK ,
 and
@@ -1849,18 +1794,6 @@ Because of the attendant risk of data corruption,
 .\" commit f6de7a39c181dfb8a2c534661a53c73afb3081cd
 this parameter defaults to 0 (disabled).
 .SH BUGS
-.SS F_SETFL
-It is not possible to use
-.B F_SETFL
-to change the state of the
-.B O_DSYNC
-and
-.B O_SYNC
-flags.
-.\" FIXME . According to POSIX.1-2001, O_SYNC should also be modifiable
-.\" via fcntl(2), but currently Linux does not permit this
-.\" See http://bugzilla.kernel.org/show_bug.cgi?id=5994
-Attempts to change the state of these flags are silently ignored.
 .SS F_GETOWN
 A limitation of the Linux system call conventions on some
 architectures (notably i386) means that if a (negative)
diff --git a/man/man2const/F_GETFL.2const b/man/man2const/F_GETFL.2const
new file mode 100644 (file)
index 0000000..798d009
--- /dev/null
@@ -0,0 +1,108 @@
+.\" Copyright, the authors of the Linux man-pages project
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.TH F_GETFL 2const (date) "Linux man-pages (unreleased)"
+.SH NAME
+F_GETFL,
+F_SETFL
+\-
+get/set file status flags
+.SH LIBRARY
+Standard C library
+.RI ( libc ,\~ \-lc )
+.SH SYNOPSIS
+.nf
+.B #include <fcntl.h>
+.P
+.BI "int fcntl(int " fd ", F_GETFL);"
+.BI "int fcntl(int " fd ", F_SETFL, int " arg );
+.fi
+.SH DESCRIPTION
+Each open file description has certain associated status flags,
+initialized by
+.BR open (2)
+.\" or
+.\" .BR creat (2),
+and possibly modified by
+.BR fcntl ().
+Duplicated file descriptors
+(made with
+.BR dup (2),
+.BR F_DUPFD (2const),
+.BR fork (2),
+etc.) refer to the same open file description, and thus
+share the same file status flags.
+.P
+The file status flags and their semantics are described in
+.BR open (2).
+.TP
+.BR F_GETFL \~(\f[I]void\f[])
+Return (as the function result)
+the file access mode and the file status flags;
+.I arg
+is ignored.
+.TP
+.BR F_SETFL \~(\f[I]int\f[])
+Set the file status flags to the value specified by
+.IR arg .
+File access mode
+.RB ( O_RDONLY ", " O_WRONLY ", " O_RDWR )
+and file creation flags
+(i.e.,
+.BR O_CREAT ", " O_EXCL ", " O_NOCTTY ", " O_TRUNC )
+in
+.I arg
+are ignored.
+On Linux, this operation can change only the
+.BR O_APPEND ,
+.BR O_ASYNC ,
+.BR O_DIRECT ,
+.BR O_NOATIME ,
+and
+.B O_NONBLOCK
+flags.
+It is not possible to change the
+.B O_DSYNC
+and
+.B O_SYNC
+flags; see BUGS, below.
+.SH RETURN VALUE
+.TP
+.B F_GETFL
+Value of file status flags.
+.TP
+.B F_SETFL
+Zero.
+.P
+On error, \-1 is returned, and
+.I errno
+is set to indicate the error.
+.SH ERRORS
+See
+.BR fcntl (2).
+.TP
+.B EPERM
+Attempted to clear the
+.B O_APPEND
+flag on a file that has the append-only attribute set.
+.SH STANDARDS
+POSIX.1-2008.
+.SH HISTORY
+SVr4, 4.3BSD, POSIX.1-2001.
+.SH BUGS
+.SS F_SETFL
+It is not possible to use
+.B F_SETFL
+to change the state of the
+.B O_DSYNC
+and
+.B O_SYNC
+flags.
+.\" FIXME . According to POSIX.1-2001, O_SYNC should also be modifiable
+.\" via fcntl(2), but currently Linux does not permit this
+.\" See http://bugzilla.kernel.org/show_bug.cgi?id=5994
+Attempts to change the state of these flags are silently ignored.
+.SH SEE ALSO
+.BR fcntl (2),
+.BR open (2)