HP-UX Reference Section 2: System Calls HP-UX 11i Version 2 September 2004 Volume 5 of 10 Manufacturing Part Number : B2355-90843 Printed In USA E0904 Printed in USA © Copyright 1983-2004 Hewlett-Packard Development Company LP.
Legal Notices The information in this document is subject to change without notice. Warranty The only warranties for HP products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. HP shall not be liable for technical or editorial errors or omissions contained herein. U.S. Government License Confidential computer software.
Copyright 1996 Morning Star Technologies, Inc. Copyright 1996 Progressive Systems, Inc. Trademark Notices Intel and Itanium are registered trademarks of Intel Corporation in the US and other countries and are used under license. Java is a US trademark of Sun Microsystems, Inc. Microsoft and MS-DOS are U.S. registered trademarks of Microsoft Corporation. OSF/Motif is a trademark of The Open Group in the US and other countries. UNIX is a registered trademark of The Open Group.
Revision History This document’s printing date and part number indicate its edition. The printing date changes when a new edition is printed. (Minor corrections and updates which are incorporated at reprint do not cause the date to change.) New editions of this manual incorporate all material updated since the previous edition. Part Number Date; Release; Format; Distribution B2355-60105 September 2004; HP-UX 11i version 2; one volume HTML; docs.hp.com and Instant Information.
audit (5) An HP-UX manpage. audit is the name and 5 is the section in the HP-UX Reference. On the web and on the Instant Information CD, it may be a hot link to the manpage itself. From the HP-UX command line, you can enter “man audit” or “man 5 audit” to view the manpage. See man (1). Book Title The title of a book. On the web and on the Instant Information CD, it may be a hot link to the book itself. KeyCap The name of a keyboard key. Note that Return and Enter both refer to the same key.
vi
Preface HP-UX is the Hewlett-Packard Company’s implementation of an operating system that is compatible with various industry standards. It is based on the UNIX System V Release 4 operating system and includes important features from the Fourth Berkeley Software Distribution. The ten volumes of this manual contain the system reference documentation, made up of individual entries called manpages, named for the man command that displays them on the system.
viii
Volume Five Table of Contents Section 2
Volume Five Table of Contents Section 2
Table of Contents Volume Five Section 2: System Calls Entry Name(Section): name Description intro(2): intro ......................................................................................................... introduction to system calls __pset_rtctl(2): __pset_rtctl() .................................................................... real-time processor set control accept(2): accept() ...........................................................................................
Table of Contents Volume Five Entry Name(Section): name Description FD_ISSET() : synchronous I/O multiplexing ................................................................................. see select(2) FD_SET() : synchronous I/O multiplexing ..................................................................................... see select(2) FD_ZERO() : synchronous I/O multiplexing ...................................................................................
Table of Contents Volume Five Entry Name(Section): name Description kill(2): kill(), raise() ..................................................... send a signal to a process or a group of processes killpg(2): killpg() , getpgrp() , setpgrp() , signal() , sigvec() ............................................................................................. 4.2 BSD-compatible process control facilities link(2): link() ............................................................................................
Table of Contents Volume Five Entry Name(Section): name Description pread64() : non-POSIX standard API interfaces to support large files ..................................... see creat64(2) prealloc(2): prealloc() ..................................................................................... preallocate fast disk storage prealloc64() : non-POSIX standard API interfaces to support large files ............................... see creat64(2) PRI_HPUX_TO_POSIX(): return POSIX.4 process priority ..........
Table of Contents Volume Five Entry Name(Section): name Description pw_postv() : lightweight synchronization mechanism ............................................................ see postwait(2) pw_wait() : lightweight synchronization mechanism .............................................................. see postwait(2) pwrite64() : non-POSIX standard API interfaces to support large files ................................... see creat64(2) quotactl(2): quotactl() ..........................................
Table of Contents Volume Five Entry Name(Section): name Description setpgrp() : 4.2 BSD-compatible process control facilities ............................................................ see killpg(2) setpgrp2() : set process group ID ............................................................................................. see setpgid(2) setpgrp3() : create session and set process group ID ..................................................................
Table of Contents Volume Five Entry Name(Section): name Description swapon(2): swapon() .................................................. add swap device for interleaved paging and swapping symlink(2): symlink() ......................................................................................... make symbolic link to a file sync(2): sync() ..............................................................................................................................
Notes xvi Hewlett-Packard Company HP-UX 11i Version 2: September 2004
Section 2 System Calls
Section 2 System Calls
intro(2) intro(2) NAME intro - introduction to system calls DESCRIPTION This section describes all of the system calls. All of these calls return a function result. This result indicates the status of the call. Typically, a zero or positive result indicates that the call completed successfully, and −1 indicates an error. The individual descriptions specify the details. An error number is also made available in the external variable errno (see errno (2)). Note: errno is not cleared on successful calls.
__pset_rtctl(2) __pset_rtctl(2) NAME __pset_rtctl - real-time processor set control SYNOPSIS #include A _A int __pset_rtctl( pset_rt_req_t request , psetid_t pset , int arg , ); DESCRIPTION HP-UX Processor Sets allow a subset of processors in the system to be isolated for exclusive use by specified threads and processes. Only the threads bound to a processor set can execute on processors in that processor set (see pset_create (2)).
__pset_rtctl(2) __pset_rtctl(2) RTE_PSET_GETNEXTPSET Return the ID of the next RTE processor set in the system after pset . The arg argument is ignored. Typically, RTE_PSET_GETFIRSTPSET is called to determine the first RTE processor set. RTE_PSET_GETNEXTPSET is then called in a loop (until the call returns -1) to determine the IDs of the remaining RTE processor sets in the system. See pset_ctl (2) for additional processor set query operations.
__pset_rtctl(2) __pset_rtctl(2) Use sysconf() with _SC_PSET_RTE_SUPPORT to see if the RTE processor set functionality is supported by the underlying HP-UX operating system version. EXAMPLES Create a new processor set, and configure it as RTE processor set: #include
accept(2) accept(2) NAME accept - accept a connection on a socket SYNOPSIS #include AF_CCITT only #include int accept(int s, void *addr, int *addrlen); A _XOPEN_SOURCE_EXTENDED only (UNIX 98) int accept(int s, struct sockaddr *addr, socklen_t *addrlen); Obsolescent _XOPEN_SOURCE_EXTENDED only (UNIX 95) int accept(int s, struct sockaddr *addr, size_t *addrlen); DESCRIPTION The accept() system call is used with connection-based socket types, such as SOCK_STREAM.
accept(2) accept(2) If an error occurs, accept() returns -1 and sets errno to indicate the cause. ERRORS If accept() fails, errno is set to one of the following values: A aA [EAGAIN] Nonblocking I/O is enabled using O_NONBLOCK and no connections are present to be accepted. [EBADF] The argument, s, is not a valid file descriptor. [ECONNABORTED] The socket is being shutdown due to a request by software. This is usually caused by a shutdown() system call.
access(2) access(2) NAME access - determine accessibility of a file SYNOPSIS #include int access(char *path, int amode); DESCRIPTION The access() system call checks the file pointed to by path for accessibility according to the bit pattern contained in amode . access() uses the real user ID, not the effective user ID, and the real group ID, not the effective group ID. The value of amode is either the bit-wise inclusive OR of the access permissions to be checked, or the existence test.
access(2) access(2) [EFAULT] path points outside the allocated address space for the process. The reliable detection of this error is implementation dependent. [ELOOP] Too many symbolic links were encountered in translating the path name. [ENAMETOOLONG] The length of the specified path name exceeds PATH_MAX bytes, or the length of a component of the path name exceeds NAME_MAX bytes while _POSIX_NO_TRUNC is in effect.
acct(2) acct(2) NAME acct() - enable or disable process accounting SYNOPSIS #include int acct(const char *path); DESCRIPTION The acct() system call enables or disables the system’s process accounting routine. If the routine is enabled, an accounting record is written on an accounting file for each process that terminates. Termination can be caused by one of two things: an exit() call or a signal (see exit (2) and signal (5)).
acl(2) acl(2) NAME acl() - set a file’s Access Control List (ACL) information (JFS File Systems only) SYNOPSIS #include #include int acl(char *pathp, int cmd, int nentries, struct acl *aclbufp); A aA DESCRIPTION The acl() system call is used to manipulate ACLs on JFS file system objects. pathp points to a pathname naming a file. nentries specifies how many ACL entries are pointed to by aclbufp . aclbufp is a pointer to the first element of an array of struct acl.
acl(2) acl(2) Entries of type USER, GROUP, DEF_USER, or DEF_GROUP do not contain duplicate entries. A duplicate entry is one of the same type containing the same numeric ID. If the ACL contains no entries of type USER and no entries of type GROUP, then the entries of type GROUP_OBJ and CLASS_OBJ have the same permissions.
adjtime(2) adjtime(2) NAME adjtime() - correct the time to synchronize the system clock SYNOPSIS #include A aA int adjtime( const struct timeval *delta, struct timeval *olddelta ); DESCRIPTION The function adjtime() adjusts the current time of the system. The time is either advanced or retarded by the amount of time specified in the struct timeval pointed to by delta . The adjustment is made by applying small correctional adjustments to the value of current time that the system keeps.
adjtime(2) [EINVAL] adjtime(2) If delta.tv_sec is greater than 31536000 (approx. 365 days) or less than −31536000. The delta.tv_usec field is not used in calculation of these limits. If the user wants to adjust time greater than these limits, an appropriate alternative interface should be used. EXAMPLES The following code snippet will take the time forward 20 minutes. struct timeval forward; forward.tv_sec = 20 * 60; forward.
aio_cancel(2) aio_cancel(2) NAME aio_cancel() - cancel an asynchronous I/O operation SYNOPSIS #include int aio_cancel(int fildes, struct aiocb *aiocbp); A aA DESCRIPTION The aio_cancel() function attempts to cancel the asynchronous I/O request currently outstanding for the aiocb referenced by aiocbp or, if aiocbp is NULL, any asynchronous I/O operations currently outstanding for the file descriptor fildes .
aio_error(2) aio_error(2) NAME aio_error() - return error status of an asynchronous I/O operation SYNOPSIS #include int aio_error(const struct aiocb *aiocbp); DESCRIPTION The aio_error() function returns the error status of the asynchronous I/O operation that was initiated with the aiocb and referenced by aiocbp. The error status for an asynchronous I/O operation is the errno value set by the corresponding read(), write(), or fsync() function.
aio_fsync(2) aio_fsync(2) NAME aio_fsync() - force outstanding asynchronous operations on a file to the synchronized state SYNOPSIS #include int aio_fsync(int op, struct aiocb *aiocbp); A aA DESCRIPTION The aio_fsync() function asynchronously forces all I/O operations that are enqueued at the time of the call for the file or device referenced by aiocbp->aio_fildes to the synchronized I/O state.
aio_fsync(2) aio_fsync(2) STANDARDS CONFORMANCE aio_fsync(): POSIX Realtime Extensions, IEEE Std 1003.
aio_read(2) aio_read(2) NAME aio_read() - start an asynchronous read operation SYNOPSIS #include int aio_read(struct aiocb *aiocbp); A aA DESCRIPTION The aio_read() function allows the calling process to perform an asynchronous read from a previously opened file. The function call returns when the read operation has been enqueued for processing. At this point, processing of the read operation may proceed concurrently with execution of the calling process or thread.
aio_read(2) aio_read(2) Once the read request has been enqueued by aio_read(), the following errors, in addition to all of the errors normally reported by the read() function, may be reported asynchronously by a subsequent call to aio_error() or aio_return() referencing its aiocb. [EBADF] The aiocbp->aio_fildes was not a valid file descriptor open for reading. [EINVAL] The value of aiocbp->aio_reqprio is not valid. [EINVAL] The value of aiocbp->aio_nbytes is invalid.
aio_reap(2) aio_reap(2) NAME aio_reap() - wait for multiple asynchronous I/O requests SYNOPSIS #include A aA typedef struct aio_completion_data { struct aiocb *aio_aiocb; int aio_return; int aio_error; } aio_completion_t; int aio_reap(aio_completion_t list[], int nent, const struct timespec *timeout, int waitfor, int *completed_count) ; DESCRIPTION The aio_reap() function is an extension of the aio_suspend() library function.
aio_reap(2) aio_reap(2) The use of aio_reap() in an application should not be mixed with the older aio_return() or aio_error() functions. Mixing of the two methods of IO collection will result in undefined behavior and possible data loss. The timeout parameter must be either NULL or point to a timespec structure that has a timeout time specified. If a NULL pointer is specified, then no timeout handling is performed and aio_reap() blocks until waitfor AIO requests are available.
aio_reap(2) aio_reap(2) Usage Notes To use aio_reap(), link in the realtime library by specifying -lrt on the compiler or linker command line. Then, before making any AIO function calls, initialize the reap mechanism by calling aio_reap() in lightweight mode, as shown in this example: int ignore; (void)aio_reap(NULL, 0, NULL, 0, &ignore); For this single call to initialize aio_reap(), all output (including return value) should be ignored.
aio_return(2) aio_return(2) NAME aio_return() - return status of an asynchronous I/O operation SYNOPSIS #include ssize_t aio_return(struct aiocb *aiocbp); DESCRIPTION The aio_return() function returns the return status associated with the aiocb structure referenced by the aiocbp argument. The return value for an asynchronous I/O operation is the value that would be set by the corresponding read(), write(), or fsync() operation.
aio_suspend(2) aio_suspend(2) NAME aio_suspend() - wait for an asynchronous I/O operation to complete SYNOPSIS #include
aio_write(2) aio_write(2) NAME aio_write() - start asynchronous write operation SYNOPSIS #include int aio_write(struct aiocb *aiocbp); DESCRIPTION The aio_write() function allows the calling process to perform an asynchronous write to a previously opened file. The function call returns when the write operation has been enqueued for processing. At this point, processing of the write operation may proceed concurrently with execution of the calling process or thread.
aio_write(2) A aA aio_write(2) [EBADF] The aiocbp->aio_fildes was not a valid file descriptor open for writing. [EINVAL] The aiocb->aio_sigevent is not a valid address in the process virtual address space. [EINVAL] The parameters of the indicated sigevent in aiocb->aio_sigevent are invalid. [EINVAL] The value of aiocbp->aio_reqprio is not valid. [EINVAL] The value of aiocbp->aio_nbytes is invalid.
alarm(2) alarm(2) NAME alarm - set a process’s alarm clock SYNOPSIS #include unsigned int alarm(unsigned int sec); DESCRIPTION alarm() instructs the alarm clock of the calling process to send the signal SIGALRM to the calling process after the number of real-time seconds specified by sec have elapsed; see signal (5). Specific implementations might place limitations on the maximum supported alarm time. The constant MAX_ALARM defined in
audctl(2) audctl(2) NAME audctl - start or halt the auditing system and set or get audit files SYNOPSIS #include int audctl(int cmd, char *cpath, char *npath, mode_t mode); DESCRIPTION A aA audctl() sets or gets the auditing system "current" and "next" audit files, and starts or halts the auditing system. This call is restricted to superusers. cpath and npath hold the absolute path names of the "current" and "next" files. mode specifies the audit file’s permission bits.
audctl(2) audctl(2) there is no available "next" file, no action is performed; -1 is returned, and errno is set to ENOENT. AUD_OFF The caller issues the AUD_OFF command to halt the auditing system. If the auditing system is on, it is turned off and the "current" and "next" audit files are closed. cpath , npath , and mode are ignored. If the audit system is already off, -1 is returned and errno is set to EALREADY. RETURN VALUE Upon successful completion, a value of 0 is returned.
audswitch(2) audswitch(2) NAME audswitch - suspend or resume auditing on the current process SYNOPSIS #include int audswitch(int aflag); DESCRIPTION A aA audswitch() suspends or resumes auditing within the current process. This call is restricted to superusers. One of the following aflags must be used: AUD_SUSPEND Suspend auditing on the current process. AUD_RESUME Resume auditing on the current process.
audwrite(2) audwrite(2) NAME audwrite - write an audit record for a self-auditing process SYNOPSIS #include int audwrite(const struct self_audit_rec *audrec_p); DESCRIPTION audwrite() is called by trusted self-auditing processes, which are capable of turning off the regular auditing (using audswitch (2)) and doing higher-level auditing on their own. audwrite() is restricted to superusers.
bind(2) bind(2) NAME bind - bind an address to a socket SYNOPSIS #include AF_CCITT only #include AF_INET, AF_INET6 and AF_VME_LINK only A bA #include AF_UNIX only #include
bind(2) bind(2) [EBADF] s is not a valid file descriptor. [EDESTADDRREQ] No addr parameter was specified. [EFAULT] addr is not a valid pointer. [EINVAL] The socket is already bound to an address, the socket has been shut down, addrlen is a bad value, or an attempt was made to bind() an AF_UNIX socket to an NFS-mounted (remote) name. AF_CCITT: The protocol-ID length is negative or greater than 8, the X.121 address string contains an illegal character, or the X.
brk(2) brk(2) NAME brk, sbrk - change data segment space allocation SYNOPSIS #include int brk(const void *endds); void *sbrk(int incr); A bA DESCRIPTION brk() and sbrk() are used to change dynamically the amount of space allocated for the calling process’s data segment; see exec (2). The change is made by resetting the process’s break value and allocating the appropriate amount of space. The break value is the address of the first location beyond the end of the data segment.
chdir(2) chdir(2) NAME chdir, fchdir - change working directory SYNOPSIS #include int chdir(const char *path); int fchdir(int fildes); DESCRIPTION chdir() and fchdir() cause a directory pointed to by path or fildes to become the current working directory, the starting point for path searches of path names not beginning with /. path points to the path name of a directory. fildes is an open file descriptor of a directory.
chmod(2) chmod(2) NAME chmod(), fchmod() - change file mode access permissions SYNOPSIS #include int chmod(const char *path, mode_t mode); int fchmod(int fildes, mode_t mode); DESCRIPTION The chmod() and fchmod() system calls set the access permission portion of the file’s mode according to the bit pattern contained in mode. path points to a path name naming a file. fildes is a file descriptor.
chmod(2) chmod(2) Access Control Lists - JFS File Systems Only The effective permissions granted by optional entries in a file’s access control list may be changed when chmod() is executed. In particular, using chmod() to remove read, write and execute permissions from a file’s owner, owning group, and all others works as expected, because chmod() affects the class entry in the ACL, limiting any access that can be granted to additional users or groups via optional ACL entries.
chown(2) chown(2) NAME chown(), fchown(), lchown() - change owner and group of a file SYNOPSIS #include int chown(const char *path, uid_t owner, gid_t group); int lchown(const char *path, uid_t owner, gid_t group); int fchown(int fildes, uid_t owner, gid_t group); A cA DESCRIPTION The chown() system call changes the user and group ownership of a file. path points to the path name of a file.
chown(2) chown(2) [EACCES] Search permission is denied on a component of the path prefix. [EFAULT] path points outside the allocated address space of the process. The reliable detection of this error is implementation dependent. [ELOOP] Too many symbolic links were encountered in translating path . [ENAMETOOLONG] A component of path exceeds NAME_MAX bytes while _POSIX_NO_TRUNC is in effect, or path exceeds PATH_MAX bytes. [ENOENT] The file named by path does not exist.
chroot(2) chroot(2) (TO BE OBSOLETED) NAME chroot - change root directory SYNOPSIS #include int chroot(const char *path); DESCRIPTION chroot() causes the named directory to become the root directory, the starting point for path searches for path names beginning with /. path points to a path name naming a directory. The user’s working directory is unaffected by the chroot() system call.
clocks(2) clocks(2) NAME clock_settime(), clock_gettime(), clock_getres() - clock operations SYNOPSIS #include int clock_settime( clockid_t clock_id, const struct timespec *tp ); int clock_gettime( clockid_t clock_id, struct timespec *tp ); A int clock_getres( clockid_t clock_id, struct timespec *res ); DESCRIPTION clock_settime() The clock_settime() function sets the specified clock, clock_id, to the value specified by tp.
clocks(2) clocks(2) ERRORS If any of the following conditions occur, the clock_settime(), clock_gettime(), and clock_getres() functions return −1 and set errno (see errno (2)) to the corresponding value: A cA [ENOSYS] The functions clock_settime(), clock_gettime(), and clock_getres() are not supported by this implementation. [EINVAL] The clock_id argument does not specify a known clock. [EINVAL] The tp argument to clock_settime() is outside the range for the given clock_id.
close(2) close(2) NAME close - close a file descriptor SYNOPSIS #include int close(int fildes); DESCRIPTION close() closes the file descriptor indicated by fildes . fildes is a file descriptor obtained from a creat(), open(), dup(), fcntl(), or pipe() system call. All associated file segments which have been locked by this process with the lockf() function are released (i.e., unlocked).
connect(2) connect(2) NAME connect - initiate a connection on a socket SYNOPSIS #include AF_CCITT only #include AF_INET, AF_INET6 and AF_VME_LINK only #include A cA AF_UNIX only #include
connect(2) connect(2) AF_CCITT Only Use the x25addrstr struct for the address structure. The caller must know the X.121 address of the DTE to which the connection is to be established, including any subaddresses or protocol IDs that may be needed. If address-matching by protocol ID, specify the protocol ID with the X25_WR_USER_DATA ioctl() call before issuing the connect() call. DEPENDENCIES AF_CCITT The SO_REUSEADDR option to setsockopt() is not supported for sockets in the AF_CCITT address family.
connect(2) connect(2) [ENETUNREACH] The network is not reachable from this host. For AF_CCITT only: X.25 Level 2 is down. The X.25 link is not working: wires might be broken, connections are loose on the interface hoods at the modem, the modem failed, or noise interfered with the line for an extremely long period of time. A cA [ENOBUFS] No buffer space is available. The connect() has failed. [ENOMEM] No memory is available. The connect() has failed.
crashconf(2) crashconf(2) NAME crashconf() - configure system crash dumps SYNOPSIS #include int crashconf( int operation, int includeClasses, int excludeClasses, int deviceCount, char **devices, int *deviceReturn ); A DESCRIPTION crashconf() changes the current system crash dump configuration. The crash dump configuration consists of: • The crash dump device list. This list identifies all devices that can be used to store a crash dump.
crashconf(2) crashconf(2) includeClasses is a bitmask of classes that must be dumped. If it is set to DT_ALL, all dumps will be full dumps. Other allowed values are described under Classes , below. excludeClasses is a bitmask of classes that may not be dumped unless a full dump is required (due to the cause of the dump, or by explicit operator request). If it is set to DT_ALL, dumps will be disabled. Other allowed values are described under Classes , below.
crashconf(2) crashconf(2) char *ccerrs[] = { CCERR_STRINGS }; int num_ccerrs = sizeof(ccerrs)/sizeof(*ccerrs); char *ccwarns[] = { CCWARN_STRINGS }; int num_ccwarns = sizeof(ccwarns)/sizeof(*ccwarns); char *device_to_add[1]; int device_return[1]; ...
creat(2) creat(2) NAME creat - create a new file or rewrite an existing one SYNOPSIS #include int creat(const char *path, mode_t mode); DESCRIPTION The creat() system call creates a new regular file or prepares to rewrite an existing file named by the path name pointed to by path . A cA If the file exists, its length is truncated to 0, and its mode and owner are unchanged. Otherwise, the file’s owner ID is set to the effective user ID of the process.
creat(2) creat(2) [ENAMETOOLONG] The length of the specified path name exceeds PATH_MAX bytes, or the length of a component of the path name exceeds NAME_MAX bytes while _POSIX_NO_TRUNC is in effect. [ENFILE] The system file table is full. [ENOENT] The named file does not exist (for example, path is null, or a component of path does not exist). [ENOSPC] Not enough space on the file system. [ENOTDIR] A component of the path prefix is not a directory.
creat64(2) creat64(2) NAME creat64( ), fstat64( ), fstatvfs64( ), getrlimit64( ), lockf64( ), lseek64( ), lstat64( ), mmap64( ), open64( ), pread64( ), prealloc64( ), pwrite64( ), setrlimit64( ), stat64( ), statvfs64( ), truncate64( ), ftruncate64( ), O_LARGEFILE - non-POSIX standard API interfaces to support large files SYNOPSIS #include int creat64(const char *path, mode_t mode); #include int fstat64(int fildes, struct stat64 *buf); A cA #include
creat64(2) creat64(2) creat64() The creat64() function returns a file descriptor which can be used to grow the file past 2 GB if desired. All other functional behaviors, returns, and errors are identical to creat(). fstat64() The fstat64() function is identical to fstat() except that fstat64() returns file status in a struct stat64 instead of a struct stat. All other functional behaviors, returns, and errors are identical.
creat64(2) creat64(2) _FILE_OFFSET_BITS is set to 64. The bit may be queried by fcntl() (or fcntl64()), which can also turn the bit on or off if desired. APPLICATION USAGE The standard POSIX interfaces may be used by 32-bit applications to create and access large files if compiled with _FILE_OFFSET_BITS set to 64. The interfaces described here are alternatives to the standard ones, and are enabled by defining _LARGEFILE64_SOURCE.
dup(2) dup(2) NAME dup - duplicate an open file descriptor SYNOPSIS #include int dup(int fildes); DESCRIPTION fildes is a file descriptor obtained from a creat(), open(), dup(), fcntl(), or pipe() system call. dup() returns a new file descriptor having the following in common with the original: • Same open file (or pipe). • Same file pointer (i.e., both file descriptors share one file pointer). • Same access mode (read, write or read/write).
dup2(2) dup2(2) NAME dup2 - duplicate an open file descriptor to a specific slot SYNOPSIS #include int dup2(int fildes, int fildes2); DESCRIPTION fildes is a file descriptor obtained from a creat(), open(), dup(), fcntl(), or pipe() system call. fildes2 is a non-negative integer less than the maximum value allowed for file descriptors. dup2() causes fildes2 to refer to the same file as fildes . If fildes2 refers to an already open file, the open file is closed first.
errno(2) errno(2) NAME errno - error indicator for function calls SYNOPSIS #include DESCRIPTION Many functions in the HP-UX operating system indicate an error condition by returning an otherwise out-of-range value (usually -1). Most of these functions set the symbol errno, that is defined in , to a nonzero code value that more specifically identifies the particular error condition that was encountered.
errno(2) errno(2) [ECONNREFUSED] Connection refused. No connection could be made because the target machine actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host. [ECONNRESET] Connection reset by peer. A connection was forcibly closed by a peer. This normally results from the peer executing a shutdown() call (see shutdown (2)). [EDEADLK] Resource deadlock would occur.
errno(2) errno(2) [EMLINK] Too many links. An attempt to make more than the maximum number of links to a file. [EMSGSIZE] Message too long. The socket requires that the message be sent atomically, and the size of the message to be sent made this impossible. [ENAMETOOLONG] File name too long. A path specified exceeds the maximum path length for the system. The maximum path length is specified by PATH_MAX and is defined in . PATH_MAX is guaranteed to be at least 1023 bytes.
errno(2) errno(2) [ENOSYM] Symbol does not exist in executable. The dynamic loader was unable to resolve a symbolic reference in a shared library during a call to one of the dynamic loader interface routines (see shl_load (3X). The program may be in an inconsistent state and should be terminated immediately. [ENOSYS] Function is not available. The requested function or operation is not implemented or not configured in the system. [ENOTBLK] Block device required.
errno(2) [ESPIPE] [ESRCH] errno(2) Illegal seek. An lseek() was issued to a pipe. No such process. No process can be found corresponding to that specified by pid in kill(), rtprio(), or ptrace(), or the process is not accessible. [ETIMEDOUT] Connection timed out. A connect() request failed because the connected party did not properly respond after a period of time (timeout period varies, depending on the communication protocol). [ETXTBSY] Text file busy.
exec(2) exec(2) NAME execl(), execle(), execlp(), execv(), execve(), execvp() - execute a file SYNOPSIS #include extern char **environ; int execl(const char *path, const char *arg0, ... /* * [const char *arg1, ... , const char *argn,] */ (char *)0 ); A eA int execle(const char *path, const char *arg0, ... /* * [const char *arg1, ... , const char *argn,] */ (char *)0, char * const envp[] ); int execlp(const char *file, const char *arg0, ... /* * [const char *arg1, ...
exec(2) exec(2) file (in execlp() or execvp()) points to a file name identifying the executable file containing the new program. The path prefix for this file is obtained by searching the directories passed in the environment variable PATH (see environ (5)). The environment is supplied by the shell (see sh(1)). If file does not have an executable magic number (see magic (4)), it is passed to the POSIX shell as a shell script. arg0 , ..., argn are one or more pointers to null-terminated character strings.
exec(2) exec(2) • • • • • • • • • • process start time real-time priority (see rtprio (2)) root directory (see chroot (2)) semadj values (see semop (2)) session membership signal mask (see sigvector (2)) supplementary group IDs time left until an alarm clock signal (see alarm (2)) trace flag (see the PT_SETTRC request of ptrace (2)) tms_utime, tms_stime, tms_cutime, and tms_cstime (see times (2)) For a script file, the initial line of a script file must begin with #! as the first two bytes, followed by
exec(2) exec(2) recognized. [EINVAL] argv points to NULL and null pointer dereferencing is allowed. In this case, NULL is a valid address, but is considered an invalid argument. [ELOOP] Too many symbolic links were encountered in translating the path name. [ENAMETOOLONG] The executable file’s path name or the interpreter’s path name exceeds PATH_MAX bytes, or the length of a component of the path name exceeds NAME_MAX bytes while _POSIX_NO_TRUNC is in effect. [ENOENT] path points to an empty string.
exit(2) exit(2) NAME exit, _exit - terminate process SYNOPSIS #include void exit(int status); #include void _exit(int status); DESCRIPTION exit() terminates the calling process and passes status to the system for inspection, see wait (2). Returning from main in a C program has the same effect as exit(); the status value is the function value returned by main (this value is undefined if main does not take care to return a value or to call exit() explicitly).
exit(2) exit(2) AUTHOR exit() was developed by HP, AT&T, and the University of California, Berkeley. SEE ALSO acct(2), plock(2), pthread_cancel(3T), pthread_exit(3T), pthread_key_create(3T), semop(2), shmop(2), times(2), vfork(2), wait(2), signal(5), sh(1), see exit conditions ($?). STANDARDS CONFORMANCE exit(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, ANSI C _exit(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.
fcntl(2) fcntl(2) NAME fcntl - file control SYNOPSIS #include int fcntl(int fildes, int cmd, ... /* arg */); Remarks The ANSI C ", ..." construct denotes a variable length argument list whose optional [or required] members are given in the associated comment (/* */). DESCRIPTION fcntl() provides for control over open files. fildes is an open file descriptor.
fcntl(2) fcntl(2) negative values, other than -1, indicate a process group ID. F_GETLK64 Same as F_GETLK, except arg is a pointer to struct flock64 instead of struct flock. F_SETLK64 Same as F_SETLK, except arg is a pointer to struct flock64 instead of struct flock. F_SETLKW64 Same as F_SETLKW, except arg is a pointer to struct flock64 instead of struct flock. A read lock prevents any other process from write-locking the protected area.
fcntl(2) fcntl(2) F_SETFD Value other than −1. F_GETFL Value of file status flags and access modes. F_SETFL Value other than −1. F_GETLK Value other than −1. F_SETLK Value other than −1. F_SETLKW Value other than −1. F_GETOWN Value of process or process group ID specified to receive SIGURG signals when out-of-band data is available. F_SETOWN Value other than −1. F_GETLK64 Value other than −1. F_SETLK64 Value other than −1. F_SETLKW64 Value other than −1.
fcntl(2) fcntl(2) [EFAULT] cmd is either F_GETLK, F_SETLK, or F_SETLKW, and arg points to an illegal address. [ENOTSOCK] cmd is F_GETOWN or F_SETOWN, and fildes does not refer to a socket. AUTHOR fcntl() was developed by HP, AT&T and the University of California, Berkeley. SEE ALSO lockd(1M), statd(1M), chmod(2), close(2), creat64(2), exec(2), lockf(2), open(2), read(2), write(2), fcntl(5). STANDARDS CONFORMANCE fcntl(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.
fork(2) fork(2) NAME fork - create a new process SYNOPSIS #include pid_t fork(void); DESCRIPTION The fork() system call causes the creation of a new process. The new child process is created wth exactly one thread or lightweight process. The new child process contains a replica of the calling thread (if the calling process is multi-threaded) and its entire address space, possibly including the state of mutexes and other resources.
fork(2) fork(2) If a parent and child process both have a file opened and the parent or child closes the file, the file is still open for the other process. RETURN VALUE Upon successful completion, fork() returns a value of 0 to the child process and returns the process ID of the child process to the parent process. Otherwise, a value of −1 is returned to the parent process, no child process is created, and errno is set to indicate the error.
fsctl(2) fsctl(2) NAME fsctl - file system control SYNOPSIS #include int fsctl( int fildes, int command, void *outbuf, size_t outlen ); DESCRIPTION fsctl() provides access to file-system-specific information. fildes is an open file descriptor for a file in the file system of interest. The possible values for command depend on the type of file system. Currently, defined commands exist only for the CDFS file system (see sys/cdfsdir.h).
fsctl(2) fsctl(2) with a NULL character. The maximum size of the volume set ID is 128 bytes, so a length of 129 can be used for outlen and the size of outbuf . EXAMPLES The following code fragment gets the extended attribute record for a file on a CDFS volume. The filename is passed in as the first argument to the routine. Note that error checking is omitted for brevity. #include #include #include #include
fstat(2) fstat(2) NAME fstat - get file status SYNOPSIS #include #include int fstat(int fildes, struct stat *buf); DESCRIPTION The fstat() function obtains information about an open file associated with the file descriptor fildes , and writes it to the area pointed to by buf. fildes is a file descriptor for an open file, which is created with the successful completion of an open(), creat(), dup(), fcntl(), or pipe() system call.
fstat(2) fstat(2) st_ctime Time when file status was last changed. Changed by the following system calls: acl(), chmod(), chown(), creat(), fchmod(), fchown(), truncate(), ftruncate(), (see truncate (2)), link(), mknod(), pipe(), prealloc(), rename(), setacl(), unlink(), utime(), write(), and writev() (see write (2)). The touch command (see touch (1)) can be used to explicitly control the times of a file.
fstat(2) fstat(2) WARNINGS Access Control Lists - HFS and JFS File Systems Only Access control list descriptions in this entry apply only to HFS and JFS file systems on standard HP-UX operating systems. For 32-bit applications, st_ino will be truncated to its least significant 32-bits for filesystems that use 64-bit values. DEPENDENCIES CD-ROM The st_uid and st_gid fields are set to −1 if they are not specified on the disk for a given file. AUTHOR stat() and fstat() were developed by AT&T.
fsync(2) fsync(2) NAME fsync, fdatasync - synchronize a file’s in-core and on-disk states SYNOPSIS #include int fsync(int fildes); int fdatasync(int fildes); DESCRIPTION fsync() and fdatasync() cause all modified data and attributes of fildes to be moved to a permanent storage device. This normally results in all in-core modified copies of buffers for the associated file to be written to a disk.
ftime(2) ftime(2) NAME ftime - get date and time more precisely SYNOPSIS #include int ftime(struct timeb *tp); Remarks This facility is provided for backwards compatibility with Version 7 systems. Either time() or gettimeofday() should be used in new programs. DESCRIPTION ftime() fills in a structure pointed to by its argument, as defined by
getaccess(2) getaccess(2) NAME getaccess - get a user’s effective access rights to a file SYNOPSIS #include int getaccess( const char *path, uid_t uid, int ngroups, const gid_t *gidset, void *label, void *privs ); DESCRIPTION getaccess() identifies the access rights (read, write, execute/search) a specific user ID has to an existing file. path points to a path name of a file.
getaccess(2) getaccess(2) access() checks all ACL entries (HFS and JFS File Systems only) uses real uid, real gid, and supplementary groups list checks specific mode value, returns succeed or fail checks path to file using caller’s effective IDs W_OK false if shared-text file currently being executed W_OK false if file on read-only file system X_OK not modified for file currently open for writing R_OK and W_OK always true for superuser (except as above) X_OK always true for superuser A gA getaccess() sa
getaccess(2) getaccess(2) int gid = 109; int mode; mode = getaccess ("/tmp/hold", 23, 1, & gid, (void ∗) 0, (void ∗) 0); Should the need arise, the following code builds a gidset that includes the process’s effective group ID: #include int gidset [NGROUPS_MAX + 1]; int ngroups; gidset [0] = getegid(); ngroups = 1 + getgroups (NGROUPS_MAX, & gidset [1]); AUTHOR getaccess() was developed by HP. SEE ALSO access(2), acl(2), chmod(2), getacl(2), setacl(2), stat(2), acl(5), aclv(5), unistd(5).
getacl(2) getacl(2) NAME getacl, fgetacl - get access control list (ACL) information (HFS File Systems only) SYNOPSIS #include int getacl( const char *path, int nentries, struct acl_entry *acl ); int fgetacl(int fildes, int nentries, struct acl_entry *acl); DESCRIPTION getacl() returns a complete listing of all ACL entries (uid.gid , mode) in an existing file’s access control list. path points to a path name of a file.
getacl(2) getacl(2) [EINVAL] nentries is non-zero and less than the number of entries in the file’s ACL, or it is greater than NACLENTRIES. [ENOSYS] The function is not supported by this file system type. [ENFILE] The system file table is full. EXAMPLES The following call returns the number of entries in the ACL on file /users/bill/mcfile. #include
getaudid(2) getaudid(2) NAME getaudid - get the audit ID (aid) for the current process SYNOPSIS #include int getaudid(void); DESCRIPTION getaudid() returns the audit ID ( aid ) for the current process. This call is restricted to the super-user. RETURN VALUE Upon successful completion, the audit ID is returned; otherwise, a -1 is returned. ERRORS getaudid() fails if the following is true: [EPERM] The caller is not super-user. AUTHOR A gA getaudid() was developed by HP.
getaudproc(2) getaudproc(2) NAME getaudproc - get the audit process flag for the calling process SYNOPSIS #include int getaudproc(void); DESCRIPTION getaudproc() returns the audit process flag for the calling process. The audit process flag (u_audproc ) determines whether the process run by a given user should be audited. The process is audited if the returned flag is 1. If the returned flag is 0, the process is not audited. This call is restricted to the super-user.
getcontext(2) getcontext(2) NAME getcontext, setcontext - get and set current user context SYNOPSIS #include int getcontext(ucontext_t *ucp); int setcontext(const ucontext_t *ucp); DESCRIPTION The getcontext() function initializes the structure pointed to by ucp to the current user context of the calling process.
getdirentries(2) getdirentries(2) (TO BE OBSOLETED) NAME getdirentries() - get entries from a directory in a file-system-independent format SYNOPSIS #include For versions prior to 10.30 #include For 10.30 and later versions int getdirentries( int fildes, struct direct *buf, size_t nbytes, off_t *basep ); DESCRIPTION The getdirentries() system call and the header file have been obsoleted starting from HP-UX 10.30 by the functions described in directory (3C).
getdirentries(2) getdirentries(2) (TO BE OBSOLETED) [EIO] An I/O error occurred while reading from or writing to the file system. WARNINGS Obsolescent Interfaces getdirentries() is to be obsoleted at a future date. Note: The getdirentries() call can encounter truncated d_ino values when it is used with a 64-bit filesystem. AUTHOR getdirentries() was developed by Sun Microsystems, Inc. SEE ALSO lseek(2), open(2), directory(3C).
getdomainname(2) getdomainname(2) NAME getdomainname, setdomainname - get/set name of current Network Information Service domain SYNOPSIS int getdomainname(char *name, int namelen); int setdomainname(char *name, int namelen); DESCRIPTION getdomainname() returns the name of the Network Information Service (NIS) domain for the current processor, as previously set by setdomainname(). The parameter namelen specifies the size of the name array.
getevent(2) getevent(2) NAME getevent - get events and system calls that are currently being audited SYNOPSIS #include int getevent( struct aud_type *a_syscall, struct aud_event_tbl *a_event ); DESCRIPTION getevent() gets the events and system calls being audited. The events are returned in a table pointed to by a_event . The system calls are returned in a table pointed to by a_syscall . This call is restricted to the super-user.
getfh(2) getfh(2) NAME getfh() - return file handle for file on remote node SYNOPSIS #include #include #include #include int getfh(char *path, fhandle_t *fhp); DESCRIPTION The getfh() system call returns a file handle in the struct pointed to by fhp for the file pointed to by path . This information is used to perform an NFS mount for a remote node. getfh() is executed on the remote node; results are passed back to the program doing the NFS mount.
getgroups(2) getgroups(2) NAME getgroups - get group access list SYNOPSIS #include int getgroups(int ngroups, gid_t gidset[ ]); DESCRIPTION getgroups() gets the current group access list of the user process and stores it in the array gidset . The parameter ngroups indicates the number of entries which may be placed in gidset. No more than NGROUPS_MAX, as defined in , is ever returned.
gethostid(2) gethostid(2) (TO BE OBSOLETED) NAME gethostid - get an identifier for the current host SYNOPSIS #include long gethostid(void); DESCRIPTION The gethostid() function retrieves a 32-bit identifier for the current host. RETURN VALUE Upon successful completion, gethostid() returns an identifier for the current host. ERRORS No errors are defined. APPLICATION USAGE X/Open does not define the domain in which the return value is unique.
gethostname(2) gethostname(2) NAME gethostname - get name of current host SYNOPSIS #include int gethostname(char *hostname, size_t size); DESCRIPTION gethostname() returns in the array to which hostname points, the standard host name for the current processor as set by sethostname() (see sethostname (2)). size specifies the length of the hostname array. hostname is null-terminated unless insufficient space is provided. RETURN VALUE gethostname() returns 0 if successful.
getitimer(2) getitimer(2) NAME getitimer, setitimer - get and set value of interval timer SYNOPSIS #include int getitimer(int which, struct itimerval *value); int setitimer( int which, const struct itimerval *value, struct itimerval *ovalue ); DESCRIPTION The getitimer() function stores the current value of the timer specified by which into the structure pointed to by value .
getitimer(2) getitimer(2) timerclear Set a time value to zero. timerisset Test if a time value is non-zero. timercmp Compare two time values. (Beware that >= and <= do not work with the timercmp macro.) The timer used with ITIMER_REAL is also used by alarm() (see alarm (2)). Thus successive calls to alarm(), getitimer(), and setitimer() set and return the state of a single timer. In addition, a call to alarm() sets the timer interval to zero.
getksym(2) getksym(2) NAME getksym - get information for a global kernel symbol SYNOPSIS #include #include #include #include /* For STT_PARISC_MILLI on PA-RISC */ int getksym( char *symname , char *modname , uint64_t *value , uint64_t *info ); Remarks getksym() is currently implemented as a macro. DESCRIPTION There are two ways that getksym() can be used to retrieve kernel symbol information.
getksym(2) getksym(2) EXAMPLES The following code sequence and call to getksym() obtains a symbol name (and an offset) given an address. #include #include #include uint64_t value=0x12345678, info=0; char symname[MAXSYMNMLEN]; /* name will be placed in symname, and offset in info */ if (getksym(symname, NULL, &value, &info) != 0) { perror("getksym"); return(-1); } The following code sequence and call to getksym() obtains an address given a symbol name.
getmsg(2) getmsg(2) NAME getmsg, getpmsg - receive next message from a STREAMS file SYNOPSIS #include int getmsg( int fildes, struct strbuf *ctlptr, struct strbuf *dataptr, int *flagsp ); int getpmsg( int fildes, struct strbuf *ctlptr, struct strbuf *dataptr, int *band, int *flagsp ); DESCRIPTION The getmsg() function retrieves the contents of a message located at the head of the stream head read queue associated with a STREAMS file and places the contents into one or more buffers.
getmsg(2) getmsg(2) bandp to the priority band of interest. In this case, getpmsg() will only process the next message if it is in a priority band equal to, or greater than, the integer pointed to by bandp , or if it is a high-priority message. If a process just wants to get the first message off the queue, the integer pointed to by bandp should be set to 0.
getpagesize(2) getpagesize(2) NAME getpagesize - get the current page size SYNOPSIS #include int getpagesize(void); DESCRIPTION The getpagesize() function returns the current page size. The getpagesize() function sysconf(_SC_PAGESIZE). is equivalent to sysconf(_SC_PAGE_SIZE) and RETURN VALUE The getpagesize() function returns the current page size. ERRORS No errors are defined.
getpeername(2) getpeername(2) NAME getpeername - get address of connected peer SYNOPSIS #include AF_CCITT only: #include
getpeername(2) getpeername(2) SEE ALSO bind(2), socket(2), getsockname(2), thread_safety(5), inet(7F), xopen_networking(7).
getpid(2) getpid(2) NAME getpid(), getpgid(), getpgrp(), getpgrp2(), getppid() - get process, process group and parent process ID. SYNOPSIS #include pid_t getpgid (pid_t pid); pid_t getpgrp(void); pid_t getpgrp2(pid_t pid); pid_t getpid(void); pid_t getppid(void); DESCRIPTION These functions return process, process group and parent process IDs, as follows: A gA getpgid() Process group ID of the specified process. If pid is zero, the call applies to the calling process.
getpriority(2) getpriority(2) NAME getpriority, setpriority - get or set process priority SYNOPSIS #include int getpriority(int which, int who); int setpriority(int which, int who, int priority); DESCRIPTION getpriority() returns the priority of the indicated processes. setpriority() sets the priority of the indicated processes to priority .
getpriority(2) getpriority(2) SEE ALSO nice(1), renice(1M), nice(2).
getprivgrp(2) getprivgrp(2) NAME getprivgrp(), setprivgrp() - get and set special attributes for group SYNOPSIS #include int getprivgrp(struct privgrp_map *grplist); int setprivgrp(gid_t grpid, const int *mask); DESCRIPTION getprivgrp() The getprivgrp() system call returns a table of the privileged group assignments into a user-supplied structure. grplist points to an array of structures of type privgrp_map, associating a group ID with a privilege mask.
getprivgrp(2) getprivgrp(2) [EINVAL] grpid is out of range. [EPERM] The caller is not a privileged user. EXAMPLES The following example prints out PRIV_GLOBAL and the group IDs of the privilege groups to which the user belongs: #include struct privgrp_map pgrplist[PRIV_MAXGRPS]; int i; gid_t pgid; A getprivgrp (pgrplist); for (i=0; i
getrlimit(2) getrlimit(2) NAME getrlimit(), setrlimit() - control maximum resource consumption SYNOPSIS #include int getrlimit(int resource, struct rlimit *rlp); int setrlimit(int resource, const struct rlimit *rlp); DESCRIPTION Limits on the consumption of a variety of resources by the calling process may be obtained with getrlimit() and set with setrlimit(). Each call to either getrlimit() or setrlimit() identifies a specific resource to be operated upon as well as a resource limit.
getrlimit(2) getrlimit(2) attempts to increase the size of a file from end-of-file to beyond the limit will fail with errno set to [EFBIG]. A gA RLIMIT_NOFILE This is a number one greater than the maximum value that the system may assign to a newly-created descriptor. If this limit is exceeded, functions that allocate new file descriptors may fail with errno set to [EMFILE]. This limit constrains the number of file descriptors that a process may allocate.
getrlimit(2) getrlimit(2) AUTHOR getrlimit() and setrlimit() were developed by HP, AT&T, and the University of California, Berkeley. SEE ALSO brk(2), exec(2), fork(2), creat64(2), malloc(3C), open(2), sigaltstack(2), sysconf(2), ulimit(2), maxdsiz(5), maxssiz(5), , . CHANGE HISTORY First released in Issue 4, Version 2.
getrusage(2) getrusage(2) NAME getrusage - get information about resource utilization SYNOPSIS #include int getrusage(int who, struct rusage *r_usage); DESCRIPTION The getrusage() function provides measures of the resources used by the current process or its terminated and waited-for child processes. If the value of the who argument is RUSAGE_SELF, information is returned about resources used by the current process.
getsid(2) getsid(2) NAME getsid() - get session ID SYNOPSIS #include pid_t getsid (pid_t pid); DESCRIPTION The getsid() function returns the session ID of the specified process. If pid is 0, the call applies to the current process. For this to be allowed, the current process and the referenced process must be in the same session. RETURN VALUE Upon successful completion, getsid() returns the session ID of the specified process.
getsockname(2) getsockname(2) NAME getsockname - get socket address SYNOPSIS #include AF_CCITT only: #include
getsockname(2) getsockname(2) SEE ALSO bind(2), socket(2), getpeername(2), thread_safety(5), inet(7F), xopen_networking(7).
getsockopt(2) getsockopt(2) NAME getsockopt(), setsockopt() - get and set options on sockets SYNOPSIS #include
getsockopt(2) getsockopt(2) The parameters optval and optlen specify the value of the option. optval is the address of the data structure that contains the option value, and optlen is the length of the data structure. The type and value of the data structure that optval points to depends on the option. For "boolean" options, the value may be zero (not set) or non-zero (set). The value of other options depends on the purpose of the option.
getsockopt(2) getsockopt(2) buffer size: 2147483647 bytes; maximum buffer size: 2147483647 bytes; udp maximum receive buffer size can be lowered using the ndd parameter udp_recv_hiwater_max). A SO_REUSEADDR (int; boolean; AF_INET sockets only) If enabled, allows a local address to be reused in subsequent calls to bind(). Default: disallowed. SO_REUSEPORT (int; boolean; AF_INET sockets only) If enabled, allows a local address and port to be reused in subsequent calls to bind(). Default: disallowed.
getsockopt(2) getsockopt(2) Setting the SO_REUSEADDR option allows the local socket address to be reused in subsequent calls to bind(). This permits multiple SOCK_STREAM sockets to be bound to the same local address, as long as all existing sockets with the desired local address are in a connected state before bind() is called for a new socket. For SOCK_DGRAM sockets, SO_REUSEADDR allows multiple sockets to receive UDP multicast datagrams addressed to the bound port number.
getsockopt(2) getsockopt(2) FUTURE DIRECTION Currently, the default behavior is the HP-UX BSD Sockets; however, it might be changed to X/Open Sockets in a future release. At that time, any HP-UX BSD Sockets behavior that is incompatible with X/Open Sockets might be obsoleted. Applications that conform to the X/Open specification now will avoid migration problems (see xopen_networking(7)). AUTHOR getsockopt() and setsockopt() were developed by HP and the University of California, Berkeley.
gettimeofday(2) gettimeofday(2) NAME gettimeofday - get the date and time SYNOPSIS #include int gettimeofday(struct timeval *tp, void *tzp); DESCRIPTION The gettimeofday() function obtains the current time, expressed as seconds and microseconds since Epoch, and stores it in the timeval structure pointed to by tp . The resolution of the system clock is one microsecond. PARAMETERS Programs should use this time zone information only in the absence of the TZ environment variable.
gettimeofday(2) gettimeofday(2) AUTHOR gettimeofday() was developed by the University of California, Berkeley, and HP. SEE ALSO date(1), ftime(2), settimeofda(2), stime(2), time(2), ctime(3C).
gettune(2) gettune(2) NAME gettune - get the value of a kernel tunable parameter SYNOPSIS #include int gettune( const char *tunable , uint64_t *value ); DESCRIPTION This function retrieves the current value of the kernel tunable parameter named tunable . The value is passed back through the supplied value pointer. The value returned is the value for the tunable that is being used by the currently running kernel. RETURN VALUE This function returns zero for success or -1 for an error.
getuid(2) getuid(2) NAME getuid, geteuid, getgid, getegid - get real user, effective user, real group, and effective group IDs SYNOPSIS #include uid_t getuid(void); uid_t geteuid(void); gid_t getgid(void); gid_t getegid(void); DESCRIPTION The following functions return the information indicated: A gA getuid() Real-user- ID of the calling process. geteuid() Effective-user- ID of the calling process. getgid() Real-group- ID of the calling process.
ioctl(2) ioctl(2) NAME ioctl - control device SYNOPSIS #include int ioctl(int fildes, int request, ... /* arg */); Remarks The ANSI C ", ..." construct denotes a variable length argument list whose optional [or required] members are given in the associated comment (/* */). DESCRIPTION ioctl() performs a variety of functions on character special files (devices), or regular files and directories on VxFS file systems.
ioctl(2) ioctl(2) AUTHOR ioctl() was developed by AT&T and HP. SEE ALSO ioctl(5), arp(7P), socket(7), termio(7).
iscomsec(2) iscomsec(2) NAME iscomsec - check if the system has been converted to a trusted system. SYNOPSIS #include int iscomsec(); DESCRIPTION iscomsec returns a zero (0) if the system is not a trusted system. If the system has been converted to a trusted system, iscomsec returns a one (1). Notes iscomsec determines if the system is a trusted system or not by checking the file, /tcb/files/auth/system/default. If the file exists, then the system is a trusted system.
kill(2) kill(2) NAME kill(), raise() - send a signal to a process or a group of processes SYNOPSIS #include int kill(pid_t pid, int sig); int raise(int sig); DESCRIPTION The kill() system call sends a signal to a process or a group of processes, as specified by pid . The signal to be sent is specified by sig and is either one from the list given in signal (2), or 0. The raise() system call sends a signal to the executing program.
kill(2) kill(2) APPLICATION USAGE Threads Considerations kill() can be used to post signals to another process but cannot be used to post signals to a specific thread in another process. For information on posting signals to specific threads within the same process, see pthread_kill (3T). LWP (Lightweight Processes) Considerations Signals cannot be posted to specific LWPs in another process. AUTHOR kill() was developed by HP, AT&T, and the University of California, Berkeley.
killpg(2) killpg(2) NAME bsdproc: killpg(), getpgrp(), setpgrp(), signal(), sigvec() - 4.2 BSD-compatible process control facilities SYNOPSIS #include int killpg(int pgrp, int sig); int getpgrp(int pid); int setpgrp(int pid, int pgrp); void (*signal(int sig, void (*func)(int)))(int); Obsolescent Interfaces int sigvec( int sig, struct sigvec *vec, struct sigvec *ovec ); DESCRIPTION These calls simulate (and are provided for backward compatibility with) functions of the same name in the 4.
link(2) link(2) NAME link() - link to a file SYNOPSIS #include int link(const char *path1, const char *path2); DESCRIPTION The link() system call creates a new link (directory entry) for the existing file. path1 points to a path name naming an existing file. path2 points to a path name naming the new directory entry to be created. RETURN VALUE Upon successful completion, link() returns zero. Otherwise, it returns −1 and sets errno (see errno (2)) to indicate the error.
link(2) link(2) STANDARDS CONFORMANCE link(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.
lio_listio(2) lio_listio(2) NAME lio_listio() - start a list of asynchronous I/O operations SYNOPSIS #include int lio_listio( int mode , struct aiocb *const list [], int nent , struct sigevent *sig ); DESCRIPTION The lio_listio() function allows the calling process to request a list of asynchronous I/O operations with a single function call. The function call returns when all operation requests have been enqueued for processing.
lio_listio(2) lio_listio(2) ERRORS If lio_listio() detects one of the following error conditions, errno is set to the indicated value: [EAGAIN] At least one request could not be queued either because of a resource shortage or because the per-process or system-wide limit on asynchronous I/O operations or asynchronous threads would have been exceeded. [EINTR] The mode argument was LIO_WAIT and a signal was delivered while waiting for the requested operations to complete.
lio_listio(2) lio_listio(2) SEE ALSO aio_cancel(2), aio_error(2), aio_fsync(2), aio_read(2), aio_return(2), aio_suspend(2), aio_write(2), read(2), write(2), aio(5). STANDARDS CONFORMANCE lio_listio(): POSIX Realtime Extensions, IEEE Std 1003.
listen(2) listen(2) NAME listen - listen for connections on a socket SYNOPSIS #include int listen(int s, int backlog); DESCRIPTION To accept connections, a socket is first created using socket(), a queue for incoming connections is activated using listen(), and then connections are accepted using accept(). listen() applies only to unconnected sockets of type SOCK_STREAM.
lockf(2) lockf(2) NAME lockf - provide semaphores and record locking on files SYNOPSIS #include int lockf(int fildes, int function, off_t size); DESCRIPTION The lockf() function allows regions of a file to be used as semaphores (advisory locks) or restricts access to only the locking process (enforcement-mode record locks). Other processes that attempt to access the locked resource either return an error or sleep until the resource becomes unlocked.
lockf(2) lockf(2) A potential for deadlock occurs if a process controlling a locked resource is put to sleep by accessing the locked resource of another process. Thus, calls to fcntl(), lockf(), read(), or write() (see fcntl (2), lockf (2), read (2), and write (2)) scan for a deadlock prior to sleeping on a locked resource. Deadlock is not checked for the wait() and pause() system calls (see wait (2) and pause (2)), so potential for deadlock is not eliminated.
lockf(2) lockf(2) Application Usage Because in the future the variable errno will be set to [EAGAIN] rather than [EACCES] when a section of a file is already locked by another process, portable application programs should expect and test for either value. For example: if (lockf(fd, F_TLOCK, siz) == -1) if ((errno == EAGAIN) || (errno == EACCES)) /* * section locked by another process * check for either EAGAIN or EACCES * due to different implementations */ else if ...
lseek(2) lseek(2) NAME lseek - move read/write file pointer; seek SYNOPSIS #include off_t lseek(int fildes, off_t offset, int whence); DESCRIPTION lseek() sets the file pointer associated with the file descriptor as follows: • If whence is SEEK_SET, the pointer is set to offset bytes. • If whence is SEEK_CUR, the pointer is set to its current location plus offset . • If whence is SEEK_END, the pointer is set to the size of the file plus offset .
lstat(2) lstat(2) NAME lstat - get symbolic link status SYNOPSIS #include int lstat( const char *path , struct stat *buf ); PARAMETERS The parameters for the lstat() function are as follows: path is a pointer to a path name of any file within the mounted file system. All directories listed in the path name must be searchable. buf is a pointer to a stat structure where the file status information is stored.
lstat(2) lstat(2) RETURN VALUE Upon successful completion, lstat() returns 0. Otherwise, it returns −1 and sets errno to indicate the error. ERRORS The lstat() function will fail if: [EACCES] A component of the path prefix denies search permission. [ELOOP] Too many symbolic links were encountered in resolving path. [ENAMETOOLONG] The length of a pathname exceeds {PATH_MAX}, or the pathname component is longer than {NAME_MAX}. [ENOTDIR] A component of the path prefix is not a directory.
madvise(2) madvise(2) NAME madvise() - advise the system of a process’s expected paging behavior SYNOPSIS #include int madvise( caddr_t addr, size_t len, int behav ); DESCRIPTION The madvise system call permits a process to advise the system about its expected future behavior in referencing a mapped file, an anonymous memory region, or a shared memory region. Certain implementations can use this information to optimize the use of resources.
madvise(2) madvise(2) [EINVAL] [EINVAL] behav contains an invalid value, or addr is not a multiple of the page size as returned by the system call sysconf(_SC_PAGE_SIZE). The address range specified by addr and len was not created by a successful call to mmap() or shmat(). AUTHOR madvise() was developed by HP and OSF. SEE ALSO mmap(2), sysconf(2).
makecontext(2) makecontext(2) NAME makecontext, swapcontext - manipulate user contexts SYNOPSIS #include void makecontext(ucontext_t *ucp, (void *func)(), int argc, ...); int swapcontext(ucontext_t *oucp, const ucontext_t *ucp); DESCRIPTION The makecontext() function modifies the context specified by ucp , which has been initialized using getcontext().
mkdir(2) mkdir(2) NAME mkdir - make a directory file SYNOPSIS #include int mkdir(const char *path, mode_t mode); DESCRIPTION The mkdir() system call creates a new directory file named by path . The file permission bits of the new directory are initialized from mode, and are modified by the process’s file mode creation mask. For each bit set in the process’s file mode creation mask, the corresponding bit in the new directory’s mode is cleared (see umask(2)).
mkdir(2) mkdir(2) component of the path name exceeds NAME_MAX bytes while _POSIX_NO_TRUNC is in effect. [ENOENT] A component of the path prefix does not exist. [ENOSPC] Not enough space on the file system. [ENOTDIR] A component of the path prefix is not a directory. [EROFS] The named file resides on a read-only file system. [EDQUOT] User’s disk quota block or inode limit has been reached for this file system. AUTHOR mkdir() was developed by the University of California, Berkeley.
mknod(2) mknod(2) NAME mknod() - make directory, special, or ordinary file SYNOPSIS #include int mknod(const char *path, mode_t mode, dev_t dev); DESCRIPTION The mknod() system call creates a new file named by the path name pointed to by path . The mode of the new file is specified by the mode argument. Symbolic constants that define the file type and file access permission bits are found in the header file and are used to construct the mode argument.
mknod(2) mknod(2) [ENOENT] A component of the path prefix does not exist. [ENOSPC] Not enough space on the file system. [ENOTDIR] A component of the path prefix is not a directory. [EPERM] The effective-user-ID of the process does not match that of a user who has appropriate privileges, and the file type is not FIFO special. [EROFS] The directory in which the file is to be created is located on a read-only file system. AUTHOR mknod() was developed by AT&T and HP.
mlock(2) mlock(2) NAME mlock() - lock a segment of the process virtual address space in memory SYNOPSIS #include int mlock( const void * addr, size_t len) ; DESCRIPTION The mlock() system call allows the calling process to lock a segment of the process virtual address space into memory. Any addressable segment of the process’ address space may be locked. Locked segments are immune to all routine swapping. addr must be a valid address in the process virtual address space.
mlockall(2) mlockall(2) NAME mlockall() - lock a process virtual address space in memory SYNOPSIS #include int mlockall( constant int flags); DESCRIPTION The mlockall() system call allows the calling process to lock its entire virtual address space into memory, making it immune to all routine swapping. flags may be one or both of the following: MCL_CURRENT Lock the current process virtual address space. All addressable pages of the address space are locked.
mmap(2) mmap(2) NAME mmap - map pages of memory SYNOPSIS #include void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off); DESCRIPTION The mmap() function establishes a mapping between a process’ address space and a file.
mmap(2) mmap(2) MAP_IO Create a virtual mapping for a physical I/O address range. MAP_MEM_INTERLEAVED Physical memory will be interleaved. MAP_MEM_LOCAL Allocate physical memory from the current locality domain. MAP_MEM_FIRST_TOUCH Allocate physical memory from the locality domain of the first processor to touch each address. The MAP_PRIVATE and MAP_SHARED flags control the visibility of write references to the memory region. Exactly one of these flags must be specified.
mmap(2) mmap(2) The off argument is constrained to be aligned and sized according to the value returned by sysconf() when passed _SC_PAGESIZE or _SC_PAGE_SIZE. When MAP_FIXED is specified, the argument addr must also meet these constraints. The implementation performs mapping operations over whole pages. Thus, while the argument len need not meet a size or alignment constraint, the implementation will include, in any unmapping operation, any partial page specified by the range [pa , pa +len ].
mmap(2) mmap(2) mmap() cannot create a mapped file region unless the file descriptor used to map the file is open for reading. For a mapped file region that is mapped with MAP_SHARED, mmap() grants write access permission only if the file descriptor is open for writing. If a region was mapped with either MAP_PRIVATE or MAP_ANONYMOUS, mmap() grants all requested access permissions.
mmap(2) mmap(2) ERRORS The mmap() function will fail if: A mA [EBADF] The fildes argument is not a valid open file descriptor. [EACCES] The fildes argument is not open for read, regardless of the protection specified, or fildes is not open for write and PROT_WRITE was specified for a MAP_SHARED type mapping, or PROT_EXECUTE was set for a MAP_SHARED mapping operation and the underlying file does not have execute permission. [ENXIO] Addresses in the range [off, off+len ] are invalid for fildes .
mmap(2) mmap(2) mapping. Only after all mappings for a file range have been destroyed can that range be mapped to a different virtual address. • In most cases, two separate calls to mmap() cannot map overlapping ranges in a file. The virtual address range reserved for a file range is determined at the time of the initial mapping of the file range into a process address space. The system allocates only the virtual address range necessary to represent the initial mapping.
mmap(2) mmap(2) SEE ALSO creat64(2), exec(2), fcntl(2), fork(2), lockf(2), madvise(2), mpctl(2), mprotect(2), msem_init(2), msem_lock(2), msem_unlock(2), msync(2), munmap(2), pset_ctl(2), shmop(2), sysconf(2), truncate(2), mman(5), stat(5), zero(7), Adaptive Address Space Whitepaper .
modload(2) modload(2) NAME modload - load kernel modules on demand SYNOPSIS #include int modload(char *pathname ); DESCRIPTION modload allows processes with appropriate privilege to demand-load a kernel module into the running kernel. The module must be of a supported type and must have been registered via kcmodule (1M) before it can be loaded. The module to be loaded is specified by pathname . pathname may be either a module name or an absolute pathname.
modpath(2) modpath(2) NAME modpath - change global search path for dynamically loadable kernel modules SYNOPSIS #include int modpath(const char *pathname ); DESCRIPTION modpath allows users with appropriate privilege to modify the global search path used to locate object files for dynamically loadable kernel modules. The search path modifications take effect immediately and affect all subsequent loads for all users on the system.
modstat(2) modstat(2) NAME modstat - get information for a dynamically loaded kernel module SYNOPSIS #include int modstat(int module_id , struct modstatus *stbuf , int get_next_module ); DESCRIPTION The modstat function allows processes to get information for dynamically loaded kernel modules. For modules with appropriate privilege, it fills in all the elements of the modstatus structure, specified by stbuf , with the information available for the given module identifier module_id .
moduload(2) moduload(2) NAME moduload - unload a kernel module on demand SYNOPSIS #include int moduload(long module_id ); DESCRIPTION moduload allows users with appropriate privilege to demand unload one or all unloadable modules from the running kernel. A module is considered unloadable if it is not currently in use, if no module depending on it is currently loaded, and if the module is not being loaded or unloaded from the kernel.
mount(2) mount(2) NAME mount() - mount a file system SYNOPSIS #include int mount(const char *fs, const char *path, int mflag); int mount(const char *fs, const char *path, int mflag, const char *fstype, const char *dataptr, int datalen); DESCRIPTION The mount() system call requests that a file system identified by fs be mounted on the file identified by path. mflag contains a bit-mask of flags (described below). Note that the MS_DATA flag must be set for the sixargument version of the call.
mount(2) mount(2) 700 systems, as it was prior to release 10.0. MS_BEHIND and MS_DELAY are mutually exclusive. MS_NO_FSASYNC Rigorous posting of file system metadata is to be used. This is the default. MS_FSASYNC Relaxed posting of file system metadata is to be used. This may lead to better performance for certain applications; but there is increased potential for data loss in case of a crash. MS_FSASYNC and MS_NO_FSASYNC are mutually exclusive.
mpctl(2) mpctl(2) NAME mpctl - multiprocessor control SYNOPSIS #include int mpctl( mpc_request_t request, spu_t spu, pid_t pid ); int mpctl( mpc_request_t request, spu_t spu, lwpid_t lwpid ); int mpctl( mpc_request_t request, ldom_t ldom, pid_t pid ); int mpctl( mpc_request_t request, ldom_t ldom, lwpid_t lwpid ); REMARKS Much of the functionality of this capability is highly dependent on the underlying hardware.
mpctl(2) mpctl(2) The mpctl call is expected to be used to increase performance in certain applications, but should not be used to ensure correctness of an application. Specifically, cooperating processes/lightweight processes should not rely on processor or locality domain assignment in lieu of a synchronization mechanism (such as semaphores). Machine Topology Information Warning: Processor and locality domain IDs are not guaranteed to exist in numerical order.
mpctl(2) mpctl(2) ldom. The pid argument is ignored. MPC_SPUTOLDOM This request returns the ID of the locality domain containing processor spu. The pid argument is ignored. Processor Set Information Warning: Dynamic creation and deletion of processor sets, and dynamic reassignment of a processor from one processor set to another may occur. All processors in the system comprises one processor set by default at boot time until new processor sets are created and configured by users.
mpctl(2) mpctl(2) When a process creates another process (via fork() or vfork()), the child process will inherit the parent process’s binding assignments (NOT the binding assignments of the creating LWP). The initial LWP in the child process shall inherit its binding assignments from the child process. LWPs other than the initial LWP shall inherit their binding assignments from the creating LWP (unless specified otherwise in the LWP create attributes).
mpctl(2) mpctl(2) The lwpid MPC_SELFLWPID may be used to refer to the calling LWP. The spu MPC_SPUNOCHANGE may be passed to read the current assignment. The spu MPC_SPUFLOAT may be used to break any specific-processor assignment. This allows the LWP to float to any processor. Note: This call is advisory . If the scheduling policy for a LWP conflicts with this processor assignment, the scheduling policy takes precedence.
mpctl(2) mpctl(2) When a processor is ready to choose another LWP to execute, and the highest priority SCHED_FIFO LWP is bound to processor in a different locality domain, that LWP will not be selected to execute on the selecting processor, but instead wait for a processor on the locality domain to which it was bound. The selecting processor will then choose a lower priority LWP to execute on the processor. Note: This option will not guarantee compliance with POSIX real-time scheduling algorithms.
mpctl(2) mpctl(2) For all launch policies, the target process or LWP is bound to the locality domain on which it was launched. The target is allowed to execute on any processor within that locality domain. When setting a launch policy, if the target already has processor or locality domain binding, the existing binding will not be overwritten.
mpctl(2) mpctl(2) Applications using this option should be written to handle other return values in order to continue working on future releases. The ldom argument is ignored. MPC_SETPROCESS_RR This call establishes a round robin launch policy (MPC_LAUNCH_POLICY_RR) for the specified process. The successive child processes are launched on different locality domains in a round robin manner until all available locality domains have been used by processes in the launch tree.
mpctl(2) mpctl(2) MPC_SETLWP_RR This call establishes a round robin launch policy (MPC_LAUNCH_POLICY_RR) for the specified LWP. The successive child LWPs are launched on different locality domains in a round robin manner until all available locality domains have been used by LWPs in the launch tree. At that point, the selection of locality domains begins again from the original locality domain. The ldom argument is ignored.
mpctl(2) mpctl(2) the caller is not the super-user, does not have the same effective user id of the target process, or is not a member of a group having PRIV_MPCTL access.
mprotect(2) mprotect(2) NAME mprotect - set or check protection of memory mapping SYNOPSIS #include int mprotect(void *addr, size_t len, int prot); DESCRIPTION The mprotect() function changes the access protections on the mappings specified by the range [addr , addr +len ], rounding len up to the next multiple of the page size as returned by sysconf(), to be that specified by prot . Legitimate values for prot are the same as those permitted for mmap() and are defined in
mprotect(2) mprotect(2) STANDARDS CONFORMANCE mprotect(): AES, SVID3 CHANGE HISTORY First released in Issue 4, Version 2.
mq_close(2) mq_close(2) NAME mq_close - close a message queue descriptor SYNOPSIS #include int mq_close(mqd_t mqdes); DESCRIPTION The mq_close() system call removes the association between the message queue descriptor, mqdes, and a message queue.
mq_getattr(2) mq_getattr(2) NAME mq_getattr - get status information and attributes associated with a message queue SYNOPSIS #include int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat); DESCRIPTION The mq_getattr() system call collects status information and attributes associated with the message queue specified by mqdes which is copied into the mq_attr structure referenced by mqstat .
mq_notify(2) mq_notify(2) NAME mq_notify - register/cancel a notification request with a message queue SYNOPSIS #include int mq_notify(mqd_t mqdes, const struct sigevent *notification); DESCRIPTION If the argument notification is not NULL, the mq_notify() system call registers the calling process to be notified of message arrival at an empty message queue associated with the message queue descriptor mqdes.
mq_open(2) mq_open(2) NAME mq_open - create/open a message queue SYNOPSIS #include mqd_t mq_open(const char *name, int oflag, ... /* * [mode_t mode, struct mq_attr] */ ); Remarks The ANSI C ", ..." construct specifies a variable length argument list whose optional members are given in the associated comment (/* */). DESCRIPTION The mq_open() system call establishes a connection between a process and a message queue.
mq_open(2) mq_open(2) b. Contain no pathname component consisting of a dot or dot-dot; e.g., /./tmp and /../tmp. c. Contain no illegal characters. d. Contain no pathname components longer that _POSIX_NAME_MAX. e. Entire name should not be longer that _POSIX_PATH_MAX. To use this function, link in the realtime library by specifying -lrt on the compiler or linker command line. RETURN VALUE mq_open() returns the following values: n Successful completion.
mq_receive(2) mq_receive(2) NAME mq_receive - receive a message from a message queue SYNOPSIS #include ssize_t mq_receive(mqd_t char size_t unsigned int ); mqdes, *msg_ptr, msg_len, *msg_prio DESCRIPTION The mq_receive() system call receives the oldest of the highest priority message from the message queue specified by mqdes. The selected message is removed from the queue and copied to the buffer pointed to by the msg_ptr argument.
mq_send(2) mq_send(2) NAME mq_send - send a message to a message queue SYNOPSIS #include int mq_send(mqd_t const char size_t unsigned int ); mqdes, *msg_ptr, msg_len, msg_prio DESCRIPTION The mq_send() system call adds a message pointed to by the argument msg_ptr to the message queue specified by mqdes. The msg_len argument specifies the length of the message in bytes.
mq_setattr(2) mq_setattr(2) NAME mq_setattr - set the blocking status of a message queue associated with a descriptor SYNOPSIS #include int mq_setattr(mqd_t mqdes, const struct mq_attr *mqstat, struct mq_attr *omqstat, ); DESCRIPTION The mq_setattr() system call changes the blocking status of a message queue associated with the descriptor, mqdes.
mq_unlink(2) mq_unlink(2) NAME mq_unlink - unlink a message queue SYNOPSIS #include int mq_unlink(const char *name); DESCRIPTION The mq_unlink() system call disassociates the queue name, from a message queue specified by the argument, name. After a successful call to mq_unlink(), attempts to open a message queue with the same name will fail, if the flag O_CREAT is not set in oflags. If there are no processes with existing open descriptors for the message queue, the queue is destroyed.
msem_init(2) msem_init(2) NAME msem_init - initialize a semaphore in a mapped file or anonymous memory region SYNOPSIS #include msemaphore *msem_init(msemaphore *sem, int initial_value); DESCRIPTION msem_init() allocates a new binary semaphore and initializes the state of the new semaphore. sem points to an msemaphore structure in which the state of the semaphore is to be stored. If initial_value is MSEM_LOCKED, the new semaphore is initialized in the locked state.
msem_lock(2) msem_lock(2) NAME msem_lock - lock a semaphore SYNOPSIS #include int msem_lock(msemaphore *sem, int condition); DESCRIPTION msem_lock() attempts to lock a binary semaphore. sem points to an msemaphore structure which specifies the semaphore to be locked. If the semaphore is not currently locked, it becomes locked and the function returns successfully. If the semaphore is currently locked, and condition is MSEM_IF_NOWAIT, then the function returns with an error.
msem_remove(2) msem_remove(2) NAME msem_remove - remove a semaphore in mapped file or anonymous region SYNOPSIS #include int *msem_remove(msemaphore *sem ); DESCRIPTION msem_remove() removes a binary semaphore. sem points to an msemaphore structure that specifies the semaphore to be removed. Any subsequent use of the msemaphore structure before it is again initialized by calling msem_init() produces undefined results.
msem_unlock(2) msem_unlock(2) NAME msem_unlock - unlock a semaphore SYNOPSIS #include int msem_unlock(msemaphore *sem, int condition); DESCRIPTION msem_unlock() unlocks a binary semaphore. sem points to an msemaphore structure that specifies the semaphore to be unlocked. If the condition argument is zero, the semaphore will be unlocked, whether or not any other processes are currently attempting to lock it.
msgctl(2) msgctl(2) NAME msgctl - message control operations SYNOPSIS #include int msgctl(int msqid, int cmd, struct msqid_ds *buf); DESCRIPTION msgctl() provides a variety of message control operations as specified by cmd. The following cmds are available: IPC_STAT Place the current value of each member of the data structure associated with msqid into the structure pointed to by buf. The contents of this structure are defined in glossary (9).
msgctl(2) msgctl(2) SEE ALSO ftok(3C), ipcrm(1), ipcs(1), msgget(2), msgop(2).
msgget(2) msgget(2) NAME msgget - get message queue SYNOPSIS #include int msgget(key_t key, int msgflg); DESCRIPTION msgget() returns the message queue identifier associated with key . A message queue identifier and associated message queue and data structure are created for key if one of the following is true: key is equal to IPC_PRIVATE. This call creates a new identifier, subject to available resources.
msgget(2) msgget(2) STANDARDS CONFORMANCE msgget(): SVID2, SVID3, XPG2, XPG3, XPG4 A HP-UX 11i Version 2: September 2004 −2− Hewlett-Packard Company Section 2−−195 mA
msgop(2) msgop(2) NAME msgsnd, msgrcv - message operations SYNOPSIS #include int msgsnd( int msqid, const void *msgp, size_t msgsz, int msgflg ); int msgrcv( int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg ); DESCRIPTION The msgsnd() system call sends a message to the queue associated with the message queue identifier specified by msqid .
msgop(2) msgop(2) long char mtype; mtext[]; /* message type */ /* message text */ mtype is the received message’s type as specified by the sending process. mtext is the text of the message. msgsz specifies the size in bytes of mtext . The received message is truncated to msgsz bytes if it is larger than msgsz and (msgflg & MSG_NOERROR) is true. The truncated part of the message is lost and no indication of the truncation is given to the calling process.
msgop(2) msgop(2) [EAGAIN] The message cannot be sent for one of the reasons cited above and (msgflg IPC_NOWAIT) is true. [EFAULT] msgp points to an illegal address. The reliable detection of this error is implementation dependent. [EIDRM] The message queue identifier msqid has been removed from the system. [EINTR] msgsnd() was interrupted by a signal. [EINVAL] msqid is not a valid message queue identifier. [EINVAL] mtype is less than 1.
msync(2) msync(2) NAME msync - synchronize the memory of a mapped file with physical storage SYNOPSIS #include int msync(void *addr, size_t len, int flags); DESCRIPTION The msync() function writes all modified copies of pages over the range [addr , addr +len ] to the underlying hardware, or invalidates any copies so that further references to the pages will be obtained by the system from their permanent storage locations.
msync(2) msync(2) RETURN VALUE Upon successful completion, msync() returns 0. Otherwise, it returns −1 and sets errno to indicate the error. ERRORS The msync() function will fail if: [EINVAL] The addr argument is not a multiple of the page size as returned by sysconf(_SC_PAGE_SIZE). [EINVAL] The address range specified by addr and len was not created by a successful call to mmap(). [EIO] An I/O error occurred while reading from or writing to the file system.
munlock(2) munlock(2) NAME munlock() - unlock a segment of the process virtual address space SYNOPSIS #include int munlock( const void * addr, size_t len) ; DESCRIPTION The munlock() system call allows the calling process to unlock a segment of the process virtual address space that may have been previously locked with mlock() or mlockall(). Upon successful completion of the munlock(), pages within the specified segment are subject to routine paging and/or swapping.
munlockall(2) munlockall(2) NAME munlockall() - unlock the entire virtual address space of a process SYNOPSIS #include int munlockall() ; DESCRIPTION The munlockall() system call allows the calling process to unlock any portions of its virtual address space that have previously been locked into memory with mlock() or mlockall(), including any portions locked due to the MCL_FUTURE option of mlockall().
munmap(2) munmap(2) NAME munmap - unmap pages of memory SYNOPSIS #include int munmap(void *addr, size_t len); DESCRIPTION The munmap() function removes the mappings for pages in the range [addr , addr +len ], rounding the len argument up to the next multiple of the page size as returned by sysconf(). If addr is not the address of a mapping established by a prior call to mmap(), the behavior is undefined.
nanosleep(2) nanosleep(2) NAME nanosleep() - high resolution sleep SYNOPSIS #include int nanosleep( const struct timespec *rqtp, struct timespec *rmtp ); DESCRIPTION The nanosleep() function causes the current process to be suspended from execution until either the time interval specified by the rqtp argument has elapsed, or a signal is delivered to the calling process and its action is to invoke a signal-catching function or to terminate the process.
nanosleep(2) nanosleep(2) SEE ALSO clocks(2), timers(2), sleep(3C). STANDARDS CONFORMANCE nanosleep(): POSIX.
nice(2) nice(2) NAME nice - change priority of a process SYNOPSIS #include int nice(int priority_change); DESCRIPTION nice() adds the value of priority_change to the nice value of the calling process. A process’s nice value is a positive number for which a more positive value results in lower CPU priority. A maximum nice value of 39 and a minimum nice value of 0 are imposed by the system.
open(2) open(2) NAME open() - open file for reading or writing SYNOPSIS #include int open(const char *path, int oflag, ... /* [mode_t mode] */ ); Remarks The ANSI C ", ..." construct specifies a variable length argument list whose optional member is given in the associated comment (/* */). DESCRIPTION The open() system call opens a file descriptor for the named file and sets the file status flags according to the value of oflag.
open(2) open(2) When opening a FIFO with O_RDONLY or O_WRONLY set: If O_NDELAY is set: A read-only open() returns without delay. A write-only open() returns an error if no process currently has the file open for reading. If O_NDELAY is clear: A read-only open() does not return until a process opens the file for writing. A write-only open() does not return until a process opens the file for reading.
open(2) open(2) n -1 Successful completion. n is a file descriptor for the opened file. Failure. errno is set to indicate the error. ERRORS If open() fails, errno is set to one of the following values. [EACCES] oflag permission is denied for the named file. [EACCES] A component of the path prefix denies search permission. [EACCES] The file does not exist and the directory in which the file is to be created does not permit writing. [EACCES] O_TRUNC is specified and write permission is denied.
open(2) open(2) int infd; infd = open ("inputfile", O_RDONLY); The following call to open() opens file outputfile for writing and returns a file descriptor for outputfile. For an example of preallocating disk space for outputfile, see the prealloc (2) manual entry. For an example of writing to outputfile, see the write (2) manual entry. int outfd; outfd = open ("outputfile", O_WRONLY); The following call opens file iofile for synchronized I/O file integrity for reads and writes.
pathconf(2) pathconf(2) NAME pathconf( ), fpathconf( ) - get configurable path name variables SYNOPSIS #include long pathconf(const char *path, int name); long fpathconf(int fildes, int name); DESCRIPTION The pathconf() and fpathconf() functions provide a method for applications to determine the value of a configurable limit or option associated with a file or directory (see limits (5) and ). For pathconf(), the path argument points to the path name of a file or directory.
pathconf(2) pathconf(2) _POSIX_CHOWN_RESTRICTED is undefined and pathconf() or fpathconf() returns −1 without changing errno. To determine if chown() can be performed on a file, it is simplest to attempt the chown() operation and check the return value for failure or success. 9. _POSIX_SYNC_IO, when defined, determines whether synchronized IO operations may be performed for the associated file (see open (2)).
pathconf(2) pathconf(2) } } /* otherwise, _POSIX_NO_TRUNC is in effect for this directory */ if ((fd = open(filebuf, O_CREAT, mode)) < 0) perror(filebuf); DEPENDENCIES NFS The following error can occur: [EOPNOTSUPP] path or fildes refers to a file for which a value for name cannot be determined. In particular, _PC_LINK_MAX, _PC_NAME_MAX, _PC_PIPE_BUF, _PC_PATH_MAX, _PC_NO_TRUNC, and _PC_CHOWN_RESTRICTED, cannot be determined for an NFS file. AUTHOR pathconf() and fpathconf() were developed by HP.
pause(2) pause(2) NAME pause - suspend process until signal SYNOPSIS #include int pause(void); DESCRIPTION pause() suspends the calling process until it receives a signal. The signal must be one that is not currently set to be ignored or blocked (masked) by the calling process. If the signal causes termination of the calling process, pause() does not return.
pipe(2) pipe(2) NAME pipe - create an interprocess channel SYNOPSIS int pipe(int fildes[2]); DESCRIPTION pipe() creates an I/O mechanism called a pipe and returns two file descriptors, fildes [0] and fildes [1]. fildes [0] is opened for reading and fildes [1] is opened for writing. A read-only file descriptor fildes [0] accesses the data written to fildes [1] on a first-in-first-out (FIFO) basis. For details of the I/O behavior of pipes see read (2) and write (2).
pipe(2) [ENOSR] pipe(2) Could not allocate resources for both Stream heads (STREAMS-based pipes only). SEE ALSO sh(1), read(2), write(2), popen(3S), streamio(7). STANDARDS CONFORMANCE pipe(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.
plock(2) plock(2) NAME plock() - lock process, text, data, stack, or shared library in memory SYNOPSIS #include int plock(int op); DESCRIPTION The plock() system call allows the calling process to lock the text segment of the process (text lock), its data segment (data lock), or both its text and data segment (process lock) into memory. Stack segments are also locked when data segments are locked. Shared library text and shared library data segments (shlib lock) can also be locked.
plock(2) plock(2) [EINVAL] op is equal to DATSHLIBLOCK and a data lock, or process lock already exists on the calling process. [EINVAL] op is not equal to one of the values specified in DESCRIPTION. [EINVAL] plock() is not allowed in a [vfork,exec] window. See vfork (2). [ENOMEM] There is not enough lockable memory in the system to satisfy the locking request.
poll(2) poll(2) NAME poll - monitor I/O conditions on multiple file descriptors SYNOPSIS #include int poll( struct pollfd fds[], nfds_t nfds, int timeout ); DESCRIPTION poll() provides a general mechanism for reporting I/O conditions associated with a set of file descriptors and for waiting until one or more specified conditions becomes true. Specified conditions include the ability to read or write data without blocking, and error conditions.
poll(2) poll(2) POLLMSG A M_SIG or M_PCSIG message specifying SIGPOLL has reached the front of the stream head read queue. The conditions indicated by POLLNORM and POLLOUT are true if and only if at least one byte of data can be read or written without blocking. The exception is regular files, which always poll true for POLLNORM and POLLOUT. Also, streams return POLLNORM in revents even if the available message is of zero length.
poll(2) poll(2) count = poll(fds, 3, 10000); if (count == -1) { perror("poll failed"); exit(1); } if (count==0) printf("No data for reading or writing\n"); if (fds[0].revents & POLLNORM) printf("There is data for reading fd %d\n", fds[0].fd); if (fds[1].revents & POLLNORM) printf("There is data for reading fd %d\n", fds[1].fd); if (fds[2].revents & POLLOUT) printf("There is room to write on fd %d\n", fds[2].fd); Check for input or output on file descriptor 5 without waiting: #include
postwait(2) postwait(2) NAME postwait: pw_getukid(), pw_wait(), pw_post(), pw_postv(), pw_getvmax() - lightweight synchronization mechanism SYNOPSIS #include #include
postwait(2) postwait(2) [EINTR] pw_wait() was interrupted by a signal. [EINVAL] The timespec pointed to by ts is invalid. pw_post() sets errno to one of the following values if it fails: [EINVAL] The ukid refers to a non-existent kernel thread. pw_postv() sets errno to one of the following values if it fails: [EFAULT] targets points to an illegal address. The reliable detection of this error is implementation dependent. [EFAULT] errors points to an illegal address.
prealloc(2) prealloc(2) NAME prealloc - preallocate fast disk storage SYNOPSIS #include int prealloc(int fildes, off_t size); DESCRIPTION prealloc() is used to preallocate space on a disk for faster storage operations. fildes is a file descriptor obtained from a creat(), open(), dup(), or fcntl() system call for an ordinary file of zero length. It must be opened writable, because it will be written to by prealloc().
profil(2) profil(2) NAME profil - execution time profile SYNOPSIS #include void profil( unsigned short int *buff, size_t bufsiz, size_t offset, unsigned int scale ); DESCRIPTION profil() controls profiling, by which the system maintains estimates of the amount of time the calling program spends executing at various places in its address space. The buff argument must point to an area of memory whose length (in bytes) is given by bufsiz .
pset_assign(2) pset_assign(2) NAME pset_assign - change processor set assignment SYNOPSIS #include int pset_assign( psetid_t pset , spu_t spu , psetid_t *opset ); DESCRIPTION The pset_assign() function assigns the processor spu to the processor set pset , removing the processor spu from its current processor set. A processor may not belong to more than one processor set at any given time.
pset_assign(2) pset_assign(2) perror("pset_assign"); exit(1); } RETURN VALUE pset_assign returns zero on successful completion. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS pset_assign fails if one or more of the following is true: [EBUSY] The processor set currently assigned to the processor spu has active threads and processes, and the processor set attributes do not allow this operation. [EFAULT] The memory location pointed to by opset is not writable by the user.
pset_bind(2) pset_bind(2) NAME pset_bind - bind process or thread to a processor set SYNOPSIS #include int pset_bind( psetid_t idtype_t id_t psetid_t pset, idtype, id, *opset); DESCRIPTION The pset_bind() function binds thread(s) or process(es) specified by idtype and id to the processor set pset. If idtype is P_PID, then id specifies the pid of the process to be assigned, and the binding affects all threads of the process.
pset_bind(2) pset_bind(2) process to an empty processor set is to fail the request. The child process and its first thread created by a fork() or vfork() function will inherit the processor set binding from the parent process. The new threads in the multi-threaded process will inherit their processor set binding from the creator thread. EXAMPLE Migrate the current thread to another processor set new_pset , and retrive its current processor set in old_pset . #include
pset_create(2) pset_create(2) NAME pset_create - create a processor set SYNOPSIS #include int pset_create( psetid_t *newpset); DESCRIPTION The pset_create() function creates an empty processor set with no processors. Processor sets allow a subset of processors in the system to be isolated for exclusive use by specified threads and processes. Only the threads bound to a processor set can execute on processors in that processor set.
pset_create(2) pset_create(2) PSET_ATTR_OWNID UID of the processor set owner. The processor set creator is the default owner. PSET_ATTR_PERM Access permissions for the processor set. By default, the processor set owner has all permissions, whereas group and others have only READ and EXEC permissions. Processor sets define a scheduling allocation domain for threads and processes. All threads may execute only on processors within the assigned processor set.
pset_ctl(2) pset_ctl(2) NAME pset_ctl - processor set control SYNOPSIS #include int pset_ctl( pset_request_t psetid_t id_t request, pset, id); DESCRIPTION The pset_ctl() function provides a means to query the system processor set configuration and assignment information. The request argument specifies what information is needed for the pset processor set. The following request values are supported: PSET_GETCURRENTPSET Return the ID of the processor set binding for the calling thread.
pset_ctl(2) pset_ctl(2) PSET_SPUTOPSET Return the ID of the processor set assigned for the processor specified in id. If the processor is not enabled or is in transition from one processor set to another, -1 is returned with an error. The pset argument is ignored. Any user may query the system processor set topology using the pset_ctl() function. Use sysconf() with _SC_PSET_SUPPORT name to see if the processor set functionality is supported by the underlying HP-UX operating system version.
pset_ctl(2) [ENOSYS] pset_ctl(2) The processor set functionality is not supported by the underlying HP-UX version. AUTHOR pset_ctl was developed by HP. SEE ALSO psrset(1M), pset_assign(2), pset_bind(2), pset_create(2), pset_destroy(2), pset_getattr(2), pset_setattr(2), sysconf(2).
pset_destroy(2) pset_destroy(2) NAME pset_destroy - destroy a processor set SYNOPSIS #include int pset_destroy( psetid_t pset); DESCRIPTION The pset_destroy() function destroys the processor set pset , releasing all constituent processors and processes by default. The processors and processes are reassigned to the system default processor set. Once destroyed, the pset identifier becomes available for new processor sets that may be created in the future.
pset_destroy(2) pset_destroy(2) SEE ALSO psrset(1M), pset_assign(2), pset_bind(2), pset_create(2), pset_ctl(2), pset_getattr(2), privgrp(4).
pset_getattr(2) pset_getattr(2) NAME pset_getattr, pset_setattr - manage processor set attributes SYNOPSIS #include int pset_getattr( psetid_t pset, pset_attrtype_t type, pset_attrval_t* val); int pset_setattr( psetid_t pset, pset_attrtype_t type, pset_attrval_t val); DESCRIPTION The pset_getattr() function returns the current value of the attribute type for the processor set pset in the memory location pointed to by val .
pset_getattr(2) pset_getattr(2) PSET_OWNER_EXEC The processor set owner has EXEC access. PSET_OWNER_READ The processor set owner has READ access. PSET_OWNER_WRITE The processor set owner has WRITE access. A newly created processor set by default has READ and EXEC access for everyone, but WRITE access only for the processor set owner. A superuser, a PRIV_PSET privilege user, or the pset owner may change value of the PSET_ATTR_PERM attribute.
pset_getattr(2) pset_getattr(2) PSET_ATTRVAL_DFLTPSET Assign the processor to the specified processor set, and migrate all threads and processes to the system default processor set PS_DEFAULT. This is the default value for this attribute. A superuser, a PRIV_PSET privilege user, or a user with WRITE permissions may change the value of the PSET_ATTR_LASTSPU attribute. The default value for any attribute can be assigned using the PSET_ATTRVAL_DEFAULT value in the pset_setattr() function.
pstat(2) pstat(2) NAME pstat(), pstat_getcommandline(), pstat_getcrashdev(), pstat_getcrashinfo(), pstat_getdisk(), pstat_getdynamic(), pstat_getfile(), pstat_getfile2(), pstat_getfiledetails(), pstat_getipc(), pstat_getlocality(), pstat_getlv(), pstat_getlwp(), pstat_getmpathname(), pstat_getmsg(), pstat_getnode(), pstat_getpathname(), pstat_getpmq(), pstat_getproc(), pstat_getprocessor(), pstat_getproclocality(), pstat_getprocvm(), pstat_getpsem(), pstat_getpset(), pstat_getsem(), pstat_getshm(), pstat_
pstat(2) pstat(2) int index, pid_t pid ); int pstat_getmpathname( struct pst_mpathnode *buf, size_t elemsize, size_t elemcount, int index, struct psfsid *fid ); int pstat_getmsg( struct pst_msginfo *buf, size_t elemsize, size_t elemcount, int index ); int pstat_getnode( struct pst_node *buf, size_t elemsize, size_t elemcount, int index ); int pstat_getpathname( char *buf, size_t elemcount, struct pst_fid *fid ); int pstat_getpmq( struct pst_pmqinfo *buf, size_t elemsize, size_t elemcount, int index ); int
pstat(2) pstat(2) ); int pstat_getstatic( struct pst_static *buf, size_t elemsize, size_t elemcount, int index ); int pstat_getstream( struct pst_stream *buf, size_t elemsize, size_t elemcount, int moduleskip, struct pst_fid *fid ); int pstat_getswap( struct pst_swapinfo *buf, size_t elemsize, size_t elemcount, int index ); int pstat_getvminfo( struct pst_vminfo *buf, size_t elemsize, size_t elemcount, int index ); Remarks The underlying function pstat() is provided for backward compatibility.
pstat(2) pstat(2) Context Commandline Struct char * Process LW Process Process VM Process Locality LVM Vol Sema Set Msg Queue Shared Mem Proc Set P-Sema Set P-Msg Queue Open File Open File Open File pst_status lwp_status pst_vm_status pst_proc_ locality pst_lvinfo pst_seminfo pst_msginfo pst_shminfo pst_pset pst_pseminfo pst_pmqinfo pst_fileinfo pst_fileinfo2 pst_ filedetails pst_socket pst_stream char * pst_mpathnode Open Socket Open Stream Open File DNLC Routine pstat_ getcommandline() pstat_getpro
pstat(2) pstat(2) open file for a specified process. For the specified process, there is one instance of this context for each open file descriptor. For each instance requested, data, up to a maximum of elemsize bytes, is returned in the structs pst_fileinfo pointed to by buf. The elemcount parameter specifies the number of structs pst_fileinfo that are available at buf to be filled in.
pstat(2) pstat(2) context. This data may change while the system is running due to administrative changes in the associated kernel tunables. Data, up to a maximum of elemsize bytes, is returned in the struct pst_ipcinfo pointed to by buf. The elemcount parameter must be 1. The index parameter must be 0. pstat_getlocality() Returns information specific to a particular locality. See the pstat_getlocality(2) manpage. pstat_getlv() Returns information specific to a particular logical volume.
pstat(2) pstat(2) formed by concatenating the pathname to the mount point of the file system. Use of this function is limited to UID==0. On success, the function returns the number of DNLC entries copied. In case of failure, the value of -1 is returned and errno is set indicating the cause of the failure. pstat_getmsg() Returns information specific to a particular System V message queue. There is one instance of this context for each System V message queue on the system.
pstat(2) pstat(2) See the pstat_getproclocality(2) manpage. pstat_getprocvm() Returns information specific to a particular process’s address space. There is one instance of this context for each process region contained in the process’ address space. For each instance requested, data, up to a maximum of elemsize bytes, is returned in the struct pst_vm_status pointed to by buf. Only at most one instance (process region) is returned for each call to pstat_getprocvm().
pstat(2) pstat(2) match. On success, the function returns 1. On failure, the value of -1 is returned and errno is set indicating the cause of the failure. For AF_UNIX sockets that are opened to files, more information about the files can be obtained with the pstat_getfiledetails() call. In case of AF_UNIX sockets, the fields pst_peer_hi_nodeid and pst_peer_lo_nodeid can be used to find the peer socket by matching them with pst_hi_nodeid and pst_lo_nodeid.
pstat(2) pstat(2) Refer to the pstat header file to see how the various structures would look like when the -D_PSTAT64 flag is used. The pstat_getlwp, pstat_getcrashinfo, pstat_getcrashdev, and pstat_getnode interfaces are available only in the wide mode and for applications written in standard C and extended ANSI. RETURN VALUE Upon successful completion, pstat() and the various wrapper routines (for example, pstat_getprocessor()) return the number of instances filled in at the address buf.
pstat(2) pstat(2) [EOVERFLOW] For the pstat_getpathname() call, the elemcount parameter is not one greater than the length of the pathname to be returned. [ENOSTR] pstat_getstream() is called for a file which is neither a stream nor a stream based pipe/socket. [EINTR] For pstat_getsocket() call, the operation was terminated due to the receipt of a signal, and no data was transferred. [ENOBUFS] For pstat_getsocket() call, the operation was terminated due to unavailability of buffer space.
pstat(2) pstat(2) int total_execs = 0; for (i = 0; i < nspu; i++) { int execs = psp[i].
pstat(2) pstat(2) struct pst_ipcinfo psi; struct pst_shminfo *pss; if (pstat_getipc(&psi, sizeof(psi), (size_t)1, 0) != -1) { size_t num_shm = psi.psi_shmmni; pss = (struct pst_shminfo *) malloc(num_shm * sizeof(struct pst_shminfo)); if (pstat_getshm(pss, sizeof(struct pst_shminfo), num_shm, 0) != -1) { int i; (void)printf("owner\tkey\tsize\n"); for (i = 0; i < num_shm; i++) { /* skip inactive segments */ if (!(pss[i].psh_flags & PS_SHM_ALLOC)) continue; (void)printf("%d\t%#x\t%d\n", pss[i].
pstat(2) pstat(2) { struct lwp_status lwpbuf; /* * get information for LWP whose lwpid is 4321 within * a process whose pid is 1234. */ count = pstat_getlwp(buf, sizeof(struct lwp_status), 0, 4321, 1234) if (count == -1) perror("pstat_getlwp()"); else ...
pstat(2) pstat(2) if (rv == 1) { /* * Ask for 3 structures (head + module(s) + driver). * If there are no modules, we expect 2 structures (head, driver) * If there is 1 module, we expect 3 structures (head, module, * driver) * If there is more than 1 module, we expect 3 structures * (head, modules). */ count = pstat_getstream(psfstream, sizeof(struct pst_stream), 3, 0, &(psf.psf_fid)); if (count > 0) { if ((psfstream[0].val.head.pst_hi_fileid == psf.psf_hi_fileid) && (psfstream[0].val.head.
pstat(2) pstat(2) psfsocket.pst_type, PS_SOCK_STREAM); } else { printf("State changed\n"); } } else { perror("pstat_getsocket()"); } } else { perror("pstat_getfile2"); } close(fd); } /* * Example 11: Acquire pathname information about opened file */ main() { struct pst_fileinfo2 psf; char filename[20]; int rv, count, fd; fd = open("/etc/passwd", O_RDONLY); rv = pstat_getfile2(&psf, sizeof(psf), 0, fd, getpid()); if (rv == 1) { /* * Ask for pathname information.
pstat(2) pstat(2) target = getpid(); fd = open("/etc/passwd", O_RDONLY); rv = pstat_getfile2(&psf, sizeof(psf), 0, fd, target); if (rv == 1) { /* * Ask for multiple pathname information. */ count = pstat_getmpathname(mpath_buf, sizeof(struct pst_mpathnode), 20, 0, &(psf.psf_id.psf_fsid)); if (count > 0) { for (i = 0; i < count; i++) { printf("component %d: %s\n", i, mpath_buf[i].
pstat(2) pstat(2) sysconf(2), fileno(3S), thread_safety(5).
pstat_getlocality(2) pstat_getlocality(2) NAME pstat_getlocality(), pstat_getproclocality() - returns system-wide or per-process information of a ccNUMA system SYNOPSIS #include
pstat_getlocality(2) pstat_getlocality(2) There is one instance of this context for each locality on the system. For each locality requested, data, up to a maximum of elemsize bytes, are returned in the struct pst_locality pointed to by buf. The elemcount parameter specifies the number of struct pst_locality that are available at buf to be filled in. The index parameter specifies the starting index within the context of localities.
pstat_getlocality(2) pstat_getlocality(2) uint64_t ppl_rss_weighted The number of resident pages for this process in this locality, weighted by the number of processes sharing each page. Private pages count as one page, and shared pages count as the page divided by the number of processes sharing that page. Notes These functions only return the wide (64-bit) versions of their associated structures.
pstat_getlocality(2) pstat_getlocality(2) /* * Verify arguments, call sys_locinfo(), and call pid_locinfo() * if desired.
pstat_getlocality(2) pstat_getlocality(2) /* Convert integers into strings */ pages_to_str ( pstl[i].psl_total_pages, total_str ); pages_to_str ( pstl[i].psl_free_pages, free_str ); pages_to_str ( (pstl[i].psl_total_pages pstl[i].psl_free_pages), used_str ); printf ( "%6d%6lld%7lld%6s%10s%10s%10s\n", (idx+i), pstl[i].psl_ldom_id, pstl[i].psl_physical_id, ((pstl[i].
pstat_getlocality(2) pstat_getlocality(2) * can be returned at a time. This will get the first: */ count = pstat_getproclocality ( &ppl, sizeof(struct pst_proc_locality), pid, i ); printf ( " --- Per-process locality info for pid %d: ---\n", pid ); printf ( "%6s%10s%10s%10s%10s\n", "idx", "total", "shared", "private", "weighted" ); while ( count == 1 ) { total shared private weighted += += += += pages_to_str pages_to_str pages_to_str pages_to_str ppl.ppl_rss_total; ppl.ppl_rss_shared; ppl.
pstat_getlocality(2) pstat_getlocality(2) void pages_to_str ( uint64_t pages, char *str ) { uint64_t kpg = pages*(pgsize/1024L); uint64_t mpg = kpg/1024L; uint64_t gpg = mpg/1024L; if ( gpg > 10 ) sprintf } else if ( mpg sprintf } else if ( kpg sprintf } else { sprintf } { ( > ( > ( str, "%lluG", gpg ); 10 ) { str, "%lluM", mpg ); 1 ) { str, "%lluK", kpg ); ( str, "%llu", pages ); } AUTHOR The pstat routines were developed by Hewlett-Packard Company. SEE ALSO pstat(2), mpctl(2).
ptrace(2) ptrace(2) (PA Only; TO BE OBSOLETED) NAME ptrace() - process trace SYNOPSIS #include long ptrace( int request, pid_t pid, long addr, long data, long addr2 ); Remarks ptrace() is not available on Itanium(R)-based systems. Its use is discouraged because it is targeted for removal from HP-UX. Please use ttrace (2) instead. Much of the functionality of ptrace() is highly dependent on the underlying hardware.
ptrace(2) ptrace(2) (PA Only; TO BE OBSOLETED) PT_RUAREA The word specified by the address in the addr argument in the user area of the traced process in the system’s address space (see ) is returned to the tracing process. The addresses in this area are system dependent but start at zero and the limit can be obtained from . The data and addr2 arguments are ignored.
ptrace(2) ptrace(2) (PA Only; TO BE OBSOLETED) PT_SINGLE This request causes a flag to be set so that an interrupt occurs upon the completion of one machine instruction. It then executes the same way as listed for request PT_CONTIN, effectively allowing the single-stepping of the traced process. If the processor does not provide a trace bit, this request returns an error. Whether or not the trace bit remains set after this interrupt is a function of the hardware.
ptrace(2) ptrace(2) (PA Only; TO BE OBSOLETED) is logged in the parent’s context and the parent’s pid argument value is logged in the child’s context. The child does not inherit its parent’s event flags. See the ptrace_state structure description under PT_GET_PROCESS_STATE for further details. PTRACE_VFORK This event flag indicates that the traced process needs to take special action when it invokes vfork().
ptrace(2) ptrace(2) (PA Only; TO BE OBSOLETED) PT_GET_EVENT_MASK This request is used by the calling process to determine the event flags and signal mask values that have been set in the traced process’s context by the last PT_SET_EVENT_MASK request. The data argument specifies the number of bytes to be read from the traced process’ context into the ptrace_event data structure pointed to by addr argument. The addr2 argument is ignored.
ptrace(2) ptrace(2) (PA Only; TO BE OBSOLETED) EXAMPLES The following example illustrates the use of some of the ptrace() calls by a tracing process. #include #include #include #include
ptrace(2) ptrace(2) (PA Only; TO BE OBSOLETED) if (!WIFSTOPPED(status)) printf("Parent: invalid wait() completion\n"); /* * Child has stopped; fetch its process state and examine state * information.
ptrace(2) ptrace(2) (PA Only; TO BE OBSOLETED) [EPERM] The process specified in the pid argument is already being traced or refers to the calling process itself. [ESRCH] pid specifies a process to be traced that does not exist or has not executed a ptrace() call that has done a PT_SETTRC request. SEE ALSO adb(1), exec(2), exit(2), signal(2), ttrace(2), wait(2).
putmsg(2) putmsg(2) NAME putmsg, putpmsg - send a message on a stream SYNOPSIS #include int putmsg( int fildes, const struct strbuf *ctlptr, const struct strbuf *dataptr, int flags ); int putpmsg( int fildes, const struct strbuf *ctlptr, const struct strbuf *dataptr, int band, int flags ); DESCRIPTION The putmsg() function creates a message from a process buffer(s) and sends the message to a STREAMS file. The message may contain either a data part, a control part, or both.
putmsg(2) putmsg(2) No partial message is sent. RETURN VALUE Upon successful completion, putmsg() and putpmsg() return 0. Otherwise, they return -1 and set errno to indicate the error. ERRORS [EAGAIN] A non-priority message was specified, the O_NONBLOCK flag is set, and the stream write queue is full due to internal flow control conditions, or buffers could not be allocated for the message that was to be created. [EBADF] fildes is not a valid file descriptor open for writing.
quotactl(2) quotactl(2) NAME quotactl - manipulate disk quotas SYNOPSIS #include int quotactl(int cmd, const char *special, uid_t uid, void *addr); DESCRIPTION quotactl() manipulates disk quotas. cmd indicates a command to be applied to the user ID uid. Parameter special is a pointer to a null-terminated string containing the path name of the block special device for the file system being manipulated. The block special device must be mounted.
quotactl(2) quotactl(2) [EINVAL] The parameters cmd and/or uid are invalid. [ESRCH] No disc quota is found for the indicated user or quotas have not been turned on for this file system. [EPERM] The call is privileged and the calling process does not have appropriate privileges. [ENODEV] The parameter special contains a type of file system that does not support quotas. Currently, quotas are supported on HFS and VxFS file systems. [ENOTBLK] The parameter special is not a block device.
read(2) read(2) NAME read, readv, pread - read from file SYNOPSIS #include ssize_t read(int fildes, void *buf, size_t nbyte); ssize_t pread(int fildes, void *buf, size_t nbyte, off_t offset); #include ssize_t readv(int fildes, const struct iovec *iov, int iovcnt); DESCRIPTION The read() function attempts to read nbyte bytes from the file associated with the open file descriptor, fildes , into the buffer pointed to by buf.
read(2) read(2) For ordinary files, if the O_RSYNC|O_DSYNC file status flag is set, the calling process blocks until the data being read and all file attributes required to retrieve the data are the same as their image on disk. Writes pending on the data to be read are executed before returning to the calling process.
read(2) read(2) Upon successful completion, readv() marks for update the st_atime field of the file. The pread() function performs the same action as read(), except that it reads from a given position in the file without changing the file pointer. The first three arguments of pread() are the same as read() with the addition of a fourth argument offset for the desired position inside the file. An attempt to perform a pread() on a file that is incapable of seeking results in an error.
read(2) read(2) The readv() function may fail if: [EINVAL] The iovcnt argument was less than or equal to 0, or greater than {IOV_MAX}. The pread() function will fail and the file pointer remains unchanged if: [EINVAL] The offset argument is invalid. The value is negative. [EOVERFLOW] The file is a regular file and an attempt was made to read at or beyond the offset maximum associated with the file. [ESPIPE] fildes is associated with a pipe or FIFO.
readlink(2) readlink(2) NAME readlink() - read the contents of a symbolic link SYNOPSIS #include int readlink( const char *path, char *buf, size_t bufsiz ); DESCRIPTION The readlink() function places the contents of the symbolic link referred to by path in the buffer buf which has size bufsiz . If the number of bytes in the symbolic link is less than bufsiz , the contents of the remainder of buf are unspecified.
readlink(2) readlink(2) STANDARDS CONFORMANCE readlink() : AES, SVID3 A rA Section 2−−282 Hewlett-Packard Company −2− HP-UX 11i Version 2: September 2004
reboot(2) reboot(2) NAME reboot - boot the system SYNOPSIS #include int reboot (int howto); DESCRIPTION reboot() causes the system to reboot. howto is a mask of reboot options (see ), specified as follows: RB_AUTOBOOT A file system sync is performed (unless RB_NOSYNC is set) and the processor is rebooted from the default device and file. RB_HALT The processor is simply halted. A sync of the file system is performed unless the RB_NOSYNC flag is set.
recv(2) recv(2) NAME recv, recvfrom, recvmsg - receive a message from a socket SYNOPSIS #include
recv(2) recv(2) based sockets such as SOCK_STREAM, there is no concept of message boundaries. In this case, data is returned to the user as soon as it becomes available, and no data is discarded. See the AF_CCITT Only subsection below for a list of the exceptions to this behavior for connections in the address family AF_CCITT. recvmsg() performs the same action as recv(), but scatters the read data into the buffers specified in the msghdr structure (see _XOPEN_SOURCE_EXTENDED Only below).
recv(2) recv(2) • If the remote side of a connection-based socket has performed an orderly shutdown and there is no more data to read (the socket has reached the end of its data stream), recv() returns 0. • If the remote side of a connection-based socket has reset the connection, recv() returns −1 and sets errno to [ECONNRESET]. • If an error occurs, recv() returns −1 and errno is set to indicate the error. If the O_NDELAY flag is set using fcntl() (defined in
recv(2) recv(2) • The MSG_OOB flag is supported. • The MSG_PEEK flag is supported; the two flags can be combined. • If a message is received that is larger than the user-controlled maximum message size, the X.25 subsystem RESETs the circuit, discards the data, and sends the out-of-band event OOB_VC_MESSAGE_TOO_BIG to the socket.
recv(2) recv(2) The flags parameter accepts a new value, MSG_WAITALL, which requests that the function block until the full amount of data requested can be returned. The function may return a smaller amount of data if a signal is caught, the connection is terminated, or an error is pending for the socket. On successful completion of recvmsg(), the msg_flags member of the message header is the bitwiseinclusive OR of all of the following flags that indicate conditions detected for the received message.
recv(2) recv(2) [ENOTCONN] Receive on a SOCK_STREAM socket that is not yet connected. [ENOTSOCK] The argument s is a valid file descriptor, but it is not a socket. [EOPNOTSUPP] The MSG_OOB flag was set for a UDP SOCK_DGRAM message-based socket, or MSG_OOB or MSG_PEEK was set for any AF_UNIX socket. The MSG_OOB flag is supported only for stream-based TCP SOCK_STREAM sockets. Neither MSG_PEEK nor MSG_OOB is supported for AF_UNIX sockets. AF_CCITT only: recv() was issued on a listen() socket.
rename(2) rename(2) NAME rename - change the name of a file SYNOPSIS #include int rename(const char *source, const char *target); DESCRIPTION The rename() system call causes the source file to be renamed to target . If target exists, it is first removed. Both source and target must be of the same type (that is, either directories or nondirectories), and must reside on the same file system.
rename(2) rename(2) AUTHOR rename() was developed by the University of California, Berkeley. SEE ALSO open(2). STANDARDS CONFORMANCE rename(): AES, SVID3, XPG3, XPG4, FIPS 151-2, POSIX.
rmdir(2) rmdir(2) NAME rmdir() - remove a directory file SYNOPSIS #include int rmdir(const char *path); DESCRIPTION The rmdir() system call removes a directory file whose name is given by path . The directory must be empty (except for the files . and ..) before it can be removed. RETURN VALUE rmdir() returns the following values: 0 -1 Successful completion. Failure. errno is set to indicate the error. ERRORS If rmdir() fails, errno is set to one of the following values.
rtprio(2) rtprio(2) NAME rtprio - change or read real-time priority SYNOPSIS #include int rtprio(pid_t pid, int prio); DESCRIPTION The rtprio() system call sets or reads the real-time priority of a process. If pid is zero, it specifies the calling process; otherwise, it specifies the process ID of a process.
rtprio(2) rtprio(2) indicated by pid . [EPERM] The group access list of the calling process does not contain a group having PRIV_RTPRIO capability and prio is not RTPRIO_NOCHG, or RTPRIO_RTOFF with a pid of zero. [ESRCH] No process can be found corresponding to that specified by pid .
rtsched(2) rtsched(2) NAME rtsched: sched_get_priority_max(), sched_get_priority_min(), sched_getparam(), sched_getscheduler(), sched_rr_get_interval(), sched_setparam(), sched_setscheduler(), sched_yield(), PRI_HPUX_TO_POSIX(), PRI_POSIX_TO_HPUX() - real-time scheduling operations SYNOPSIS #include
rtsched(2) rtsched(2) scheduling policy of the process specified by pid . Higher numerical values for the priority represent higher (stronger) priorities. Note that this is different from the SCHED_HPUX, SCHED_TIMESHARE, SCHED_NOAGE, and SCHED_RTPRIO scheduling policies, where higher numerical values represent lower (weaker) priorities. See the PRI_HPUX_TO_POSIX() and PRI_POSIX_TO_HPUX() functions, and SCHED_RTPRIO, SCHED_NOAGE, and SCHED_OTHER in "Scheduling Policies" below.
rtsched(2) rtsched(2) The possible values for the policy parameter are defined in the header file , and mentioned below. If a process described by pid exists, the scheduling policy and scheduling parameters are set for the process whose process ID is equal to pid . If pid is zero, the scheduling policy and scheduling parameters are set for the calling process.
rtsched(2) rtsched(2) PRI_HPUX_TO_POSIX() PRI_POSIX_TO_HPUX() These two functions serve to map (translate) the range of HP-UX priorities into the POSIX.4 model. These translations are necessary because the POSIX.4 standard chose larger numbers to represent stronger priorities and the existing HP-UX behavior, which must be maintained for backward compatibility, uses smaller numbers for stronger priorities. The PRI_HPUX_TO_POSIX() function returns the POSIX.
rtsched(2) rtsched(2) contains at least 32 priorities. SCHED_RR Round-robin scheduling policy, with a per-system time slice (time quantum).
rtsched(2) rtsched(2) is guaranteed that the priority range for the SCHED_OTHER scheduling policy is properly disjoint from the priority ranges of all of the real-time scheduling policies described and the strongest priority in the priority range for SCHED_OTHER is weaker than the weakest priority in the priority ranges for any of the other policies, SCHED_FIFO, SCHED_RR, and SCHED_RR2. SCHED_NOAGE A timeshare scheduling policy with nondecaying priorities.
rtsched(2) rtsched(2) [EINVAL] One or more of the requested scheduling parameters is outside the range defined for the scheduling policy of the specified pid . [ENOSYS] The function is not supported by this implementation. [EPERM] The requesting process does not have permission to set the scheduling parameters for the specified process, or does not have the appropriate privilege to invoke sched_setparam(). [ESRCH] No process can be found corresponding to that specified by pid .
rtsched(2) rtsched(2) AUTHOR The sched_* () functions were derived from the proposed IEEE POSIX P1003.4 standard, draft 14. PRI_HPUX_TO_POSIX() and PRI_POSIX_TO_HPUX() were developed by HP. SEE ALSO rtsched(1), rtprio(2). STANDARDS CONFORMANCE sched_get_priority_max(): POSIX.4 sched_get_priority_min(): POSIX.4 sched_getparam(): POSIX.4 sched_getscheduler(): POSIX.4 sched_rr_getinterval(): POSIX.4 sched_setparam(): POSIX.4 sched_setscheduler(): POSIX.4 sched_yield(): POSIX.
select(2) select(2) NAME select, FD_CLR, FD_ISSET, FD_SET, FD_ZERO - synchronous I/O multiplexing SYNOPSIS #include int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout); void FD_CLR(int fd, fd_set *fdset); int FD_ISSET(int fd, fd_set *fdset); void FD_SET(int fd, fd_set *fdset); void FD_ZERO(fd_set *fdset); For Backward Compatibility Only: (_XOPEN_SOURCE_EXTENDED not defined) #include
select(2) select(2) If the readfds , writefds , and errorfds arguments are all null pointers and the timeout argument is not a null pointer, select() blocks for the time specified, or until interrupted by a signal. If the readfds , writefds , and errorfds arguments are all null pointers and the timeout argument is a null pointer, select() blocks until interrupted by a signal. File descriptors associated with regular files always select true for ready to read, ready to write, and error conditions.
select(2) select(2) * User can set it to the maximum possible value the kernel is * configured for, by using sysconf(_SC_OPEN_MAX). * Note that, if you are not using these many files, you are * wasting too much space. */ num_of_fds = sysconf(_SC_OPEN_MAX); s = sizeof(long); /* * howmany is a macro defined in sys/types.h */ f = (struct fd_set *)malloc(s*howmany(num_of_fds, s*8); /* * Use f wherever struct fd_set * is used. * It can be used to test num_of_fds file descriptors.
select(2) select(2) /* First open each terminal for reading and put the * file descriptors into array tty[NTTYS]. The code * for opening the terminals is not shown here. */ for (i=0; i < NTTYS; i++) { ttymask[i] = MASK(tty[i]); readmask |= ttymask[i]; } timeout.tv_sec = 5; timeout.
select(2) select(2) perror ("select failed"); else if (nfound == 0) printf ("select timed out \n"); else for (i=0, k=0; i < NTTYS && k < NWORDS; k++) for (j=0; j < NFDBITS && i < NTTYS; j++, i++) if (ttymask[i] & readfds.fds_bits[k]) /* Read from tty[i]. The code for reading * is not shown here. */ else printf ("tty[%d] is not ready for reading \n",i); WARNINGS Check all references to signal (5) for appropriateness on systems that support sigvector().
sem_close(2) sem_close(2) NAME sem_close - close a named POSIX semaphore SYNOPSIS #include int sem_close(sem_t *sem); DESCRIPTION sem_close() is used to close a named semaphore. A successful call to sem_close() will do the following: Remove the process’s descriptor for the semaphore referenced by the specified sem_t structure sem.
sem_destroy(2) sem_destroy(2) NAME sem_destroy - destroy an unnamed POSIX semaphore SYNOPSIS #include int sem_destroy(sem_t *sem); DESCRIPTION sem_destroy() is used to destroy an unnamed semaphore. A successful call to sem_destroy() will invalidate the unnamed semaphore referred to by sem and removes all descriptors referencing it. The semaphore should have been created by a previous call to sem_init() and there should not be any processes blocked on it.
sem_getvalue(2) sem_getvalue(2) NAME sem_getvalue - get the value of a POSIX semaphore SYNOPSIS #include int sem_getvalue(sem_t *sem, int *sval); DESCRIPTION sem_getvalue() is used to read the value of the semaphore. The value of the semaphore specified by sem is read, at some unspecified time during the call, and then stored into sval . If the semaphore value is <= 0, at that time, the semaphore is considered unavailable.
sem_init(2) sem_init(2) NAME sem_init - initialize an unnamed POSIX semaphore SYNOPSIS #include int sem_init(sem_t *sem, int pshared, unsigned int value); DESCRIPTION sem_init() is used to initialize an unnamed semaphore. A successful call to sem_init() will create a new unnamed semaphore referred to by sem, if one does not exist, initialize the unnamed semaphore descriptor, referred to by sem, to the non-negative value specified by value . If the unnamed semaphore already exists, i.e.
sem_open(2) sem_open(2) NAME sem_open - create/open a named POSIX semaphore SYNOPSIS #include sem_t * sem_open(const char *name, int oflag, mode_t mode, unsigned int value); DESCRIPTION sem_open() is used to open or create a named semaphore. A successful call to sem_open() will create a descriptor for the semaphore specified by name. The pointer to the semaphore returned by sem_open() can be used to access the semaphore associated with name in subsequent operations.
sem_open(2) sem_open(2) [ENFILE] There are too many semaphores in the system. [ENOENT] The flag O_CREAT is not set in oflag and the named semaphore does not exist. [ENOSPC] There are insufficient resources for the creation of a new named semaphore. SEE ALSO sem_close(2), sem_post(2), sem_wait(2), sem_unlink(2), .
sem_post(2) sem_post(2) NAME sem_post - unlock a POSIX semaphore SYNOPSIS #include int sem_post(sem_t *sem); DESCRIPTION sem_post() is used to post the semaphore referenced by sem. The calling thread will not return from its call to sem_post() unless it can either: increment the semaphore value, if there are no blocked threads on this semaphore; give the semaphore to a blocked thread, if there are any blocked threads on this semaphore; or have an error condition.
sem_unlink(2) sem_unlink(2) NAME sem_unlink - unlink a named POSIX semaphore SYNOPSIS #include int sem_unlink(const char *name); DESCRIPTION sem_unlink() is used to unlink named semaphores. A successful call to sem_unlink() marks the semaphore, specified by name, for removal. Calling sem_unlink() does not affect processes, including the calling process, which currently have a descriptor, obtained from a call to sem_open(). Named semaphores are uniquely identified by character strings.
sem_wait(2) sem_wait(2) NAME sem_wait, sem_trywait - lock a POSIX semaphore SYNOPSIS #include int sem_wait(sem_t *sem); int sem_trywait(sem_t *sem); DESCRIPTION sem_wait() is used to lock a semaphore. The calling thread will not return from its call to sem_wait() until one of the following events occur: it successfully obtains a lock on the semaphore; it is interrupted by a signal or an error condition occurs. sem_trywait() is used to lock a semaphore, if it is available.
semctl(2) semctl(2) NAME semctl - semaphore control operations SYNOPSIS #include int semctl(int semid, int semnum, int cmd, ... ); union semun { int val; struct semid_ds ∗buf; ushort ∗array; } arg; DESCRIPTION The semctl() system call provides a variety of semaphore control operations as specified by cmd. The fourth argument is optional and depends on the operation requested. If present, it must be of type union semun, which the application program must explicitly declare.
semctl(2) semctl(2) or to the value of either sem_perm.uid or sem_perm.cuid in the data structure associated with semid . RETURN VALUE Upon successful completion, semctl() returns a value based on cmd as follows: GETVAL GETNCNT GETZCNT GETPID The The The The value value value value of of of of semval . semncnt . semzcnt . sempid . All others return 0. If it fails, it returns -1 and sets errno to indicate the error.
semget(2) semget(2) NAME semget - get set of semaphores SYNOPSIS #include int semget(key_t key, int nsems, int semflg); DESCRIPTION semget() returns the semaphore identifier associated with key. A semaphore identifier and associated data structure and set containing nsems semaphores are created for key if one of the following is true: key is equal to IPC_PRIVATE. This call creates a new identifier, subject to available resources.
semget(2) semget(2) [EEXIST] A semaphore identifier exists for key but ((semflg & IPC_CREAT) && (semflg & IPC_EXCL)) is ‘‘true’’. SEE ALSO ipcrm(1), ipcs(1), semctl(2), semop(2), stdipc(3C).
semop(2) semop(2) NAME semop, semtimedop - semaphore operations SYNOPSIS #include #include int semop( int semid, struct sembuf *sops, size_t nsops ); int semtimedop( int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout ); DESCRIPTION semop() is used to atomically perform an array of semaphore operations on the set of semaphores associated with the semaphore identifier specified by semid . sops is a pointer to the array of semaphoreoperation structures.
semop(2) • semop(2) If sem_op is zero, one of the following occurs: If semval is zero, semop() proceeds to the next semaphore operation specified by sops , or returns immediately if this is the last operation. If semval is not equal to zero and (sem_flg & IPC_NOWAIT) is ‘‘true’’, semop() returns immediately.
semop(2) semop(2) [EAGAIN] The operation would result in suspension of the calling process but (sem_flg & IPC_NOWAIT) is ‘‘true’’. [ENOSPC] The limit on the number of individual processes requesting an SEM_UNDO would be exceeded. [EINVAL] The number of individual semaphores for which the calling process requests a SEM_UNDO would exceed the limit. [ERANGE] An operation would cause a semval to overflow the system-imposed limit.
send(2) send(2) NAME send(), sendmsg(), sendto() - send a message from a socket SYNOPSIS #include
send(2) send(2) −1 is returned, and errno is set to [EMSGSIZE]. For SOCK_DGRAM sockets, this size is fixed by the implementation (see the DEPENDENCIES section). Otherwise there is no size limit. When send() or sendto() returns a positive value, it only indicates this number of bytes have been sent to the local transport provider. It does not mean this number of bytes have been delivered to the peer socket application. A SOCK_DGRAM socket does not guarantee end-to-end delivery.
send(2) send(2) If the O_NDELAY flag is set using fcntl() (defined in and explained in fcntl (2) and fcntl (5)), nonblocking I/O is enabled. In this case, the send() request completes in one of three ways: • If there is enough space available in the system to buffer all of the data, send() completes successfully, having written out all of the data, and returns the number of bytes written.
send(2) send(2) socklen_t int msg_controllen; msg_flags; /* ancillary data buffer len */ /* flags on received message */ } Obsolescent (UNIX 95) struct msghdr { void *msg_name; size_t msg_namelen; struct iovec *msg_iov; int msg_iovlen; void *msg_control; size_t msg_controllen; int msg_flags; } /* /* /* /* /* /* /* optional address */ size of address */ scatter array for data */ # of elements in msg_iov */ ancillary data, see below */ ancillary data buffer len */ flags on received message */ msg_cont
send(2) send(2) [EAGAIN] Nonblocking I/O is enabled using the O_NONBLOCK flag with fcntl(), and the requested operation would block, or the socket has an error that was set asynchronously. An asynchronous error can be caused by a gateway failing to forward a datagram from this socket because the datagram exceeds the MTU of the next-hop network and the "Don’t Fragment" (DF) bit in the datagram is set. (See SO_PMTU in getsockopt (2)). [EBADF] s is not a valid file descriptor.
send(2) send(2) [EPIPE] and SIGPIPE signal An attempt was made to send on a socket that was connected, but the connection has been shut down either by the remote peer or by this side of the connection. Note that the default action for SIGPIPE, unless the process has established a signal handler for this signal, is to terminate the process. [EWOULDBLOCK] Nonblocking I/O is enabled using ioctl() FIOSNBIO request and the requested operation would block. WARNINGS IPv6 is supported on HP-UX 11i Version 1.
sendfile(2) sendfile(2) NAME sendfile() - send the contents of a file through a socket SYNOPSIS #include sbsize_t sendfile(int s, int fd, off_t offset, bsize_t nbytes, const struct iovec *hdtrl, int flags); DESCRIPTION The sendfile() system call transmits the contents of a file associated with the file descriptor fd, plus an optional header and trailer buffers across a socket connection specified by s. sendfile() can be used only when the socket is in a connected state.
sendfile(2) sendfile(2) process has established a signal handler for this signal, is to terminate the process. [EAGAIN] Nonblocking I/O is enabled using the O_NONBLOCK flag with fcntl(), and the requested operation would block. [EWOULDBLOCK] The socket is marked non-blocking and the requested operation would block. [ENOMEM] No memory is available in the system to perform the operation. [EOPNOTSUPP] The socket is not a TCP socket.
sendfile64(2) sendfile64(2) NAME sendfile64() - send the contents of a Large File through a socket SYNOPSIS #include sbsize64_t sendfile64(int s, int fd, off64_t offset, bsize64_t nbytes, const struct iovec *hdtrl, int flags); DESCRIPTION The sendfile64() system call transmits the contents of a file (including a Large File (greater than 2GB)) associated with the file descriptor fd, plus an optional header and trailer buffers across a socket connection specified by s.
sendfile64(2) sendfile64(2) [EPIPE] With SIGPIPE signal. An attempt was made to send on a socket that was connected, but the connection has been shut down either by the remote peer or by this side of the connection. Note that the default action for SIGPIPE, unless the process has established a signal handler for this signal, is to terminate the process. [EAGAIN] Nonblocking I/O is enabled using the O_NONBLOCK flag with fcntl(), and the requested operation would block.
serialize(2) serialize(2) NAME serialize() - force target process to run serially with other processes SYNOPSIS #include int serialize(int timeshare, pid_t pid); DESCRIPTION The serialize() system call is used to force the target process referenced by the pid value passed in to run serially with other processes also marked for serialization. If the value of pid is zero, then the currently running process is marked for serialization.
setacl(2) setacl(2) NAME setacl, fsetacl - set access control list (ACL) information SYNOPSIS #include int setacl( const char *path, int nentries, const struct acl_entry *acl ); int fsetacl( int fildes, int nentries, const struct acl_entry *acl ); DESCRIPTION setacl() sets an existing file’s access control list (ACL) or deletes optional entries from it. path points to a path name of a file.
setacl(2) setacl(2) Altering a base ACL entry’s modes with setacl() changes the file’s corresponding permission bits. The permission bits can be altered also by using chmod() (see chmod(2)) and read using stat() (see stat (2)). The number of entries allowed per file (see NACLENTRIES in ) is small for space and performance reasons. User groups should be created as needed for access control purposes.
setacl(2) [EDQUOT] setacl(2) User’s disk quota block or inode limit has been reached for this file system. EXAMPLES The following code fragment defines and sets an ACL on file ../shared which allows the file’s owner to read, write, and execute or search the file, and allows user 103, group 204 to read the file. #include #include #include char *filename = "../shared"; struct acl_entry acl [2]; struct stat statbuf; if (stat (filename, & statbuf) < 0) error (...
setaudid(2) setaudid(2) NAME setaudid - set the audit ID (aid) for the current process SYNOPSIS #include int setaudid(aid_t audid); DESCRIPTION setaudid() sets the audit ID (aid ) for the current process. This call is restricted to the super-user. RETURN VALUE Upon successful completion, setaudid() returns a value of 0; otherwise, it returns −1 and sets errno to indicate the error.
setaudproc(2) setaudproc(2) NAME setaudproc - controls process level auditing for the current process and its decendents SYNOPSIS #include int setaudproc(int aflag); DESCRIPTION setaudproc() controls process level auditing for the current process and its decendents. It accomplishes this by setting or clearing the u_audproc flag in the u area of the calling process. When this flag is set, the system audits the process; when it is cleared, the process is not audited.
setevent(2) setevent(2) NAME setevent - set current events and system calls which are to be audited SYNOPSIS #include int setevent( const struct aud_type a_syscall[], const struct aud_event_tbl a_event[] ); DESCRIPTION setevent() sets the events and system calls to be audited. The event and system call settings in the tables pointed to by a_syscall and a_event become the current settings. This call is restricted to the super-user.
setgroups(2) setgroups(2) NAME setgroups - set group access list SYNOPSIS #include int setgroups(int ngroups, const gid_t *gidset); DESCRIPTION setgroups() sets the group access list of the current user process according to the array gidset . The parameter ngroups indicates the number of entries in the array and must be no more than NGROUPS_MAX, as defined in .
sethostname(2) sethostname(2) NAME sethostname - set name of host cpu SYNOPSIS #include int sethostname(const char *name, size_t namelen); DESCRIPTION The sethostname() system call sets the name of the host processor to name, which has a length of namelen characters. At system boot time sethostname() is normally executed by the hostname command (see hostname (1)) in the /sbin/init.d/hostname script. Host names are limited to MAXHOSTNAMELEN characters, as defined in .
setpgid(2) setpgid(2) NAME setpgid(), setpgrp2() - set process group ID for job control SYNOPSIS #include int setpgid(pid_t pid, pid_t pgid); int setpgrp2(pid_t pid, pid_t pgid); DESCRIPTION The setpgid() and setpgrp2() system calls cause the process specified by pid to join an existing process group or create a new process group within the session of the calling process. The process group ID of the process whose process ID is pid is set to pgid .
setpgrp(2) setpgrp(2) NAME setpgrp - set process group ID SYNOPSIS #include pid_t setpgrp(void); DESCRIPTION If the calling process is not already a session leader, setpgrp() sets the process group ID of the calling process to the process ID of the calling process. If setpgrp() creates a new session, then the new session has no controlling terminal. The setpgrp() function has no effect when the calling process is a session leader.
setpgrp3(2) setpgrp3(2) (TO BE OBSOLETED) NAME setpgrp3 - create session and set process group ID; for HP-UX 9.x compatibility. SYNOPSIS #include pid_t setpgrp3(void); DESCRIPTION If the calling process is not a process group leader, setpgrp3() creates a new session. The calling process becomes the session leader of this new session, it becomes the process group leader of a new process group, and it has no controlling terminal.
setregid(2) setregid(2) NAME setregid - sets the real and effective group IDs SYNOPSIS #include int setregid(gid_t rgid , gid_t egid ); DESCRIPTION setregid() sets the real and effective group IDs of the calling process. Only a privileged process can set the real group ID and/or the effective group ID to any valid value.
setresuid(2) setresuid(2) NAME setresuid, setresgid - set real, effective, and saved user and group IDs SYNOPSIS #include int setresuid(uid_t ruid, uid_t euid, uid_t suid); int setresgid(gid_t rgid, gid_t egid, gid_t sgid); DESCRIPTION setresuid() sets the real, effective and/or saved user ID of the calling process.
setreuid(2) setreuid(2) NAME setreuid - set real and effective user IDs SYNOPSIS #include int setreuid(uid_t ruid, uid_t euid); DESCRIPTION The setreuid() function sets the real and effective user IDs of the current process to the values specified by the ruid and euid arguments. If ruid or euid is −1, the corresponding effective or real user ID of the current process is left unchanged. A process with appropriate privileges can set either ID to any value.
setsid(2) setsid(2) NAME setsid - create session and set process group ID SYNOPSIS #include pid_t setsid(void); DESCRIPTION If the calling process is not a process group leader, setsid() creates a new session. The calling process becomes the session leader of this new session, it becomes the process group leader of a new process group, and it has no controlling terminal. The process group ID of the calling process is set equal to the process ID of the calling process.
settimeofday(2) settimeofday(2) NAME settimeofday - set the date and time SYNOPSIS #include int settimeofday struct timeval *tp, const struct timezone *tzp); DESCRIPTION The settimeofday() function sets the current time, expressed as seconds and microseconds since Epoch, and passed as the timeval structure pointed to by tp . The resolution of the system clock is one microsecond. Security Restrictions Only a user with appropriate privileges can set the time of day.
settune(2) settune(2) NAME settune - set the value of a kernel tunable parameter SYNOPSIS #include int settune(const char *tunable, uint64_t value, unsigned int flags); DESCRIPTION This function sets the value of the kernel tunable parameter named tunable to the supplied value . This new value will take effect immediately, except in the cases noted below. Some parameters cannot be changed without rebooting the OS kernel.
settune(2) settune(2) [EIO] The Kernel Registry Service was unavailable or encountered an error. [ENOMEM] Insufficient memory to accommodate the new parameter value. WARNINGS The caller must have super-user permissions to use this call. It is possible to seriously degrade system performance, or even render a system unbootable, with incorrect tunable settings. Use care when setting tunable values.
settune_txn(2) settune_txn(2) NAME settune_txn(2) - sets the values of kernel tunable parameters in a transaction SYNOPSIS #include int settune_txn (uint64_t version, struct ktune_context *transaction, size_t struct_size, uint64_t num_elements, char *err_buf, uint64_t *err_bufsize, uint64_t stf_flags); PARAMETERS version transaction The version parameter should always be set to SETTUNE_VERSION. The details of the changes are specified in an array of ktune_context structures.
settune_txn(2) settune_txn(2) DESCRIPTION This function is used to modify the values of a set of kernel tunable parameters at the same time. The caller needs to have super-user privileges to make this call. Changes are made to the tunables using a transactional change model using a three-phase commit where the following rules apply: • None of the changes within a transaction succeed or all of the changes within a transaction succeed. There are no in-betweens.
settune_txn(2) settune_txn(2) [EINVAL] The combination of flags specified is invalid. [EINVAL] The number of elements specified is zero. [EINVAL] The size of a ktune_context structure as specified by struct_size is invalid. [EINVAL] The number of elements specified is greater than the number of tunables available. [EFAULT] err_buf or err_bufsize specifies an address that is inaccessible. [EIO] The Kernel Registry Service was either unavailable or encountered an error.
setuid(2) setuid(2) NAME setuid, setgid - set user and group IDs SYNOPSIS #include int setuid(uid_t uid); int setgid(gid_t gid); DESCRIPTION setuid() sets the real-user- ID (ruid ), effective-user- ID (euid ), and/or saved-user- ID (suid ) of the calling process. The super-user’s euid is zero. The following conditions govern setuid ’s behavior: • If the euid is zero, setuid() sets the ruid , euid , and suid to uid.
shm_open(2) shm_open(2) NAME shm_open - create/open a shared memory object SYNOPSIS #include int shm_open(const char *name, int oflag, mode_t mode); DESCRIPTION The shm_open() system call establishes a connection between a shared memory object and a file descriptor. It creates an open file description that corresponds to the shared memory object and returns a file descriptor that refers to that open file description.
shm_open(2) shm_open(2) [EMFILE] Too many file descriptors are currently in use by this process. [ENAMETOOLONG] The length of the name string exceeds PATH_MAX, or the length of a (pathname) component of the name string exceeds NAME_MAX while _POSIX_NO_TRUNC is in effect. [ENFILE] Too many shared memory objects are currently open in the system. [ENOENT] The O_CREAT flag is not set in oflag and the named shared memory object does not exist.
shm_unlink(2) shm_unlink(2) NAME shm_unlink - unlink a shared memory object SYNOPSIS #include int shm_unlink(const char *name); DESCRIPTION The shm_unlink() system call removes the name of the shared memory object named by the string pointed to by name.
shmctl(2) shmctl(2) NAME shmctl() - shared memory control operations SYNOPSIS #include int shmctl(int shmid, int cmd, struct shmid_ds *buf); DESCRIPTION The shmctl() system call provides a variety of shared memory control operations as specified by the cmd argument. cmd can have the following values: IPC_STAT Place the current value of each member of the data structure associated with shmid into the structure pointed to by buf. The contents of this structure are defined in glossary (9).
shmctl(2) shmctl(2) [ENOMEM] cmd is equal to SHM_LOCK and there is not sufficient lockable memory to fill the request. [EPERM] cmd is equal to IPC_RMID, IPC_SET, SHM_LOCK, or SHM_UNLOCK and the effective user ID of the calling process is not equal to that of a user having appropriate privileges and it is not equal to the value of either shm_perm.uid or shm_perm.cuid in the data structure associated with shmid.
shmget(2) shmget(2) NAME shmget - get shared memory segment SYNOPSIS #include int shmget(key_t key, size_t size, int shmflg); DESCRIPTION shmget() returns the shared memory identifier associated with key . A shared memory identifier and associated data structure and shared memory segment of size size bytes (see glossary (9)) are created for key if one of the following is true: • key is equal to IPC_PRIVATE. This call creates a new identifier, subject to available resources.
shmget(2) shmget(2) System V Shared Memory Under Adaptive Address Space Itanium-based platforms have the capability to create two types of processes: MGAS (Mostly Global Address Space), which is the default, and MPAS (Mostly Private Address Space). See ld(1) and chatr (1). If 64-bit MPAS and 64-bit MGAS processes want to share a mapping among themselves without incurring the cost of aliasing, then (shmflg & IPC_GLOBAL) should be ‘‘true’’, but (shmflg & IPC_SHARE32) should be ‘‘false’’.
shmop(2) shmop(2) NAME shmat(), shmdt() - shared memory operations SYNOPSIS #include void *shmat( int shmid , void *shmaddr , int shmflg ); int shmdt(void *shmaddr ); DESCRIPTION shmat() attaches the shared memory segment associated with the shared memory identifier specified by shmid to the data segment of the calling process. The segment is attached for reading if (shmflg & SHM_RDONLY) is "true"; otherwise, it is attached for reading and writing.
shmop(2) shmop(2) [EACCES] Operation permission is denied to the calling process. [EINVAL] shmid is not a valid shared memory identifier, (possibly because the shared memory segment was already removed using shmctl (2) with IPC_RMID), or the calling process is already attached to shmid. [EINVAL] shmaddr is not zero and the machine does not permit nonzero values, or shmaddr is not equal to the current attach location for the shared memory segment.
shutdown(2) shutdown(2) NAME shutdown - shut down a socket SYNOPSIS #include int shutdown(int s, int how); DESCRIPTION The shutdown() system call is used to shut down a socket. In the case of a full-duplex connection, shutdown() can be used to either partially or fully shut down the socket, depending upon the value of how.
shutdown(2) shutdown(2) [EINVAL] HP-UX BSD Sockets only. The specified socket is not connected. [ENOTCONN] _XOPEN_SOURCE_EXTENDED only. The specified socket is not connected. [EINVAL] _XOPEN_SOURCE_EXTENDED only. The how argument is invalid. FUTURE DIRECTION Currently, the default behavior is the HP-UX BSD Sockets; however, it might be changed to X/Open Sockets in a future release. At that time, any HP-UX BSD Sockets behavior that is incompatible with X/Open Sockets might be obsoleted.
sigaction(2) sigaction(2) NAME sigaction - examine and change signal action SYNOPSIS #include int sigaction ( int sig, const struct sigaction *act, struct sigaction *oact ); DESCRIPTION The sigaction() function allows the calling process to examine and/or specify the action to be associated with a specific signal. The argument sig specifies the signal; acceptable values are defined in . The structure sigaction, used to describe an action to be taken, is defined in the header
sigaction(2) sigaction(2) interruptible functions interrupted by this signal will fail with errno set to [EINTR]. SA_SIGINFO If cleared and the signal is caught, the signal-catching function will be entered as: void func(int signo); where signo is the only argument to the signal catching function. In this case the sa_handler member must be used to describe the signal catching function and the application must not modify the sa_sigaction member.
sigaction(2) sigaction(2) SA_RESETHAND is set, and then including the signal being delivered. If and when the user’s signal handler returns normally, the original signal mask is restored. Once an action is installed for a specific signal, it remains installed until another action is explicitly requested (by another call to sigaction()), until the SA_RESETHAND flag causes resetting of the handler, or until one of the exec functions is called.
sigaction(2) sigaction(2) If, when a pending signal is delivered, there are additional signals to be queued to that signal number, the signal will remain pending. Otherwise, the pending indication will be reset. An implementation will document any condition not specified by this document under which the implementation generates signals. Signal Actions There are three types of action that can be associated with a signal: SIG_DFL, SIG_IGN or a pointer to a function.
sigaction(2) sigaction(2) • The behaviour of a process is undefined after it returns normally from a signal- catching function for a SIGBUS, SIGFPE, SIGILL, or SIGSEGV signal that was not generated by kill() or raise(). • The system will not allow a process to catch the signals SIGKILL and SIGSTOP.
sigaction(2) sigaction(2) In order to prevent errors arising from interrupting non-reentrant function calls, applications should protect calls to these functions either by blocking the appropriate signals or through the use of some programmatic semaphore. This document does not address the more general problem of synchronizing access to shared data structures.
sigaction(2) sigaction(2) STANDARDS CONFORMANCE sigaction(): AES, SVID3, XPG3, XPG4, FIPS 151-2, POSIX.
sigaltstack(2) sigaltstack(2) NAME sigaltstack - set and/or get signal alternate stack context. SYNOPSIS #include int sigaltstack(const stack_t *ss, stack_t *oss); DESCRIPTION The sigaltstack() function allows a process to define and examine the state of an alternate stack for signal handlers. Signals that have been explicitly declared to execute on the alternate stack will be delivered on the alternate stack.
sigaltstack(2) sigaltstack(2) perror("sigaltstack"); In some implementations, a signal (whether or not indicated to execute on the alternate stack) will always execute on the alternate stack if it is delivered while another signal is being caught using the alternate stack. On some implementations, stack space is automatically extended as needed. On those implementations, automatic extension is typically not available for an alternate stack. If the stack overflows, the behavior is undefined.
sigblock(2) sigblock(2) (TO BE OBSOLETED) NAME sigblock - block signals SYNOPSIS #include long sigblock(long mask); DESCRIPTION sigblock() causes the signals specified in mask to be added to the set of signals currently being blocked from delivery. Signal i is blocked if the i-th bit in mask is 1, as specified with the macro sigmask(i). It is not possible to block signals that cannot be ignored, as documented in signal (5); this restriction is silently imposed by the system.
sighold(2V) sighold(2V) NAME sigset, sighold, sigrelse, sigignore, sigpause - signal management SYNOPSIS #include void (*sigset(int sig, void (*func)(int)))(int); int sighold(int sig); int sigrelse(int sig); int sigignore(int sig); int sigpause(int sig); DESCRIPTION The system defines a set of signals that can be delivered to a process. The set of signals is defined in signal (5), along with the meaning and side effects of each signal.
sighold(2V) sighold(2V) For the other functions, a 0 value indicates that the call succeeded. A -1 return value indicates an error occurred and errno is set to indicate the reason. ERRORS sigset() fails and the system signal action for sig is not changed if any of the following occur: [EFAULT] The func argument points to memory that is not a valid part of the process address space. Reliable detection of this error is implementation dependent.
siginterrupt(2) siginterrupt(2) NAME siginterrupt - allow signals to interrupt functions SYNOPSIS #include int siginterrupt(int sig, int flag); DESCRIPTION The siginterrupt() function is used to change the restart behaviour when a function is interrupted by the specified signal. The function siginterrupt(sig, flag) has an effect as if implemented as: siginterrupt(int sig, int flag) { int ret; struct sigaction act; (void) sigaction(sig, NULL, &act); if (flag) act.
signal(2) signal(2) NAME signal, sigset, sighold, sigrelse, sigignore, sigpause - signal management SYNOPSIS #include
signal(2) signal(2) is executed for all other signals (see exec). Acceptable values for sig are described in signal(5). Acceptable values for func are: SIG_DFL Execute the default action, which varies depending on the signal. The default action for most signals is to terminate the process (see signal (5)). A pending signal is discarded (whether or not it is blocked) if action is set to SIG_DFL but the default action of the pending signal is to ignore the signal (as in the case of SIGCLD).
signal(2) signal(2) If disp is not SIG_DFL, SIG_IGN, or SIG_HOLD, it must be a pointer to a function, the signal-catching handler, that is called when signal sig occurs. Before calling the signal-catching handler, the system signal action of sig is set to SIG_HOLD. Any pending signal of this type is released. This handler address is retained across calls to the other signal management functions listed here.
signal(2) signal(2) then test the variables. If they have not changed, call sigpause() to wait for the signal. Threads Considerations The signal disposition (such as catch/ignore/default) established by signal() is shared by all threads in the process. Blocked signal masks are maintained by each thread.
sigpending(2) sigpending(2) NAME sigpending - examine pending signals SYNOPSIS #include int sigpending(sigset_t *set); DESCRIPTION sigpending() stores the set of signals that are blocked from delivery and are pending to the calling thread, at the location pointed to by set . RETURN VALUE Upon successful completion, sigpending() returns 0. Otherwise −1 is returned and errno is set to indicate the error.
sigprocmask(2) sigprocmask(2) NAME sigprocmask - examine and change blocked signals SYNOPSIS #include int sigprocmask( int how, const sigset_t *set, sigset_t *oset ); DESCRIPTION The sigprocmask() function allows the calling thread to examine and/or change its signal mask. If the argument set is not a null pointer, it points to a set of signals to be used to change the currently blocked set.
sigprocmask(2) sigprocmask(2) SEE ALSO pthread_sigmask(3T), sigaction(2), sigpending(2), sigsetops(3C), sigsuspend(2), signal(5). CHANGE HISTORY First released in Issue 3. Entry included for alignment with the POSIX.1-1988 standard. STANDARDS CONFORMANCE sigprocmask(): AES, SVID3, XPG3, XPG4, FIPS 151-2, POSIX.
sigqueue(2) sigqueue(2) NAME sigqueue() - queue a signal to a process SYNOPSIS #include int sigqueue(pid_t pid, int signo, const union sigval value); DESCRIPTION The sigqueue() system call causes the signal specified by signo to be sent with the value specified by value to the process specified by pid . If signo is zero (the null signal), error checking is performed but no signal is actually sent. The null signal can be used to check the validity of pid .
sigsend(2) sigsend(2) NAME sigsend(), sigsendset() - send a signal to a process or a group of processes SYNOPSIS #include #include int sigsend (idtype_t idtype, id_t id, int sig); int sigsendset (const procset_t *psp, int sig); DESCRIPTION The sigsend() system call sends a signal to a process or a group of processes. The process or group of processes to which the signal is to be sent is specified by id and idtype .
sigsend(2) sigsend(2) RETURN VALUE Upon successful completion, sigsend() returns a value of 0. Otherwise, it returns a value of −1 and sets errno to indicate the error. ERRORS If sigsend() fails, it sets errno (see errno (2)) to one of the following values: [EINVAL] sig is neither a valid signal number nor zero. [EINVAL] idtype is not a valid value. [EINVAL] sig is SIGKILL, idtype is P_PID, and id is 1. [ESRCH] No process can be found corresponding to that specified by id and idtype .
sigsetmask(2) sigsetmask(2) (TO BE OBSOLETED) NAME sigsetmask - set current signal mask SYNOPSIS #include long sigsetmask(long mask); DESCRIPTION sigsetmask() sets the current signal mask (those signals that are blocked from delivery). Signal i is blocked if the i-th bit in mask, as specified with the macro sigmask(i), is a 1. It is not possible to mask signals that cannot be ignored, as documented in signal (5); this restriction is silently imposed by the system.
sigspace(2) sigspace(2) NAME sigspace - assure sufficient signal stack space SYNOPSIS #include ssize_t sigspace(ssize_t stacksize); DESCRIPTION sigspace() requests additional stack space that is guaranteed to be available for processing signals received by the calling process. If the value of stacksize is positive, it specifies the size of a space, in bytes, which the system guarantees to be available when processing a signal.
sigspace(2) sigspace(2) LWP (Lightweight Processes) Considerations Each LWP may define an alternate signal handling stack. AUTHOR sigspace() was developed by HP. SEE ALSO sigaction(2), sigstack(2), sigvector(2), malloc(3C), setjmp(3C).
sigstack(2) sigstack(2) (TO BE OBSOLETED) NAME sigstack - set and/or get alternate signal stack context SYNOPSIS #include int sigstack( struct sigstack *ss, struct sigstack *oss ); DESCRIPTION The sigstack() function allows the calling process to indicate to the system an area of its address space to be used for processing signals received by the process. The sigstack() function requires the application to have knowledge of the underlying system’s stack architecture.
sigstack(2) sigstack(2) (TO BE OBSOLETED) WARNINGS Do not use sigstack() in conjunction with sigspace(). The direction of stack growth is not indicated in the historical definition of struct sigstack . The only way to portably establish a stack pointer is for the application to determine stack growth direction, or to allocate a block of storage and set the stack pointer to the middle. An application can assume that the size of the signal stack is SIGSTKSZ.
sigsuspend(2) sigsuspend(2) NAME sigsuspend - wait for a signal SYNOPSIS #include int sigsuspend(const sigset_t *sigmask); DESCRIPTION The sigsuspend() function replaces the current signal mask of the calling thread with the set of signals pointed to by sigmask and then suspends the thread until delivery of a signal whose action is either to execute a signal-catching function or to terminate the process.
sigvector(2) sigvector(2) (TO BE OBSOLETED) NAME sigvector - software signal facilities SYNOPSIS #include int sigvector( int sig, const struct sigvec *vec, struct sigvec *ovec ); DESCRIPTION The system defines a set of signals that can be delivered to a process. The set of signals is defined in signal (5), along with the meaning and side effects of each signal.
sigvector(2) sigvector(2) (TO BE OBSOLETED) The sv_flags field can be used to modify the receipt of signals. The following flag bits are defined: SV_ONSTACK SV_BSDSIG SV_RESETHAND Use the sigspace() allocated space. Use the Berkeley signal semantics. Use the semantics of signal (2). If SV_ONSTACK is set, the system uses or permits the use of the space reserved for signal processing in the sigspace() system call. If SV_BSDSIG is set, the signal is given the Berkeley semantics.
sigvector(2) sigvector(2) (TO BE OBSOLETED) Call read (slow devices) readv (slow devices) write (slow devices) writev (slow devices) open (slow devices) ioctl (slow requests) close (slow requests) wait select pause sigpause semop msgsnd msgrcv sc_syscall value SYS_READ SYS_READV SYS_WRITE SYS_WRITEV SYS_OPEN SYS_IOCTL SYS_CLOSE SYS_WAIT SYS_SELECT SYS_PAUSE SYS_SIGPAUSE SYS_SEMOP SYS_MSGSND SYS_MSGRCV These system calls are not defined if the preprocessor macro _XPG2 is defined when
sigvector(2) sigvector(2) (TO BE OBSOLETED) APPLICATION USAGE Threads Considerations The signal disposition (such as catch/ignore/default) established by sigvector() is shared by all threads in the process. Each thread maintains its own blocked signal mask. For more information regarding signals and threads, refer to signal (5). AUTHOR sigvector() was developed by HP and the University of California, Berkeley.
sigwait(2) sigwait(2) NAME sigwait(), sigwaitinfo(), sigtimedwait() - synchronously accept a signal SYNOPSIS #include int sigwait(const sigset_t *set, int *sig); int sigwaitinfo(const sigset_t *set, siginfo_t *info); int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout); DESCRIPTION The sigwait() function atomically selects and clears a pending signal from set and returns the signal number in the location pointed to by sig.
sigwait(2) sigwait(2) errno variable is NOT set if an error occurs. Upon successful completion, sigwaitinfo() and sigtimedwait() will return the selected signal number. Otherwise a value of -1 is returned and errno is set to indicate the error. ERRORS If any of the following conditions occur, the sigwait family of routines will return the following error number: [EAGAIN] sigtimedwait() was called and no signal in the set parameter was delivered within the time interval specified by the timeout parameter.
socket(2) socket(2) NAME socket() - create an endpoint for communication SYNOPSIS #include AF_CCITT Only #include int socket(int af, int type, int protocol); DESCRIPTION The socket() system call creates an endpoint for communication and returns a descriptor. The socket descriptor returned is used in all subsequent socket-related system calls. The af parameter specifies an address family to be used to interpret addresses in later operations that specify the socket.
socket(2) socket(2) cases, Internet protocol (IP) and the X.25-to-IP interface module are used. If the socket is in the AF_CCITT address family, only the SOCK_STREAM socket type is supported. Refer to the topic "Comparing X.25 Level 3 Access to IP" in the X.25 Programmer’s Guide for more details on the difference between programmatic access to X.25 via IP and X.25 Level 3. If the socket is in the AF_CCITT family, the connection and all other operations pass data directly from the application to the X.
socket(2) socket(2) STANDARDS CONFORMANCE socket(): XPG4 A HP-UX 11i Version 2: September 2004 −3− Hewlett-Packard Company Section 2−−405 sA
socketpair(2) socketpair(2) NAME socketpair() - create a pair of connected sockets SYNOPSIS #include int socketpair(int af, int type, int protocol, int sv[2]); DESCRIPTION The socketpair() system call creates an unnamed pair of connected sockets and returns two file descriptors in sv [0] and sv [1]. The two sockets are indistinguishable. af specifies the address family. See socket (2). type specifies the semantics of communication for the socket.
sprofil(2) sprofil(2) NAME sprofil() - execution time profile for disjointed text spaces SYNOPSIS #include #include int sprofil( struct prof int struct timeval unsigned int ); *profp, profcnt, *tvp, flags DESCRIPTION sprofil() controls profiling, by which the system maintains estimates of the amount of time the calling program spends executing at various places in its address space.
sprofil(2) sprofil(2) one element. If the pc value did not fall within the range of one of the preceding descriptors, the single element specified by the pr_base field is incremented, unless that would result in overflow. Each call to sprofil() disables profiling if it was enabled and then enables profiling of the regions specified by the prof array entries. Due to variations in instruction length on different architectures, the pr_scale setting results in different entry-to-instruction ratios.
sprofil(2) sprofil(2) should always be last in the list of specified regions. Notes Profiling is turned off when an exec (2) is executed, but remains on in both child and parent processes after a fork (2). A call to profil(2) has the same effect as calling sprofil() with just one member in the profp array with the fields profcnt, tvp, and flags taking on the values of 1, NULL, and PROF_USHORT respectively. RETURN VALUE On success, sprofil() returns 0.
stat(2) stat(2) NAME stat - get file status SYNOPSIS #include #include int stat(const char *path, struct stat *buf); DESCRIPTION The stat() function obtains information about the named file and writes it to the area pointed to by the buf argument. The path argument is a pointer to a path name of any file within the mounted file system. (All directories listed in the path name must be searchable).
stat(2) stat(2) ERRORS The stat() function will fail if: [EACCES] Search permission is denied for a component of the path prefix. [EFAULT] buf or path points to an invalid address. The reliable detection of this error is implementation dependent. [EIO] An error occurred while reading from the file system. [ELOOP] Too many symbolic links were encountered in resolving path. [ENAMETOOLONG] The length of the path argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.
statfs(2) statfs(2) NAME statfs, fstatfs - get file system statistics SYNOPSIS #include int statfs(const char *path, struct statfs *buf); int fstatfs(int fildes, struct statfs *buf); DESCRIPTION statfs() returns status information for a mounted file system. fstatfs() returns similar information for an open file. The parameters for the statfs() and fstatfs() functions are as follows: path is a pointer to a path name of any file within the mounted file system.
statfs(2) statfs(2) [EFAULT] buf points to an invalid address. [EIO] An I/O error occurs while reading from or writing to the file system. WARNINGS statfs() is deprecated and should be used only by legacy 32-bit applications. statvfs() or statvfs64() are the recommended replacements. AUTHOR statfs() and fstatfs() were developed by Sun Microsystems, Inc. SEE ALSO df(1M), stat(2), statvfs(2), ustat(2).
statvfs(2) statvfs(2) NAME statvfs, fstatvfs - get file system information SYNOPSIS #include #include int statvfs (const char *path, struct statvfs *buf); int fstatvfs (int fildes, struct statvfs *buf); DESCRIPTION statvfs() returns information about a mounted file system. fstatvfs() returns similar information about an open file.
statvfs(2) statvfs(2) ERRORS If statvfs() fails, errno is set to one of the following values: [EACCES] Search permission is denied for a component of the path prefix. [ELOOP] Too many symbolic links are encountered during path-name translation. [ENAMETOOLONG] The length of the specified path name exceeds PATH_MAX bytes, or the length of a component of the path name exceeds NAME_MAX bytes while _POSIX_NO_TRUNC is in effect.
stime(2) stime(2) NAME stime() - set time and date SYNOPSIS #include int stime(const time_t *tp); DESCRIPTION The stime() system call sets the system time and date. tp points to the value of time as measured in seconds from 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC). RETURN VALUE stime() returns the following values: 0 -1 Successful completion. Failure. errno is set to indicate the error. ERRORS If stime() fails, errno is set to one of the following values.
stream(2) stream(2) NAME stream - STREAMS enhancements to standard system calls DESCRIPTION The open(), close(), read(), readv(), write(), writev(), ioctl(), select(), and signal() system calls are enhanced to support STREAMS. The new functionality is described below for each system call. Open Enhancements When calling open for a STREAMS device, the oflag parameter can only be constructed from the O_NONBLOCK flag values that are OR-ed with the O_RDONLY, O_WRONLY, or O_RDWR flag values.
stream(2) stream(2) message. • If the read mode is message-discard or message-nondiscard, the read() function returns zero, and then consumes the message. The read() function reads the data at the front of the stream head read queue. It reads both priority band and normal data. The read() function processes control messages according to the STREAMS read flags: RPROTNORM, RPROTDAT, and RPROTDIS.
stream(2) stream(2) A write to a STREAMS device may fail for one or more of the following STREAMS-specific conditions: EAGAIN The O_NONBLOCK flag is set, and the stream cannot accept write() data because it is flow controlled. EINVAL The write() function attempts to write to a stream that is linked below a multiplexor. ENXIO A hangup occurs on a stream while the write() function is writing to the stream. ERANGE The nbytes parameter is not within the allowable range.
stty(2) stty(2) (TO BE OBSOLETED) NAME stty(), gtty() - control terminal device (Bell Version 6 compatibility) SYNOPSIS #include int stty(int fildes, const struct sgttyb *argp); int gtty(int fildes, struct sgttyb *argp); Remarks These system calls are preserved for backward compatibility with Bell Version 6. They provide as close an approximation as possible to the old Version 6 functions. All new code should use the TCSETA and TCGETA ioctl() calls described in termio (7).
swapon(2) swapon(2) NAME swapon - add swap space for interleaved paging/swapping SYNOPSIS #include int swapon(const char *path, ... /* [int min, int limit, int reserve,] int priority */ ); Remarks The ANSI C ", ..." construct denotes a variable length argument list whose optional and required members are given in the associated comment (/* */). DESCRIPTION The swapon() system call makes a block device or a directory named path available to the system for paging and swapping.
swapon(2) swapon(2) [EIO] Unable to read the device associated with path. [ELOOP] Too many symbolic links were encountered in translating the path name. [ENAMETOOLONG] The length of the specified path name exceeds PATH_MAX bytes, or the length of a component of the path name exceeds NAME_MAX bytes while _POSIX_NO_TRUNC is in effect. [ENODEV] The device associated with path does not exist. [ENOENT] The system-imposed limit on the number of swap file entries has been reached.
symlink(2) symlink(2) NAME symlink - make symbolic link to a file SYNOPSIS #include int symlink(const char *path1, const char *path2); DESCRIPTION The symlink() function creates a symbolic link. Its name is the pathname pointed to by path2 , which must be a pathname that does not name an existing file or symbolic link. The contents of the symbolic link are the string pointed to by path1 . RETURN VALUE Upon successful completion, symlink() returns 0.
symlink(2) symlink(2) STANDARDS CONFORMANCE symlink(): AES, SVID3 CHANGE HISTORY First released in Issue 4, Version 2.
sync(2) sync(2) NAME sync - update disk SYNOPSIS #include void sync(void); DESCRIPTION sync() causes all information in memory that should be on disk to be written out. This includes modified file system meta-data and delayed block I/O. It should be used by commands and programs that examine a file system, such as fsck, df, etc. It is mandatory before a shutdown. The writing, although scheduled, is not necessarily complete upon return from sync .
sysconf(2) sysconf(2) NAME sysconf(), CPU_IS_PA_RISC() - get configurable system variables SYNOPSIS #include long sysconf(int name ); int CPU_IS_PA_RISC(long cpuvers ); DESCRIPTION The sysconf() system call provides a way for applications to determine the current value of a configurable limit or variable. The name argument represents the system variable being queried.
sysconf(2) sysconf(2) CLK_TCK _SC_CLK_TCK CLOCKS_PER_SEC _SC_CLOCKS_PER_SEC Number of clock intervals per second for times() (see times (2)) Number of clock ticks per second for clock() (see clock (3C)) COLL_WEIGHTS_ MAX _SC_COLL_ WEIGHTS_MAX Maximum number of weights that can be assigned to an entry of the LC_COLLATE order keyword in a localedef input file (see localedef (1M)) CPU_CHIP_TYPE _SC_CPU_CHIP_TYPE Itanium-based systems: CPUID Register 3 of the Itanium-based processor identification
sysconf(2) sysconf(2) IO_TYPE Type of I/O drivers the kernel supports, currently, only the value _SC_IO_TYPE IO_TYPE_CDIO A sA KERNEL_BITS _SC_KERNEL_BITS Returns the number of bits used by the kernel for pointer and long data types. Current values include 32 and 64. LIBC_VERSION _SC_LIBC_VERSION The version of libc that is in use by the application that is requesting this information. See below for details.
sysconf(2) sysconf(2) POSIX_MEMORY_ PROTECTION _SC_MEMORY_PROTECTION Positive if the system supports POSIX memory protection POSIX_MESSAGE_ PASSING _SC_MESSAGE_PASSING Positive if the system supports POSIX Prioritized Input and Output POSIX_ PRIORITIZED_IO _SC_PRIORITIZED_IO Positive if the system supports POSIX message queues; POSIX_PRIORITY_ SCHEDULING _SC_PRIORITY_ SCHEDULING Positive if the system supports POSIX.
sysconf(2) A sA sysconf(2) POSIX_THREAD_ SAFE_FUNCTIONS _SC_THREAD_SAFE_ FUNCTIONS Positive if the implementation supports the POSIX Thread Thread-Safe Functions option; -1 otherwise. POSIX_THREADS _SC_THREADS Positive if the implementation supports POSIX threads; -1 otherwise. POSIX_TTY_ NAME_MAX _SC_TTY_NAME_MAX Maximum length of a terminal device name POSIX2_C_BIND _SC_2_C_BIND Equal to 1 if the POSIX.
sysconf(2) sysconf(2) PROC_RSRC_MGR _SC_PROC_RSRC_MGR Equal to 1 if the optional HP Process Resource Management (PRM) software is installed and configured; 0 otherwise (see prmconfig(1)) RE_DUP_MAX _SC_RE_DUP_MAX Maximum number of repeated occurrences of a regular expression permitted when using the interval notation \{m ,n \} (see regcomp (3C)) RTSIG_MAX _SC_RTSIG_MAX Maximum number of realtime signals reserved for application use.
sysconf(2) sysconf(2) are supported by confstr (3C). A return value of -1 indicates they are not supported. XBS5_ILP32_ OFFBIG _SC_XBS5_ILP32_ OFFBIG A flag which denotes whether _CS_XBS5_ILP32_OFFBIG_CFLAGS, _CS_XBS5_ILP32_OFFBIG_LDFLAGS, _CS_XBS5_ILP32_OFFBIG_LIBS and _CS_XBS5_ILP32_OFFBIG_LINTFLAGS are supported by confstr (3C). A return value of -1 indicates they are not supported.
sysconf(2) sysconf(2) ZZZZ Library-specific number q 0=32PA 1=64PA 2=32EM 3=64EM 4-9=Reserved N 0 = archive library 1-9 = System V version of shared library RETURN VALUE Upon successful completion, sysconf() returns the value of the named variable. If the value of name is not recognized, sysconf() returns −1 and sets errno to [EINVAL]. If the value in name is defined but is not supported in this environment, sysconf() returns −1, but does not change errno.
sysconf(2) sysconf(2) STANDARDS CONFORMANCE sysconf(): AES, SVID3, XPG3, XPG4, FIPS 151-2, POSIX.1, POSIX.2, POSIX.
sysfs(2) sysfs(2) NAME sysfs - get file system type information SYNOPSIS #include int sysfs(int opcode, const char *fsname); int sysfs(int opcode, int fs_index, char *buf ); int sysfs(int opcode); DESCRIPTION sysfs is used to return information about the file system types configured in the system. The number arguments accepted by sysfs varies and depends on the opcode.
time(2) time(2) NAME time - get time SYNOPSIS #include time_t time(time_t *tloc); DESCRIPTION time() returns the value of time in seconds since the Epoch. If tloc is not a null pointer, the return value is also assigned to the object to which it points. RETURN VALUE Upon successful completion, time() returns the value of time. Otherwise, a value of (time_t)−1 is returned and errno is set to indicate the error. ERRORS [EFAULT] time() fails if tloc points to an illegal address.
timers(2) timers(2) NAME timer_create(), timer_delete(), timer_settime(), timer_gettime(), timer_getoverrun() - timer operations SYNOPSIS #include
timers(2) timers(2) If the flag TIMER_ABSTIME is set in the argument flags, timer_settime() behaves as if the time until next expiration is set equal to the difference between the absolute time specified by the it_value member of value and the current value of the clock associated with timerid . That is, the timer will expire when the clock reaches the value specified by the it_value member of value .
timers(2) timers(2) [EFAULT] The timerid or evp argument points to an invalid address. [ENOSYS] The function timer_create() is not supported by this implementation. If any of the following conditions occur, the timer_delete() function returns −1 and sets errno to the corresponding value: [EINVAL] The timer ID specified by timerid is not a valid timer ID. [ENOSYS] The function timer_delete() is not supported by this implementation.
timers(2) timers(2) perror("timer_create"); exit(1); } pause(); if (timer_delete(timerid) == -1) { perror("timer_delete"); exit(1); } return 0; } AUTHOR timer_create(), timer_delete(), timer_settime(), timer_gettime(), timer_getoverrun() were derived from the proposed IEEE POSIX P1003.4 standard, draft 14. and SEE ALSO clocks(2), getitimer(2). STANDARDS CONFORMANCE timer_create(): POSIX.4 timer_delete(): POSIX.4 timer_getoverrun(): POSIX.4 timer_gettime(): POSIX.4 timer_settime(): POSIX.
times(2) times(2) NAME times - get process and child process times SYNOPSIS #include clock_t times(struct tms *buffer); DESCRIPTION times() fills the structure pointed to by buffer with time-accounting information. The structure defined in
truncate(2) truncate(2) NAME ftruncate, truncate - truncate a file to a specified length SYNOPSIS #include int ftruncate(int fildes, off_t length); int truncate(const char *path, off_t length); DESCRIPTION The ftruncate() function causes the regular file referenced by fildes to have a size of length bytes. The truncate() function causes the regular file named by path to have a size of length bytes. The effect of ftruncate() and truncate() on other types of files is unspecified.
truncate(2) truncate(2) [ENOTDIR] A component of the path prefix of path is not a directory. [EROFS] The named file resides on a read-only file system. [ETXTBSY] The file is a pure procedure (shared text) file that is being executed. AUTHOR truncate() was developed by the University of California, Berkeley. SEE ALSO ftruncate64(2), open(2), truncate64(2), . CHANGE HISTORY First released in Issue 4, Version 2.
ttrace(2) ttrace(2) NAME ttrace - tracing facility for multithreaded processes SYNOPSIS #include int ttrace (ttreq_t request, pid_t pid, lwpid_t lwpid, uint64_t addr, uint64_t data, uint64_t addr2); Remarks While the POSIX API is defined and will not change, the present underlying system calls are not guaranteed to be compatible with future versions. Much of the functionality of this capability is highly dependent on the underlying hardware.
ttrace(2) ttrace(2) For this request, the lwpid , addr , data and addr2 arguments must be set to zero. TT_PROC_RDTEXT TT_PROC_RDDATA TT_PROC_RDTEXT_NOATTACH TT_PROC_RDDATA_NOATTACH These requests allow reading from the target process text (TT_PROC_RDTEXT and TT_PROC_RDTEXT_NOATTACH) or data space (TT_PROC_RDDATA and TT_PROC_RDDATA_NOATTACH). The addr argument specifies the offset to be read from.
ttrace(2) ttrace(2) The ttevent_t data structure is as follows: typedef struct { sigset_t tte_signals; ttevents_t tte_events; tteopt_t tte_opts; } ttevent_t; The options provided in tte_opts control the behavior of child processes produced by fork() and are as follows: TTEO_NONE TTEO_NOSTRCCHLD TTEO_PROC_INHERIT TTEO_LWP_INHERIT TTEO_NORM_SIGTRAP = = = = = 0x0000 0x0001 0x0002 0x0004 0x0008 If TTEO_NOSTRCCHLD is set, the child process resulting from a fork() will not be traced.
ttrace(2) ttrace(2) TT_PROC_GET_FIRST_LWP_STATE This request returns the ttstate_t structure associated with the first thread on the stopped list. It resets the list pointer to the first entry in the list. The TT_PROC_GET_NEXT_LWP_STATE request (see below) provides the means to examine the state of other stopped threads. The data argument specifies the number bytes to be read from the context of the traced process into the ttstate_t data structure in the user space pointed to by addr .
ttrace(2) ttrace(2) tts_scarg is the argument list of the system call. The data associated with a TTEVT_EXEC event is as follows: typedef struct { int tts_pathlen; } ttexec_data_t; tts_pathlen is the length of the pathname of the exec() system call. The data associated with a TTEVT_FORK, TTEVT_VFORK or TTEVT_FORK_FAIL event is as follows: typedef struct { pid_t tts_fpid; lwpid_t tts_flwpid; int tts_isparent; int tts_errno; } ttfork_data_t; tts_fpid is the process ID of the other side of the fork.
ttrace(2) ttrace(2) } ttthread_data_t; tts_target_lwpid is the lwpid of the targeted lwp. The data associated with a TTEVT_SYSCALL event is as follows: typedef struct { int64_t tts_rval[2]; int tts_errno; } ttsyscall_data_t; The tts_rval fields are the return value(s) of the system call. tts_errno is the error status if the system call failed. The data associated with a TTEVT_LWP_EXIT event is as follows: typedef struct { int tts_exitcode; } ttexit_data_t; tts_exitcode is the exit code of the process.
ttrace(2) ttrace(2) TT_PROC_SET_SCBM This request allows the debugger to pass a bitmap to the kernel indicating which system calls should cause a debugger stop. The addr argument must be set to TTSCBM_SELECT or TTSCBM_UNSELECT to indicate whether the bitmap represents a positive (meaning that the calls in the bitmap will result in a stop) or a negative (meaning that all calls except those in the bit map will result in a stop) list. The data argument is the size of the bitmap, in bytes.
ttrace(2) ttrace(2) these arguments, this address can be used to retrieve the full argument and environment list. Note: This request is not supported on PA-RISC versions of HP-UX. Other Requests All other requests, except non debug-related requests below, are targeted to a specific thread in the target process. Also, all other requests require both the pid of the target process and an lwpid specifying a valid thread in the target process.
ttrace(2) ttrace(2) Note: The available breakpoint registers must be shared between process-wide breakpoints and per-thread breakpoints. If a breakpoint register is currently being used as a process-wide breakpoint within the target process, it may not be used for a per-thread breakpoint in any thread of the target process. Note: These requests are not supported on PA-RISC versions of HP-UX.
ttrace(2) ttrace(2) Important If an event is requested by the process, the event mask of the thread is not examined. For the event mask of the thread to be significant, the process event must be be unset. Similarly, if an event option is enabled in the process, the option for the thread is not considered. Event masks may be inherited across fork() using the tte_opts options in the ttevent_t structure. If TTEO_PROC_INHERIT is set, the child process inherits the event mask of its parent.
ttrace(2) ttrace(2) system call number, its number of arguments and all its arguments, its return value and its error return in the ttstate_t structure. If the system call is a fork(), vfork() or exec() and if, respectively, the TTEVT_FORK, TTEVT_VFORK or TTEVT_EXEC event is set, only the notification associated with these events is performed. See the TT_PROC_SET_SCBM request. TTEVT_SYSCALL_ENTRY This event flag requests notification of system call entry points.
ttrace(2) ttrace(2) Reg __gp __r1 __r2-__r3 __r4-__r7 __ret0-__ret3 __r8-__r11 __sp __r12 __tp __r13 __r14-__r31 __r32-__r127 Interuption Syscall Notes R/W R/W Global Pointer R/W R/W Reads as 0 R/W Scratch registers R/W R/W R/W R/W R/W R/W R/W Reads as 0 See TT_LWP_RDRSEBS TT_LWP_WRRSEBS __f2-__f5 __f6-__f15 __f16-__f31 __f32-__f127 R/W R/W R/W R/W R/W Read as 0.0 R/W Read as 0.
ttrace(2) ttrace(2) __ar_lc __ar65 __ar_ec __ar66 __reason R/W R/W R/W R/W R R 0 == syscall context, non-zero == interruption context __ip R/W R/W Low-order 2-bits indicate slot number. __cfm R/W R/W Current Frame Marker corresponding to __ip __ed R/W Reads as 0 May not be set if not previously set. __cr_isr __cr17 __cr_iipa __cr22 R R On PA-RISC, the words at offset addr in the save_state structure are returned to the calling process. The data argument is the size of the read.
ttrace(2) ttrace(2) [EINVAL] An offset in the save_state structure is not word-aligned. [EINVAL] An invalid register is targeted by TT_LWP_WUREGS. [EINVAL] The core file argument to a TT_PROC_CORE request exists and is not a regular file. [ENOENT] The directory portion of the core file argument to a TT_PROC_CORE request does not exist. [EINVAL] The size argument to a TT_PROC_GET_PATHNAME is larger than MAXPATHLEN. [EACCES] The pid argument to the TT_PROC_ATTACH is the pid of the invoker.
ttrace(2) ttrace(2) static char * gen_name(_exp_t *base, int val) { _exp_t *rp; for (rp = base; rp->name; rp++) { if (val == rp->val) { return rp->name; } } return NULL; } A tA static char * ev_name(ttevents_t ev) { char buf[32]; char *p; static _exp_t tab[] = { TTEVT_SIGNAL, "SIGNAL", TTEVT_FORK, "FORK", TTEVT_EXEC, "EXEC", TTEVT_EXIT, "EXIT", TTEVT_VFORK, "VFORK", TTEVT_SYSCALL, "SYSCALL", TTEVT_SYSCALL_ENTRY, "SYSCALL_ENTRY", TTEVT_LWP_CREATE, "LWP_CREATE", TTEVT_LWP_TERMINATE, "LWP_TERMINATE", TTEV
ttrace(2) ttrace(2) TT_PROC_DETACH, TT_PROC_CONTINUE, TT_PROC_SET_EVENT_MASK, TT_PROC_GET_FIRST_LWP_STATE, TT_PROC_GET_NEXT_LWP_STATE, TT_LWP_CONTINUE, -1, "PROC_DETACH", "PROC_CONTINUE", "PROC_SET_EVENT_MASK", "PROC_GET_FIRST_LWP_STATE", "PROC_GET_NEXT_LWP_STATE", "LWP_CONTINUE", NULL }; rval = ttrace(req, pid, lwpid, addr, data, addr2); if (rval == -1) { p = gen_name(tab, req); errexit(p ? p : "ttrace"); } } static void show_syscall(const ttstate_t *stp) { int nargs = stp->tts_scnargs; ttevents_t evt
ttrace(2) ttrace(2) (void) printf("("); for (i = 0, argp = stp->tts_scarg; i < nargs; i++, argp++) { (void) printf("%#llx", *argp); (void) printf("%s", (i == nargs - 1) ? "" : ", "); } (void) printf(")"); } if (stp->tts_event == TTEVT_SYSCALL_RETURN) { if (stp->tts_u.tts_syscall.tts_errno) { (void) printf(" ERR%d", stp->tts_u.tts_syscall.tts_errno); } else { (void) printf(" = %lld", stp->tts_u.tts_syscall.tts_rval[0]); } } else { (void) printf(" ...
ttrace(2) ttrace(2) ev.tte_events = TTEVT_SYSCALL|TTEVT_EXEC|TTEVT_EXIT; ev.tte_opts = TTEO_NONE; if (pid) { siginfo_t si; dottrace(TT_PROC_ATTACH, pid, 0, TT_DETACH_ON_EXIT, TT_VERSION, 0); if (waitid(P_PID, pid, &si, WEXITED|WSTOPPED) < 0 || si.si_pid != pid || si.
ttrace(2) ttrace(2) int rval = ttrace_wait(pid, 0, TTRACE_WAITOK, &st, sizeof st); if (rval < 0) { errexit("ttrace_wait"); } show_event(&st); if (st.tts_event == TTEVT_EXIT) { break; } dottrace(TT_LWP_CONTINUE, pid, st.tts_lwpid, TT_NOPC, st.tts_event == TTEVT_SIGNAL ? (uint64_t) st.tts_u.tts_signal.
ttrace_wait(2) ttrace_wait(2) NAME ttrace_wait - wait for ttrace event SYNOPSIS #include int ttrace_wait(pid_t pid, lwpid_t lwpid, ttwopt_t option, ttstate_t *tsp, size_t size); DESCRIPTION The ttrace_wait() system call provides a means to wait for a ttrace() event to occur. A tracing process (debugger) will normally invoke ttrace_wait() after a process or any of its threads has been set running. ttrace_wait() synchronizes tracing requests directed at threads within the traced process.
ttrace_wait(2) ttrace_wait(2) SEE ALSO ttrace(2), wait(2).
tuneinfo2(2) tuneinfo2(2) NAME tuneinfo2 - retrieve detailed information about kernel tunable parameters SYNOPSIS #include int tuneinfo2(int version, const char *tunable, tuneinfo2_t *buf, size_t *bufsize); TUNEINFO_STRING(tunable, string) DESCRIPTION This function provides detailed information about one or all kernel tunable parameters. If a particular parameter is of interest, specify it by name in tunable .
tuneinfo2(2) tuneinfo2(2) reflect any restrictions on the tunable value based on transient factors like the current usage pattern of the system. For example, the maximum value returned for maxfiles (the number of files a process may have open) will be no greater than the current value of nfile (the number of files the system may have open). However, the minimum value returned for maxfiles may very well be less than the number of files that some existing process has open.
tuneinfo2(2) tuneinfo2(2) /* 2. Allocate that much space: */ buf = (tuneinfo2_t *)malloc(bufsize); if (buf == NULL) { ... } /* 3. Query the data: */ count = tuneinfo2(TUNEINFO_VERSION, NULL, buf, &bufsize); if (count < 0) { ... } /* 4.
ualarm(2) ualarm(2) NAME ualarm - set the interval timer SYNOPSIS #include useconds_t ualarm(useconds_t useconds, useconds_t interval); DESCRIPTION The ualarm() function causes the SIGALRM signal to be generated for the calling process after the number of real-time microseconds specified by the useconds argument has elapsed. When the interval argument is non-zero, repeated timeout notification occurs with a period in microseconds specified by the interval argument.
ulimit(2) ulimit(2) NAME ulimit - get and set user limits SYNOPSIS #include long ulimit(int cmd, ...); Remarks The ANSI C ", ..." construct denotes a variable length argument list whose optional [or required] members are given in the associated comment (/* */). DESCRIPTION ulimit() provides for control over process limits. Available values for cmd are: UL_GETFSIZE Get the file size limit of the process. The limit is in units of 512-byte blocks and is inherited by child processes.
umask(2) umask(2) NAME umask - set and get file creation mask SYNOPSIS #include mode_t umask(mode_t cmask); DESCRIPTION umask() sets the process’s file mode creation mask to umask() and returns the previous value of the mask. Only the file access permission bits of the masks are used. The bits set in cmask specify which permission bits to turn off in the mode of the created file, and should be specified using the symbolic values defined in stat (5).
umount(2) umount(2) NAME umount - unmount a file system SYNOPSIS #include int umount(const char *name); DESCRIPTION umount() requests that a previously mounted file system contained on the block special device identified by name be unmounted. name is a pointer to a path name. After unmounting the file system, the directory upon which the file system was mounted reverts to its ordinary interpretation.
uname(2) uname(2) NAME uname(), setuname() - get information about computer system; set node name (system name) SYNOPSIS #include int uname(struct utsname *name); int setuname(const char *name, size_t namelen); DESCRIPTION uname() The uname() system call places information identifying the computer system in the utsname structure pointed to by name. The utsname structure, defined in
uname(2) uname(2) [EFAULT] name points to an illegal address. The reliable detection of this error is implementation dependent. [EPERM] setuname() was attempted by a process lacking appropriate privileges. AUTHOR uname() was developed by AT&T and HP. SEE ALSO hostname(1), uname(1), setuname(1M), gethostname(2), sethostname(2). STANDARDS CONFORMANCE uname(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.
unlink(2) unlink(2) NAME unlink - remove directory entry; delete file SYNOPSIS #include int unlink(const char *path); DESCRIPTION The unlink() system call removes the directory entry named by the path name pointed to by path . When all links to a file have been removed and no process has the file open, the space occupied by the file is freed and the file ceases to exist.
unlink(2) unlink(2) SEE ALSO rm(1), close(2), link(2), open(2), rmdir(2), remove(3C). STANDARDS CONFORMANCE unlink(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.
usleep(2) usleep(2) NAME usleep - suspend execution for an interval SYNOPSIS #include int usleep(useconds_t useconds); DESCRIPTION The usleep() function will cause the calling thread to be suspended from execution until either the number of real-time microseconds specified by the argument useconds has elapsed, or a signal is delivered to the calling thread and its action is to invoke a signal-catching function or to terminate the process.
ustat(2) ustat(2) NAME ustat() - get mounted file system statistics SYNOPSIS #include int ustat(dev_t dev, struct ustat *buf); DESCRIPTION The ustat() system call returns information about a mounted file system. dev is a device number identifying a device containing a mounted file system. buf is a pointer to a ustat structure (defined in
utime(2) utime(2) NAME utime() - set file access and modification times SYNOPSIS #include int utime(const char *path, const struct utimbuf *times); DESCRIPTION The utime() system call sets the access and modification times of the file to which the path argument refers. If times is a NULL pointer, the access and modification times of the file are set to the current time. A process must be the owner of the file or have write permission on the file to use utime() in this manner.
utime(2) utime(2) STANDARDS CONFORMANCE utime(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.
utimes(2) utimes(2) NAME utimes() - set file access and modification times SYNOPSIS #include int utimes(const char *path, const struct timeval times[2]); DESCRIPTION The utimes() function sets the access and modification times of the file pointed to by the path argument to the value of the times argument. The utimes() function allows time specifications accurate to the microsecond. For utimes(), the times argument is an array of timeval structures.
vfork(2) vfork(2) NAME vfork - spawn new process; share virtual memory SYNOPSIS #include pid_t vfork(void); REMARKS vfork() is a higher performance version of fork() that is provided on some systems where a performance advantage can be attained. If the calling process is multi-threaded, the newly created child process will only contain one thread. This one thread will be a copy of the thread calling vfork().
vfork(2) vfork(2) SIGSEGV or SIGBUS. In the [vfork,exec] window, a call to signal() (see signal (2) that installs a catching function can affect handling of the signal by the parent. The parent is not affected if the handling is being set to SIG_DFL or SIG_IGN, or if either sigaction() or sigvector() is used (see sigaction (2) and sigvector (2)). AUTHOR vfork() was developed by the University of California, Berkeley. SEE ALSO exec(2), exit(2), fork(2), wait(2).
vfsmount(2) vfsmount(2) (TO BE OBSOLETED) NAME vfsmount - mount a file system SYNOPSIS #include int vfsmount(int type, const char *dir, int flags, caddr_t data); Remarks This routine is included only for compatibility with past releases. It works only with UFS (HFS), NFS, and CDFS file systems. For maximum portability and improved functionality, new applications should use the mount() system call (see mount (2)). DESCRIPTION The vfsmount() system call attaches a file system to a directory.
vfsmount(2) vfsmount(2) (TO BE OBSOLETED) MS_BEHIND and MS_DELAY are mutually exclusive. MS_NO_FSASYNC Specify that rigorous posting of file system metadata is to be used. This is the default. MS_FSASYNC Specify that relaxed posting of file system metadata is to be used. This may lead to better performance for certain applications; but there is increased potential for data loss in case of a crash. MS_FSASYNC and MS_NO_FSASYNC are mutually exclusive.
vfsmount(2) vfsmount(2) (TO BE OBSOLETED) [EINVAL] A value in a field of data is out of proper range. See mountd (1M), getfh (2), and inet (7F) for more information. WARNINGS The mount command (see mount (1M)) is preferred over vfsmount() because mount supports all mounting options that are available from vfsmount() directly, plus mount also maintains the /etc/mnttab file which lists what file systems are mounted. Obsolescent Interfaces vfsmount() is to be obsoleted at a future date.
wait(2) wait(2) NAME wait, waitpid - wait for child process to stop or terminate SYNOPSIS #include #include pid_t wait(int *stat_loc); pid_t waitpid(pid_t pid, int *stat_loc, int options); DESCRIPTION The wait() and waitpid() functions shall obtain status information pertaining to one of the caller’s child processes. Various options permit status information to be obtained for child processes that have terminated or stopped.
wait(2) wait(2) stopped and traced and whose status has not yet been reported. If the calling process has the signal action SA_NOCLDWAIT set or has SIGCHLD set to SIG_IGN, and the process has no unwaited-for children that were transformed into zombie processes, the calling thread shall block until all of the children of the process containing the calling thread terminate, and wait() and waitpid() shall fail and set errno to [ECHILD].
wait(2) wait(2) If the information pointed to by stat_loc was stored by a call to waitpid() that did not specify the WUNTRACED flag and specified the WCONTINUED lag, or by a call to the wait() function, exactly one of the WIFEXITED(*stat_loc), macros WIFSIGNALED(*stat_loc), and WIFCONTINUED(*stat_loc) shall evaluate to a non-zero value. There may be additional implementation-dependent circumstances under which wait(), waitpid() report status.
wait(2) wait(2) wait() and waitpid() will not return until all threads in the process have reached the desired state. For example, the wait(), waitpid() calls will not return until all threads have terminated. If the WUNTRACED or WCONTINUED options are specified for the waitpid() call, it will not return until all threads have stopped or continued, respectively. SEE ALSO Exit conditions ($?) in sh(1); exec(2), exit(2), fork(2), pause(2), ptrace(2), signal(5), wait3(2), waitid(2), ,
wait3(2) wait3(2) NAME wait3(), wait4() - wait for child process to change state SYNOPSIS #include pid_t wait3 (int *stat_loc, int options, struct rusage *resource_usage); pid_t wait4 (pid_t pid, int *stat_loc, int options, struct rusage *resource_usage); DESCRIPTION The wait3() and wait4() functions allow the calling process to obtain various status information for a caller’s child process based on the options specified.
wait3(2) wait3(2) APPLICATION USAGE Threads Considerations In a multi-threaded application, only the calling thread is suspended by wait3() and wait4(). The wait3() and wait4() functions will not return until all threads in the process have reached the desired state. For example, wait3() and wait4() will not return until all threads have terminated. If the WUNTRACED or WCONTINUED options are specified, wait3() and wait4() will not return until all threads have stopped or continued respectively.
waitid(2) waitid(2) NAME waitid - wait for child process to change state SYNOPSIS #include int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options); DESCRIPTION The waitid() function suspends the calling process until one of its children changes state. It records the current state of a child in the structure pointed to by infop . If a child process changed state prior to the call to waitid(), waitid() returns immediately.
waitid(2) waitid(2) CHANGE HISTORY First released in Issue 4, Version 2.
write(2) write(2) NAME write, writev, pwrite - write on a file SYNOPSIS #include ssize_t write(int fildes, const void *buf, size_t nbyte); ssize_t pwrite(int fildes, const void *buf, size_t nbyte, off_t offset); #include ssize_t writev(int fildes, const struct iovec *iov, int iovcnt); DESCRIPTION The write() function attempts to write nbyte bytes from the buffer pointed to by buf to the file associated with the open file descriptor, fildes .
write(2) write(2) • The system-dependent maximum number of bytes that a pipe or FIFO can store is PIPSIZ as defined in . • The minimum value of PIPSIZ on any HP-UX system is 8192. When writing a pipe with the O_NDELAY or O_NONBLOCK file status flag set, the following apply: • If nbyte is less than or equal to PIPSIZ and sufficient room exists in the pipe or FIFO, the write() succeeds and returns the number of bytes written.
write(2) write(2) performed by the owner or a user who has appropriate privileges, the behavior is file-system dependent. In some file systems, the write clears the set-user-ID, set-group-ID, and sticky bits on a nondirectory file. In other file systems, the write does not clear these bits on a nondirectory file. For directories, write() does not clear the set-user-ID, set-group-ID, and sticky bits.
write(2) write(2) [ENOSPC] Not enough space on the file system. The process does not possess the limit effective privilege to override this restriction. [ENXIO] A request was made of a non-existent device, or the request was outside the capabilities of the device. [ENXIO] A hangup occurred on the STREAM being written to. [EPIPE] An attempt is made to write to a pipe or FIFO that is not open for reading by any process, or that only has one end open. A SIGPIPE signal will also be sent to the process.
write(2) write(2) STANDARDS CONFORMANCE write(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1, POSIX.