900 Series HP 3000 Computer Systems MPE/iX Developer's Kit Reference Manual Volume I ABCDE HP Part No. 36430-90001 Printed in U.S.A. 1994 Second Edition E0494 FINAL TRIM SIZE : 7.0 in x 8.
UNIX is a registered trademark of UNIX System Laboratories Inc. in the USA and other countries. The information contained in this document is subject to change without notice. Hewlett-Packard makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability or tness for a particular purpose.
Printing History The following table lists the printings of this document, together with the respective release dates for each edition. The software version indicates the version of the software product at the time that this document was issued. Many product releases do not require changes to the document; therefore, do not expect a one-to-one correspondence between product releases and document editions. Edition Date Software Version First Edition Second Edition October 1992 April 1994 A.00.00 C.50.
Preface MPE/iX, Multiprogramming Executive with Integrated POSIX, is the latest in a series of forward-compatible operating systems for the HP 3000 line of computers. In HP documentation and in talking with HP 3000 users, you will encounter references to MPE XL, the direct predecessor of MPE/iX. MPE/iX is a superset of MPE XL. All programs written for MPE XL will run without change under MPE/iX.
Conventions nonitalics Within syntax descriptions, nonitalicized words represent literals. Enter them exactly as shown. This includes angle brackets appearing within syntactic descriptions. For example, #include Nonitalicized words and punctuation characters appear in computer font.
Contents 1. Introduction What Is the POSIX/iX Library? . . . . . . . . . . . . . . The POSIX Standards . . . . . . . . . . . . . . . . . . . How to Use This Manual . . . . . . . . . . . . . . . . . . Using the HP C/iX Library Reference Manual . . . . . . . Using the MPE/iX Developer's Kit Reference Manual, Volume 2 . . . . . . . . . . . . . . . . . . . . . . . . . Using the MPE/iX Shell and Utilities Reference Manual . . . Using The POSIX.1 Standard - A Programmer's Guide . . . Understanding MPE/iX . . . .
3. MPE/iX Library Implementation Considerations Naming File System Objects . . . . . . . . . . . . . . Files . . . . . . . . . . . . . . . . . . . . . . . . POSIX File Types . . . . . . . . . . . . . . . . . Creating and Opening Files . . . . . . . . . . . . . Creating Pipes, FIFOs, and Special Files . . . . . . . Directory Restrictions . . . . . . . . . . . . . . . Input/Output Considerations . . . . . . . . . . . . . File Limits . . . . . . . . . . . . . . . . . . . .
MPE/iX Lockwords . . . . . . . . . . Signals . . . . . . . . . . . . . . . . Supported Signal Functions . . . . . . Signal Descriptions . . . . . . . . . . Additional Implementation Considerations Process Management . . . . . . . . . . Creating a New Process . . . . . . . . MPE/iX Process Handling Capability . Inherited Process Attributes . . . . . Process Termination . . . . . . . . . . Additional Implementation Considerations 4. POSIX/iX access . . alarm . . chdir . . chmod . . chown . . close . .
getenv . . . . geteuid . . . getgid . . . . getgrgid . . . getgrnam . . getgroups . . getlogin . . . getopt . . . . getpid . . . . getpwuid . . . getpgrp . . . getpid . . . . getppid . . . getpwnam . . getpwuid . . . getuid . . . . glob . . . . . globfree . . . ioctl-mag tape ioctl-sockets . ioctl-streams . isatty . . . . kill . . . . . lseek . . . . mkdir . . . . mk fo . . . . mknod . . . . open . . . . opendir . . . pause . . . . pathconf . . . pclose . . . . pipe . . . . . popen . . . . read . . . . .
regerror . . regexec . . regfree . . . rename . . rewinddir . rmdir . . . setuid . . . sigaction . . sigaddset . sigdelset . . sigemptyset sig llset . . sigismember siglongjmp . sigpending . sigprocmask sigsetjmp . sigsuspend . sleep . . . stat . . . . symlink . . sysconf . . system . . . time . . . . times . . . ttyname . . umask . . . uname . . . unlink . . . utime . . . wait . . . . waitpid . . wordexp . . wordfree . . write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5. POSIX/iX Header Descriptions Index Contents-6 FINAL TRIM SIZE : 7.0 in x 8.
Tables 1-1. 3-1. 3-2. 3-3. Summary of POSIX/iX Library Functions . . . . . . . . . MPE/iX Implementations of POSIX File Types . . . . . . . Mapping between POSIX.1 and ACD File Access Permissions Mapping between POSIX.1 and ACD Directory Access Permissions . . . . . . . . . . . . . . . . . . . . . 3-4. Mapping between POSIX.1 and ACD User Classes . . . . . 3-5. POSIX/iX Signals . . . . . . . . . . . . . . . . . . . 5-1. POSIX/iX Library Headers . . . . . . . . . . . . . . .
1 Introduction This chapter provides a summary overview of the POSIX/iX library available through the MPE/iX Developer's Kit (product # 36430A). The following topics are discussed in this chapter: What is the POSIX/iX library? How to use this manual. Overview of the POSIX standards. Understanding MPE/iX. Summary of POSIX/iX library functions.
The POSIX Standards The Institute of Electrical and Electronics Engineers (IEEE) has been investigating the application of standards to information technology. This work has led to a set of standards known collectively as IEEE 1003, or Portable Operating System Interface (POSIX). The IEEE 1003 is actually a group of individual standards that address speci c areas of information technology.
This manual describes C library functions de ned by the POSIX.1 standard. Additional C library functions available through the POSIX/iX library are documented in the HP C/iX Library Reference Manual (30026-90001). Using the HP C/iX Library Reference Manual The HP C/iX Library Reference Manual (30026-90001) contains reference descriptions of ANSI C library functions that are required by the POSIX.1 standard.
The POSIX.1 standard requires that certain ANSI C library functions have additional capabilities or characteristics. These extensions to the behavior of ANSI C library functions are described in the HP C/iX Library Reference Manual (30026-90001) under the appropriate function description. This manual is available as a special core supplement to the MPE/iX FOS manual set.
Understanding MPE/iX The MPE/iX Developer's Kit provides facilities that allow you to develop portable applications while minimizing the need to understand underlying MPE/iX operating system features. However, because the current implementation of the POSIX/iX library does not conform to the POSIX.1 standard, some of the topics discussed in this manual require that you have an understanding of underlying features of the MPE/iX operating system.
Table 1-1. Summary of POSIX/iX Library Functions Standards De nition Function Name Description Location HP C/iX Library Reference Manual a64l() abort() ANSI C, POSIX.1 HP C/iX Library Reference Manual abs() ANSI C, POSIX.1 HP C/iX Library Reference Manual access() POSIX.1 This manual acos() ANSI C, POSIX.1 HP C/iX Library Reference Manual alarm() POSIX.1 This manual asctime() ANSI C, POSIX.1 HP C/iX Library Reference Manual asin() ANSI C, POSIX.
Table 1-1. Summary of POSIX/iX Library Functions (continued) Function Name Standards De nition Description Location bsearch() ANSI C, POSIX.1 HP C/iX Library Reference Manual calloc() ANSI C, POSIX.1 HP C/iX Library Reference Manual catread() HP C/iX Library Reference Manual ccode() HP C/iX Library Reference Manual ceil() ANSI C, POSIX.1 HP C/iX Library Reference Manual cfgetispeed() POSIX.1 Not currently implemented cfgetospeed() POSIX.1 Not currently implemented cfsetispeed() POSIX.
Table 1-1. Summary of POSIX/iX Library Functions (continued) Standards De nition Function Name Description Location HP C/iX Library Reference Manual crypt() ctermid() POSIX.1 This manual ctime() ANSI C, POSIX.1 HP C/iX Library Reference Manual difftime() ANSI C HP C/iX Library Reference Manual div() ANSI C HP C/iX Library Reference Manual dup() POSIX.1 This manual dup2() POSIX.
Table 1-1. Summary of POSIX/iX Library Functions (continued) Function Name fcntl() Standards De nition POSIX.1 Description Location This manual HP C/iX Library Reference Manual fcvt() fdopen() POSIX.1 HP C/iX Library Reference Manual feof() ANSI C, POSIX.1 HP C/iX Library Reference Manual ferror() ANSI C, POSIX.1 HP C/iX Library Reference Manual fflush() ANSI C, POSIX.1 HP C/iX Library Reference Manual fgetc() ANSI C, POSIX.
Table 1-1. Summary of POSIX/iX Library Functions (continued) Standards De nition Function Name Description Location free() ANSI C, POSIX.1 HP C/iX Library Reference Manual freopen() ANSI C, POSIX.1 HP C/iX Library Reference Manual frexp() ANSI C, POSIX.1 HP C/iX Library Reference Manual fscanf() ANSI C, POSIX.1 HP C/iX Library Reference Manual fseek() ANSI C, POSIX.1 HP C/iX Library Reference Manual fsetpos() ANSI C HP C/iX Library Reference Manual fstat() POSIX.
Table 1-1. Summary of POSIX/iX Library Functions (continued) Function Name Standards De nition Description Location HP C/iX Library Reference Manual getmsg() getopt() IEEE, POSIX.2 This manual getpgrp() POSIX.1 This manual getpid() POSIX.1 This manual getppid() POSIX.1 This manual getpwnam() POSIX.1 This manual getpwuid() POSIX.1 This manual gets() ANSI C, POSIX.1 HP C/iX Library Reference Manual getuid() POSIX.1 This manual HP C/iX Library Reference Manual getw glob() POSIX.
Table 1-1. Summary of POSIX/iX Library Functions (continued) Standards De nition Function Name Description Location isdigit() ANSI C, POSIX.1 HP C/iX Library Reference Manual isgraph() ANSI C, POSIX.1 HP C/iX Library Reference Manual islower() ANSI C, POSIX.1 HP C/iX Library Reference Manual isprint() ANSI C, POSIX.1 HP C/iX Library Reference Manual ispunct() ANSI C, POSIX.1 HP C/iX Library Reference Manual isspace() ANSI C, POSIX.
Table 1-1. Summary of POSIX/iX Library Functions (continued) Function Name lseek() Standards De nition POSIX.1 Description Location This manual ltol3() HP C/iX Library Reference Manual mallinfo() HP C/iX Library Reference Manual malloc() ANSI C, POSIX.
Table 1-1. Summary of POSIX/iX Library Functions (continued) Standards De nition Function Name Description Location open() POSIX.1 This manual opendir() POSIX.1 This manual pathconf() POSIX.2 This manual pause() POSIX.1 This manual pclose() POSIX.2 This manual perror() ANSI C, POSIX.1 HP C/iX Library Reference Manual pipe() POSIX.1 This manual popen() POSIX.2 This manual pow() ANSI C, POSIX.1 HP C/iX Library Reference Manual printf() ANSI C, POSIX.
Table 1-1. Summary of POSIX/iX Library Functions (continued) Function Name Standards De nition Description Location realloc() ANSI C, POSIX.1 HP C/iX Library Reference Manual regcomp() POSIX.2 This manual regerror() POSIX.2 This manual regexec() POSIX.2 This manual regfree() POSIX.2 This manual remove() ANSI C, POSIX.1 HP C/iX Library Reference Manual rename() POSIX.1, ANSI C This manual rewind() ANSI C, POSIX.1 HP C/iX Library Reference Manual rewinddir() POSIX.
Table 1-1. Summary of POSIX/iX Library Functions (continued) Standards De nition Function Name Description Location setuid() POSIX.1 This manual setvbuf() ANSI C HP C/iX Library Reference Manual sigaction() POSIX.1 This manual sigaddset() POSIX.1 This manual sigdelset() POSIX.1 This manual sigemptyset() POSIX.1 This manual POSIX.1 This manual sigismember() POSIX.1 This manual siglongjmp() POSIX.1 This manual signal() ANSI C HP C/iX Library Reference Manual sigpending() POSIX.
Table 1-1. Summary of POSIX/iX Library Functions (continued) Function Name Standards De nition Description Location sscanf() ANSI C, POSIX.1 HP C/iX Library Reference Manual stat() POSIX.1 This manual strcat() ANSI C, POSIX.1 HP C/iX Library Reference Manual strchr() ANSI C, POSIX.1 HP C/iX Library Reference Manual strcmp() ANSI C, POSIX.1 HP C/iX Library Reference Manual strcoll() ASNI C HP C/iX Library Reference Manual strcpy() ANSI C, POSIX.
Table 1-1. Summary of POSIX/iX Library Functions (continued) Standards De nition Function Name Description Location strtoul() ANSI C HP C/iX Library Reference Manual strxfrm() ANSI C HP C/iX Library Reference Manual swab() symlink() j HP C/iX Library Reference Manual This manual sysconf() POSIX.2 This manual system() ANSI C, POSIX.2 This manual This manual symlink() tan() ANSI C, POSIX.1 HP C/iX Library Reference Manual tanh() ANSI C, POSIX.
Table 1-1. Summary of POSIX/iX Library Functions (continued) Function Name Standards De nition Description Location tmpfile() ANSI C, POSIX.1 HP C/iX Library Reference Manual tmpnam() ANSI C, POSIX.1 HP C/iX Library Reference Manual HP C/iX Library Reference Manual toascii() tolower() ANSI C, POSIX.1 HP C/iX Library Reference Manual toupper() ANSI C, POSIX.1 HP C/iX Library Reference Manual HP C/iX Library Reference Manual tsearch() ttyname() POSIX.
Table 1-1. Summary of POSIX/iX Library Functions (continued) Standards De nition Function Name Description Location vsprintf() ANSI C HP C/iX Library Reference Manual wait() POSIX.1 This manual waitpid() POSIX.1 This manual wcstombs() ANSI C HP C/iX Library Reference Manual wctomb() ANSI C HP C/iX Library Reference Manual wordexp() POSIX.2 This manual wordfree() POSIX.2 This manual write() POSIX.1 This manual 1-20 Introduction FINAL TRIM SIZE : 7.0 in x 8.
2 Using the POSIX/iX Library The POSIX/iX library provides an extensive library of C functions. The functions provide facilities for such operations as input, output, process management, signal management, mathematics, string manipulation, and time and date operations.
The POSIX/iX library The POSIX/iX library le, /lib/libc.a, contains four classes of C library functions: functions de ned by ANSI C functions de ned by the POSIX.1 standard functions de ned by IEEE P1003.2/D11.2 functions provided to increase portability between MPE/iX and HP-UX The POSIX/iX math library The POSIX/iX math library consists of additional mathematical functions, such as trigonometric and logarithmic functions, that perform oating-point operations.
Specifying the POSIX SOURCE Feature Test Macro An application that includes a header described by the POSIX.1 standard must specify the _POSIX_SOURCE feature test macro prior to any instance of that header being included in the source le. When _POSIX_SOURCE is speci ed in the source le, the following conditions are true: All symbols required by the POSIX.1 standard are made visible to the application. Symbols that are explicitly permitted, but not required, by the POSIX.
Streams Streams are abstractions over le descriptors in order to provide bu ered I/O de ned by ANSI C. ANSI C de nes two types of streams, the text stream and the binary stream; however, the POSIX/iX library does not distinguish between text and binary streams. For more information about streams, refer to the HP C/iX Library Reference Manual (30026-90001). Note The term \stream" should not be confused with the MPE/iX le whose record format is \byte-stream". File descriptors The POSIX.
ANSI C time functions: ctime() gmtime() localtime() mktime() strftime() fseek() exit() fileno() fdopen() fopen() fclose() freopen() fflush() ANSI C functions that read input: fgetc() fgets() fread() getc() getchar() gets() scanf() fscanf() ANSI C functions that write output fputc() fputs() fwrite() putc() putchar() puts() printf() fprintf() vprintf() vfprintf() Using the POSIX/iX Library FINAL TRIM SIZE : 7.0 in x 8.
rewind() perror() tmpfile() ftell() remove() Extensions required by POSIX.1 are documented in the library function descriptions found in the HP C/iX Library Reference Manual (30026-90001). Developing Applications Using the MPE/iX Shell and Utilities Application development using libraries provided with the MPE/iX Developer's Kit must be accomplished through the MPE/iX Shell and Utilities, a command interpreter that provides a set of commands and utilities useful for application development.
Compiling and linking an application that requires libraries available through the MPE/iX Developer's Kit must be accomplished through the c89 command available in the MPE/iX Shell. For detailed information about using the c89 command, refer to the MPE/iX Shell and Utilities Reference Manual, Volumes 1 and 2 (36431-60001). Using the POSIX/iX Library FINAL TRIM SIZE : 7.0 in x 8.
3 MPE/iX Library Implementation Considerations This chapter describes important implementation details that you should understand when using functions provided by the MPE/iX library.
Naming File System Objects The syntax that the operating system uses to resolve an object name that you specify (either a le or directory) to an actual system object depends upon the interface you are using to access or name the object. A name syntax is a set of rules that de nes the structure of valid names for that syntax. The hierarchical le system (HFS) name syntax used by MPE/iX conforms to object name syntax rules de ned by the POSIX.1 standard.
Files This section provides an overview of implementation considerations that you should understand when creating, accessing, and managing les through the POSIX/iX library. For more information about how les are created and managed in a POSIX.1 environment, refer to chapter 3, \Files and Directories", in The POSIX.1 Standard - A Programmer's Guide (36430-90003). Additional information about MPE/iX byte-stream les is located in New Features of MPE/iX: Using the Hierarchical File System (32650-90351).
Creating and Opening Files While MPE/iX supports many le types and le record formats, only MPE/iX byte-stream les can be created or opened using POSIX/iX library functions. Attempts to open an existing le that is not a byte-stream le result in an error, with errno set to EIMPL. This applies to emulators. The group ID (GID) of a newly created le or directory is set to the GID of the directory (the parent directory) in which the le is created.
File Limits MPE/iX supports le limits on all objects created on the system to allow users to control the maximum size a that le can attain. Files created through POSIX/iX library functions have le limits. The default le limit for a byte-stream le is two gigabytes when created through POSIX/iX library functions. A le's le limit cannot be manipulated through POSIX/iX functions.
not associated with access control bits must be set to zeros or the function returns an error, with errno set to EIMPL. On MPE/iX, the le structure associated with directory streams is implemented using a le descriptor. One e ect of this implementation is encountered when using an exec() function to execute a le.
MPE/iX HFS directory services present an integrated view of the le system. Files and hierarchical directories can be created anywhere in the le system. MPE/iX accounts and MPE/iX groups are special directories that serve as directories while continuing to serve as \classic" MPE accounts and groups. POSIX/iX directory functions can access any le in the le system hierarchy, including les in the \classic" MPE directory structure, using HFS syntax.
any other hierarchical directory. File information functions can be used to return information about these directories. MPE/iX Account Features MPE/iX accounts cannot be created, renamed, copied, or purged through POSIX/iX library functions. MPE/iX accounts can be created directly under the root directory only by a user with SM capability using the MPE/iX CI command NEWACCT. Access permissions for an MPE/iX account are read and execute access for all users and write access for none.
When an MPE/iX group name is a component in a pathname, it must be speci ed in uppercase. Files and hierarchical directories can be created at any level beneath MPE/iX groups. Names of les and hierarchical directories created directly under MPE/iX groups are restricted to 16 characters in length. MPE/iX groups (and, indirectly, all les and hierarchical directories at all levels under them) can optionally be assigned to a user volume set.
Names of hierarchical directories and les located directly under either the root directory or MPE/iX groups are restricted to 16 characters in length. Names of hierarchical directories that are not directly under either the root directory or MPE/iX groups are restricted to 255 characters in length. This limit is de ned by {NAME_MAX}, found in the header . Hierarchical directories contain explicit dot (.) and dot dot (..) directory entries.
Additional Implementation Considerations The return type of the rewinddir() function is implemented as int in order to return a value of -1 indicating an error. The POSIX.1 standard calls for no value to be returned (void). A strictly conforming POSIX.1 application should not evaluate values returned by rewinddir().
MPE/iX Access Control Definitions Access permissions de ned by the POSIX.1 standard are fully supported in the POSIX/iX library through the use of the MPE/iX access control de nition (ACD) facility. POSIX.1 security is fully integrated with MPE/iX security. Except in cases described below, ACD access control remains transparent when accessed through POSIX/iX library functions. The POSIX/iX library automatically provides translation between the POSIX.
The following table describes the correspondence between POSIX.1 directory access permissions and MPE/iX ACD access permissions. Table 3-3. Mapping between POSIX.1 and ACD Directory Access Permissions POSIX.
Table 3-4. Mapping between POSIX.1 and ACD User Classes POSIX.1 File Classes ACD User Speci cations File owner $OWNER File group $GROUP and $GROUP_MASK File other @.@ The $OWNER ACD entry speci es the owner of the le or directory. A user is a le or directory owner if the user's e ective UID matches the UID of the le. The $GROUP ACD entry speci es the group members of the le or directory. A user is a le or directory group member if the user's e ective GID matches the GID of the le.
Example of POSIX file security and underlying ACD File Owner Class File Group Class File Other Class rwx r-x --x R,W,X,RACD:$OWNER R,X,RACD:$GROUP R,X, RACD:$GROUP_MASK X:@.@ If the ACD Has Been Modified or Removed If you are accessing les that were not created through POSIX/iX library functions, or whose security was modi ed by MPE/iX commands or system intrinsics, the ACDs may be missing any or all of the four ACD user speci cation entries $OWNER, $GROUP, $GROUP_MASK, and @.@.
If the ACD contains no $GROUP_MASK entry, fstat() and stat() return for the le group class the access permissions resulting from ORing all le group class members (all user.account entries, @.account entries, and the $GROUP entry). If the $GROUP entry and the @.account entry that corresponds to the le GID are both missing, and an @.@ entry exists, the permissions associated with the @.@ entry are included in the calculation.
Summary of chmod() Behavior MPE/iX uses the rules described in the following sections when determining how the chmod() function modi es access permissions. If the File or Directory has an ACD If the ACD contains the $GROUP entry, and does not contain user.account or @.account entries, the $GROUP entry is assigned the le group class access permissions passed by chmod(), plus RACD access. If the ACD contains the $GROUP entry as well as user.account or @.
If the ACD contains the @.@ entry, the @.@ entry is assigned the le other class access permissions passed by chmod(), plus RACD access. If the ACD contains no @.@ entry, the @.@ entry is created with the le other class access permissions passed in chmod(), plus RACD access.
queries of directory and le access permissions to occur through the stat() and fstat() functions without error. MPE/iX provides facilities outside the POSIX/iX library to manipulate the RACD access permission of a directory or le. If a process attempts to invoke the fstat() or stat() function on a directory or le with an ACD that does not allow RACD access to that process, both functions return an error, with errno set to EPERM.
Signals This section provides an overview of implementation considerations that you must understand when using signals as they are implemented in the POSIX/iX library. For more information about how signals are used in a POSIX.1 environment, refer to chapter 5, \Signals", in The POSIX.1 Standard - A Programmer's Guide (36430-90003). Supported Signal Functions All signal functions de ned by the POSIX.1 standard are implemented in the POSIX/iX library.
Table 3-5. POSIX/iX Signals Constant Default Action Description and Implementation Details SIGABRT Abnormal Abnormal termination signal (initiated by the abort() termination function). Required for POSIX.1 conformance. SIGALRM Abnormal Timeout signal (initiated by the alarm() function). termination Required for POSIX.1 conformance. SIGBUS Abnormal Address violation. SIGBUS is not required for POSIX.1 termination conformance, but is a signal commonly used on UNIXTM -based systems. A POSIX.
Table 3-5. POSIX/iX Signals (continued) Constant Default Action Description and Implementation Details SIGKILL Abnormal Termination signal (cannot be caught or ignored). If an termination application attempts to change the default action associated with SIGKILL, the attempt is ignored without error. Required for POSIX.1 conformance. SIGPIPE Abnormal Write on a pipe with no readers. termination Required for POSIX.1 conformance. SIGPOLL Ignore SIGQUIT Abnormal Interactive termination signal.
Table 3-5. POSIX/iX Signals (continued) Constant Default Action Description and Implementation Details Job Control Signals SIGCHLD Ignore the signal Child process stopped or terminated. Required for POSIX.1 conformance. SIGCONT Continue if Continue if stopped. This signal is never generated by the system. stopped; otherwise, Required for POSIX.1 conformance. ignore SIGSTOP Stop the process Stop signal (cannot be caught or ignored).
Additional Implementation Considerations On MPE/iX, signals cannot be delivered to a process while that process is executing system code. The signal remains pending until control returns to the calling process. A sending process cannot rely on timely delivery of a signal if the target process is executing system code.
If the sigmask parameter of the sigsuspend() function is set to NULL, the process is suspended with the current signal mask. This implementation is considered an extension to the POSIX.1 standard. A strictly conforming POSIX application should pass in the sigmask parameter of the sigsuspend() function the current signal mask returned by a successful call to sigprocmask() where set is set to NULL.
Creating a New Process The following implementation considerations must be understood when using fork() or an exec() function to create or execute processes. The executable le must have an MPE/iX le code of NMPRG. The MPE/iX process handling (PH) capability must be appropriately assigned. Process handling capability is described in the section \MPE/iX Process Handling Capability.
Inherited Process Attributes Because processes created through POSIX/iX library functions reside in an MPE/iX process environment, certain MPE/iX process attributes are inherited by a process created by fork(); however, these MPE/iX process attributes are not visible in the POSIX/iX environment.
CPU time accounting information accrued by process is not made available to the parent process through the wait() and waitpid() functions. A zero is always returned. Attempts to use the fork() or exec() function to create a new process fails if the calling process has active switches to MPE/iX compatibility mode (CM) code has set critical mode has outstanding NOWAITIO is holding an operating system internal resource (SIR) 3-28 MPE/iX Library Implementation Considerations FINAL TRIM SIZE : 7.0 in x 8.
4 POSIX/iX Library Function Descriptions This chapter describes POSIX/iX library functions de ned in the POSIX.1 standard. Function descriptions are arranged alphabetically. POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
access Check le accessibility Syntax #include int access (const char *path, init amode); Parameters path amode The pathname of a le. One of the following le access permissions. The bitwise inclusive OR of the following access permission constants to be checked: Descriptions Access Permissions R OK Test for read permission. W OK Test for write permission. X OK Test for execute or search permission. Or the existence test (F OK) Other values of the amode argument are ignored.
access Implementation Considerations None. Errors If an error occurs, errno is set to one of the following values: E2BIG CAUSE CAUSE The number of bytes used by the new process image's argument list and environment list combined is greater than the limit of {ARG_MAX} (de ned in ). Reduce the size of the argument list or environment list or both. One of the following: ACTION The calling process does not have search permission to a component of the pathname.
access ENAMETOOLONG CAUSE ACTION ENOENT CAUSE ENOEXEC ACTION CAUSE ACTION ENOMEM CAUSE ACTION ENOTDIR 4-4 CAUSE ACTION One of the following: The length of the pathname exceeds the {PATH_MAX} limit (de ned in the le ). A component of the pathname is longer than {NAME_MAX} (de ned in ), and {_POSIX_NO_TRUNC} is in e ect for that directory. Make sure that both the component's length and the full pathname length do not exceed the {NAME_MAX} or {PATH_MAX} limits.
access EPERM CAUSE One of the following: ACTION The calling process does not have the MPE/iX process handling (PH) capability. The calling process has outstanding switches to CM code, has set critical mode, has outstanding NOWAITIO, or is holding an operating system internal resource, or the calling process is in a Procedure Exit handler. One of the following: Link the program le with the MPE/iX PH capability.
alarm Schedules a SIGALRM signal. Syntax #include unsigned int alarm (unsigned int seconds); Parameters seconds The number of real-time seconds to wait before generating a SIGALRM signal. A zero cancels any previously scheduled alarm request. Return Values 0 >0 Success. There is no previously scheduled alarm. Success. The number of seconds remaining on a previously scheduled alarm is returned.
alarm Implementation Considerations Currently, alarm() does not cause a read timeout. Errors None. See Also fork(), pause(), sigaction(), , POSIX.1 (Section 3.4.1) POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
chdir Changes the current working directory. Syntax #include int chdir (const char *pathname); Parameters pathname A pointer to a string containing the pathname of the directory to be the current working directory. The pathname must be terminated by a null character. Return Values 0 -1 Success. An error occurred. The current working directory is not changed, and errno is set to indicate the error condition.
chdir Errors If an error occurs, errno is set to one of the following values: EACCES CAUSE ACTION EFAULT CAUSE EIMPL ACTION CAUSE ACTION ENAMETOOLONG CAUSE ACTION ENOENT ENOTDIR ESYSERR CAUSE ACTION CAUSE ACTION CAUSE ACTION The calling process does not have search permission to a component of the pathname. Make sure that the calling process has search permission to all components of the pathname.
chmod Changes le access permissions. Syntax #include #include int chmod (const char *pathname, mode_t mode); Parameters pathname mode 4-10 A pointer to a string containing the pathname of a le or directory whose access permissions are to be modi ed. The pathname must be terminated by a null character. New access permissions.
chmod S_IWOTH S_IXOTH Set le other class write permission bit. Set le other class execute (if a le) or search (if a directory) permission bit. Unused bits of the mode parameter not associated with access permissions must contain zeros, or an error occurs. Return Values 0 -1 Success. An error occurred. Access permission bits are not changed, and errno is set to indicate the error condition.
chmod If bits in mode other than access permission bits are set to a nonzero value, an error is returned and access permission bits are not changed. Errors If an error occurs, errno is set to one of the following values: EFAULT CAUSE EIMPL ACTION CAUSE The calling process does not have search permission to a component of the pathname. Make sure that the calling process has search permission to all component directories in the pathname.
chmod ENAMETOOLONG CAUSE ACTION CAUSE ACTION CAUSE The length of the pathname exceeds the {PATH_MAX} limit (de ned in the le ). A component of the pathname is longer than {NAME_MAX} (de ned in ), and {_POSIX_NO_TRUNC} is in e ect for that directory. Make sure that both the component's length and the full pathname length do not exceed the {NAME_MAX} or {PATH_MAX} limits. The speci ed le does not exist, or pathname points to an empty string. Specify an existing lename.
chown Changes the owner and group of a le. Syntax #include #include int chown (const char *pathname, uid_t owner, gid_t group); Parameters pathname owner group A pointer to a string containing the pathname of a le whose user ID and group ID are to be modi ed. The pathname must be terminated by a null character. The new owner (user ID) of the le. The new group ID of the le. Return Values 0 -1 Success. An error occurred.
chown A system manager (a user who has the MPE/iX system manager (SM) user capability). In this case, owner can specify any UID existing in the user database. In order to change the GID of a le, the user associated with the calling process must be one of the following: The le owner (a user whose e ective UID matches the UID of the le). In this case, owner must specify the le's UID and group must specify the le owner's own GID.
chown Changing an object's le owner ID (UID) or le group ID (GID) changes access control for that le or directory. File owners of les and directories can also change the access permissions granted to the object. Changing an object's UID or GID also changes the le owner or le group referenced by $OWNER and $GROUP entries in the ACD associated with the le or directory.
chown ENAMETOOLONG CAUSE One of the following: EINVAL ACTION CAUSE ACTION CAUSE EPERM ACTION CAUSE The length of the pathname exceeds the {PATH_MAX} limit (de ned in the le ). A component of the pathname is longer than {NAME_MAX} (de ned in ), and {_POSIX_NO_TRUNC} is in e ect for that directory. Make sure that both the component's length and the full pathname length do not exceed the {NAME_MAX} or {PATH_MAX} limits.
close Closes a le. Syntax #include int close (int ldes); Parameters ldes An open le descriptor. Return Values 0 -1 Success. The le is closed. An error occurred. The le is not closed, and errno is set to indicate the error condition. Description The close() function closes the le speci ed by ldes . Upon the close, all record locks held by the calling process on the le associated with ldes are removed.
close Implementation Considerations Refer to the ESYSERR error description below. Signals generated for the calling process during the execution of close() are deferred from delivery until the completion of close(). Errors If an error occurs, errno is set to one of the following values: EBADF CAUSE ACTION ESYSERR CAUSE ACTION The ldes parameter is not a valid open le descriptor. Check to see if ldes has been altered or is not initialized.
closedir Closes a directory stream. Syntax #include #include int closedir (DIR *dirp); Parameters dirp A pointer to a structure of type DIR representing an open directory stream (returned by a call to opendir()). Return Values 0 -1 Success. The directory is closed. An error occurred. The directory le is not closed, and errno is set to indicate the error condition. Description The closedir() function closes the open directory le pointed to by dirp .
closedir Errors If an error occurs, errno is set to one of the following values: EBADF CAUSE ACTION EFAULT CAUSE ACTION The dirp parameter does not point to an open directory stream. Pass a pointer to an open directory stream returned by the opendir() function. The system detected a NULL or bad address in attempting to use the dirp parameter. Make sure that the pointer is correctly initialized. See Also opendir(), readdir(), rewinddir(), , POSIX.1 (Section 5.1.
confstr Determine string-valued system con guration options. Syntax #include size_t confstr(int name, char *buf, size_t len); Parameters name Speci es the system con guration option, the string value of which you want to obtain. The value of name may be any one of a set of symbols de ned in ; each of these symbols corresponds to a system con guration option. Possible symbols are: CS PATH This name is used to return a value for the PATH environment variable that can nd all the POSIX.
confstr Description confstr() is for options that have a string value; for options with a numeric value, use sysconf(). Unless there is an error, confstr() returns the length of the con guration de ned string, including the null termination character. This may be greater than len if len wasn't big enough to hold the entire string value. If len is zero and buf is a NULL pointer, confstr() does not attempt to return a string but does return the appropriate length.
creat Creates a new le or rewrites an existing le. Syntax #include #include #include int creat (const char *pathname, mode_t mode); Parameters pathname mode 4-24 A pointer to a string containing the pathname of a le to be created or rewritten. The pathname must be terminated by a null character. File access permission bits. If the le already exists, mode is ignored.
creat S_IROTH S_IWOTH S_IXOTH Set le other class read permission bit. Set le other class write permission bit. Set le other class execute (if a le) or search (if a directory) permission bit. Return Values >=0 -1 Success. A nonnegative integer is returned representing the lowest numbered le descriptor not open by the calling process. An error occurred. The le is not opened, and errno is set to indicate the error condition.
creat If the le already exists, the following occurs: The le is truncated to zero length, and the le o set is set to the beginning of the le. The le's UID, GID, and mode remain unchanged. The st_ctime and st_mtime time elds of the le are marked for update.
creat Errors Refer to the error section of the open() function description for errors returned by creat(). Possible errors returned by creat() are the same as those returned by open() when o ag is set to (O_WRONLY | O_CREAT | O_TRUNC). See Also. open(), close(), dup(), execl(), execv(), , lseek(), read(), , fstat(), stat(), , write(), umask(), POSIX.1 (Section 5.3.2) POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
ctermid Identi cation of controlling terminal. Syntax #include char *ctermid(char *s); Parameters s The address of an array that will receive the pathname fo the current controlling terminal. Return Values If s is not NULL then it points to an array of char L ctermid bytes long, or longer, as de ned in . An empty string is returned if the ctermid() function is unsuccessful. Description The ctermid() function returns a string that can be used as a lename for referencing a terminal.
dup, dup2 dup, dup2 Duplicates an open le descriptor. Syntax #include int dup (int ldes); int dup2(iint ldes, int ldes2) Parameters ldes An open le descriptor. Return Values >=0 -1 Success. A new le descriptor is returned. An error occurred. the open le descriptor is not duplicated, and errno is set to indicate the error condition. Description The dup() and dup2 functions return the lowest numbered le descriptor not currentely open by the calling process.
dup, dup2 Errors If an error occurs, errno is set to one of the following values: CAUSE EBADF ACTION CAUSE EEXCL ACTION EMFILE CAUSE ESYSERR ACTION CAUSE ACTION The parameter ldes is not a valid open le descriptor. Check to see if the value passed in ldes has been altered or whether the le indicated by ldes was ever opened. The speci ed le descriptor is opened for exclusive access. Do not attempt to duplicate a le descriptor that is opened for exclusive access.
execl execl Executes a le. Syntax #include int execl (const char *pathname, const char *arg0, ..., const char *argn-1, (const char *)0); Parameters pathname arg0, ..., argn A pointer to a string containing the pathname of the executable le that is to become the new process image. The pathname must be terminated by a null character. The elements of the pathname must be uppercase and must resolve to a valid MPE/iX le, group, and account.
execl Description The execl() function replaces the current process image with a new process image created from the executable le speci ed in pathname . Use the execl() function if you know the exact number of arguments to be passed to the new process image. Use the execv() function if the number of arguments passed to the new process image might vary at run time.
execl The following attributes of the new process image are set to the same values of those of the calling process: process ID parent process ID process group ID session membership real user ID real group ID time remaining until a SIGALRM signal current working directory root directory le mode creation mask process signal mask pending signals tms_utime, tms_stime, tms_cutime, and tms_cstime The executable le's st_atime time eld is marked for update.
execl Errors If an error occurs, errno is set to one of the following values: CAUSE E2BIG CAUSE The number of bytes used by the new process image's argument list and environment list combined is greater than the limit of {ARG_MAX} (de ned in ). Reduce the size of the argument list or environment list or both. One of the following: ACTION The calling process does not have search permission to a component of the pathname. The calling process does not have execute permission to the le.
execl ENAMETOOLONG CAUSE ACTION ENOENT CAUSE ENOEXEC ACTION CAUSE ACTION ENOMEM CAUSE ACTION ENOTDIR CAUSE ACTION One of the following: The length of the pathname exceeds the {PATH_MAX} limit (de ned in the le ). A component of the pathname is longer than {NAME_MAX} (de ned in ), and {_POSIX_NO_TRUNC} is in e ect for that directory. Make sure that both the component's length and the full pathname length do not exceed the {NAME_MAX} or {PATH_MAX} limits.
execl EPERM CAUSE One of the following: ACTION The calling process does not have the MPE/iX process handling (PH) capability. The calling process has outstanding switches to CM code, has set critical mode, has outstanding NOWAITIO, or is holding an operating system internal resource. One of the following: Link the program le with the MPE/iX PH capability.
execle execle Executes a le. Syntax #include int execle (const char *path, const char *arg ...), Parameters path arg0, ..., argn A pointer to a string containing the pathname of the executable le that is to become the new process image. The pathname must be terminated by a null character. The elements of the pathname must be uppercase and must resolve to a valid MPE/iX le, group, and account. For example, the pathname /FINANCE/PAYROLL/JULY must resolve to JULY.PAYROLL.
execle Description The execle() function replaces the current process image with a new process image created from the executable le speci ed in pathname . Use the execl() function if you know the exact number of arguments to be passed to the new process image. Use the execv() function if the number of arguments passed to the new process image might vary at run time.
execle process group ID session membership real user ID real group ID time remaining until a SIGALRM signal current working directory root directory le mode creation mask process signal mask pending signals tms_utime, tms_stime, tms_cutime, and tms_cstime The executable le's st_atime time eld is marked for update. The executable le is open until the new process image terminates or executes another of the exec() functions.
execle Errors If an error occurs, errno is set to one of the following values: CAUSE E2BIG CAUSE The number of bytes used by the new process image's argument list and environment list combined is greater than the limit of {ARG_MAX} (de ned in ). Reduce the size of the argument list or environment list or both. One of the following: ACTION The calling process does not have search permission to a component of the pathname. The calling process does not have execute permission to the le.
execle ENOENT CAUSE CAUSE ACTION CAUSE a component of the pathname for the executable le does not exist, or pathname points to an empty string. Specify a valid pathname. The program le does not have the NMPRG le code. Make sure that the program le has the NMPRG le code. The new process image requires more memory than the system allows. No action required. The new process image cannot be created. A component of the pathname is not a directory. Specify a valid pathname.
execlp Executes a le. Syntax #include /* proto */ int execlp(const char *filename, const char *arg0, ...,); Parameters lename arg0, ..., argn A pointer to a string containing the pathname of the executable le that is to become the new process image. The pathname must be terminated by a null character. The elements of the pathname must be uppercase and must resolve to a valid MPE/iX le, group, and account. For example, the pathname /FINANCE/PAYROLL/JULY must resolve to JULY.PAYROLL.
execlp Description The execlp() function replaces the current process image with a new process image created from the executable le speci ed in lename . Use the execlp() function if you know the exact number of arguments to be passed to the new process image. Use the execv() function if the number of arguments passed to the new process image might vary at run time.
execlp process group ID session membership real user ID real group ID time remaining until a SIGALRM signal current working directory root directory le mode creation mask process signal mask pending signals tms_utime, tms_stime, tms_cutime, and tms_cstime The executable le's st_atime time eld is marked for update. The executable le is open until the new process image terminates or executes another of the exec() functions.
execlp Errors If an error occurs, errno is set to one of the following values: E2BIG CAUSE CAUSE The number of bytes used by the new process image's argument list and environment list combined is greater than the limit of {ARG_MAX} (de ned in ). Reduce the size of the argument list or environment list or both. One of the following: ACTION The calling process does not have search permission to a component of the pathname. The calling process does not have execute permission to the le.
execlp ENOENT CAUSE CAUSE ACTION CAUSE a component of the pathname for the executable le does not exist, or pathname points to an empty string. Specify a valid pathname. The program le does not have the NMPRG le code. Make sure that the program le has the NMPRG le code. The new process image requires more memory than the system allows. No action required. The new process image cannot be created. A component of the pathname is not a directory. Specify a valid pathname.
execve execve Executes a le. Syntax #include int execve (const char *path, char *const *argv[], cr *const envp[]); har *const envp[]); Parameters path arg0, ..., argn envp[] A pointer to a string containing the pathname of the executable le that is to become the new process image. The pathname must be terminated by a null character. The elements of the pathname must be uppercase and must resolve to a valid MPE/iX le, group, and account.
execve Return Values No return Success. -1 An error occurred. The current process image remains unchanged, and errno is set to indicate the error condition. Description The execve() function replaces the current process image with a new process image created from the executable le speci ed in pathname . Use the execl() function if you know the exact number of arguments to be passed to the new process image.
execve Signals set to SIG_DFL or SIG_IGN in the calling process remain unchanged in the new process image. All signals of the calling process whose action is to invoke a signal handling function are set to SIG_DFL in the new process image.
execve Errors If an error occurs, errno is set to one of the following values: CAUSE E2BIG CAUSE The number of bytes used by the new process image's argument list and environment list combined is greater than the limit of {ARG_MAX} (de ned in ). Reduce the size of the argument list or environment list or both. One of the following: ACTION The calling process does not have search permission to a component of the pathname. The calling process does not have execute permission to the le.
execve ENAMETOOLONG CAUSE ACTION ENOENT CAUSE ENOEXEC ACTION CAUSE ACTION ENOMEM CAUSE ACTION ENOTDIR CAUSE ACTION One of the following: The length of the pathname exceeds the {PATH_MAX} limit (de ned in the le ). A component of the pathname is longer than {NAME_MAX} (de ned in ), and {_POSIX_NO_TRUNC} is in e ect for that directory. Make sure that both the component's length and the full pathname length do not exceed the {NAME_MAX} or {PATH_MAX} limits.
execve EPERM CAUSE One of the following: ACTION The calling process does not have the MPE/iX process handling (PH) capability. The calling process has outstanding switches to CM code, has set critical mode, has outstanding NOWAITIO, or is holding an operating system internal resource, or the calling process is in a Procedure Exit handler. One of the following: Link the program le with the MPE/iX PH capability.
execvp execvp Executes a le. Syntax #include int execvp (const char * le, char * const argv[]); Parameters le arg0, ..., argn A pointer to a string containing the pathname of the executable le that is to become the new process image. The pathname must be terminated by a null character. The elements of the pathname must be uppercase and must resolve to a valid MPE/iX le, group, and account. For example, the pathname /FINANCE/PAYROLL/JULY must resolve to JULY.PAYROLL.
execvp Description The execvp() function replaces the current process image with a new process image created from the executable le speci ed in pathname . Use the execl() function if you know the exact number of arguments to be passed to the new process image. Use the execv() function if the number of arguments passed to the new process image might vary at run time.
execvp process group ID session membership real user ID real group ID time remaining until a SIGALRM signal current working directory root directory le mode creation mask process signal mask pending signals tms_utime, tms_stime, tms_cutime, and tms_cstime The executable le's st_atime time eld is marked for update. The executable le is open until the new process image terminates or executes another of the exec() functions.
execvp Errors If an error occurs, errno is set to one of the following values: CAUSE E2BIG CAUSE The number of bytes used by the new process image's argument list and environment list combined is greater than the limit of {ARG_MAX} (de ned in ). Reduce the size of the argument list or environment list or both. One of the following: ACTION The calling process does not have search permission to a component of the pathname. The calling process does not have execute permission to the le.
execvp ENOENT CAUSE CAUSE ACTION CAUSE a component of the pathname for the executable le does not exist, or pathname points to an empty string. Specify a valid pathname. The program le does not have the NMPRG le code. Make sure that the program le has the NMPRG le code. The new process image requires more memory than the system allows. No action required. The new process image cannot be created. A component of the pathname is not a directory. Specify a valid pathname.
execv Executes a le. Syntax #include int execv (const char *pathname, const char *argv[]); Parameters pathname argv A pointer to a string containing the pathname of the executable le that is to become the new process image. The pathname must be terminated by a null character. The elements of the pathname must be uppercase and must resolve to a valid MPE/iX le, group, and account. For example, the pathname /FINANCE/PAYROLL/JULY must resolve to JULY.PAYROLL.
execv Description The execv() function replaces the current process image with a new process image created from the executable le speci ed by pathname . Use the execl() function if you know the exact number of arguments to be passed to the new process image. Use the execv() function if the number of arguments passed to the new process image might vary at run time.
execv The following attributes of the new process image are set to the same values of those of the calling process: process ID parent process ID process group ID session membership real user ID real group ID time remaining until a SIGALRM signal current working directory root directory le mode creation mask process signal mask pending signals tms_utime, tms_stime, tms_cutime, and tms_cstime The executable le's st_atime time eld is marked for update.
execv Errors If an error occurs, errno is set to one of the following values: POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
execv CAUSE E2BIG CAUSE The number of bytes used by the new process image's argument list and environment list combined is greater than the limit of {ARG_MAX} (de ned in the le ). Reduce the size of the argument list or the environment list or both. One of the following: ACTION The calling process does not have search permission to a component of the pathname. The calling process does not have execute permission to the le. The le is not a valid executable le.
execv ENOENT CAUSE CAUSE ACTION CAUSE A component of the pathname for the executable le does not exist, or pathname points to an empty string. Specify a valid pathname. The program le does not have the NMPRG le code. Make sure that the program le has the NMPRG le code. The new process image requires more memory than the system allows. No action required. The new process image cannot be created. A component of the pathname is not a directory. Specify a valid pathname.
exit Terminates a process. Syntax #include void _exit (int status); Parameters status A status code to be made available to the parent process of the calling process through the wait() or waitpid() functions. Return Values None. This function does not return to the calling process. Description The _exit() function terminates the calling process. The following actions are performed: The calling process is terminated. All open les and directory streams in the calling process are closed.
exit Implementation Considerations All child processes of the calling process are terminated. They are not adopted by a system process. The CI session variable CJCW is set to status . Time accounting information of the calling process is not made available to the parent process through the wait() or waitpid() functions. A zero is always returned. No user process can be a controlling process. Only system processes (CI processes) are allowed to be controlling processes.
fcntl File control. Syntax #include #include #include int fcntl(int * ldes, int cmd, ...); Parameters ldes cmd An open le descriptor. The following values can be used for the le control command. F DUPFD Duplicate le descriptor. F GETFD Get le descriptor ags. F GETLK Get record locking information. F SETFD Set le descriptor ags. F GETFL Get le status ags. F SETFL Set le status ags. F SETLK Set record locking information.
fcntl O O O O CREAT EXCL NOCITY TRUNC Create le if it does not exist. Exclusive use ag. Do not assign a controlling terminal. Truncate ag. File Status Flags Used for open() and fcntl() O APPEND O NONBLOCK Set append mode. No delay. File Access Modes Used for open() and fcntl() O RDONLY O RDWR O WRONLY Open for reading only. Open for reading and writing. Open for writing only. Mask for Use With File Access Modes O ACCMODE Mask for le access modes. Return Values >=0 -1 Success.
fcntl argument, arg , taken as an integer of type int . The new le descriptor refers to the same open le description as the original le descriptor and shares any locks. F GETFD F GETLK F SETFD F GETFL F SETFL The FD CLOEXEC ag associated with the new le descriptor cleared to keep the le open across calls to the exec family of functions. Get the le descriptor ags that are associated with the le descriptor ldes .
fcntl F SETLK F SETLKW is found that would prevent this lock from being created, the structure will be left unchanged by this function call except for the lock type, which will be set to F UNLCK. Set or clear a le segment lock according to the lock description pointed to by the third argument, arg , taken as a pointer to type struct ock (see below). F SETLK is used to establish shared (or read) locks (F RDLCK) or exclusive (or write) locks, (F WRLCK), as well as to remove either type of lock (F UNLCK).
fcntl flock Structure short short o t o t pid t Member Type Member Name l type l l l l whence start len pid Description F RDLCK,F WRLCK,or F UNLCK. Flag for starting o set. Relative o set in bytes. Size;if 0,then until EOF. Process ID of the process holding the lock, returned with F GETLK. Locks may start and extend beyond the current end of a le, but, will not start or extend before the beginning of the le.
fcntl Description The function fcntl() provides for control over open les. The argument ldes is a le descriptor. Implementation Considerations The calling process must have the correct access permissions as de ned by either an attached ACD or by the MPE/iX le security matrix. For example, a le opened O_RDONLY must have either ACD read access or MPE/iX read access. A le opened O_WRONLY or O_RDWR must have either ACD write access and append access or MPE/iX write access and append access.
fcntl CAUSE EBADF EINTR ACTION CAUSE EINVAL ACTION CAUSE EMFILE ACTION CAUSE ENOLCK ACTION CAUSE ACTION The ldes argument is not a valid le descriptor. The argument cmd is F SETLK or F SETLKW, the type of lock (l type) is shared lock(F RDLCK), and ldes is not a valid le descriptor open for reading. The argument cmd is F SETLK or F SETLKW, the type of lock (l type) is an exclusive lock(F WLRCK), and ldes is not a valid le descriptor open for writing. None.
fcntl CAUSE The argument cmd is F SETLKW, and a deadlock condition was detected. None. The system lacked the resources to create another process. Attempt process creation at a later time, or decrease the number of processes associated with the application. One of the following: ACTION The calling process does not have the MPE/iX process handling (PH) capability.
fnmatch Compare lename to pattern (wild card) string. Syntax #include int fnmatch (const char *pattern, const char *string, int ags); Parameters pattern string ags 4-74 Is a string that may contain standard path name matching wild card characters. For example, asterisk (*), question mark (?), [] constructs, and so on. is a path name you want to compare to pattern. speci es options for the match. Flags are represented by symbols de ned in .
fnmatch FNM_IGNORECASE expression does not match a leading period if FNM PERIOD is set. indicates that case is to be ignored when comparing characters. For example, a matches A when this ag is set. Return Values 0 string is a path name matching the wild card construct pattern. FNM_ERROR error with the pattern and consequently no match. FNM_NOMATCHthere is no match. Description fnmatch() determines whether string is a path name matching the wild card construct pattern. If so, fnmatch() returns zero.
fork Creates a new child process. Syntax #include #include pid_t fork (void); Parameters None. Return Values >0 0 -1 Success. The process ID of the newly created child process is returned to the calling process. Success. A value of 0 is returned to the newly created child process. An error occurred. The process is not created, and errno is set to indicate the error condition. Description The fork() function creates a new child process.
fork The child process has its own copy of the parent's open directory streams. Each open directory stream in the child process shares stream positioning with the corresponding directory stream of the parent. Directory streams are implemented using le descriptors. Both parent and child share the same open le descriptor for each directory stream. The child process's tms_utime, tms_stime, tms_cutime, and tms_cstime are set to zero. File locks set by the parent process are not inherited by the child process.
fork Errors If an error occurs, errno is set to one of the following values: EAGAIN CAUSE ACTION EFAULT CAUSE ACTION CAUSE EIMPL ACTION ENOMEM CAUSE ACTION 4-78 The system lacked the resources to create another process. Attempt process creation at a later time, or decrease the number of processes associated with the application. The system detected a NULL or bad address in attempting to use the functional return argument. Make sure that the functional return is correctly initialized.
fork EPERM CAUSE One of the following: ACTION The calling process does not have the MPE/iX process handling (PH) capability. The calling process is not executing a program le whose MPE/iX le code is NMPRG. The calling process has outstanding switches to CM code, has set critical mode, has outstanding NOWAITIO, or is holding an operating system internal resource. One of the following: Make sure that the calling process has the MPE/iX PH capability.
fpathconf Returns con guration variable for le descriptor. Syntax #include long fpathconf(int ldes, int name); Parameters ldes name is an open le descriptor for the le or directory of which you want to determine the con guration variables. is a symbol indicating the variable, the value of which you want to determine. Return Values variable value -1 fpathconf() lets you determine the value of a con guration variable associated with a particular le descriptor.
fpathconf Errors If an error occurs, errno is set to one of the following values: EBADF EINVAL CAUSE ACTION CAUSE ACTION ldes was not a valid le descriptor. Specify a valid le descriptor. Name was not a valid variable code, or the given variable cannot be associated with the speci ed le. Specify a valid variable code. See Also pathconf() POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
fstat Returns open le status information. Syntax #include #include int fstat (int ldes, struct stat *bu er); Parameters ldes bu er An open le descriptor. A pointer to a bu er of type struct stat (de ned in ) where le information is returned. Return Values 0 -1 Success. An error occurred. File status information is not returned and errno is set to indicate the error condition.
fstat Implementation Considerations Refer to the EFAULT, EPERM, and ESYSERR error descriptions below. Errors If an error occurs, errno is set to one of the following values: EBADF CAUSE EFAULT ACTION CAUSE EPERM ACTION CAUSE The ldes parameter is not a valid open le descriptor. Pass a valid open le descriptor. The system detected a NULL or bad address in attempting to use the bu er parameter. Make sure that the pointer is correctly initialized.
fstat See Also creat(), dup(), open(), , POSIX.1 (Section 5.6.2) 4-84 POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
getcwd getcwd Returns the pathname of the current working directory. Syntax #include #include char *getcwd (char *bu er, size_t size); Parameters bu er size A pointer to a character array where an absolute pathname for the calling process's current working directory is returned. The pathname must be terminated by a null character. The size of the array must be large enough to contain the length of the pathname plus the terminating null character.
getcwd Errors If an error occurs, errno is set to one of the following values: EACCES CAUSE ACTION EFAULT CAUSE EINVAL ACTION CAUSE ACTION ERANGE CAUSE ESYSERR ACTION CAUSE ACTION The calling process either does not have search permission to a component of the pathname or does not have read permission to the current working directory. Make sure that the calling process has search permission to all component directories in the pathname and read permission to the current working directory.
getegid getegid Returns the e ective group ID. Syntax #include #include gid_t getegid (void); Parameters None. Return Values The e ective group ID of the calling process. Description The getegid() function returns the e ective group ID (GID) of the calling process. Implementation Considerations None. Errors None. See Also getgid(), geteuid(), getuid(), POSIX.1 (Section 4.2.1) POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
getenv Returns an environment value. Syntax #include char *getenv (const char *name); Parameters name A pointer to a string of characters to match in the environment list. Return Values <>NULL NULL NULL + errno A pointer to the value portion of a name=value string is returned. A matching name was not found, and errno is not modi ed. An error occurred, and errno is set to indicate the error condition.
getenv Implementation Considerations Refer to the EFAULT error description below. Errors If an error occurs, errno is set to the following value: EFAULT CAUSE ACTION The system detected a NULL or bad address in attempting to use the name parameter or while dereferencing environ and traversing the process's environment list. Check to see if the pointer is correctly initialized or if the environment list is corrupted. See Also environ(), POSIX.1 (Section 4.6.
geteuid Returns the e ective user ID. Syntax #include #include uid_t geteuid (void); Parameters None. Return Values The e ective UID of the calling process. Description The geteuid() function returns the e ective user ID (UID) of the calling process. Implementation Considerations None. Errors None. See Also getegid(), getgid(), getuid(), POSIX.1 (Section 4.2.1) 4-90 POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
getgid getgid Returns the real group ID. Syntax #include #include gid_t getgid (void); Parameters None. Return Values The real GID of the calling process. Description The getgid() function returns the real group ID (GID) of the calling process. Implementation Considerations None. Errors None. See Also getegid(), geteuid(), getuid(), POSIX.1 (Section 4.2.1) POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
getgrgid Group data base access based on GID. Syntax #include #include struct group *getgrgid(gid_t gid); Parameters gid A value of a GID. Return Values Returns a pointer to an object of type struct group on success. The return values may point to static data that is overwritten by each cell. A null pointer is returned on error or if the requested entry is not found.
getgrgid Errors If an error occurs, errno is set to one of the following values: EFAULT CAUSE EINVAL ACTION CAUSE ESYSERR ACTION CAUSE ACTION The system detected a NULL or bad address when attempting to allocate or access a struct group bu er. Report circumstances to HP The GID parameter is invalid. No matching entry was found in the group database. Specify a valid GID. The system detected an unexpected error. Report circumstances to HP. See Also getlogin(),getgrnam() POSIX.
getgrnam Group data base access. Syntax #include #include struct group *getgrnam(const char *name); Parameters name A character-string value. Return Values Returns a pointer to an object of type struct group on success. The return values may point to static data that is overwritten by each cell. A null pointer is returned on error or if the requested entry is not found.
getgrnam Implementation Considerations Currently, member gr-nam has not been implemented. It returns NULL. Errors If an error occurs, errno is set to one of the following values: EFAULT CAUSE EINVAL ACTION CAUSE ESYSERR ACTION CAUSE ACTION The system detected a NULL or bad address when attempting to allocate or access a struct group bu er. Report circumstances to HP The name is invalid. No matching entry was found in the group database. Specify a valid name. The system detected an unexpected error.
getgroups Gets Supplementary Group IDs. Syntax #include int getgroups (int *gidsetsize, gid_t grouplist[]); Parameters gidsetsize grouplist The number of elements in the grouplist array. An array containing the supplementary group IDs of the calling process. Return Values Upon successful completion, the number of supplementary group IDs is returned. This value is zero if fNGROUPS MAXg is zero. A return value of -1 indicates failure, and errno is set to indicate the error.
getgroups Implementation Considerations Supplemental group IDs are not currently supported (fNGROUPS MAXg is 0). Therefore, this function will always return 0. Errors If an error occurs, errno is set to one of the following values: EINVAL CAUSE ACTION gidsetsize is not equal to zero and is less than the number of supplemental group IDs. Specify a valid and supported value. See Also getgid(), POSIX.1 POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
getlogin Gets user name. Syntax #include char *getlogin(void); Parameters None. Return Values Returns a pointer to a string on success. The return values may point to static data that is overwritten by each cell. A null pointer is returned on error or if the user's login name cannot be found. Description The getlogin() function returns a pointer to a string giving a user name associated with the calling process.
getlogin See Also getpwnam(), getpwuid, POSIX.1 POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
getopt Command option parsing. Syntax #include extern char *optarg; extern int optind, opterr, optopt; int getopt(int argc, const char *argv[], const char *optstring); Parameters argc argv[] optstring is the argument count as passed to main(). is the argument vector as passed to main(). is a string containing letters and/or digits which should be recognized as command line arguments. For example, if a program takes the arguments -a, -A, and -b, optstring could be \aAb".
getopt ? If getopt() encounters an invalid option (one whose character does not appear in optstring) or an option that was supposed to be followed by an argument value but was not, getopt() returns a question mark (?). If the rst character is a :, and the error is a missing argument, then : is returned instead of ?. The character that caused the error is assigned to the variable optopt, and optind is not updated.
getopt immediately after the argument letter. It is the rest of the argv element. In this case, optind is incremented by 1. Example The following code fragment shows how one might process the arguments for a utility that can take the mutually exclusive options a and b and the options f and o , both of which require arguments. #include int main (int argc, char *argv[]) { int c, bflg, aflg, errflg = 0; char *ifile, *ofile; extern char *optarg; extern int optind, optopt; . . .
getopt case ':': /* -f or -o without option-arg */ fprintf (stderr, "Option -%c requires an option-argument0, optopt); errflg = 1; break; case '?': fprintf (stderr, "Unrecognized option: -%c0, optopt); errflg = 1; break; } } if (errflg) { fprintf(stderr, "usage: . . . "); exit(2); } for ( ; optind < argc; optind++) { if (access(argv[optind], R_OK)) { . . .
getopt Implementation Considerations The current implementation of MPE/iX uses the INFO string to pass arguments to programs. If the size of this string plus the size of the current environment (determined by the number and size of the environment variables in the current process) is greater than 8192 bytes, the string is too long to pass to a subprocess and the process creation fails. See Also getopt(1), getopts(1) 4-104 POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
getpid getpid Returns the process identi cation number. Note If linking with the POSIX/iX libraries, refer to the description of getpid() located in the MPE/iX Developer's Kit Reference Manual . Syntax int getpid (void) Parameters None. Return Values x The process identi cation number (PIN) of the calling process. Implementation Considerations None. See Also MPE/iX intrinsics FATHER and GETPROCID, described in the MPE/iX Intrinsics Reference Manual .
getpwuid User database access based on UID. Syntax #include #include struct passwd *getpwuid(uid_t uid); Parameters uid A value of a user ID. Return Values Returns a pointer to an object of type struct passwd on success. The return values may point to static data that is overwritten by each cell. A null pointer is returned on error or if the requested entry is not found.
getpwuid Implementation Considerations None. Errors If an error occurs, errno is set to one of the following values: EFAULT CAUSE EINVAL ACTION CAUSE ESYSERR ACTION CAUSE ACTION The system detected a NULL or bad address when attempting to allocate or access a struct passwd bu er. Report circumstances to HP the UID parameter is invalid. No matching entry was found in the passwd bu er. Specify a valid UID. The system detected an unexpected error. Report circumstances to HP.
getpgrp Returns the process group ID. Syntax #include #include pid_t getpgrp (void); Parameters None. Return Values The process group ID of the calling process. Description The getpgrp() function returns the process group ID of the calling process. Implementation Considerations None. Errors None. See Also getpid(), sigaction(), POSIX.1 (Section 4.3.1) 4-108 POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
getpid getpid Returns the process ID. Syntax #include #include pid_t getpid (void); Parameters None. Return Values The process ID of the calling process. Description The getpid() function returns the process ID (PID) of the calling process. Implementation Considerations None. Errors None. See Also getppid(), execl(), execv(), fork(), kill(), POSIX.1 (Section 4.1.1) POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
getppid Returns the parent's process ID. Syntax #include #include pid_t getppid (void); Parameters None. Return Values The parent process ID of the calling process. Description The getppid() function returns the parent process ID of the calling process. Implementation Considerations None. Errors None. See Also getpid(), execl(), execv(), fork(), kill(), POSIX.1 (Section 4.1.1) 4-110 POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
getpwnam getpwnam User database access based on UID User database access. Syntax #include #include struct passwd *getpwnam(const char *name); Parameters name A character string value corresponding to the user name. Return Values Returns a pointer to an object of type struct passwd on success. The return values may point to static data that is overwritten by each cell. A null pointer is returned on error or if the requested entry is not found.
getpwnam Implementation Considerations None. Errors If an error occurs, errno is set to one of the following values: EFAULT CAUSE EINVAL ACTION CAUSE ACTION CAUSE ACTION ESYSERR The system detected a NULL or bad address when attempting to allocate or access a struct passwd bu er. Report circumstances to HP The name parameter is invalid. No matching entry was found in the group database. Specify a valid name. The system detected an unexpected error. Report circumstances to HP.
getpwuid getpwuid User database access based on UID. Syntax #include #include struct passwd *getpwuid(uid_t uid); Parameters uid A value of a user ID. Return Values Returns a pointer to an object of type struct passwd on success. The return values may point to static data that is overwritten by each cell. A null pointer is returned on error or if the requested entry is not found.
getpwuid Implementation Considerations None. Errors If an error occurs, errno is set to one of the following values: E2BIG CAUSE CAUSE The number of bytes used by the new process image's argument list and environment list combined is greater than the limit of {ARG_MAX} (de ned in ). Reduce the size of the argument list or environment list or both. One of the following: ACTION The calling process does not have search permission to a component of the pathname.
getpwuid EIMPL CAUSE ACTION ENAMETOOLONG CAUSE ACTION ENOENT CAUSE ENOEXEC ACTION CAUSE ACTION ENOMEM CAUSE ACTION ENOTDIR CAUSE ACTION The pathname did not resolve to a valid MPE/iX le, group, and account, or the pathname begins with two slashes. Specify a valid pathname as described in the pathname parameter description. One of the following: The length of the pathname exceeds the {PATH_MAX} limit (de ned in the le ).
getpwuid EPERM CAUSE One of the following: ACTION The calling process does not have the MPE/iX process handling (PH) capability. The calling process has outstanding switches to CM code, has set critical mode, has outstanding NOWAITIO, or is holding an operating system internal resource, or the calling process is in a Procedure Exit handler. One of the following: CAUSE ESYSERR ACTION Link the program le with the MPE/iX PH capability.
getuid getuid Returns the real user ID (UID). Syntax #include #include uid_t getuid (void); Parameters None. Return Values The real UID of the calling process. Description The getuid() function returns the real user ID (UID) of the calling process. Implementation Considerations None. Errors None. See Also geteuid(), getegid(), getgid(), POSIX.1 (Section 4.2.1) POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
glob Generate path name list matching pattern. Syntax #include int glob(const char *pattern, int ags, int (*errfunc)(const char *name, int errno), glob_t *paths); Parameters pattern ags 4-118 is a string giving a path name pattern, possibly containing wild card characters and other path name generation constructs. is a collection of ags controlling the glob() action. Flags are speci ed by ORing together symbolic constants de ned in .
glob errfunc by putting a slash (/) after directory names. GLOB NOCHECK takes a special action if no path names match pattern. By default, glob() returns a null list if there are no path names matching pattern. However, if GLOB NOCHECK is speci ed, glob() returns a list consisting only of pattern and indicates that the number of matched path names is 1. You might use this option if an argument can be either a path name or a normal string. GLOB NOESCAPE turns o escape character functionality.
glob an int giving the value of errno set by the function that tried to open or read the directory. This function could be opendir(), readdir(), or stat(). points to an area where glob() can store a glob_t structure. This structure gives the list of path names matching pattern and other information. It must be created by the caller. paths Description glob() generates a list of all accessible path names matching pattern .
glob If GLOB APPEND is speci ed to add new path names to an existing list, glob() follows these rules: If GLOB DOOFFS is set in the rst call to glob(), it must be set in subsequent calls and gl o s must have the same value in each call; If GLOB DOOFFS is not set in the rst call, it must not be set in subsequent calls; After the second call, gl pathv points to a list containing: The number of NULL pointers as determined by GLOB DOOFFS and gl o s; Pointers to the path names that were in the list before the s
glob Errors If an error occurs, errno is set to one of the following values: GLOB_NOSPACE CAUSE GLOB_NOMATCH ACTION CAUSE GLOB_ABORTED ACTION CAUSE ACTION glob() was unable to allocate memory for at least one of the path names obtained. Free up more memory. glob() did not nd any path names which matched pattern and GLOB NOCHECK was not set in the ags. No action required.
globfree globfree Release data created by glob(). Syntax #include void globfree(glob_t *paths); Parameters paths is a glob_t structure used in a previous call to glob(). Description globfree() frees any memory allocated in connection with the paths structure. Typically, this gets rid of any space that a call to glob() allocated to hold a path name list. Errors None. See Also glob() POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
ioctl-mag tape Provides an interface and control over magnetic tape devices. In the case of magnetic tape devices, the ioctl() function provides an interface for issuing various control commands to opened tape devices. The ioctl() operations can be used to position the magnetic tape, and to determine the tape device status. Syntax int ioctl ( ldes, request, arg) int ldes; int request; void *arg; Parameters ldes request arg 4-124 The le descriptor of the successfully opened device.
ioctl-mag tape Return Values 0 -1 The function completed successfully. An error occured. The value of -1 is returned by the function, and the global variable errno is set with the resultant error.
ioctl-mag tape If the request is MTIOCGET, then the arg parameter returned will be equated to the following structure: full struct mtget long long long long long long long long { mt_type; mt_resid; mt_dsreg1; mt_dsreg2; mt_gstat; mt_erreg; mt_fileno; mt_blkno; }; /* /* /* /* /* /* /* /* type and subtype of device */ not supported */ not supported */ not supported */ generic device status */ not supported */ not supported */ not supported */ The mt_type that is returned will be a integer with the upper
ioctl-mag tape bit 10 bit 11 bit 12 bit 13 bit 14 bit 15 bit 16 bpi 800 unused unused door open unused immediate mode bit 31 unused Implementation Considerations There will not be any implementation de ned items in the magnetic tape portion of ioctl(). There are two operations, MTNOPs and MTEOD, that will not be supported. The MTNOP operation only sets the status, it does not perform an operation. The MTEOD operation is used for DDS and QIC devices only, and it does a seek to the \end of data" point.
ioctl-mag tape Errors If an error occurs, errno is set to one of the following values: EBADF CAUSE ACTION EFAULT CAUSE ACTION EINTR EINVAL CAUSE ACTION CAUSE ACTION EIO ENOTTY CAUSE ACTION CAUSE ACTION 4-128 The argument ldes is not a descriptor for an opened le. Check to see if ldes has been altered or if ldes is not initialized. The system detected a NULL address while attempting to use the arg parameter passed by the caller.
ioctl-mag tape ENXIO CAUSE The request parameter referenced a device that did not exist, or the request made was beyond the limits of the device. Check to see if the request parameter is a correct command. Make sure the request is valid for the device. One of the following: ACTION The calling process does not have the MPE/iX process handling (PH) capability.
ioctl-sockets Provides an interface and control over magnetic tape devices. In the case of magnetic tape devices, the ioctl() function provides an interface for issuing various control commands to opened tape devices. The ioctl() operations can be used to position the magnetic tape, and to determine the tape device status. Syntax int ioctl( ldes, request, arg) int ldes; int request; void *arg; Parameters ldes request 4-130 The socket descriptor.
ioctl-sockets Gets the status of non-blocking i/o. If non-blocking i/o is enabled for the socket, then the integer whose address is arg is set to 1. If non-blocking i/o is disabled, the integer is set to zero. FIOGSAIO- If asynchronous signaling is enabled for the socket, then the integer whose address is arg is set to 1. If the STAT asynchronous state is disabled, the integer is set to zero.
ioctl-sockets type of request speci ed, the integer can represent a variety of values. See the appropriate request command for an explanation of the value that the integer will represent in that context. Return Values 0 -1 The function completes successfully. If an error occurs, a value of -1 is returned by the function and the global variable errno is set with the resultant error. Description Sockets are communication endpoints that allow processes to communicate either locally or remotely.
ioctl-sockets EFAULT CAUSE ACTION EINTR CAUSE EINVAL ACTION CAUSE ACTION The system detected a NULL address while attempting to use the arg parameter passed by the caller. Check to see if the pointer used is initialized and/or not equal to NULL. Once this function is executing an intrinsic, no signal interruption may occur. Signal interrupts can only occur in the library portion of the code. Check the state of the socket referenced by ldes .
ioctl-streams Provides an interface and control over magnetic tape devices. In the case of magnetic tape devices, the ioctl() function provides an interface for issuing various control commands to opened tape devices. The ioctl() operations can be used to position the magnetic tape, and to determine the tape device status. Syntax int ioctl( ldes, request, arg) int ldes; int request; void *arg; Parameters ldes request 4-134 The open le descriptor for the stream that will be used.
ioctl-streams I_CANPUT I_CKBAND I_FDINSERT I_FIFO I_FIND I_FLUSH I_FLUSHBAND I_GETBAND the message is marked. If the arg value is set to LASTMARK, then the check will be to see if the message is the last one that is marked on the queue. If marked conditions is satis ed, a 1 is returned; otherwise a zero is returned. Checks if a message can be passed on a stream. The arg parameter speci es which priority band to check.
ioctl-streams I_GETCLTIME I_GETSIG I_GETSTREAMID I_GRDOPT I_GWROPT I_LINK I_LIST I_LOOK I_NREAD I_PEEK 4-136 Gets the time delay for closing a stream. The time value is returned in the arg parameter. Gets the events for which the calling process has registered to receive a signal. The events are returned in the arg parameter. Gets the stream handle for a C-library le descriptor. Use for NETWARE. Gets the current read mode setting of the stream. The integer value is returned in the arg parameter.
ioctl-streams I_PIPE I_PLINK I_POP I_PUNLINK I_PUSH I_RECVFD I_SENDFD I_SETCLTIME I_SETSIG Connects two streams as a pipe. Used for non-System V systems. Permanently connects two streams. The descriptor of the stream referenced by the ldes is connected to the descriptor of the stream referenced by the arg parameter. The latter stream is connected via a persistent link that can exist even if the rst stream is closed. Removes/pops the module just below the stream head.
ioctl-streams arg the particular events that SIGPOLL is to be sent for. I_SRDOPT Sets the read mode of the stream according to the value of the arg parameter. I_STR Creates an internaltioctl() message from the data pointed to by the arg parameter and sends the message downstream to a module or driver. I-SWROPT Sets the stream write mode according to the value of the arg parameter. I_UNLINK Disconnects two streams.
ioctl-streams When the stream head receives a streams ioctl() function, the request and the arg parameters are interpreted into an M_IOCTL message. In some cases, the parameters are passed onto a module or driver in the stream. The module in a stream can detect errors in the ioctl() function. If an error is detected, an error message containing the error number is sent to the stream head. Subsequent calls to functions will fail with the errno set to this number. Implementation Considerations None.
isatty Determines whether or not an open le descriptor is associated with a terminal. Syntax #include int isatty (int ldes); Parameters ldes An open le descriptor. Return Values 1 0 -1 The speci ed le descriptor is associated with a terminal. The speci ed le descriptor is not associated with a terminal. The speci ed le descriptor is invalid, and errno is set to indicate the error condition.
isatty See Also POSIX.1 (Section 4.7.2) POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
kill Sends a signal to a process or a process group. Syntax #include #include int kill (pid_t pid, int sig); Parameters pid sig A value indicating the process or process group to receive the signal speci ed in sig . Following are valid values and their meanings: >0 A process whose process ID is equal to pid . 0 All processes whose process group ID is equal to the caller's process group ID. <-1 All processes whose process group ID is equal to the absolute value of pid .
kill Description The kill() function sends a signal speci ed by sig to a process or group of processes speci ed by pid . If sig is 0 (the null signal), no signal is sent, but error checking is performed. Use the null signal to check for the validity of pid . The signal is sent only if the caller has permission to send it to the target process(es).
kill Implementation Considerations Job control is not supported. The {POSIX_SAVED_IDS} constant is always de ned. Use the kill() function to send SIGCONT to a process to continue it after SIGSTOP has stopped it. The system never generates SIGCONT and SIGSTOP for a process. A sending process cannot rely on the target process acting upon a signal in a timely manner if the target process is executing operating system code. The target process is not interrupted until it returns from operating system code.
kill Errors If an error occurs, errno is set to one of the following values: EINVAL CAUSE The signal sig is not a valid signal number, or pid is -1. Refer to Table 3-5 for descriptions of valid signal numbers, or set pid to a valid value. One of the following: ACTION The calling process does not have the MPE/iX process handling (PH) capability.
lseek Repositions a read/write le o set. Syntax #include #include off_t lseek (int ldes, off_t o set, int whence); Parameters ldes o set whence An open le descriptor. The number of bytes for the new o set. The application of this value is de ned by whence . A value specifying how o set is to be applied to calculate the resultant o set. Following are valid values and their meanings (de ned in ). SEEK_SET Set new o set to o set .
lseek The lseek() function allows the le o set to be set beyond the end of existing data in the le. If data is later written at this point, subsequent reads of data in the gap return bytes with the value zero until data is actually written into the gap; however, the lseek() function cannot, by itself, extend the size of a le. Implementation Considerations Refer to the ESEEK and ESYSERR error descriptions below. Pipes (or FIFOs) and device special les are not supported.
mkdir Creates a directory. Syntax #include #include int mkdir (const char *pathname, mode_t mode); Parameters pathname mode 4-148 A pointer to a string containing the pathname of the directory to be created. The pathname must be terminated by a null character. The access permission bits for the new directory.
mkdir S_IWOTH S_IXOTH Set le other class write permission bit. Set le other class execute (if a le) or search (if a directory) permission bit. Unused bits of the mode parameter not associated with access permissions must contain zeros or an error occurs. Return Values 0 -1 Success. An error occurred. The new directory is not created, and errno is set to indicate the error condition. Description The mkdir() function creates a new directory le whose name is speci ed in the pathname parameter.
mkdir The mkdir() function cannot create the root directory, MPE/iX accounts, or MPE/iX groups. The mkdir() function does not support read-only le systems. Errors If an error occurs, errno is set to one of the following values: EACCES CAUSE ACTION EEXIST CAUSE ACTION EFAULT CAUSE ACTION 4-150 The calling process does not have search permission to a component of the pathname, or does not have write permission to the parent directory.
mkdir EIMPL ENAMETOOLONG CAUSE Any of the following conditions: ACTION Attempted to create a directory in an MPE/iX account. The directory name exceeded 16 characters in length in the root directory, an MPE/iX account, or an MPE/iX group. The pathname begins with two slash characters (//). Bits of mode that are not le permission bits do not contain zeros. One of the following: CAUSE Do not create a directory in an MPE/iX account.
mkdir ENOENT CAUSE ENOSPC ACTION CAUSE ACTION CAUSE ACTION CAUSE ENOTDIR ESYSERR ACTION A component of the pathname does not exist, or pathname points to an empty string. Specify a valid pathname. The directory could not be created because of a lack of disk space, or the process owner would have exceeded limits imposed by the MPE/iX accounting facility. Make sure that there is enough space to create the directory on the volume set, or ask your system administrator to increase your accounting limits.
mkfifo mkfifo Make a FIFO special le. Syntax #include #include int mkfifo (const char *path, mode_t mode); Parameters path mode The pathname of a le. The access permission bits for the new directory. Access permission bits are set by ORing any combination of the following macros: S_IRWXU Set le owner class read, write, and execute (if a le) or search (if a directory) permission bits. S_IRUSR Set le owner class read permission bit.
mkfifo S_IWOTH S_IXOTH Set le other class write permission bit. Set le other class execute (if a le) or search (if a directory) permission bit. Unused bits of the mode parameter not associated with access permissions must contain zeros or an error occurs. Return Values 0 -1 Successful completion No FIFO is created, and errno is set to indicate the error. Description The mkfifo() routine creats a new FIFO special le named by the pathname pointed to by path .
mkfifo Errors If any of the following conditions occur, the mkfifi9() function returns -1 and sets errno to the corresponding value. EACCES CAUSE ACTION EEXIST CAUSE ACTION ENAMETOOLONG CAUSE Serach permission is denied on a compoenent of the path pre x, or wirte permission is denied on the parent directory of the le to be created. Make sure that the calling process has search permission for all components of the pathname and write permission to the parent directory. The named le already exists.
mknod Make a FIFO special le. Makes a directory, or a special or regular le. Syntax #include int mknod(const char *path, mode_t mode, dev_t dev); Parameters path mode dev The pathname of a le. Speci es the le type and le access permission. Speci es the major and minor device numbers. Return Values 0 -1 Successful completion Error and errno is set to indicate the error. Description mknod() creates a new le named by the path name pointed to by path .
mknod The le access permission bits of mode are modi ed by the process's le mode creation mask: for each bit set in the process's le mode creation mask, the corresponding bit in the le's mode is cleared (see umask(2)). The new le is created with three base access-control-list (ACL) entries, corresponding to the le access permission bits. The dev argument is meaningful only if mode indicates a block or character special le, and is ignored otherwise.
mknod Errors If an error occurs, errno is set to one of the following values: EACCES CAUSE One of the following: ACTION The directory in which path would be created denies write permission, mode is for a FIFO le and the caller does not have appropriate privileges. A component of the path pre x denies search permission. One of the following: CAUSE Make sure that the calling process has search permission to all components of t he pathname.
mknod ENOSPC CAUSE ACTION ENOTDIR CAUSE ACTION CAUSE EPERM ACTION EROFS CAUSE ACTION Not enough space on the le system. Extend accounting limits for the directory in which the le is located, or fr ee up disk space. A component of the path pre x is not a directory. Specify a valid pathname. The e ective-user-ID of the process does not match that of the super-user, and the le type is not FIFO special. Refer to the kill() function description for signal permission rules.
open Opens a le and returns its le descriptor. Syntax #include #include #include int open (const char *pathname, int o ag, ...); Parameters pathname o ag A pointer to a string containing a pathname of a le to be opened. The pathname must be terminated by a null character. A value specifying the le status and le access modes of the le to be opened. If O_CREAT is speci ed, the mode of the le must be passed in a third parameter, modes .
open Any combination of the following optional ags may also be speci ed in o ag : O_APPEND The le o set is set to the end of the le prior to each write. O_CREAT This option requires a third parameter, mode , which is of type mode_t. If the optional third parameter is not passed when O_CREAT is speci ed, open() attempts to read invalid data o the stack, and the results are indeterminate. If the le exists, this ag has no e ect, except as noted under O_EXCL, below.
open is set to the beginning of the le (where the o set position is 0). An error results if the le is opened O_TRUNC and O_RDONLY. If O_TRUNC is speci ed for an existing le, the st_ctime and st_mtime time elds of the le are marked for update. If o ag speci es O_CREAT, mode , a structure of type mode_t, must be passed to specify the access permission bits that the le is to be created with.
open Return Values >=0 -1 Success. A nonnegative integer is returned representing the lowest numbered le descriptor not open by the calling process. An error occurred. The le is not opened, and errno is set to indicate the error condition. Description The open() function establishes the connection between a le speci ed by pathname and a le descriptor. It creates an open le description that refers to the le and a le descriptor that refers to that open le description.
open The calling process must have the correct access permissions as de ned by either an attached ACD or by the MPE/iX le security matrix. For example, a le opened O_RDONLY must have either ACD read access or MPE/iX read access. A le opened O_WRONLY or O_RDWR must have either ACD write access and append access or MPE/iX write access and append access. Signals generated for the calling process during execution of open() are deferred from delivery until completion of this function.
open EEXIST CAUSE EFAULT ACTION CAUSE EIMPL ACTION CAUSE exists. Open the le a di erent way, or remove the le. The system detected a NULL or bad address in attempting to use the pathname parameter, or the pathname was not terminated by a null character. Make sure that the pointer is correctly initialized. One of the following: ACTION The speci ed le is not a byte-stream le. The pathname began with two slash characters (//). Bits in mode that are not le permission bits did not contain zeros.
open CAUSE EMFILE ACTION ENAMETOOLONG CAUSE ACTION ENOENT CAUSE ENOSPC ACTION CAUSE ACTION CAUSE ACTION CAUSE ENOTDIR ESYSERR ACTION The number of open les and directories would exceed {OPEN_MAX}, the limit of opened les per process. Reduce the number of les and directories opened by the calling process. One of the following: The length of the pathname exceeds the {PATH_MAX} limit (de ned in the le ). A component of the pathname is longer than {NAME_MAX} (de ned in
opendir opendir Opens a directory stream. Syntax #include #include DIR *opendir (const char *pathname); Parameters pathname A pointer to a string containing a pathname of a directory to open. The pathname must be terminated by a null character. Return Values <>NULL NULL Success. A pointer to an object of type DIR is returned. An error occurred. The directory is not opened, and errno is set to indicate the error condition.
opendir Errors If an error occurs, errno is set to one of the following values: CAUSE EACCES ACTION EFAULT CAUSE EIMPL ACTION CAUSE ACTION EMFILE CAUSE ACTION ENAMETOOLONG CAUSE ACTION ENOENT CAUSE ACTION 4-168 Either the calling process does not have search permission to a component of pathname or does not have read permission to the directory to be opened.
opendir ENOTDIR ESYSERR CAUSE ACTION CAUSE ACTION A component of the pathname is not a directory. Specify a valid pathname. An operating system error has occurred that does not map directly to any of the above errors. Examine the MPE/iX error stack for the type of system error. See Also closedir(), readdir(), rewinddir(), , POSIX.1 (Section 5.1.2) POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
pause Suspends execution of the calling process. Syntax #include int pause (void); Parameters None. Return Values No return Success. -1 An error occurred, and errno is set to indicate the error condition. Description The pause() function suspends execution of the calling process until the delivery of a signal that either executes a user-supplied signal handling function (signal handler) or causes the process to terminate.
pause See Also alarm(), kill(), sigaction(), wait(), POSIX.1 (Section 3.4.2). POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
pathconf Gets con guration variable for path name. Syntax #include long pathconf(char *pathname, int name); Parameters pathname name is the name of the le or directory. is a symbol indicating the variable, the value of which you want to determine, relative to the le or directory speci ed in pathname. . Description pathconf() lets you determine the value of a con guration variable associated with a particular le.
pathconf application may have the user enter before the application actually reads the input. pathname must refer to a terminal le. _PC_NAME_MAX stands for NAME_MAX de ned in |the maximum number of characters in a lename (not including any terminating 0 if the lename is stored as a string). This only refers to the lename itself, that is, the last component of the le's path name. pathname must be a directory, and pathconf() returns the maximum length of lenames for les in the directory.
pathconf under the directory, but not for subdirectories of the directory. stands for _POSIX_NO_TRUNC de ned in . This indicates that an error is to be generated if a le name is longer than NAME_MAX. pathname must be a directory, and the value returned by pathconf() applies to all les under that directory. stands for _POSIX_VDISABLE de ned in . This indicates that terminal special characters can be disabled using this character value, if it is de ned; see tcsetattr() for details.
pathconf ENAMETOOLONG CAUSE ACTION ENOENT CAUSE ACTION ENOTDIR CAUSE ACTION pathname is longer than PATH_MAX characters, or some component of pathname is longer than NAME_MAX and _POSIX_NO_TRUNC is set. Unset the con guration variable _POSIX_NO_TRUNC' to disable checking the length of pathname or modify pathname to ensure that the entire name is less than PATH_MAX characters in length and that each component is less than NAME_MAX characters in length.
pclose Close a pipe. Syntax #include int pclose(FILE *stream); Parameters stream is the pointer for a pipe opened with popen(). If it is not a pointer for a pipe opened with popen(), the result is unde ned. Description pclose() closes a pipe that was opened with popen(). It then waits for the command on the other end of the pipe to terminate. Errors Normally, pclose() returns the termination status of the command at the other end of the pipe.
pclose See Also sh(1), popen() POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
pipe Create an inter-process channel. Syntax int pipe (int ldes[2]) Parameters ldes An open le descriptor. Return Values 0 -1 successful completion error, errno is set to indicate the error Description The pipe() function creates a pipe and places two le descriptors, one each into the arguments ldes [0] and ldes [1]. These arguments refer to the open le descriptions for the read and write ends of the pipe. Their integer values are the two lowest available at the time of the pipe() function call.
pipe Implementation Considerations None. Errors If an error occurs, errno is set to one of the following values: EMFILE CAUSE ENFILE ACTION CAUSE ACTION f g More than OPEN MAX -2 le descriptors are already in use by this process. Check process limit in . Close a le. The number of simultaneously open les in the system would exceed a system-imposed limit. Close a le. See Also fcntl(), open(), read(), write(), POSIX.1 POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
popen Open a pipe to a command and execute the command. Syntax #include FILE *popen(const char *command, const char *mode); Parameters command mode Is a string giving the command line for a command you want to execute. Speci es the nature of the pipe you want to open. This can be the string \r" or \w". See the following section for more details. Description popen() executes the command speci ed by command.
popen Errors popen() returns NULL if it cannot create the pipe or the child process. It sets errno to one of the values used by pipe() or fork(). popen() may also set errno to: EINVAL CAUSE ACTION The value of mode was invalid. Specify a valid value for mode. See Also sh(1), pclose() POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
read Reads data from a le. Syntax #include ssize_t read (int ldes, void *bu er, size_t nbyte); Parameters ldes bu er nbyte An open le descriptor. A pointer to a bu er where data is returned. The size of the bu er must be greater than nbyte . The maximum number of bytes to read. Return Values >=0 -1 Success. An integer value indicating the number of bytes actually read is returned. An error occurred. The content of the bu er is indeterminate and errno is set to indicate the error condition.
read The value returned by read() is never greater than nbyte . The value returned may be less than nbyte if either the number of bytes left in the le is less than nbyte or the le is a special le (STDIN_FILENO) and fewer than nbytes are available. If nbytes is zero, the read() function returns zero bytes of data. In this case, the le o set position is not changed, and no time elds are marked for update. No data transfer occurs past the current end-of- le (EOF).
read See Also creat(), dup(), execl(), execv(), fork(), open(), unlink(), POSIX.1 (Section 6.4.1) 4-184 POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
readdir readdir Reads entries from an open directory stream. Syntax #include #include struct dirent *readdir (DIR *dirp); Parameters dirp A pointer to an open directory stream obtained from a successful call to opendir(). Return Values <>NULL NULL NULL Success. End of directory stream was reached, but errno is not modi ed. An error occurred, and errno is set to indicate the error condition.
readdir Implementation Considerations Refer to the EFAULT and ESYSERR error descriptions below. Both the dot and dot dot directory entries are returned only for directories that explicitly contain them. The root directory, MPE/iX accounts, and MPE/iX groups do not contain explicit dot and dot dot entries. If an entry is removed from or added to the directory after the most recent call to opendir() or rewinddir(), subsequent returns from readdir() accurately re ect the current state of the directory.
readlink readlink Reads the value of a symbolic link. Syntax #include init readlink(const char *path, char *buf, size_t bufsiz); Parameters path buf len The pathname of a le. Points to the region of memory where confstr() stores the string value of the variable indicated by name. Is the maximum number of characters that can be placed in buf.
readlink Implementation Considerations None. Errors If an error occurs, errno is set to one of the following values: EACCES ENAMETOOLONG CAUSE One of the following: ACTION The calling process does not have search permission to a component of the pathname. The calling process does not have execute permission to the le. One of the following: CAUSE Make sure that the calling process has search permission to all components of the pathname.
readlink ELOOP CAUSE A loop exists in symbolic links encountered during resolution of the path argument. This error may be returned if more than POSIX SYMLOOP symbolic links are encountered during resolution of the path argument. Make sure that there is not a loop in the symbolic links that loops more than POSIX_SYMLOOP. a component of the pathname for the executable le does not exist, ot pathname points to an empty string. Specify a valid pathname.
regcomp Compile a regular expression. Syntax #include int regcomp (regex_t *reg, const char *regstr, int ags); Parameters reg regstr ags 4-190 points to an object where regcomp() stores the compiled regular expression. regex_t is de ned in . points to the regular expression as a string (the way it might be speci ed for a command like grep). gives a variety of ags for the compilation. Flags are given by symbols de ned in which can be ORed together.
regcomp also a ects the behavior of regexec(3) Return Values 0 Successful compile Error code Not successful compile Description regcomp() compiles a regular expression for later use. Early implementations of regcomp() generated executable code that determined whether or not strings matched regstr . Under POSIX.2, regcomp() may generate executable code and/or data which speeds pattern-matching. The result of regcomp() is a structure of the regex_t type which is stored in reg .
regcomp REG_BADPAT REG_BADRPT CAUSE ACTION CAUSE ACTION REG_EBRACE CAUSE ACTION REG_EBRACK CAUSE ACTION REG_ECOLLATE CAUSE ACTION REG_ECTYPE CAUSE ACTION REG_EESCAPE CAUSE ACTION REG_ENEWLINE CAUSE ACTION REG_EPAREN 4-192 CAUSE ACTION regstr was an invalid regular expression. Specify a valid regular expression regstr contained a ?, *, or + that was not preceded by a valid regular expression. Make sure that every unquoted /, *, or + in regstr is preceded by a valid regular expression.
regcomp REG_ERANGE CAUSE REG_ESPACE ACTION CAUSE ACTION REG_ESUBREG CAUSE ACTION REG_EFATAL CAUSE ACTION A range expression contained an invalid endpoint. For example, an equivalence or character class is not valid. Specify a valid endpoint. There were not enough free system resources for regcomp() to compile regstr Free up more resources or specify a less complex regular expression. The number in a number construct was greater than the number of matching subexpressions.
regerror Convert regular expression errors to messages. Syntax #include #include size_t regerror(int errcode, const regex_t *reg, char *errbuf, size_t len) Parameters errcode reg errbuf len Is the last non-zero value returned by a call to regcomp() or `regexec()''. Points to an object where regcomp() stored a compiled regular expression. regex_t is de ned in . reg is currently unused in this implementation.
regerror Erorrs regerror() normally places one of the messages from the regerror(3) man page in the bu er indicated by *errbuf. All messages are shown with the error code returned by regcomp() or regexec()''. See Also regexec(), regfree(), regexp(3) POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
regexec Compare string against compiled regular expression. Sytnax #include #include int regexec(const regex_t *reg, const char *string, size_t maxmatch, regmatch_t submatch[] , int ags); Parameters reg Must point to an object where regcomp() stored a compiled regular expression. string Is the string you want to compare against the regular expression associated with reg . maxmatch Is the maximum number of matching substrings that you want regexec() to nd.
regexec the special meaning of the dollar sign ($) (the end of the line) never matches in string . Return Values regexec() returns zero to indicate a successful match, or one of the following error codes. Description regexec() compares the given string to the regular expression reg . reg must have been created by a previous call to regcomp().
regexec submatch[0] contains the match for the whole regular expression, submatch[1] contains the match for \(b*\), and submatch[2] contains the match for \(d*\). Unused elements of submatch have NULL pointers and -1 o sets. If there are more than maxmatch matching substrings, regexec() nds them but only records maxmatch in submatch . A parenthesized subexpression of pattern might be part of several di erent substring matches, or match nothing even though the expression as a whole matches.
regexec Errors If an error occurs, errno is set to one of the following values: REG_ESPACE CAUSE ACTION REG_NOMATCH REG_EFATAL CAUSE ACTION CAUSE ACTION There were not enough free system for regexec() to carry out the comparison. Free up more resources, or specify a less complex regular expression or shorter string. No match was found. No action is required. Some other error occurred. For example, reg was not a valid compiled regular expression, or was destroyed by an errant pointer.
regfree Free a compiled regular expression. Syntax #include void regfree(regex_t *reg); Parameters reg must point to an object where regcomp() stored a compiled regular expression. Description regfree() frees any memory that was allocated by regcomp() when it compiled the regular expression associated with reg . The regex_t object itself is not freed. Note See Also regcomp(), regexec(), regexp(3) 4-200 POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
rename rename Renames an existing le. Syntax #include int rename(const char *old, const char new); Parameters old new The pathname of the le to be renamed. The new pathname of the le. Return Values Upon successful completion, a value of zero will be returned, Otherwise, a value of -1 will be returned and errno will be set to indicate the error. If -1 is returned, neither the lenamed by old nor the lenamed by new , if either exists, will be changed by this function call.
rename new . Thus, if new names an existing directory, it will be required to be an empty directory. The new pathname should not contain a path pre x that names old . If the link named by the new argument exists and the link count of the le becomes zero when it is removed and no process has the le open, the space occupied by the le will be freed and the le will no longer be accesable.
rename ENAMETOOLONG CAUSE ACTION ENOENT CAUSE ENOSPC ACTION CAUSE ACTION ENOTDIR ESYSERR CAUSE ACTION CAUSE ACTION One of the following: The length of the pathname exceeds the {PATH_MAX} limit (de ned in the le ). A component of the pathname is longer than {NAME_MAX} (de ned in ), and {_POSIX_NO_TRUNC} is in e ect for that directory. Make sure that both the component's length and the full pathname length do not exceed the {NAME_MAX} or {PATH_MAX} limits.
rewinddir Resets an open directory stream to point to the rst entry of the directory. Syntax #include #include int rewinddir (DIR *dirp); Parameters dirp A pointer to an open directory stream obtained from a successful call to opendir(). Return Values 0 -1 The position is successfully reset. An error occurred. The current position is not changed, and errno is set to indicate the error condition.
rewinddir Errors If an error occurs, errno is set to one of the following values: EBADF CAUSE ACTION EFAULT CAUSE ACTION The dirp parameter does not refer to an open directory stream. Pass an open directory stream pointer returned by the opendir() function. The system detected a NULL or bad address in attempting to use the dirp parameter. Make sure that the pointer is correctly initialized. See Also mkdir(), closedir(), opendir(), readdir(), , POSIX.1 Section 5.1.2.
rmdir Purges (removes) a directory. Syntax #include int rmdir (const char *pathname); Parameters pathname A pointer to a string containing a pathname of the directory to purge. The pathname must be terminated by a null character. Return Values 0 -1 Success. An error occurred. The directory is not removed, and errno is set to indicate the error condition. Description The rmdir() function purges (removes) the directory speci ed by pathname .
rmdir Implementation Considerations Refer to the EFAULT, EIMPL, and ESYSERR error descriptions below. The rmdir() function cannot remove the dot and dot dot directory entries, the root directory, MPE/iX accounts, or MPE/iX groups.
rmdir CAUSE ENOENT ENOTEMPTY ACTION CAUSE ACTION CAUSE ESYSERR ACTION CAUSE ENOTDIR ACTION The speci ed directory does not exist, or pathname points to an empty string. Specify a valid pathname. A component of the pathname is not a directory. Specify a valid pathname. The directory speci ed by pathname cannot be removed because it is not empty. Make sure that the directory is an empty directory. An operating system error has occurred that does not map directly to any of the above errors.
setuid setuid Sets user IDs. Syntax #include init setuid(uid_t uid); Parameters uid The ID of a user. Return Values Upon successful completion, a value of zero is returned. If unsuccessful, a value of -1 is returned and errno is set to indicate the error. Description If f POSIX SAVED IDSg is de ned: If the process has appropriate privileges, the setuid() function sets the real user ID, e ective user ID, and the saved set-user-ID to uid .
setuid Implementation Considerations None. Errors If any of the following conditions occur, the setuid() function shall return -1 and set errno to the corresponding value: CAUSE EINVAL ACTION CAUSE EPERM ACTION The signal sig is not a valid signal number, or pid is -1. Refer to Table 3-5 for descriptions of valid signal numbers, or set pid to a valid value. The caller does not have permission to send the signal to any receiving process.
sigaction sigaction Examines and/or changes a signal action. Syntax #include int sigaction (int sig, const struct sigaction *act, struct sigaction *oact); Parameters sig act oact The signal number of the signal to examine or change. Valid signals are described in Table 3-5. If not NULL, a pointer to a structure of type sigaction that describes a new signal action to be associated with sig . If NULL, the current signal action is unchanged.
sigaction In order to examine the current action associated with a signal without changing the current action, set act to NULL. In order to change an action associated with a signal, de ne the new signal action in a structure of type sigaction and pass it in act . Refer to the following discussion of the sigaction structure. The sigaction structure, de ned in
sigaction A signal action installed by sigaction() remains in e ect until changed by another call to sigaction() or until the next call to one of the exec() functions. The sigaction() function is incompatible with the ANSI C signal() function. The sigaction() function can return and reinstall a signal action that was originally installed by signal(); however, the structure that sigaction() returns in oact may not reliably be examined by the caller.
sigaddset Adds a signal to a signal set. Syntax #include int sigaddset (sigset_t *set, int sig); Parameters set sig A pointer to a structure of type sigset_t containing a set of signals to which sig is to be added. The signal number of the signal to add to set . Valid signals are described in Table 3-5. Return Values 0 -1 Success. An error occurred. The signal is not added, and errno is set to indicate the error condition.
sigaddset Errors If an error occurs, errno is set to one of the following values: EFAULT CAUSE EINVAL ACTION CAUSE ACTION The system detected a NULL or bad address in attempting to use the set parameter. Make sure that the pointer is correctly initialized. The signal sig is not a valid signal number. Refer to Table 3-5 for descriptions of valid signal numbers. See Also sigaction(), sigdelset() , sigemptyset() , sigfillset() , sigismember(), , POSIX.1 (Section 3.3.
sigdelset Deletes a signal from a signal set. Syntax #include int sigdelset (sigset_t *set, int sig); Parameters set sig A pointer to a structure of type sigset_t containing a set of signals from which sig is to be deleted. The signal number of the signal to delete from set . Valid signals are described in Table 3-5. Return Values 0 -1 Success. An error occurred. The signal is not deleted, and errno is set to indicate the error condition.
sigdelset Errors If an error occurs, errno is set to one of the following values: EFAULT CAUSE EINVAL ACTION CAUSE ACTION The system detected a NULL or bad address in attempting to use the set parameter. Make sure that the pointer is correctly initialized. The signal sig is not a valid signal number. Refer to Table 3-5 for descriptions of valid signal numbers. See Also sigaction(), sigaddset() , sigemptyset() , sigfillset() , sigismember(), , POSIX.1 (Section 3.3.
sigemptyset Initializes a signal set to the empty set. Syntax #include int sigemptyset (sigset_t *set); Parameters set A pointer to a structure of type sigset_t to initialize to the empty set. Return Values 0 -1 Success. An error occurred. The signal set is not initialized, and errno is set to indicate the error condition. Description The sigemptyset() function initializes set to the empty set. All signals described in Table 3-5 are excluded from the set.
sigemptyset Errors If an error occurs, errno is set to the following value: EFAULT CAUSE ACTION The system detected a NULL or bad address in attempting to use the set parameter. Make sure that the pointer is correctly initialized. See Also sigaction(), sigaddset() , sigdelset() , sigfillset(), sigismember(), , POSIX.1 Section 3.3.3. POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
sigfillset Initializes a signal set to the full set. Syntax #include int sigfillset (sigset_t *set); Parameters set A pointer to a structure of type sigset_t to initialize to the full set. Return Values 0 -1 Success. An error occurred. The signal set is not initialized, and errno is set to indicate the error condition. Description The sigfillset() function initializes set to the full set. All signals described in Table 3-5 are included in the set.
sigfillset Errors If an error occurs, errno is set to the following value: EFAULT CAUSE ACTION The system detected a NULL or bad address in attempting to use the set parameter. Make sure that the pointer is correctly initialized. See Also sigaction(), sigaddset() , sigdelset() , sigemptyset(), sigismember(), , POSIX.1 (Section 3.3.3) POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
sigismember Tests whether a signal is a member of a signal set. Syntax #include int sigismember (const sigset_t *set, int sig); Parameters set sig A pointer to a structure of type sigset_t containing a set of signals to test. The signal number of the signal to test for membership in set . Valid signals are described in Table 3-5. Return Values 1 0 -1 The signal sig is a member of the signal set. The signal sig is not a member of the signal set. An error occurred.
sigismember Errors If an error occurs, errno is set to one of the following values: EFAULT CAUSE EINVAL ACTION CAUSE ACTION The system detected a NULL or bad address in attempting to use the set parameter. Make sure that the pointer is correctly initialized. The signal sig is not a valid signal number. Refer to Table 3-5 for descriptions of valid signal numbers. See Also sigaction(), sigaddset() , sigdelset() , sigemptyset(), sigfillset(), , POSIX.1 (Section 3.3.
siglongjmp Restore an environment previously saved by sigsetjmp(). Syntax #include void siglongjmp (sigjmp_buf env, int val); Parameters env Passes information needed to restore a previous environment. This variable was used in a previous call to sigsetjmp() to save the environment. The type sigjmp_buf (de ned in ) de nes an array of unsigned integers. For this reason, the env argument does not require an & operator.. Passes a value to be returned by sigsetjmp().
siglongjmp The restoration of the environment includes trimming the stack so that all stack frames beyond the frame marked by env are removed. The siglongjmp() function cannot add stack frames. This means that if a sequence of functions is: A == calls ==> B == calls ==> C and sigsetjmp() is used in function C to save an environment in a global env , functions B or A may not contain any siglongjmp() calls that reference the env values. Only subordinate functions may issue calls to siglongjmp().
sigpending Returns the set of pending signals. Syntax #include int sigpending (sigset_t *set); Parameters set A pointer to a structure of type sigset_t that is to contain the signals that are blocked from delivery and pending for the calling process. Return Values 0 -1 Success. An error occurred. No information is returned, and errno is set to indicate the error condition.
sigpending Errors If an error occurs, errno is set to the following value: EFAULT CAUSE ACTION The system detected a NULL or bad address in attempting to use the set parameter. Make sure that the pointer is correctly initialized. See Also sigprocmask(), , POSIX.1 (Section 3.3.6) POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
sigprocmask Examines or changes blocked signals. Syntax #include int sigprocmask (int how, const sigset_t *set, sigset_t *oset); Parameters how set oset Indicates how the process's signal mask should be changed by the parameter set . One only of the following values must be passed: SIG_BLOCK Add the speci ed signals in set to the process's signal mask. SIG_UNBLOCK Delete the speci ed signals in set from the process's signal mask.
sigprocmask Description The sigprocmask() function allows the caller to examine or change (or both) the calling process's signal mask. If any pending unblocked signals remain after a call to sigprocmask(), at least one of those signals is delivered to the calling process before the function returns. It is not possible to block the signals SIGKILL and SIGSTOP. If speci ed in the structure pointed to by set , they are removed by the system without error.
sigsetjmp Save the current environment and signal mask. Syntax #include int sigsetjmp (sigjmp_buf env, int savemask); Parameters env savemask Returns the current environment for later use in a call to siglongjmp(). If savemask is set to a non-zero value, the current signal mask is also returned in env . The type sigjmp_buf (de ned in ) de nes an array of unsigned integers. For this reason, the env argument does not require an & operator.
sigsetjmp Return Values 0 <>0 Successful completion of a call to sigsetjmp(). Successful completion of a call to siglongjmp(). The value is that of the val parameter passed to siglongjmp() , or 1 if a zero was passed in the val parameter. See Also siglongjmp(), POSIX 1003.1 (Section 8.3.1) POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
sigsuspend Replaces the calling process's signal mask and suspends the calling process to wait for a signal. Syntax #include int sigsuspend (sigset_t *sigmask); Parameters sigmask If not NULL, a pointer to a structure of type sigset_t that contains a new signal mask to be installed before suspending the calling process. If NULL, the process's current signal mask is used.
sigsuspend Implementation Considerations Refer to the EFAULT error description below. If the sigmask parameter of the sigsuspend() function is set to NULL, the process is suspended with the current signal mask. This implementation is considered an extension to the POSIX.1 standard. A strictly conforming POSIX application should pass in the sigmask parameter of the sigsuspend() function the current signal mask returned by a successful call to sigprocmask() where set is set to NULL.
sleep Delays process execution. Syntax #include unsigned int sleep (unsigned int seconds); Parameters seconds Speci es the number of real time seconds to sleep. Return Values No return If the action associated with a signal is to terminate, sleep() does not return. 0 The requested time has elapsed. >0 The di erence between seconds and the actual number of seconds slept before delivery of a signal whose action is to execute a signal handling function.
sleep Implementation Considerations The SIGALRM signal is not used to implement sleep(). Errors None. See Also alarm(), pause(), sigaction(), POSIX.1 (Section 3.4.3). POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
stat Returns le status information. Syntax #include #include int stat (const char *pathname, struct stat *bu er); Parameters pathname bu er A pointer to a string containing a pathname of the le or directory from which to obtain information. The pathname must be terminated by a null character. A pointer to a bu er of type struct stat (de ned in ) where le status information is returned. Return Values 0 -1 Success. An error occurred.
stat Implementation Considerations Refer to the EACCES, EFAULT, EIMPL, and ESYSERR error descriptions below. Access permissions to the le are not required, but if the le or directory has an MPE/iX ACD, the calling process must have MPE/iX read ACD (RACD) access to the le or directory, or an error occurs.
stat CAUSE EPERM ACTION CAUSE ESYSERR ACTION The calling process does not have MPE/iX read ACD (RACD) access to the le, or the pathname begins with two slash characters (//). Make sure that the calling process has RACD access to the le before calling stat(), or do not begin the pathname with two slash characters (//). Access denied.
symlink symlink Creates a symbolic link to a le. Syntax #include init symlink(const char *pname, const char *slink); Parameters pname slink Is the pathname contained in the symbolic link. Is the name of the symbolic link created. Return Values Upon successful completion, the symlink() function will return zero. Otherwise, a value of -1 will be returned and errno will be set to indicate the error.
symlink Errors If an error occurs, errno is set to one of the following values: CAUSE EACCES ACTION ENAMETOOLONG CAUSE ACTION CAUSE ACTION CAUSE EEXIST ELOOP The calling process does not have search permission to a component of the pathname. Make sure that the calling process has search permission to all components of the pathname. One of the following: The length of the pathname exceeds the {PATH_MAX} limit (de ned in the le ).
sysconf sysconf Determine system con guration options. #include long sysconf(int name); Parameters name speci es the system con guration option for which you want to obtain the value. The value of name is given may be any one of a set of symbols de ned in ; each of these symbols corresponds to an environment variable or manifest constant which gives a system con guration option. Return Values sysconf() returns the value associated with the speci ed name .
sysconf _SC_BC_STRING_MAX _SC_CHILD_MAX _SC_CLK_TCK _SC_COLL_WEIGHTS_MAX _SC_EXPR_NEST_MAX _SC_JOB_CONTROL _SC_LINE_MAX _SC_NGROUPS_MAX 4-242 Stands for BC_STRING_MAX de ned in |the maximum length of a string accepted by bc(1). Stands for CHILD_MAX de ned in |the maximum number of processes that a real user ID may have executing simultaneously. Stands for CLK_TCK de ned in | the number of clock ticks in a second. Stands for COLL_WEIGHTS_MAX de ned in
sysconf _SC_OPEN_MAX _SC_RE_DUP_MAX _SC_SAVED_IDS _SC_STREAM_MAX _SC_TZNAME_MAX _SC_VERSION _SC_2_C_BIND _SC_2_C_DEV Stands for OPEN_MAX de ned in |the maximum number of les that a single process may have open at one time. Stands for RE_DUP_MAX de ned in |the largest number of repeated occurrences of a regular expression that you can use in the notation \{m,n\}. Stands for _POSIX_SAVED_IDS which may be de ned in
sysconf _SC_2_CHAR_TERM _SC_2_FORT_DEV _SC_2_FORT_RUN _SC_2_LOCALEDEF _SC_2_SW_DEV; _SC_2_UPE _SC_2_VERSION 4-244 Stands for _POSIX2_CHAR_TERM which may be de ned in |if this is de ned, the system supports at least one terminal type capable of all operations necessary for the User Portability Utilities. This is only on if _SC_2_UPE is on. Stands for _POSIX2_FORT_DEV which may be de ned in |if this is de ned, the system supports the FORTRAN Development Utilities Option of POSIX.
sysconf Errors If sysconf() fails to recognize name, it returns -1 and sets errno to the value: EINVAL CAUSE ACTION The value speci ed for the name argument was invalid. Specify a valid value for name. See Also bc(1), expr(1), paste(1) POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
system Execute a command using the shell. Syntax #include int system(const char *command); Parameters command is a string giving the command line for the command you want to execute using the shell (MPE/iX Shell). Return Values If command is NULL, system() returns -1. If command is not NULL, system() returns the exit status of the sh command that executes command.
system Implementation Considerations None. Errors None. See Also sh(1) POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
time Returns the number of seconds since the Epoch. Syntax #include time_t time (time_t *tloc); Parameters tloc If not NULL, a pointer to a variable of type time_t where the number of seconds since the Epoch is returned. If NULL, no value is stored. Return Values >=0 -1 Success. An error occurred. The time is not returned, and errno is set to indicate the error condition.
time Errors If an error occurs, errno is set to the following value: EFAULT CAUSE ACTION The system detected a bad address in attempting to use the tloc parameter. Make sure that the pointer is correctly initialized. See Also , POSIX.1 (Section 4.5.1) POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
times Gets process times. Syntax #include clock_t (struct tms *bu er); Parameters bu er insert parameter info here Return Values Upon successful completion, times() will return the elapsed real time, in clock ticks, since and arbitrary point in the past (for example, system start-up time). This point does not change from one invocation of times() within the process to another. The return value may over ow the possible range of type clock t .
times The times of a terminated child process are included in the tms cutime and tms cstime elements of the parent when a wait() or waidpid() function returns the process ID of this terminated child. See 3.2.1. If a child process has not waited for its terminated children, their times will not be included in its times. The value tms utime is the CPU time charged for the execution of user instructions. The value tms stime is the CPU time charged for execution by the system on behalf of the process.
ttyname Determines terminal device name. Syntax #include char *ttyname(int ldes); Parameters ldes An open le descriptor. Return Values The ttyname() function returns a NULL pointer if ledes is not a valid le descriptor associated with a terminal or if the pathname cannot be determined. Description The ttyname function returns a pointer to a string containing a null-terminated pathname of the terminal associated with le descriptor ldes . Implementation Considerations None.
umask umask Sets a process's le mode creation mask. Syntax #include #include mode_t umask (mode_t cmask); Parameters cmask A bit map specifying a creation mask. Bits that are not access permission bits must be set to zero or an error occurs. Return Values 0 -1 Any other value Success. This is the rst time umask() has been invoked by the calling process. There is no previous valid le creation mask. An error occurred, and errno is set to indicate the error condition.
umask Implementation Considerations Refer to the EIMPL error description below. The rst time umask() is invoked by a process, zero is returned to indicate that the previous le creation mask was not initialized. Errors If an error occurs, errno is set to the following value: CAUSE EIMPL ACTION Bits of cmask that are not le permission bits do not contain zeros. Make sure that bits that are not le permission bits contain zeros. See Also chmod(), creat(), mkdir(), open(), , POSIX.
uname uname Returns current system ID's. Syntax #include init uname(struct utsname *name); Parameters name A pointer to a string of characters that will return system identi cation. Return Values >=0 -1 Successful completion. Error and errno is set to indicate the error. Description The uname() function stores information identifying the current operating system in the utsname structure pointed to by the argument name . The structure utsname is de ned in the header
uname A sample output of this parameter displays as follow: sysname = MPE/iX nodename = STARS.ITG.HP release = A.41.00 version = A.51.07 machine = SERIES 955 Implementation Considerations The node name is retrieved from NMCONFIG.PUB.SYS and is not necessarily su cient information for interfacing to communications networks. The release ID is the manufacture release ID, known as the release vuf on MPE/iX. The version ID stands for the version of the MPE/iX OS product.
unlink unlink Removes a link from a le. Syntax #include int unlink (const char *pathname); Parameters pathname A pointer to a string containing the pathname of a le to unlink (purge). The pathname must be terminated by a null character. Return Values 0 -1 Success. An error occurred. The le is not unlinked, and errno is set to indicate the error condition. Description The unlink() function removes the link name speci ed by pathname .
unlink Implementation Considerations Refer to the EFAULT, EIMPL, EPERM, and ESYSERR error descriptions below. POSIX/iX does not support using unlink() on directories. Instead, use rmdir() to remove a directory. POSIX/iX does not support multiple hard links to les or soft links to les or directories. Every le has a link count of 1 when created. Files being unlinked cause the link count of the le to be decremented from 1 to 0.
unlink ENOENT ENOTDIR EPERM ESYSERR CAUSE ACTION CAUSE ACTION CAUSE ACTION CAUSE ACTION The speci ed le does not exist, or pathname points to an empty string. Specify a valid pathname. A component of the pathname is not a directory. Specify a valid pathname. The speci ed le is a directory. Do not attempt to unlink a directory. Use rmdir() instead. An operating system error has occurred that does not map directly to any of the above errors. Examine the MPE/iX error stack for the type of system error.
utime Sets access and modi cation times of a le. Syntax #include #include int utime(const char *path, const struct utimbuf *times), Parameters path times A pointer to a character array containing the pathname of the le that is to become the new process image. The pathname must be terminated by a null character. If not NULL, a pointer to a utimbuf structure containing the access and modi cation times.
utime If the utime argument is not NULL, it is interpreted as a pointer to a utimbuf structure, and the access and modi cation times are set to the values contained in the designated structure. Only the owner of the le and processes weith appropriate privileges shall be permitted to use the utime() function in this way. The utimbuf structure is de ned by the header
utime Errors If any of the following conditions occur, the utime() function will return -1 and set errno to the corresponding value. EACCES ENAMETOOLONG CAUSE One of the following: ACTION The calling process does not have search permission to a component of the pathname. The calling process does not have execute permission to the le. The le is not a valid executable le. One of the following: CAUSE Make sure that the calling process has search permission to all components of the pathname.
utime EPERM EROFS CAUSE One of the following: ACTION The calling process does not have the MPE/iX process handling (PH) capability. The calling process has outstanding switches to CM code, has set critical mode, has outstanding NOWAITIO, or is holding an operating system internal resource. One of the following: CAUSE ACTION Link the program le with the MPE/iX PH capability.
wait Suspends the calling process to wait for exit status of child processes. Syntax #include #include pid_t wait (int *stat loc); Parameters stat loc A pointer to the exit status of the child process. No information is returned if stat loc is NULL. Return Values >0 -1 Success. The process ID of a child process that has terminated is returned. An error occurred. There is no result, and errno is set to indicate the error condition.
wait The wait() function returns to the argument pointed to by stat loc an exit status of 0 if, and only if, the child process that returned status took one of the following two actions: returned a value of zero from its main() function (outer block) passed a status value of zero to _exit() or exit() The following macros that evaluate the stat loc parameter, regardless of its value, are de ned in the header
wait Errors If an error occurs, errno is set to one of the following values: ECHILD CAUSE EFAULT ACTION CAUSE EINTR ACTION CAUSE ACTION The calling process has no unwaited-for child processes. No action is necessary. The system detected a bad address in attempting to use the stat loc parameter. Make sure that the pointer is correctly initialized. The function was interrupted by a signal. The stat loc parameter's value is unde ned. Call the wait() function again to continue waiting.
waitpid waitpid Suspends the calling process to wait for exit status of the speci ed child processes. Syntax #include #include pid_t waitpid (pid_t pid, int *stat loc, int options); Parameters pid stat loc options An parameter of type pid_t that speci es the process whose status is being reported. Following are valid values and their meanings: >0 A single child process with process ID equal to pid . 0 All child processes with process group ID equal to the caller's.
waitpid Return Values >0 0 -1 Success. The process ID of a terminated child process whose process ID matches pid is returned. The WNOHANG option is speci ed in options and no child speci ed by pid has terminated. An error occurred. There is no result, and errno is set to indicate the error condition. Description The waitpid() function suspends the calling process until status information for the speci ed child process(es) is available.
waitpid WIFSIGNALED(exit_status) WTERMSIG(exit_status) WIFSTOPPED(exit_status) WSTOPSIG(exit_status) exit(), or the value that the child process returned from main(). Evaluates to a nonzero value if status was returned for a child process that terminated due to the receipt of a signal that was not caught. If WIFSIGNALED is nonzero, this macro evaluates to the number of the signal that caused the termination of the child process.
waitpid See Also _exit(), fork(), pause(), wait(), , POSIX.1 (Section 3.2.1) 4-270 POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
wordexp wordexp Expand special constructions. Syntax #include int wordexp (const char *words, wordexp_t *expansions, int ags); Parameters words is a string containing various special constructions that are typically expanded in shell command lines (for example, command substitutions, directory substitutions, parameter expansions, and so on). expansions points to an object of type wordexp_t where wordexp() can store the expanded version of words. It is created by the caller.
wordexp WRDE_UNDEF Reports error on attempt to expand an unde ned shell variable. Return Values If wordexp() completes successfully, it returns zero. Otherwise, it returns one of the following error messages. Description wordexp() expands special constructs in the string words. See the section Expanded Constructs for a list of the constructs that wordexp() expands. wordexp() returns the expansion using a wordexp_t structure.
wordexp 2. If WRDE_DOOFFS is not set in the rst call, it must not be set in subsequent calls. 3. After the second call, we_wordv points to a list containing: the number of NULL pointers as determined by WRDE_DOOFFS and we_offs; pointers to the words that were in the list before the second call, in the same order as before; and pointers to the new words obtained by the second call, in the order dictated by the ags for the second call. 4. we_wordc gives the total number of words from all the calls.
wordexp Arithmetic Expansion expands constructs of the form $((%%expression%%)) by replacing the construct with the value of the arithmetic expression . These expansions are discussed in much greater detail in sh(1). After performing the various expansions, wordexp() breaks up the result into separate words. Words are assumed to be separated by any one of the characters in the string value of the environment variable IFS.
wordexp Errors If an error occurs, errno is set to one of the following values: WRDE_BADCHAR CAUSE ACTION WRDE_BADVAL CAUSE ACTION WRDE_CMDSUB CAUSE ACTION WRDE_ERRNO CAUSE An unquoted shell metacharacter appeared in words in an inappropriate context. Examine and correct the syntax of the words string that was passed to the function. You attempted to reference an unde ned shell variable when WRDE_UNDEF was set in ags . Unset WRDE_UNDEF, or do not use unde ned shell variables.
wordfree Release data created by wordexp. Syntax #include void wordfree(wordexp_t *expansions); Parameters expansions Is a wordexp_t structure used in a previous call to wordexp(). Description wordfree() frees any memory allocated in connection with the the expansions structure. Typically, this gets rid of any space that a call to wordexp() allocated to hold a word expansion list. See Also sh(1), wordexp() 4-276 POSIX/iX Library Function Descriptions FINAL TRIM SIZE : 7.0 in x 8.
write write Writes data to a le. Syntax ssize_t write (int ldes, const void *bu er, size_t nbyte); Parameters ldes bu er nbyte An open le descriptor. A pointer to a bu er containing data to be written. The size of the bu er must be greater than nbyte . The maximum number of bytes to write. Return Values >=0 -1 Success. An integer indicating the number of bytes actually written is returned. An error occurred. No data is written, and errno is set to indicate the error condition.
write Upon successful completion, the write() function returns the actual number of bytes written to the le and, if nbyte is greater than 0, marks for update the st_ctime and st_mtime time elds of the le. If write() requests that more bytes be written than there is room for (for example, the physical end of medium), only as many bytes as there is room for are written. In this case, the next write to the le of a nonzero number of bytes fails, and an error is returned.
write EIMPL CAUSE ACTION ENOSPC CAUSE ESYSERR ACTION CAUSE ACTION The le size has exceeded the disk space limit established by the MPE/iX accounting facility. Make sure that the MPE/iX accounting facility allows you to increase the size of the le. There is no free space remaining on the device containing the le. Deallocate space on the device. An operating system error has occurred that does not map directly to any of the above errors. Examine the MPE/iX error stack for the type of system error.
5 POSIX/iX Header Descriptions This chapter describes the contents of the header les provided with the POSIX/iX library. The POSIX.1 extensions are invoked by the _POSIX_SOURCE feature test macro. Note The _POSIX_SOURCE feature test macro must be speci ed in your source code before you include any headers described in this chapter. The header or headers required for each function are speci ed in the syntax descriptions provided in this manual and in the HP C/iX Library Reference Manual (30026-90001).
Header le identi ers beginning with an underscore ( ) are reserved for library use. You should not create identi ers that begin with an underscore within your source code. The following headers are not described in this manual. Like all the headers provided with the MPE/iX Developer's Kit, they are located under the directory /usr/include. You can view them online from the MPE/iX CI using the PRINT command or from the MPE/iX Shell using the cat command. glob.h regex.h wordexp.
Table 5-1. POSIX/iX Library Headers Header Description Description Location De nes the assert() macro. HP C/iX Library Reference Manual Declares macros and functions useful for testing and mapping characters. HP C/iX Library Reference Manual Declares functions and data structures used for managing directories. This chapter Declares error variables and de nes macros useful for obtaining a more detailed description of a library function error.
Table 5-1. POSIX/iX Library Headers (continued) Header Description Description Location Declares a type and several functions for bypassing the normal function call and return discipline. This chapter Contains declaration used in dealing with conditions that may be reported during program execution. This chapter Provides a standard method for dealing with variable arguments. HP C/iX Library Reference Manual
Index Special characters :, 4-187, 4-239 @.@, 3-14 A access checks le accessibility, 4-2 access(), 4-2 access control. See access permissions, ACDs access control de nitions. See ACDs access permission bits, 4-24 changing, 4-10 access permission bits## changing, 4-92, 4-94, 4-98, 4-106, 4-111, 4-113, 4-250 access permissions @.
directories under, 3-4, 3-9 les and directories under, 3-8 fstat(), 3-16 GID, 3-8 restrictions, 3-8 stat(), 3-16 syntax, 3-8 system manager, 3-8 UID, 3-8 ACDs, 3-12 @.@, 3-14 a ect on lockwords, 3-19 assigning access permissions, 3-14 chmod() behavior, 3-17 create directory entries access, 3-13 delete directory entries access, 3-13 fstat() behavior, 3-15 $GROUP, 3-14 $GROUP MASK, 3-14 mapping between POSIX.
close(), 4-18 closedir(), 4-20 closing a directory stream, 4-20 a le, 4-18 command interpreter, 2-6 common usage math library, 2-2 compatibility mode code, 3-28 compilers C/iX, 1-3 compiling source les, 2-6 conformance, 1-1, 1-5 confstr, 4-22 controlling process, 3-27 controlling terminal, 3-27 CPU time accounting information, 3-27 creat(), 4-24 create directory entries access, 3-13 creates a symbolic link to a le, 4-239 creating accounts, 3-8 a directory, 4-148 a le, 4-24 groups, 3-8 ##new process, 4-260 n
under groups, 3-8 write access, 3-13 directory management access(), 4-2 chdir(), 4-8 closedir(), 4-20 ctermid(), 4-28 getcwd(), 4-85 mkdir(), 4-148 opendir(), 4-167 readdir(), 4-185 readlink(), 4-187 rewinddir(), 4-204 rmdir(), 4-206 symlink(), 4-239 disk space accounting limits, 3-5 dot directory, 3-10 dot dot directory, 3-10 dup(), 4-28 dup, dup2, 4-29 duplicating an open le descriptor, 4-28 E e ective GID returning, 4-87 e ective UID, 3-24 returning, 4-90 environ, 4-88 environment restoring, 4-224 envir
## fcntl(), 4-66 fstat(), 4-82 isatty(), 4-140 lseek(), 4-146 open(), 4-160 read(), 4-182 ##rename(), 4-201 stat(), 4-236 ## ttyname(), 4-252 umask(), 4-253 unlink(), 4-257 write(), 4-277 le management## getgrgid(), 4-92 getgrnam(), 4-94 getgroups(), 4-96 getlogin(), 4-98 getpwnam(), 4-111 getpwuid(), 4-106, 4-113 times(), 4-250 le mode creation mask, 4-25 le modes changing, 4-10 le modes### changing, 4-92, 4-94, 4-98, 4-106, 4-111, 4-113 times, 4-250 le o set repositioning, 4-146 le other class, 3-13 @.
read only, 3-4 record formats, 2-3 regular les, 3-3 repositioning le o set, 4-146 returning status information, 4-236 rewriting, 4-24 save access, 3-9 save les capability, 3-19 setting a creation mask, 4-253 status information, 4-82 STDERR FILENO, 3-4 STDIN FILENO, 3-4 STDOUT FILENO, 3-4 syntax, 3-2 under accounts, 3-8 under groups, 3-8 writing, 4-277 les## executing, 4-260 le status information returning, 4-82 le system security matrix, 3-16 oat.
lseek(), 4-146 mkdir(), 4-148 open(), 4-160 opendir(), 4-167 pause(), 4-170 POSIX/iX math library, 2-2 read(), 4-182 readdir(), 4-185 readlink(), 4-187 rename(), 4-201 rewinddir(), 4-204 rmdir(), 4-206 setuid(), 4-209 sigaction(), 4-211 sigaddset(), 4-214 sigdelset(), 4-216 sigemptyset(), 4-218 sig llset(), 4-220 sigismember(), 4-222 sigpending(), 4-226 sigprocmask(), 4-228 sigsuspend(), 4-232 sleep(), 4-234 stat(), 4-236 symlink(), 4-239 time(), 4-248 times(), 4-250 ttyname(), 4-252 umask(), 4-253 uname(),
restrictions, 3-8 save access, 3-9 stat(), 3-16 UID, 3-8 H hard links, 3-6 header les. See headers headers assert.h, 5-2 ctype.h, 5-2 descriptions, 5-2 oat.h, 5-2 glob.h, 5-2 locale.h, 5-2 malloc.h, 5-2 math.h, 5-2 memory.h, 5-2 mpe.h, 5-2 regex.h, 5-2 search.h, 5-2 stdarg.h, 5-2 stddef.h, 5-2 stdlib.h, 5-2 string.h, 5-2 sys/times.h, 5-2 values.h, 5-2 varargs.h, 5-2 wordexp.h, 5-2 heap size, 3-27 HFS syntax, 3-2, 3-7 hierarchical directories. See directories hierarchical le system.
le size, 3-5 link(), 1-3 link count unlinking a le, 4-257 linking object les, 2-6 links hard, 3-6 soft, 3-6 LISTFILE, 3-26 locale.h, 5-2 lockwords, 3-19 lseek(), 4-146 M macros feature test, 2-3 POSIX SOURCE, 2-3 sigsetjmp, 4-230 malloc.h, 5-2 manuals MPE/iX developer's kit, 1-2, 1-4, 2-6 related reading, 1-2, 1-4, 1-5, 2-6 understanding MPE/iX, 1-5 mask setting a le creation mask, 4-253 math.h, 5-2 math library, 2-2 behavior, 2-2 common usage, 2-2 membership of a signal set, 4-222 memory.
Pipes. See FIFO special les popen, 4-180 portability, 1-5 portable applications, 1-1 POSIX.1 and ANSI C, 1-3 C language binding, 1-2 conformance, 1-1 le user classes, 3-13 mapping between directory access permissions and ACD access permissions, 3-13 mapping between POSIX.1 and ACD le user classes, 3-13 name syntax, 3-2 portability, 1-5 programming guide, 1-4 Standards document, 1-2 version, 1-2 POSIX.
sigprocmask(), 4-228 sigsuspend(), 4-232 sleep(), 4-234 stack size, 3-27 suspending, 4-232 suspending for a time, 4-234 termination, 3-27 ##utime(), 4-260 wait(), 4-264 waitpid(), 4-267 process management### setuid(), 4-209 process priority, 3-27 proess managment### uname(), 4-255 purging a le, 4-257 R RACD, 3-18 read(), 4-182 read access, 3-12 read ACD access, 3-18 readdir(), 4-185 read directory entries access, 3-13 reading a directory stream, 4-185 a le, 4-182 readlink(), 4-187 read-only le system, 3-4
setuid(), 4-209 set user IDs, 4-209 SF capability, 3-19 shell, 2-6 c89 command, 2-6 le name syntax, 3-2 invoking, 2-6 SIGABRT, 3-20 sigaction(), 4-211 and signal(), 3-24 sigaddset(), 4-214 SIGALRM, 3-20, 4-6 SIGBUS, 3-20 SIGCHLD, 3-20, 3-24 SIGCONT, 3-20 sigdelset(), 4-216 sigemptyset(), 4-218 sig llset(), 4-220 SIGFPE, 3-20 SIGHUP, 3-20 SIG IGN, 3-24 SIGILL, 3-20 SIGINT, 3-20 sigismember(), 4-222 SIGKILL, 3-20 siglongjmp() , 4-224 signal() and sigaction(), 3-24 signal action changing, 4-211 signal mask res
block device, 3-3 character device, 3-3 directory le, 3-3 FIFO, 3-3 stack size, 3-27 standard les, 3-4 standard math library. See POSIX/iX math library stat(), 4-236 accounts, 3-16 groups, 3-16 RACD restriction, 3-18 root directory, 3-16 rules determining access permissions, 3-15 st atime, 4-18, 4-25 st ctime, 4-25 stdarg.h, 5-2 stddef.h, 5-2 STDERR FILENO, 3-4, 4-26 STDIN FILENO, 3-4, 4-26 stdlib.h, 5-2 STDOUT FILENO, 3-4, 4-26 st mtime, 4-18, 4-25 streams description, 2-4 text and binary, 2-4 string.
user classes, 3-13 user ID. See UID utime(), 4-260 V values.h, 5-2 varargs.h, 5-2 W wait(), 4-264 waiting for signal delivery, 4-234 waitpid(), 4-267 wordexp, 4-271 wordexp.h, 5-2 wordfree, 4-276 write(), 4-277 write access, 3-12 writing to a le, 4-277 Index-14 FINAL TRIM SIZE : 7.0 in x 8.