Open System Services System Calls Reference Manual (G06.28+)

System Functions (f - i) fcntl(2)
NAME
fcntl - Controls open le 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 ledes,
int request
[ , int argument1 | , struct flock *argument2 ] );
PARAMETERS
filedes Species an open le 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 le specied by the ledes
parameter.
Values for the request parameter are:
F_DUPFD Returns a new le descriptor as listed:
Returns the lowest-numbered available le descriptor that is greater than
or equal to the argument1 parameter
References the same open
Returns the same le pointer as the original le (that is, both le descrip-
tors share one le pointer if the object is a le)
Returns the same access mode (read, write, or read/write)
Returns the same le status ags (that is, both le descriptors share the
same le status ags)
Clears the close-on-exec ag (FD_CLOEXEC bit) associated with the
new le descriptor so that the le 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 species such a device for the ledes parameter,
the call fails and errno is set to [EINVAL].
527186-005 Hewlett-Packard Company 39