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

System Functions (s and S) spt_closex(2)
NAME
spt_closex - Closes a 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_closex(
int ledes
);
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.
DESCRIPTION
The spt_closex() function is the thread-aware version of the close() function. Use spt_closex()
instead of close() to ensure proper operation of the various thread-aware input/output functions.
The spt_closex() function closes the le descriptor specied by the ledes parameter.
All regions of the le associated with the ledes parameter that this process has previously
locked with the spt_fcntlx() function are unlocked. This occurs even if the process still has the
le open by another le descriptor.
When the last le descriptor associated with an open le descriptor is closed:
The open le descriptor is freed.
The last modication time for the le is updated.
All locks created by spt_fcntlx() for the le are released.
If the link count of the le is 0 (zero), the space occupied by the le is freed, and the le
is no longer accessible.
If the le is a socket, the socket is destroyed.
If the le is a pipe or FIFO, any data remaining in the pipe or FIFO is discarded.
NOTES
The macro to map close() to spt_closex() is available in C applications when
SPT_THREAD_AWARE_NONBLOCK has been dened in the following manner before
including spthread.h:
#dene SPT_THREAD_AWARE_NONBLOCK
The alias to link close() to spt_closex() is available in C++ applications when
SPT_THREAD_AWARE_PRAGMA_NONBLOCK has been dened in the following manner
before including spthread.h:
#dene SPT_THREAD_AWARE_PRAGMA_NONBLOCK
527186-005 Hewlett-Packard Company 797