Open System Services System Calls Reference Manual (G06.25+, H06.03+)

fcntl(2) OSS System Calls Reference Manual
NAME
fcntl - Controls open file descriptors
LIBRARY
G-series native OSS processes: system library
H-series OSS processes: implicit libraries
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 ] );
PARAMETERS
filedes Species an open file descriptor obtained from a successful call to the accept(),
creat(), dup( ), dup2( ), fcntl( ), open(), pipe( ), socket(),orsocketpair() func-
tion
request Species the operation to be performed
argument1 Species a variable that depends on the value of the request parameter
argument2 Species 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
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)
Clears the close-on-exec flag (FD_CLOEXEC bit) associated with the
new file descriptor so that the file remains open across calls to any func-
tion in the exec, tdm_exec,ortdm_spawn sets of functions
The value F_DUPFD is invalid for an OSSTTY or Telserv terminal device. If
this value is used in a call that specifies such a device for the filedes parameter,
the call fails and errno is set to [EINVAL].
32 Hewlett-Packard Company 527186-003