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

spt_dup2x(2) OSS System Calls Ref
erence Manual
NAME
spt_dup2x - Duplicates and controls an open le descriptor (thread-aware version)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
[#include <unistd.h>]
#include <spthread.h>
int spt_dup2x(
int ledes,
int new);
PARAMETERS
filedes Species an open le descriptor obtained from a successful call to the
spt_acceptx(), creat(), dup(), spt_dup2x( ), spt_fcntlx(), open(), pipe( ),
socket(),orsocketpair() function.
new Species the open le descriptor that is returned by the spt_dup2x( ) function. If
this descriptor is already in use, it is rst deallocated as if it had been closed.
DESCRIPTION
The spt_dup2x() function is the thread-aware version of the dup2() function.
The spt_dup2x() function returns a new le descriptor on the open le specied by the ledes
parameter. If new is less than 0 (zero) or greater than or equal to the maximum number of opens
permitted, spt_dup2x( ) returns -1 with errno set to [EBADF].
The new le descriptor:
Is the value specied as the new parameter:
If ledes is a valid le descriptor and is equal to new, spt_dup2x() returns new
without closing it.
If ledes is not a valid le descriptor, spt_dup2x() returns -1 and does not close
new.
The value returned is equal to the value of new upon successful completion, or it
is -1 upon failure.
References the same open
Returns the same le pointer as the original le (that is, both le descriptors 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 descrip-
tor so that the le remains open across calls to any function in the exec, tdm_exec, and
tdm_spawn sets of functions
7106 Hewlett-Packard Company 527186-005