Open System Services System Calls Reference Manual (G06.28+)
System Functions (s and S) spt_closex(2)
NAME
spt_closex - Closes a file 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 filedes
);
PARAMETERS
filedes Specifies an open file 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 file descriptor specified by the filedes parameter.
All regions of the file associated with the filedes parameter that this process has previously
locked with the spt_fcntlx() function are unlocked. This occurs even if the process still has the
file open by another file descriptor.
When the last file descriptor associated with an open file descriptor is closed:
• The open file descriptor is freed.
• The last modification time for the file is updated.
• All locks created by spt_fcntlx() for the file are released.
• If the link count of the file is 0 (zero), the space occupied by the file is freed, and the file
is no longer accessible.
• If the file is a socket, the socket is destroyed.
• If the file 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 defined in the following manner before
including spthread.h:
#define 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 defined in the following manner
before including spthread.h:
#define SPT_THREAD_AWARE_PRAGMA_NONBLOCK
527186-005 Hewlett-Packard Company 7−97