Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (f - i) fcntl(2)
NAME
fcntl - Controls open file descriptors
LIBRARY
G-series native OSS processes: system library
H-series and J-series OSS processes: implicit libraries
32-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/zputdll
64-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/yputdll
SYNOPSIS
#include <sys/types.h> /* optional except for POSIX.1 */
#include <unistd.h> /* optional except for POSIX.1 */
#include <fcntl.h>
int fcntl(
int filedes,
int request
[, int argument1 |
[, struct flock *argument2 |
, struct flock64 *argument2]]);
PARAMETERS
filedes Specifies an open file descriptor obtained from a successful call to the accept(),
creat(), dup( ), dup2( ), fcntl(), open(), pipe(), socket(),orsocketpair() func-
tion.
When the function is thread-aware, specifies an open file descriptor obtained
from a successful call to the creat(), creat64(), dup(), open(), open64(),
pipe( ), socket(),orsocketpair() function, or the thread-aware accept(),
dup2( ),orfcntl( ) function.
request Specifies the operation to be performed.
argument1 Specifies a variable that depends on the value of the request parameter.
argument2 Specifies a variable that depends on the value of the request parameter.
DESCRIPTION
The fcntl() function performs controlling operations on the open file specified by the filedes
parameter.
Values for the request parameter are:
F_DUPFD Returns a new file descriptor as listed:
• Returns the lowest-numbered available file descriptor that is greater than
or equal to the argument1 parameter.
• References the same open file description as the original file descriptor.
• Returns the same file pointer as the original file (that is, both file descrip-
tors share one file pointer if the object is a file).
• Returns the same access mode (read, write, or read/write).
• Returns the same file status flags (that is, both file descriptors share the
same file status flags).
527186-023 Hewlett-Packard Company 3−11