From: Alejandro Colomar Date: Sat, 12 Jul 2025 13:53:29 +0000 (+0200) Subject: man/man2/fcntl.2, man/man2const/F_GETFL.2const: Split F_{G,S}ETFL from fcntl(2) X-Git-Tag: man-pages-6.15~2^2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1f2e9c8bf7763a6de767b1a668f7a5c0d73c11b;p=thirdparty%2Fman-pages.git man/man2/fcntl.2, man/man2const/F_GETFL.2const: Split F_{G,S}ETFL from fcntl(2) Signed-off-by: Alejandro Colomar --- diff --git a/man/man2/fcntl.2 b/man/man2/fcntl.2 index 78e2c74e4..ef2b053b2 100644 --- a/man/man2/fcntl.2 +++ b/man/man2/fcntl.2 @@ -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 index 000000000..798d009e4 --- /dev/null +++ b/man/man2const/F_GETFL.2const @@ -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 +.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)