Advanced Programming in the UNIX Environment: Second Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Advanced Programming in the UNIX Environment: Second Edition [Electronic resources] - نسخه متنی

W. Richard Stevens; Stephen A. Rago

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید











  • Appendix A. Function Prototypes


    This appendix contains the function prototypes for the standard ISO C, POSIX, and UNIX System functions described in the text. Often, we want to see only the arguments to a function ("Which argument is the file pointer for fgets?") or only the return value ("Does sprintf return a pointer or a count?"). These prototypes also show which headers need to be included to obtain the definitions of any special constants and to obtain the ISO C function prototype to help detect any compile-time errors.

    The page number reference for each function prototype appears to the right of the first header file listed for the function. The page number reference gives the page containing the prototype for the function. That page should be consulted for additional information on the function.

    Some functions are supported by only a few of the platforms described in this text. In addition, some platforms support function flags that other platforms don't support. In these cases, we usually list the platforms for which support is provided. In a few cases, however, we list platforms that lack support.

    void


    abort (void);


    <stdlib.h>

    This function never returns

    p. 340

    int


    accept (int

    sockfd , struct sockaddr *restrict

    addr ,
    socklen_t *restrict

    len );


    <sys/socket.h>

    Returns: file (socket) descriptor if OK, 1 on error

    p. 563

    int

    access (const char *

    pathname , int

    mode );
    <unistd.h>

    mode : R_OK, W_OK, X_OK, F_OK

    Returns: 0 if OK, 1 on error

    p. 95

    unsigned

    int

    alarm (unsigned int

    seconds );

    <unistd.h>

    Returns: 0 or number of seconds until previously set alarm

    p. 313

    char

    *

    asctime (const struct tm *

    tmptr );

    <time.h>

    Returns: pointer to null-terminated string

    p. 175

    int

    atexit (void (*

    func )(void));

    <stdlib.h>

    Returns: 0 if OK, nonzero on error

    p. 182

    int

    [View full width]

    bind (int

    sockfd , const struct sockaddr *

    addr ,
    socklen_t

    len );

    <sys/socket.h>

    Returns: 0 if OK, 1 on error

    p. 560

    void

    *calloc (size_t

    nobj , size_t size);

    <stdlib.h>

    Returns: non-null pointer if OK, NULL on
    error

    p. 189

    speed_t

    cfgetispeed (const struct termios *

    termptr );

    <termios.h>

    Returns: baud rate value

    p. 652

    speed_t

    cfgetospeed (const struct termios *

    termptr );

    <termios.h>

    Returns: baud rate value

    p. 652

    int

    cfsetispeed (struct termios *

    termptr , speed_t

    speed );

    <termios.h>

    Returns: 0 if OK, 1 on error

    p. 652

    int

    cfsetospeed (struct termios *

    termptr , speed_t

    speed );

    <termios.h>

    Returns: 0 if OK, 1 on error

    p. 652

    int

    chdir (const char *

    pathname );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 125

    int

    chmod (const char *

    pathname , mode_t

    mode );

    <sys/stat.h>

    mode :
    S_IS[UG]ID, S_ISVTX, S_I[RWX](USR|GRP|OTH)

    Returns:
    0 if OK, 1 on error

    p. 99

    int

    chown (const char *

    pathname , uid_t

    owner , gid_t

    group );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 102

    void

    clearerr (FILE *

    fp );

    <stdio.h>

    p. 141

    int

    close (int

    filedes );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 63

    int

    closedir (DIR *

    dp );

    <dirent.h>

    Returns: 0 if OK, 1 on error

    p. 120

    void

    closelog (void);

    <syslog.h>

    p. 430

    unsigned

    char

    *

    CMSG_DATA (struct cmsghdr *

    cp );

    <sys/socket.h>

    Returns: pointer to data associated
    with cmsghdr structure

    p. 607

    struct

    cmsghdr

    *

    CMSG_FIRSTHDR (struct msghdr *

    mp );

    <sys/socket.h>

    Returns: pointer to first cmsghdr
    structure associated with the msghdr

    structure, or
    NULL if none exists

    p. 607

    unsigned

    int

    CMSG_LEN (unsigned int

    nbytes );

    <sys/socket.h>

    Returns: size to allocate for data
    object

    nbytes large

    p. 607

    struct

    cmsghdr

    *

    CMSG_NXTHDR (struct msghdr *

    mp , struct cmsghdr *

    cp );

    <sys/socket.h>

    Returns: pointer to next cmsghdr
    structure associated with the msghdr

    structure
    given the current cmsghdr structure, or NULL if
    we're

    at the last one

    p. 607

    int

    [View full width]

    connect (int

    sockfd , const struct sockaddr *

    addr ,
    socklen_t

    len );

    <sys/socket.h>

    Returns: 0 if OK, 1 on error

    p. 561

    int

    creat (const char *

    pathname , mode_t

    mode );

    [View full width]

    <fcntl.h>

    mode : S_IS[UG]ID, S_ISVTX, S_I[RWX]
    (USR|GRP|OTH)

    Returns: file descriptor opened for
    write-only if OK, 1 on error

    p. 62

    char

    *

    ctermid (char *

    ptr );

    <stdio.h>

    Returns: pointer to name of controlling
    terminal on success, pointer to

    empty string on error

    p. 654

    char

    *ctime (const time_t *

    calptr );

    <time.h>

    Returns: pointer to null-terminated string

    p. 175

    int

    dup (int

    filedes );

    <unistd.h>

    Returns: new file descriptor if OK, 1
    on error

    p. 76

    int

    dup2 (int

    filedes , int

    filedes2 );

    <unistd.h>

    Returns: new file descriptor if OK, 1
    on error

    p. 76

    void

    endgrent (void);

    <grp.h>

    p. 167

    void

    endhostent (void);

    <netdb.h>

    p. 553

    void

    endnetent (void);

    <netdb.h>

    p. 554

    void

    endprotoent (void);

    <netdb.h>

    p. 554

    void

    endpwent (void);

    <pwd.h>

    p. 164

    void

    endservent (void);

    <netdb.h>

    p. 555

    void

    endspent (void);

    <shadow.h>

    Platforms: Linux 2.4.22, Solaris 9

    p. 166

    int

    [View full width]

    execl (const char *

    pathname , const char *

    arg0 , ...
    /* (char *) 0 */ );

    <unistd.h>

    Returns: 1 on error, no return on success

    p. 231

    int

    [View full width]

    execle (const char *

    pathname , const char *

    arg0 , ...
    /* (char *) 0,
    char *const

    envp [] */ );

    <unistd.h>

    Returns: 1 on error, no return on success

    p. 231

    int

    [View full width]

    execlp (const char *

    filename , const char *

    arg0 , ...
    /* (char *) 0 */ );

    <unistd.h>

    Returns: 1 on error, no return on success

    p. 231

    int

    execv (const char *

    pathname , char *const

    argv []);

    <unistd.h>

    Returns: 1 on error, no return on success

    p. 231

    int

    [View full width]

    execve (const char *

    pathname , char *const

    argv [],
    char *const

    envp []);

    <unistd.h>

    Returns: 1 on error, no return on success

    p. 231

    int

    execvp (const char *

    filename , char *const

    argv []);

    <unistd.h>

    Returns: 1 on error, no return on success

    p. 231

    void

    _Exit (int

    status );

    <stdlib.h>

    This function never returns

    p. 180

    void

    _exit (int

    status );

    <unistd.h>

    This function never returns

    p. 180

    void

    exit (int

    status );

    <stdlib.h>

    This function never returns

    p. 180

    int

    fattach (int

    filedes , const char *

    path );

    <stropts.h>

    Returns: 0 if OK, 1 on
    error

    Platforms: Linux 2.4.22, Solaris 9

    p. 589

    int

    fchdir (int

    filedes );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 125

    int

    fchmod (int

    filedes , mode_t

    mode );

    [View full width]

    <sys/stat.h>

    mode : S_IS[UG]ID, S_ISVTX, S_I[RWX]
    (USR|GRP|OTH)

    Returns: 0 if OK, 1 on error

    p. 99

    int

    fchown (int

    filedes , uid_t

    owner , gid_t

    group );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 102

    int

    fclose (FILE *

    fp );

    <stdio.h>

    Returns: 0 if OK, EOF on error

    p. 139

    int

    fcntl (int

    filedes , int

    cmd , ... /* int

    arg */ );

    [View full width]

    <fcntl.h>

    cmd : F_DUPFD, F_GETFD, F_SETFD, F_GETFL, F_SETFL,
    F_GETOWN, F_SETOWN, F_GETLK, F_SETLK,
    F_SETLKW

    Returns: depends on

    cmd if OK, 1 on error

    p. 78

    int

    fdatasync (int

    filedes );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    Platforms
    : Linux 2.4.22, Solaris 9

    p. 77

    void

    FD_CLR (int

    fd , fd_set *

    fdset );

    <sys/select.h>

    p. 476

    int

    fdetach (const char *

    path );

    <stropts.h>

    Returns: 0 if OK, 1 on
    error

    Platforms: Linux 2.4.22, Solaris 9

    p. 590

    int

    FD_ISSET (int

    fd , fd_set *

    fdset );

    <sys/select.h>

    Returns: nonzero if

    fd is in set, 0
    otherwise

    p. 476

    FILE

    *

    fdopen (int

    filedes , const char *

    type );

    <stdio.h>

    type : "r", "w", "a", "r+", "w+", "a+",

    Returns: file pointer if OK, NULL on error

    p. 138

    void

    FD_SET (int

    fd , fd_set *

    fdset );

    <sys/select.h>

    p. 476

    void

    FD_ZERO (fd_set *

    fdset );

    <sys/select.h>

    p. 476

    int

    feof (FILE *

    fp );

    <stdio.h>

    Returns: nonzero (true) if end of file on
    stream, 0 (false) otherwise

    p. 141

    int

    ferror (FILE *

    fp );

    <stdio.h>

    Returns: nonzero (true) if error on
    stream, 0 (false) otherwise

    p. 141

    int

    fflush (FILE *

    fp );

    <stdio.h>

    Returns: 0 if OK, EOF on error

    p. 137

    int

    fgetc (FILE *

    fp );

    <stdio.h>

    Returns: next character if OK, EOF on end
    of file or error

    p. 140

    int

    fgetpos (FILE *restrict

    fp , fpos_t *restrict

    pos );

    <stdio.h>

    Returns: 0 if OK, nonzero on error

    p. 148

    char

    *

    fgets (char *restrict

    buf , int

    n , FILE *restrict

    fp );

    <stdio.h>

    Returns: buf if OK, NULL on end of file
    or error

    p. 142

    int

    fileno (FILE *

    fp );

    <stdio.h>

    Returns: file descriptor associated with
    the stream

    p. 153

    void

    flockfile (FILE *

    fp );

    <stdio.h>

    p. 403

    FILE

    [View full width]

    *

    fopen (const char *restrict

    pathname , const char
    *restrict

    type );

    <stdio.h>

    type : "r", "w", "a", "r+", "w+", "a+",

    Returns: file pointer if OK, NULL on error

    p. 138

    pid_t

    fork (void);

    <unistd.h>

    Returns: 0 in child, process ID of child
    in parent, 1 on error

    p. 211

    long

    fpathconf (int

    filedes , int

    name );

    [View full width]

    <unistd.h>

    name : _PC_ASYNC_IO, _PC_CHOWN_RESTRICTED,
    _PC_FILESIZEBITS, _PC_LINK_MAX, _PC_MAX_CANON,
    _PC_MAX_INPUT, _PC_NAME_MAX, _PC_NO_TRUNC,
    _PC_PATH_MAX, 'u'_PC_PIPE_BUF, _PC_PRIO_IO,
    _PC_SYNC_IO,
    _PC_SYMLINK_MAX, _PC_VDISABLE

    Returns:
    corresponding value if OK, 1 on error

    p. 41

    int

    [View full width]

    fprintf (FILE *restrict

    fp , const char *restrict

    format , ...);

    <stdio.h>

    Returns: number of characters output if
    OK, negative value if output error

    p. 149

    int

    fputc (int

    c , FILE *

    fp );

    <stdio.h>

    Returns:

    c if OK, EOF on error

    p. 142

    int

    fputs (const char *restrict

    str , FILE *restrict

    fp );

    <stdio.h>

    Returns: non-negative value if OK, EOF on
    error

    p. 143

    size_t

    [View full width]

    fread (void *restrict

    ptr , size_t

    size , size_t

    nobj
    , FILE *restrict

    fp );

    <stdio.h>

    Returns: number of objects read

    p. 146

    void

    free (void *

    ptr );

    <stdlib.h>

    p. 189

    void

    freeaddrinfo (struct addrinfo *

    ai );

    <sys/socket.h>
    <netdb.h>

    p. 555

    FILE

    [View full width]

    *

    freopen (const char *restrict

    pathname , const char
    *restrict

    type ,
    FILE *restrict

    fp );

    <stdio.h>

    type : "r", "w", "a", "r+", "w+", "a+",

    Returns: file pointer if OK, NULL on error

    p. 138

    int

    [View full width]

    fscanf (FILE *restrict

    fp , const char *restrict

    format , ...);

    <stdio.h>

    Returns: number of input items assigned,
    EOF if input error or end of file

    before any conversion

    p. 151

    int

    fseek (FILE *

    fp , long

    offset , int

    whence );

    <stdio.h>

    whence : SEEK_SET, SEEK_CUR, SEEK_END

    Returns: 0 if
    OK, nonzero on error

    p. 147

    int

    fseeko (FILE *

    fp , off_t

    offset , int

    whence );

    <stdio.h>

    whence : SEEK_SET, SEEK_CUR, SEEK_END

    Returns: 0 if
    OK, nonzero on error

    p. 148

    int

    fsetpos (FILE *

    fp , const fpos_t *

    pos );

    <stdio.h>

    Returns: 0 if OK, nonzero on error

    p. 148

    int

    fstat (int

    filedes , struct stat *

    buf );

    <sys/stat.h>

    Returns: 0 if OK, 1 on error

    p. 87

    int

    fsync (int

    filedes );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 77

    long

    ftell (FILE *

    fp );

    <stdio.h>

    Returns: current file position indicator
    if OK, -1L on error

    p. 147

    off_t

    ftello (FILE *

    fp );

    <stdio.h>

    Returns: current file position indicator
    if OK, (off_t)-1 on error

    p. 148

    key_t

    ftok (const char *

    path , int

    id );

    <sys/ipc.h>

    Returns: key if OK, (key_t)-1 on error

    p. 519

    int

    ftruncate (int

    filedes , off_t

    length );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 105

    int

    ftrylockfile (FILE *

    fp );

    <stdio.h>

    Returns: 0 if OK, nonzero if lock can't
    be acquired

    p. 403

    void

    funlockfile (FILE *

    fp );

    <stdio.h>

    p. 403

    int

    fwide (FILE *

    fp , int

    mode );

    <stdio.h>
    <wchar.h>

    Returns: positive if stream is wide oriented, negative if stream is

    byte oriented, or 0 if stream has no orientation

    p. 134

    size_t

    [View full width]

    fwrite (const void *restrict

    ptr , size_t

    size ,
    size_t

    nobj ,
    FILE *restrict

    fp );

    <stdio.h>

    Returns: number of objects written

    p. 146

    const

    char

    *

    gai_strerror (int

    error );

    <netdb.h>

    Returns: a pointer to a string describing
    the error

    p. 556

    int

    [View full width]

    getaddrinfo (const char *restrict

    host , const char
    *restrict

    service ,
    const struct addrinfo *restrict

    hint ,
    struct addrinfo **restrict

    res );

    <sys/socket.h> <netdb.h>

    Returns: 0 if OK, nonzero
    error code on error

    p. 555

    int

    getc (FILE *

    fp );

    <stdio.h>

    Returns: next character if OK, EOF on end
    of file or error

    p. 140

    int

    getchar (void);

    <stdio.h>

    Returns: next character if OK, EOF on end
    of file or error

    p. 140

    int

    getchar_unlocked (void);

    <stdio.h>

    Returns: the next character if OK, EOF on
    end of file or error

    p. 403

    int

    getc_unlocked (FILE *

    fp );

    <stdio.h>

    Returns: the next character if OK, EOF on
    end of file or error

    p. 403

    char

    *

    getcwd (char *

    buf , size_t

    size );

    <unistd.h>

    Returns:

    buf if OK, NULL on error

    p. 126

    gid_t

    getegid (void);

    <unistd.h>

    Returns: effective group ID of calling
    process

    p. 210

    char

    *

    getenv (const char *

    name );

    <stdlib.h>

    Returns: pointer to

    value associated
    with

    name , NULL if not found

    p. 192

    uid_t

    geteuid (void);

    <unistd.h>

    Returns: effective user ID of calling
    process

    p. 210

    gid_t

    getgid (void);

    <unistd.h>

    Returns: real group ID of calling process

    p. 210

    structgroup

    *

    getgrent (void);

    <grp.h>

    Returns: pointer if OK, NULL on error or
    end of file

    p. 167

    structgroup

    *

    getgrgid (gid_t

    gid );

    <grp.h>

    Returns: pointer if OK, NULL on error

    p. 166

    structgroup

    *

    getgrnam (const char *

    name );

    <grp.h>

    Returns: pointer if OK, NULL on error

    p. 166

    int

    getgroups (int

    gidsetsize , gid_t

    grouplist []);

    <unistd.h>

    Returns: number of supplementary group
    IDs if OK, 1 on error

    p. 168

    structhostent

    *

    gethostent (void);

    <netdb.h>

    Returns: pointer if OK, NULL on error

    p. 553

    int

    gethostname (char *

    name , int

    namelen );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 172

    char

    *

    getlogin (void);

    <unistd.h>

    Returns: pointer to string giving login
    name if OK, NULL on error

    p. 256

    int

    [View full width]

    getmsg (int

    filedes , struct strbuf *restrict

    ctlptr ,
    struct strbuf *restrict

    dataptr , int
    *restrict

    flagptr );

    <stropts.h>*

    flagptr : 0, RS_HIPRI

    Returns: non-negative value if
    OK, 1 on error

    Platforms: Linux 2.4.22, Solaris 9

    p. 469

    int

    [View full width]

    getnameinfo (const struct sockaddr *restrict

    addr ,
    socklen_t

    alen ,
    char *restrict

    host , socklen_t

    hostlen
    , char *restrict

    service ,
    socklen_t

    servlen , unsigned int

    flags );

    <sys/socket.h> <netdb.h>

    Returns: 0 if OK, nonzero
    on error

    p. 556

    structnetent

    *

    getnetbyaddr (uint32_t

    net , int

    type );

    <netdb.h>

    Returns: pointer if OK, NULL on error

    p. 554

    structnetent

    *

    getnetbyname (const char *

    name );

    <netdb.h>

    Returns: pointer if OK, NULL on error

    p. 554

    structnetent

    *

    getnetent (void);

    <netdb.h>

    Returns: pointer if OK, NULL on error

    p. 554

    int

    [View full width]

    getopt (int

    argc , const * const

    argv[] , const char
    *

    options );

    <fcntl.h>
    extern int optind, opterr, optopt;
    extern char *optarg;

    Returns: the next option
    character, or 1 when all options have been
    processed

    p. 774

    int

    [View full width]

    getpeername (int

    sockfd , struct sockaddr *restrict

    addr ,
    socklen_t *restrict

    alenp );

    <sys/socket.h>

    Returns: 0 if OK, 1 on error

    p. 561

    pid_t

    getpgid (pid_t

    pid );

    <unistd.h>

    Returns: process group ID if OK, 1 on
    error

    p. 269

    pid_t

    getpgrp (void);

    <unistd.h>

    Returns: process group ID of calling process

    p. 269

    pid_t

    getpid (void);

    <unistd.h>

    Returns: process ID of calling process

    p. 210

    int

    [View full width]

    getpmsg (int

    filedes, struct strbuf *restrict

    ctlptr,
    struct strbuf *restrict

    dataptr, int
    *restrict

    bandptr ,
    int *restrict

    flagptr );

    [View full width]

    <stropts.h>
    *

    flagptr : 0, MSG_HIPRI, MSG_BAND,
    MSG_ANY

    Returns: non-negative value if OK, 1 on
    error

    Platforms: Linux 2.4.22, Solaris 9

    p. 469

    pid_t

    getppid (void);

    <unistd.h>

    Returns: parent process ID of calling
    process

    p.210

    structprotoent

    *getprotobyname (const char *

    name );

    <netdb.h>

    Returns: pointer if OK, NULL on error

    p.554

    structprotoent

    *

    getprotobynumber (int

    proto );

    <netdb.h>

    Returns: pointer if OK, NULL on error

    p.554

    structprotoent

    *

    getprotoent (void);

    <netdb.h>

    Returns: pointer if OK, NULL on error.

    p.554

    structpasswd

    *

    getpwent (void);

    <pwd.h>

    Returns: pointer if OK, NULL on error or
    end of file

    p.164

    structpasswd

    *

    getpwnam (const char *

    name );

    <pwd.h>

    Returns: pointer if OK, NULL on error

    p.163

    structpasswd

    *

    getpwuid (uid_t

    uid );

    <pwd.h>

    Returns: pointer if OK, NULL on error

    p.163

    int

    getrlimit (int

    resource , struct rlimit *

    rlptr );

    <sys/resource.h>

    Returns: 0 if OK, nonzero on error

    p.202

    char

    *

    gets (char *

    buf );

    <stdio.h>

    Returns: buf if OK, NULL on end of file
    or error

    p142

    structservent

    *

    getservbyname (const char *

    name , const char *

    proto );

    <netdb.h>

    Returns: pointer if OK, NULL on error

    p.555

    structservent

    *

    getservbyport (int

    port , const char *

    proto );

    <netdb.h>

    Returns: pointer if OK, NULL on error

    p.555

    structservent

    *

    getservent (void);

    <netdb.h>

    Returns: pointer if OK, NULL on error

    p.555

    pid_t

    getsid (pid_t

    pid );

    <unistd.h>

    Returns: session leader's process
    group ID if OK, 1 on error

    p.271

    int

    [View full width]

    getsockname (int

    sockfd , struct sockaddr *restrict

    addr ,
    socklen_t *restrict

    alenp );

    <sys/socket.h>

    Returns: 0 if OK, 1 on error

    p.561

    int

    [View full width]

    getsockopt (int

    sockfd , int

    level , int

    option , void
    *restrict

    val ,
    socklen_t *restrict

    lenp );

    <sys/socket.h>

    Returns: 0 if OK, 1 on error

    p.579

    structspwd

    *

    getspent (void);

    <shadow.h>

    Returns: pointer if OK, NULL on
    error

    Platforms: Linux 2.4.22, Solaris 9

    p.166

    structspwd

    *

    getspnam (const char *

    name );

    <shadow.h>

    Returns: pointer if OK, NULL on
    error

    Platforms: Linux 2.4.22, Solaris 9

    p.166

    int

    [View full width]

    gettimeofday (struct timeval *restrict

    tp , void
    *restrict

    tzp );

    <sys/time.h>

    Returns: 0 always

    p.173

    uid_t

    getuid (void);

    <unistd.h>

    Returns: real user ID of calling process

    p.210

    structtm

    *

    gmtime (const time_t *

    calptr );

    <time.h>

    Returns: pointer to broken-down time

    p.175

    int

    grantpt (int

    filedes );

    <stdlib.h>

    Returns: 0 on success, 1 on
    error

    Platforms: FreeBSD 5.2.1, Linux 2.4.22, Solaris 9

    p.682

    uint32_t

    htonl (uint32_t

    hostint32 );

    <arpa/inet.h>

    Returns: 32-bit integer in network
    byte order

    p.550

    uint16_t

    htons (uint16_t

    hostint16 );

    <arpa/inet.h>

    Returns: 16-bit integer in network
    byte order

    p.550

    constchar

    [View full width]

    *

    inet_ntop (int

    domain , const void *restrict

    addr ,
    char *restrict

    str ,
    socklen_t

    size );

    <arpa/inet.h>

    Returns: pointer to address string on
    success, NULL on error

    p.552

    int

    [View full width]

    inet_pton (int

    domain , const char *restrict

    str ,
    void *restrict

    addr );

    <arpa/inet.h>

    Returns: 1 on success, 0 if the
    format is invalid, or 1 on error

    p.552

    int

    initgroups (const char *

    username , gid_t

    basegid );

    [View full width]

             <grp.h>    /* Linux & Solaris */
    <unistd.h> /* FreeBSD & Mac OS X *
    /

    Returns: 0 if OK, 1 on error

    p.168

    int

    ioctl (int

    filedes , int

    request , ...);

    [View full width]

             <unistd.h>        /* System V */
    <sys/ioctl.h> /* BSD and Linux */
    <stropts.h> /* XSI STREAMS *
    /

    Returns: 1 on error, something else if OK

    p.83

    int

    isastream (int

    filedes );

    <stropts.h>

    Returns: 1 (true) if STREAMS device, 0
    (false) otherwise

    Platforms: Linux 2.4.22, Solaris 9

    p.465

    int

    isatty (int

    filedes );

    <unistd.h>

    Returns: 1 (true) if terminal device, 0
    (false) otherwise

    p.655

    int

     

    kill (pid_t

    pid , int

    signo );

    <signal.h>

    Returns: 0 if OK, 1 on error

    p.312

    int

    [View full width]

    lchown (const char *

    pathname , uid_t

    owner , gid_t

    group );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p.102

    int

    link (const char *

    existingpath , const char *

    newpath );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p.109

    int

    listen (int

    sockfd , int

    backlog );

    <sys/socket.h>

    Returns: 0 if OK, 1 on error

    p.563

    structtm

    *

    localtime (const time_t *

    calptr );

    <time.h>

    Returns: pointer to broken-down time

    p.175

    void

    longjmp (jmp_buf

    env , int

    val );

    <setjmp.h>

    This function never returns

    p. 197

    off_t

    lseek (int

    filedes , off_t

    offset , int

    whence );

    <unistd.h>

    whence ; SEEK_SET, SEEK_CUR, SEEK_END

    Returns: new
    file offset if OK, 1 on error

    p.63

    int

    [View full width]

    lstat (const char *restrict

    pathname , struct stat
    *restrict

    buf ;

    <sys/stat.h>

    Returns: 0 if OK, 1 on error

    p.87

    void

    *

    malloc (size_t

    size );

    <stdlib.h>

    Returns: non-null pointer if OK, NULL on
    error

    p.189

    int

    mkdir (const char *

    pathname , mode_t

    mode ;

    [View full width]

    <sys/stat.h>

    mode : S_IS[UG]ID, S_ISVTX, S_I[RWX]
    (USR|GRP|OTH)

    Returns: 0 if OK, 1 on error

    p.119

    int

    mkfifo (const char *

    pathname , mode_t

    mode );

    [View full width]

    <sys/stat.h>

    mode : S_IS[UG]ID, S_ISVTX, S_I[RWX]
    (USR|GRP|OTH)

    Returns: 0 if OK, 1 on error

    p.514

    int

    mkstemp (char *

    template );

    <stdlib.h>

    Returns: file descriptor if OK, 1 on
    error

    p.158

    time_t

    mktime (struct tm *

    tmptr );

    <time.h>

    Returns: calendar time if OK, 1 on error

    p.175

    caddr_t

    [View full width]

    mmap (void *

    addr , size_t

    len , int

    prot , int

    flag ,
    int

    filedes , off_t

    off );

    <sys/mman.h>

    prot : PROT_READ, PROT_WRITE, PROT_EXEC, PROT_NONE

    flag : MAP_FIXED, MAP_SHARED, MAP_PRIVATE

    Returns:
    starting address of mapped region if OK,
    MAP_FAILED on error

    p.487

    int

    mprotect (void *

    addr , size_t

    len , int

    prot );

    <sys/mman.h>

    Returns: 0 if OK, 1 on error

    p.489

    int

    msgctl (int

    msqid , int

    cmd , struct msqid_ds *

    buf );

    <sys/msg.h>

    cmd : IPC_STAT, IPC_SET, IPC_RMID

    Returns: 0 if OK,
    1 on error

    Platforms: FreeBSD 5.2.1, Linux 2.4
    .22, Solaris 9

    p.524

    int

    msgget (key_t

    key , int

    flag );

    <sys/msg.h>

    flag : 0, IPC_CREAT, IPC_EXCL

    Returns: message queue
    ID if OK, 1 on error

    Platforms: FreeBSD 5.2.1,
    Linux 2.4.22, Solaris 9

    p.524

    ssize_t

    [View full width]

    msgrcv (int

    msqid , void *

    ptr , size_t

    nbytes , long

    type , int

    flag );

    <sys/msg.h>

    flag : 0, IPC_NOWAIT, MSG_NOERROR

    Returns: size of
    data portion of message if OK, 1 on
    error

    Platforms: FreeBSD 5.2.1, Linux 2.4.22, Solaris 9

    p.526

    int

    [View full width]

    msgsnd (int

    msqid , const void *

    ptr , size_t

    nbytes ,
    int

    flag );

    <sys/msg.h>

    flag : 0, IPC_NOWAIT

    Returns: 0 if OK, 1 on
    error

    Platforms: FreeBSD 5.2.1, Linux 2.4.22, Solaris 9

    p.525

    int

    msync (void *

    addr , size_t

    len , int

    flags );

    <sys/mman.h>

    Returns: 0 if OK, 1 on error

    p.490

    int

    munmap (caddr_t

    addr , size_t

    len );

    <sys/mman.h>

    Returns: 0 if OK, 1 on error

    p.490

    uint32_t

    ntohl (uint32_t

    netint32 );

    <arpa/inet.h>

    Returns: 32-bit integer in host byte
    order

    p.550

    uint16_t

    ntohs (uint16_t

    netint16 );

    <arpa/inet.h>

    Returns: 16-bit integer in host byte
    order

    p.550

    int

    [View full width]

    open (const char *

    pathname , int

    oflag , ... /*
    mode_t

    mode */ );

    [View full width]

    <fcntl.h>

    oflag : O_RDONLY, O_WRONLY, O_RDWR;
    O_APPEND, O_CREAT, O_DSYNC, O_EXCL, O_NOCTTY,
    O_NONBLOCK, O_RSYNC, O_SYNC, O_TRUNC

    mode : S_IS[UG]ID, S_ISVTX, S_I[RWX]
    (USR|GRP|OTH)

    Returns: file descriptor if OK, 1
    on error

    Platforms: O_FSYNC flag on FreeBSD 5.2.1
    and Mac OS X 10.3

    p.60

    DIR

    *

    opendir (const char *

    pathname );

    <direct.h>

    Returns: pointer if OK, NULL on error

    p.120

    void

    openlog (char *

    ident , int

    option , int

    facility ;

    [View full width]

    <syslog.h>

    option : LOG_CONS, LOG_NDELAY, LOG_NOWAIT,
    LOG_ODELAY,
    LOG_PERROR, LOG_PID

    facility : LOG_AUTH, LOG_AUTHPRIV, LOG_CRON,
    LOG_DAEMON,
    LOG_FTP, LOG_KERN, LOG_LOCAL[0-7], LOG_LPR,
    LOG_MAIL, LOG_NEWS, LOG_SYSLOG, LOG_USER
    , LOG_UUCP

    p.430

    long

    pathconf (const char *

    pathname , int

    name );

    [View full width]

    <unistd.h>

    name : _PC_ASYNC_IO, _PC_CHOWN_RESTRICTED,
    _PC_FILESIZEBITS, _PC_LINK_MAX, _PC_MAX_CANON,
    _PC_MAX_INPUT, _PC_NAME_MAX, _PC_NO_TRUNC,
    _PC_PATH_MAX, _PC_PIPE_BUF, _PC_PRIO_IO,
    _PC_SYMLINK_MAX, _PC_SYNC_IO,
    _PC_VDISABLE

    Returns: corresponding value if OK,
    1 on

    p.41

    int

    pause (void);

    <unistd.h>

    Returns: 1 with errno set to EINTR

    p.313

    int

    pclose (FILE *

    fp );

    <stdio.h>

    Returns: termination status of popen

    cmdstring , or 1 on error

    p.503

    void

    perror (const char *

    msg );

    <stdio.h>

    p.15

    int

    pipe (int

    filedes[2] );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p.497

    int

    [View full width]

    poll (struct pollfd

    fdarray [], nfds_t

    nfds , int

    timeout );

    <poll.h>

    Returns: count of ready descriptors, 0 on
    timeout, 1 on error

    Platforms: FreeBSD 5.2.1,
    Linux 2.4.22, Solaris 9

    p.479

    FILE

    *popen (const char *

    cmdstring , const char *

    type );

    <stdio.h>

    type : "r", "w"

    Returns: file pointer if OK, NULL on
    error

    p.503

    int

    posix_openpt (int

    oflag );

    <stdlib.h>
    <fcntl.h>

    oflag : O_RWDR, O_NOCTTY

    Returns: file descriptor of
    next available PTY master if OK, 1 on
    error

    Platforms: FreeBSD 5.2.1

    p.681

    ssize_t

    [View full width]

    pread (int

    filedes , void *

    buf , size_t

    nbytes , off_t

    offset );

    <unistd.h>

    Returns: number of bytes read, 0 if end
    of file, 1 on error

    p.75

    int

    printf (const char *restrict

    format , ...);

    <stdio.h>

    Returns: number of characters output if
    OK, negative value if output error

    p.149

    int

    [View full width]

    pselect (int

    maxfdp1 , fd_set *restrict

    readfds ,
    fd_set *restrict

    writefds ,
    fd_set *restrict

    exceptfds , const struct
    timespec *restrict

    tsptr ,
    const sigset_t *restrict

    sigmask );

    <sys/select.h>

    Returns: count of ready descriptors,
    0 on timeout, 1 on error

    Platforms: FreeBSD 5.2
    .1, Linux 2.4.22, Mac OS X 10.3

    p.478

    void

    psignal (int

    signo , const char *

    msg );

    <signal.h>
    <siginfo.h> /* on Solaris */

    p.352

    int

    [View full width]

    pthread_atfork (void (*

    prepare )(void), void
    (*

    parent )(void),
    void (*

    child )(void);

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.417

    int

    pthread_attr_destroy (pthread_attr_t *

    attr );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.389

    int

    [View full width]

    pthread_attr_getdetachstate (const pthread_attr_t
    *restrict

    attr ,
    int *

    detachstate );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.390

    int

    [View full width]

    pthread_attr_getguardsize (const pthread_attr_t
    *restrict

    attr ,
    size_t *restricts

    guardsize );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.392

    int

    [View full width]

    pthread_attr_getstack (const pthread_attr_t
    *restrict

    attr , void
    **restrict

    stackaddr , size_t
    *restrict

    stacksize );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.391

    int

    [View full width]

    pthread_attr_getstacksize (const pthread_attr_t
    *restrict

    attr ,
    size_t *restrict

    stacksize );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.392

    int

    pthread_attr_init (pthread_attr_t *

    attr );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.389

    int

    [View full width]

    pthread_attr_setdetachstate (pthread_attr_t *

    attr ,
    int

    detachstate );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.390

    int

    [View full width]

    pthread_attr_setguardsize (pthread_attr_t *

    attr ,
    size_t

    guardsize );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.392

    int

    [View full width]

    pthread_attr_setstack (const pthread_attr_t *

    attr ,
    void *

    stackaddr ,
    size_t *

    stacksize );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.391

    int

    [View full width]

    pthread_attr_setstacksize (pthread_attr_t *

    attr ,
    size_t

    stacksize );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.392

    int

    pthread_cancel (pthread_t

    tid );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.365

    void

    pthread_cleanup_pop (int

    execute );

    <pthread.h>

    p.365

    void

    pthread_cleanup_push (void (*

    rtn )(void *), void *

    arg );

    <pthread.h>

    p.365

    int

    pthread_condattr_destroy (pthread_condattr_t *

    attr );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.401

    int

    [View full width]

    pthread_condattr_getpshared (const
    pthread_condattr_t *restrict

    attr ,
    int *restrict

    pshared );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.401

    int

    pthread_condattr_init (pthread_condattr_t *

    attr );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.401

    int

    [View full width]

    pthread_condattr_setpshared (pthread_condattr_t
    *

    attr , int

    pshared );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.401

    int

    pthread_cond_broadcast (pthread_cond_t *

    cond );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.384

    int

    pthread_cond_destroy (pthread_cond_t *

    cond );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p.383

    int

    pthread_cond_init (pthread_cond_t *restrict

    cond ,
    pthread_condattr_t *restrict

    attr );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 383

    int

    pthread_cond_signal (pthread_cond_t *

    cond );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 384

    int

    [View full width]

    pthread_cond_timedwait (pthread_cond_t *restrict

    cond ,
    pthread_mutex_t *restrict

    mutex ,
    const struct timespec
    *restrict

    timeout );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 383

    int

    pthread_cond_wait (pthread_cond_t *restrict

    cond ,
    pthread_mutex_t *restrict

    mutex );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 383

    int

    [View full width]

    pthread_create (pthread_t *restrict

    tidp ,
    const pthread_attr_t *restrict

    attr ,
    void *(*

    start_rtn )(void), void
    *restrict

    arg );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 357

    int

    pthread_detach (pthread_t

    tid );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 368

    int

    pthread_equal (pthread_t

    tid1 , pthread_t

    tid2 );

    <pthread.h>

    Returns: nonzero if equal, 0 otherwise

    p. 357

    void

    pthread_exit (void *

    rval_ptr );

    <pthread.h>

    p. 361

    int

    pthread_getconcurrency (void);

    <pthread.h>

    Returns: current concurrency level

    p. 393

    void

    *

    pthread_getspecific (pthread_key_t

    key );

    <pthread.h>

    Returns: thread-specific data value or NULL if no value has been associated with the key

    p. 408

    int

    pthread_join (pthread_t

    thread , void **

    rval_ptr );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 361

    int

    [View full width]

    pthread_key_create (pthread_key_t *

    keyp , void
    (*

    destructor )(void *);

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 406

    int

    pthread_key_delete (pthread_key_t *

    key );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 407

    int

    pthread_kill (pthread_t

    thread , int

    signo );

    <signal.h>

    Returns: 0 if OK, error number on failure

    p. 414

    int

    pthread_mutexattr_destroy (pthread_mutexattr_t *

    attr );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 393

    int

    [View full width]

    pthread_mutexattr_getpshared (const
    pthread_mutexattr_t *restrict

    attr , int *restrict

    pshared );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 394

    int

    [View full width]

    pthread_mutexattr_gettype (const
    pthread_mutexattr_t *restrict

    attr ,
    int *restrict

    type );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 395

    int

    pthread_mutexattr_init (pthread_mutexattr_t *

    attr );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 393

    int

    [View full width]

    pthread_mutexattr_setpshared (pthread_mutexattr_t
    *

    attr , int

    pshared );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 394

    int

    [View full width]

    pthread_mutexattr_settype (pthread_mutexattr_t
    *

    attr , int

    type );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 395

    int

    pthread_mutex_destroy (pthread_mutex_t *

    mutex );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 371

    int

    [View full width]

    pthread_mutex_init (pthread_mutex_t *restrict

    mutex ,
    const pthread_mutexattr_t
    *restrict

    attr );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 371

    int

    pthread_mutex_lock (pthread_mutex_t *

    mutex );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 371

    int

    pthread_mutex_trylock (pthread_mutex_t *

    mutex );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 371

    int

    pthread_mutex_unlock (pthread_mutex_t *

    mutex );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 371

    int

    [View full width]

    pthread_once (pthread_once_t *

    initflag , void
    (*

    initfn )(void);

    <pthread.h>
    pthread_once_t

    initflag = PTHREAD_ONCE_INIT;

    Returns: 0 if OK, error number on failure

    p. 408

    int

    [View full width]

    pthread_rwlockattr_destroy (pthread_rwlockattr_t
    *

    attr );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 400

    int

    [View full width]

    pthread_rwlockattr_getpshared (const
    pthread_rwlockattr_t *restrict

    attr ,
    int *restrict

    pshared );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 400

    int

    pthread_rwlockattr_init (pthread_rwlockattr_t *

    attr );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 400

    int

    [View full width]

    pthread_rwlockattr_setpshared (pthread_rwlockattr_t
    *

    attr , int

    pshared );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 400

    int

    pthread_rwlock_destroy (pthread_rwlock_t *

    rwlock );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 379

    int

    [View full width]

    pthread_rwlock_init (pthread_rwlock_t *restrict

    rwlock ,
    const pthread_rwlockattr_t
    *restrict

    attr );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 379

    int

    pthread_rwlock_rdlock (pthread_rwlock_t *

    rwlock );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 379

    int

    pthread_rwlock_tryrdlock (pthread_rwlock_t *

    rwlock );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 379

    int

    pthread_rwlock_trywrlock (pthread_rwlock_t *

    rwlock );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 379

    int

    pthread_rwlock_unlock (pthread_rwlock_t *

    rwlock );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 379

    int

    pthread_rwlock_wrlock (pthread_rwlock_t *

    rwlock );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 379

    pthread_t

    pthread_self (void);

    <pthread.h>

    Returns: thread ID of the calling thread

    p. 357

    int

    pthread_setcancelstate (int

    state , int *

    oldstate );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 410

    int

    pthread_setcanceltype (int

    type , int *

    oldtype );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 411

    int

    pthread_setconcurrency (int

    level );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 393

    int

    [View full width]

    pthread_setspecific (pthread_key_t

    key , const void
    *

    value );

    <pthread.h>

    Returns: 0 if OK, error number on failure

    p. 408

    int

    pthread_sigmask (int

    how , const sigset_t *restrict

    set ,
    sigset_t *restrict>

    oset );

    <signal.h>

    Returns: 0 if OK, error number on failure

    p. 413

    void

    pthread_testcancel (void);

    <pthread.h>

    p. 411

    char

    *ptsname (int

    filedes );

    <stdlib.h>

    Returns: pointer to name of PTY slave if OK, NULL on error

    Platforms: FreeBSD 5.2.1, Linux 2.4.22, Solaris 9

    p. 682

    int

    putc (int

    c , FILE *

    fp );

    <stdio.h>

    Returns:

    c if OK, EOF on error

    p. 142

    int

    putchar (int

    c );

    <stdio.h>

    Returns:

    c if OK, EOF on error

    p. 142

    int

    putchar_unlocked (int

    c );

    <stdio.h>

    Returns:

    c if OK, EOF on error

    p. 403

    int

    putc_unlocked (int

    c , FILE *

    fp );

    <stdio.h>

    Returns:

    c if OK, EOF on error

    p. 403

    int

    putenv (char *

    str );

    <stdlib.h>

    Returns: 0 if OK, nonzero on error

    p. 194

    int

    putmsg (int

    filedes , const struct strbuf *

    ctlptr ,
    const struct strbuf *

    dataptr , int

    flag )

    <stropts.h>

    flag : 0, RS_HIPRI

    Returns: 0 if OK, 1 on error

    Platforms: Linux 2.4.22, Solaris 9

    p. 463

    int

    [View full width]

    putpmsg (int

    filedes , const struct strbuf *

    ctlptr ,
    const struct strbuf *

    dataptr , int

    band ,
    int

    flag );

    <stropts.h>

    flag : 0, MSG_HIPRI, MSG_BAND

    Returns: 0 if OK, 1 on error

    Platforms: Linux 2.4.22, Solaris 9

    p. 463

    int

    puts (const char *

    str );

    <stdio.h>

    Returns: non-negative value if OK, EOF on error

    p. 143

    ssize_t

    [View full width]

    pwrite (int

    filedes , const void *

    buf , size_t

    nbytes
    , off_t

    offset );

    <unistd.h>

    Returns: number of bytes written if OK, 1 on error

    p. 75

    int

    raise (int

    signo );

    <signal.h>

    Returns: 0 if OK, 1 on error

    p. 312

    ssize_t

    read (int

    filedes , void *

    buf , size_t

    nbytes );

    <unistd.h>

    Returns: number of bytes read if OK, 0 if end of file, 1 on error

    p. 67

    struct

    dirent

    *

    readdir (DIR *

    dp );

    <dirent.h>

    Returns: pointer if OK, NULL at end of directory or error

    p. 120

    int

    [View full width]

    readlink (const char *restrict

    pathname , char
    *restrict

    buf ,
    size_t

    bufsize );

    <unistd.h>

    Returns: number of bytes read if OK, 1 on error

    p. 115

    ssize_t

    [View full width]

    readv (int

    filedes , const struct iovec *

    iov , int

    iovcnt ;

    <sys/uio.h>

    Returns: number of bytes read if OK, 1 on error

    p. 483

    void

    *

    realloc (void *

    ptr , size_t

    newsize );

    <stdlib.h>

    Returns: non-null pointer if OK, NULL on error

    p. 189

    ssize_t

    recv (int

    sockfd , void *

    buf , size_t

    nbytes , int

    flags );


    <sys/socket.h>

    flags : 0, MSG_PEEK, MSG_OOB, MSG_WAITALL

    Returns: length of message in bytes, 0 if no messages are available and peer has done an orderly shutdown, or 1 on error

    Platforms: MSG_TRUNC flag on Linux 2.4.22

    p. 567

    ssize_t

    [View full width]

    recvfrom (int

    sockfd , void *restrict

    buf , size_t

    len , int

    flags ,
    struct sockaddr *restrict

    addr , socklen_t
    *restrict

    addrlen );

    <sys/socket.h>

    flags : 0, MSG_PEEK, MSG_OOB, MSG_WAITALL

    Returns: length of message in bytes, 0 if no messages are available and peer has done an orderly shutdown, or 1 on error

    Platforms: MSG_TRUNC flag on Linux 2.4.22

    p. 567

    ssize_t

    recvmsg (int

    sockfd , struct msghdr *

    msg , int

    flags ;

    <sys/socket.h>

    flags : 0, MSG_PEEK, MSG_OOB, MSG_WAITALL

    Returns: length of message in bytes, 0 if no messages are available

    and peer has done an orderly shutdown, or 1 on error

    Platforms: MSG_TRUNC flag on Linux 2.4.22

    p. 568

    int

    remove (const char *

    pathname );

    <stdio.h>

    Returns: 0 if OK, 1 on error

    p. 111

    int

    rename (const char *

    oldname , const char *

    newname );

    <stdio.h>

    Returns: 0 if OK, 1 on error

    p. 111

    void

    rewind (FILE *

    fp );

    <stdio.h>

    p. 147

    void

    rewinddir (DIR *

    dp );

    <dirent.h>

    p. 120

    int

    rmdir (const char *

    pathname );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 120

    int

    scanf (const char *restrict

    format , ...);

    <stdio.h>

    Returns: number of input items assigned, EOF if input error or

    end of file before any conversion

    p. 151

    void

    seekdir (DIR *

    dp , long

    loc );

    <dirent.h>

    p. 120

    int

    [View full width]

    select (int

    maxfdp1 , fd_set *restrict

    readfds ,
    fd_set *restrict

    writefds , fd_set *restrict

    exceptfds , struct timeval *restrict

    tvptr );

    <sys/select.h>

    Returns: count of ready descriptors, 0 on timeout, 1 on error

    p. 475

    int

    [View full width]

    semctl (int

    semid , int

    semnum , int

    cmd , ... /*
    union semun

    arg */ );

    <sys/sem.h>

    cmd : IPC_STAT, IPC_SET, IPC_RMID, GETPID, GETNCNT,
    GETZCNT, GETVAL, SETVAL, GETALL, SETALL

    Returns: (depends on command)

    p. 529

    int

    semget (key_t

    key , int

    nsems , int

    flag );

    <sys/sem.h>

    flag : 0, IPC_CREAT, IPC_EXCL

    Returns: semaphore ID if OK, 1 on error

    p. 529

    int

    [View full width]

    semop (int

    semid , struct sembuf

    semoparray [],
    size_t

    nops );

    <sys/sem.h>

    Returns: 0 if OK, 1 on error

    p. 530

    ssize_t

    [View full width]

    send (int

    sockfd , const void *

    buf , size_t

    nbytes ,
    int

    flags );

    <sys/socket.h>

    flags : 0, MSG_DONTROUTE, MSG_EOR, MSG_OOB

    Returns: number of bytes sent if OK, 1 on error

    Platforms: MSG_DONTWAIT flag on FreeBSD 5.2.1, Linux 2.4.22, Mac OS X 10.3 MSG_EOR flag not on Solaris 9

    p. 565

    ssize_t

    [View full width]

    sendmsg (int

    sockfd , const struct msghdr *

    msg , int

    flags );

    <sys/socket.h>

    flags : 0, MSG_DONTROUTE, MSG_EOR, MSG_OOB

    Returns: number of bytes sent if OK, 1 on error

    Platforms: MSG_DONTWAIT flag on FreeBSD 5.2.1, Linux 2.4.22, Mac OS X 10.3 MSG_EOR flag not on Solaris 9

    p. 566

    ssize_t

    [View full width]

    sendto (int

    sockfd , const void *

    buf , size_t

    nbytes ,
    int

    flags ,
    const struct sockaddr *

    destaddr , socklen_t

    destlen );

    <sys/socket.h>

    flags : 0, MSG_DONTROUTE, MSG_EOR, MSG_OOB

    Returns: number of bytes sent if OK, 1 on error

    Platforms: MSG_DONTWAIT flag on FreeBSD 5.2.1, Linux 2.4.22, Mac OS X 10.3 MSG_EOR flag not on Solaris 9

    p. 566

    void

    setbuf (FILE *restrict

    fp , char *restrict

    buf );

    <stdio.h>

    p. 136

    int

    setegid (gid_t

    gid );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 241

    int

    [View full width]

    setenv (const char *

    name , const char *

    value , int

    rewrite );

    <stdlib.h>

    Returns: 0 if OK, nonzero on error

    p. 194

    int

    seteuid (uid_t

    uid );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 241

    int

    setgid (gid_t

    gid );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 237

    void

    setgrent (void);

    <grp.h>

    p. 167

    int

    setgroups (int

    ngroups , const gid_t

    grouplist []);


    <grp.h> /* on Linux */
    <unistd.h> /* on FreeBSD, Mac OS X, and Solaris */

    Returns: 0 if OK, 1 on error

    p. 168

    void

    sethostent (int

    stayopen );

    <netdb.h>

    p. 553

    int

    setjmp (jmp_buf

    env );

    <setjmp.h>

    Returns: 0 if called directly, nonzero if returning from a call to longjmp

    p. 197

    int

    setlogmask (int

    maskpri );

    <syslog.h>

    Returns: previous log priority mask value

    p. 430

    void

    setnetent (int

    stayopen );

    <netdb.h>

    p. 554

    int

    setpgid (pid_t

    pid , pid_t

    pgid );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 269

    void

    setprotoent (int

    stayopen );

    <netdb.h>

    p. 554

    void

    setpwent (void);

    <pwd.h>

    p. 164

    int

    setregid (gid_t

    rgid , gid_t

    egid );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 240

    int

    setreuid (uid_t

    ruid , uid_t

    euid );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 240

    int

    setrlimit (int

    resource , const struct rlimit *

    rlptr );

    <sys/resource.h>

    Returns: 0 if OK, nonzero on error

    p. 202

    void

    setservent (int

    stayopen );

    <netdb.h>

    p. 555

    pid_t

    setsid (void);

    <unistd.h>

    Returns: process group ID if OK, 1 on
    error

    p. 271

    int

    [View full width]

    setsockopt (int

    sockfd , int

    level , int

    option ,
    const void *

    val , socklen_t

    len );

    <sys/socket.h>

    Returns: 0 if OK, 1 on error

    p. 579

    void

    setspent (void);

    <shadow.h>

    Platforms: Linux 2.4.22, Solaris 9

    p. 166

    int

    setuid (uid_t

    uid );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 237

    int

    [View full width]

    setvbuf (FILE *restrict

    fp , char *restrict

    buf , int

    mode , size_t

    size );

    <stdio.h>

    mode : _IOFBF, _IOLBF, _IONBF

    Returns: 0 if OK, nonzero on error

    p. 136

    void

    *

    shmat (int

    shmid , const void *

    addr , int

    flag );

    <sys/shm.h>

    flag : 0, SHM_RND, SHM_RDONLY

    Returns: pointer to shared memory segment if OK, 1 on error

    p. 536

    int

    shmctl (int

    shmid , int

    cmd , struct shmid_ds *

    buf );

    <sys/shm.h>

    cmd : IPC_STAT, IPC_SET, IPC_RMID,
    SHM_LOCK, SHM_UNLOCK

    Returns: 0 if OK, 1 on error

    p. 535

    int

    shmdt (void *

    addr );

    <sys/shm.h>

    Returns: 0 if OK, 1 on error

    p. 536

    int

    shmget (key_t

    key , int

    size , int

    flag );

    <sys/shm.h>

    flag : 0, IPC_CREAT, IPC_EXCL

    Returns: shared memory ID if OK, 1 on error

    p. 534

    int

    shutdown (int

    sockfd , int

    how );

    <sys/socket.h>

    how : SHUT_RD, SHUT_WR, SHUT_RDWR

    Returns: 0 if OK, 1 on error

    p. 548

    int

    sig2str (int

    signo , char *

    str );

    <signal.h>

    Returns: 0 if OK, 1 on error Platforms: Solaris 9

    p. 353

    int

    [View full width]

    sigaction (int

    signo , const struct sigaction
    *restrict

    act ,
    struct sigaction *restrict

    oact );

    <signal.h>

    Returns: 0 if OK, 1 on error

    p. 324

    int

    sigaddset (sigset_t *

    set , int

    signo );

    <signal.h>

    Returns: 0 if OK, 1 on error

    p. 319

    int

    sigdelset (sigset_t *

    set , int

    signo );

    <signal.h>

    Returns: 0 if OK, 1 on error

    p. 319

    int

    sigemptyset (sigset_t *

    set );

    <signal.h>

    Returns: 0 if OK, 1 on error

    p. 319

    int

    sigfillset (sigset_t *

    set );

    <signal.h>

    Returns: 0 if OK, 1 on error

    p. 319

    int

    sigismember (const sigset_t *

    set , int

    signo );

    <signal.h>

    Returns: 1 if true, 0 if false, 1 on error

    p. 319

    void

    siglongjmp (sigjmp_buf

    env , int

    val );

    <setjmp.h>

    This function never returns

    p. 330

    void

    (*

    signal (int

    signo , void (*

    func )(int)))(int);

    <signal.h>

    Returns: previous disposition of signal if OK, SIG_ERR on error

    p. 298

    int

    sigpending (sigset_t *

    set );

    <signal.h>

    Returns: 0 if OK, 1 on error

    p. 322

    int

    sigprocmask (int

    how , const sigset_t *restrict

    set ,
    sigset_t *restrict

    oset );

    <signal.h>

    how : SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK

    Returns: 0 if OK, 1 on error

    p. 320

    int

    sigsetjmp (sigjmp_buf

    env , int

    savemask );

    <setjmp.h>

    Returns: 0 if called directly, nonzero if returning from a call to siglongjmp

    p. 330

    int

    sigsuspend (const sigset_t *

    sigmask );

    <signal.h>

    Returns: 1 with errno set to EINTR

    p. 334

    int

    [View full width]

    sigwait (const sigset_t *restrict

    set , int
    *restrict

    signop );

    <signal.h>

    Returns: 0 if OK, error number on failure

    p. 413

    unsigned

    int

    sleep (unsigned int

    seconds );

    <unistd.h>

    Returns: 0 or number of unslept seconds

    p. 347

    int

    [View full width]

    snprintf (char *restrict

    buf , size_t

    n , const char
    *restrict

    format , ...);

    <stdio.h>

    Returns: number of characters stored in array if OK, negative value if encoding error

    p. 149

    int

    sockatmark (int

    sockfd );

    <sys/socket.h>

    Returns: 1 if at mark, 0 if not at mark, 1 on error

    p. 582

    int

    socket (int

    domain , int

    type , int

    protocol );

    <sys/socket.h>

    type : SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET,

    Returns: file (socket) descriptor if OK, 1 on error

    p. 546

    int

    [View full width]

    socketpair (int

    domain , int

    type , int

    protocol , int

    sockfd [2]);

    <sys/socket.h>

    type : SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET,

    Returns: 0 if OK, 1 on error

    p. 594

    int

    [View full width]

    sprintf (char *restrict

    buf , const char *restrict

    format , ...);

    <stdio.h>

    Returns: number of characters stored in array if OK, negative value if encoding error

    p. 149

    int

    [View full width]

    sscanf (const char *restrict

    buf , const char
    *restrict

    format , ...);

    <stdio.h>

    Returns: number of input items assigned, EOF if input error or end of file before any conversion

    p. 151

    int

    [View full width]

    stat (const char *restrict

    pathname , struct stat
    *restrict

    buf );

    <sys/stat.h>

    Returns: 0 if OK, 1 on error

    p. 87

    int

    str2sig (const char *

    str , int *

    signop );

    <signal.h>

    Returns: 0 if OK, 1 on error Platforms: Solaris 9

    p. 353

    char

    *

    strerror (int

    errnum );

    <string.h>

    Returns: pointer to message string

    p. 15

    size_t

    [View full width]

    strftime (char *restrict

    buf , size_t

    maxsize ,
    const char *restrict

    format , const struct
    tm *restrict

    tmptr );

    <time.h>

    Returns: number of characters stored in array if room, 0 otherwise

    p. 176

    char

    *strsignal (int

    signo );

    <string.h>

    Returns: a pointer to a string describing the signal

    p. 352

    int

    symlink (const char *

    actualpath , const char *

    sympath );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 115

    void

    sync (void);

    <unistd.h>

    p. 77

    long

    sysconf (int

    name );

    [View full width]

    <unistd.h>

    name : _SC_ARG_MAX, _SC_ATEXIT_MAX, _SC_CHILD_MAX
    ,_SC_CLK_TCK, _SC_COLL_WEIGHTS_MAX,
    _SC_HOST_NAME_MAX, _SC_IOV_MAX, _SC_JOB_CONTROL,
    _SC_LINE_MAX, _SC_LOGIN_NAME_MAX,
    _SC_NGROUPS_MAX,
    _SC_OPEN_MAX, _SC_PAGESIZE, _SC_PAGE_SIZE,
    _SC_READER_WRITER_LOCKS, _SC_RE_DUP_MAX,
    _SC_SAVED_IDS, _SC_SHELL, _SC_STREAM_MAX,
    _SC_SYMLOOP_MAX, _SC_TTY_NAME_MAX,
    _SC_TZNAME_MAX,
    _SC_VERSION, _SC_XOPEN_CRYPT, _SC_XOPEN_LEGACY,
    _SC_XOPEN_REALTIME, _SC_XOPEN_REALTIME_THREADS,
    _SC_XOPEN_VERSION

    Returns: corresponding value if OK, 1 on error

    p. 41

    void

    syslog (int

    priority , char *

    format , ...);

    <syslog.h>

    p. 430

    int

    system (const char *

    cmdstring );

    <stdlib.h>

    Returns: termination status of shell

    p. 246

    int

    tcdrain (int

    filedes );

    <termios.h>

    Returns: 0 if OK, 1 on error

    p. 653

    int

    tcflow (int

    filedes , int

    action );

    <termios.h>

    action : TCOOFF, TCOON, TCIOFF, TCION

    Returns: 0 if OK, 1 on error

    p. 653

    int

    tcflush (int

    filedes , int

    queue );

    <termios.h>

    queue : TCIFLUSH, TCOFLUSH, TCIOFLUSH

    Returns: 0 if OK, 1 on error

    p. 653

    int

    tcgetattr (int

    filedes , struct termios *

    termptr );

    <termios.h>

    Returns: 0 if OK, 1 on error

    p. 643

    pid_t

    tcgetpgrp (int

    filedes );

    <unistd.h>

    Returns: process group ID of foreground process group if OK, 1 on error

    p. 273

    pid_t

    tcgetsid (int

    filedes );

    <termios.h>

    Returns: session leader's process group ID if OK, 1 on error

    p. 274

    int

    tcsendbreak (int

    filedes , int

    duration );

    <termios.h>

    Returns: 0 if OK, 1 on error

    p. 653

    int

    [View full width]

    tcsetattr (int

    filedes , int

    opt , const struct
    termios *

    termptr );

    <termios.h>

    opt : TCSANOW, TCSADRAIN, TCSAFLUSH

    Returns: 0 if OK, 1 on error

    p. 643

    int

    tcsetpgrp (int

    filedes , pid_t

    pgrpid );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 273

    long

    telldir (DIR *

    dp );

    <dirent.h>

    Returns: current location in directory associated with

    dp

    p. 120

    char

    *

    tempnam (const char *

    directory , const char *

    prefix );

    <stdio.h>

    Returns: pointer to unique pathname

    p. 157

    time_t

    time (time_t *

    calptr );

    <time.h>

    Returns: value of time if OK, 1 on error

    p. 173

    clock_t

    times (struct tms *

    buf );

    <sys/times.h>

    Returns: elapsed wall clock time in clock ticks if OK, 1 on error

    p. 257

    FILE

    *

    tmpfile (void);

    <stdio.h>

    Returns: file pointer if OK, NULL on error

    p. 155

    char

    *

    tmpnam (char *

    ptr );

    <stdio.h>

    Returns: pointer to unique pathname

    p. 155

    int

    truncate (const char *

    pathname , off_t

    length );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 105

    char

    *

    ttyname (int

    filedes );

    <unistd.h>

    Returns: pointer to pathname of terminal, NULL on error

    p. 655

    mode_t

    umask (mode_t

    cmask );

    <sys/stat.h>

    Returns: previous file mode creation mask

    p. 97

    int

    uname (struct utsname *

    name );

    <sys/utsname.h>

    Returns: non-negative value if OK, 1 on error

    p. 171

    int

    ungetc (int

    c , FILE *

    fp );

    <stdio.h>

    Returns:

    c if OK, EOF on error

    p. 141

    int

    unlink (const char *

    pathname );

    <unistd.h>

    Returns: 0 if OK, 1 on error

    p. 109

    int

    unlockpt (int

    filedes );

    <stdlib.h>

    Returns: 0 on success, 1 on error

    Platforms: FreeBSD 5.2.1, Linux 2.4.22, Solaris 9

    p. 682

    void

    unsetenv (const char *

    name );

    <stdlib.h>

    p. 194

    int

    [View full width]

    utime (const char *

    pathname , const struct utimbuf
    *

    times );

    <utime.h>

    Returns: 0 if OK, 1 on error

    p. 116

    int

    [View full width]

    vfprintf (FILE *restrict

    fp , const char *restrict

    format , va_list

    arg );

    <stdarg.h>
    <stdio.h>

    Returns: number of characters output if OK, negative value if output error

    p. 151

    int

    [View full width]

    vfscanf (FILE *restrict

    fp , const char *restrict

    format , va_list

    arg );

    <stdarg.h>
    <stdio.h>

    Returns: number of input items assigned, EOF if input error or end of file before any conversion

    p. 151

    int

    vprintf (const char *restrict

    format , va_list

    arg );

    <stdarg.h>
    <stdio.h>

    Returns: number of characters output if OK, negative value if output error

    p. 151

    int

    vscanf (const char *restrict

    format , va_list

    arg );

    <stdarg.h>
    <stdio.h>

    Returns: number of input items assigned, EOF if input error or end of file before any conversion

    p. 151

    int

    [View full width]

    vsnprintf (char *restrict

    buf , size_t

    n , const char
    *restrict

    format ,
    va_list

    arg );

    <stdarg.h>
    <stdio.h>

    Returns: number of characters stored in array if OK, negative value if encoding error

    p. 151

    int

    [View full width]

    vsprintf (char *restrict

    buf , const char *restrict

    format , va_list

    arg );

    <stdarg.h>
    <stdio.h>

    Returns: number of characters stored in array if OK, negative value if encoding error

    p. 151

    int

    [View full width]

    vsscanf (const char *restrict

    buf , const char
    *restrict

    format ,
    va_list

    arg );

    <stdarg.h>
    <stdio.h>

    Returns: number of input items assigned, EOF if input error or end of file before any conversion

    p. 151

    void

    [View full width]

    vsyslog (int

    priority , const char *

    format , va_list

    arg );

    <syslog.h>
    <stdarg.h>

    p. 432

    pid_t

    wait (int *

    statloc );

    <sys/wait.h>

    Returns: process ID if OK, 0, or 1 on error

    p. 220

    int

    [View full width]

    waitid (idtype_t

    idtype , id_t

    id , siginfo_t *

    infop ,
    int

    options );

    [View full width]

    <sys/wait.h>

    idtype : P_PID, P_PGID, P_ALL

    options : WCONTINUED, WEXITED, WNOHANG, WNOWAIT,
    WSTOPPED

    Returns: 0 if OK, 1 on error

    Platforms: Solaris 9

    p. 220

    pid_t

    waitpid (pid_t

    pid , int *

    statloc , int

    options );


    <sys/wait.h>

    options : 0, WCONTINUED, WNOHANG, WUNTRACED

    Returns: process ID if OK, 0, or 1 on error

    p. 220

    pid_t

    [View full width]

    wait3 (int *

    statloc , int

    options , struct rusage
    *

    rusage );


    <sys/types.h>
    <sys/wait.h>
    <sys/time.h>
    <sys/resource.h>

    options : 0, WNOHANG, WUNTRACED

    Returns: process ID if OK, 0, or 1 on error

    p. 227

    pid_t

    [View full width]

    wait4 (pid_t

    pid , int *

    statloc , int

    options , struct
    rusage *

    rusage );


    <sys/types.h>
    <sys/wait.h>
    <sys/time.h>
    <sys/resource.h>

    options : 0, WNOHANG, WUNTRACED

    Returns: process ID if OK, 0, or 1 on error

    p. 227

    ssize_t

    write (int

    filedes , const void *

    buf , size_t

    nbytes );

    <unistd.h>

    Returns: number of bytes written if OK, 1 on error

    p. 68

    ssize_t

    [View full width]

    writev (int

    filedes , const struct iovec *

    iov , int

    iovcnt );

    <sys/uio.h>

    Returns: number of bytes written if OK, 1 on error

    p. 483


  • / 369