[BACK]Return to unistd.h CVS log [TXT][DIR] Up to [local] / src / include

Annotation of src/include/unistd.h, Revision 1.71

1.71    ! matthew     1: /*     $OpenBSD: unistd.h,v 1.70 2012/04/12 12:33:03 deraadt Exp $ */
1.6       deraadt     2: /*     $NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $      */
1.1       deraadt     3:
                      4: /*-
                      5:  * Copyright (c) 1991 The Regents of the University of California.
                      6:  * All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
1.47      millert    16:  * 3. Neither the name of the University nor the names of its contributors
1.1       deraadt    17:  *    may be used to endorse or promote products derived from this software
                     18:  *    without specific prior written permission.
                     19:  *
                     20:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     21:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     22:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     23:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     24:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     25:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     26:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     27:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     28:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     29:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     30:  * SUCH DAMAGE.
                     31:  *
                     32:  *     @(#)unistd.h    5.13 (Berkeley) 6/17/91
                     33:  */
                     34:
                     35: #ifndef _UNISTD_H_
                     36: #define        _UNISTD_H_
                     37:
                     38: #include <sys/cdefs.h>
                     39: #include <sys/types.h>
                     40: #include <sys/unistd.h>
                     41:
                     42: #define        STDIN_FILENO    0       /* standard input file descriptor */
                     43: #define        STDOUT_FILENO   1       /* standard output file descriptor */
                     44: #define        STDERR_FILENO   2       /* standard error file descriptor */
                     45:
1.57      millert    46: #if __XPG_VISIBLE || __POSIX_VISIBLE >= 200112
                     47: #define F_ULOCK         0      /* unlock locked section */
                     48: #define F_LOCK          1      /* lock a section for exclusive use */
                     49: #define F_TLOCK         2      /* test and lock a section for exclusive use */
                     50: #define F_TEST          3      /* test a section for locks by other procs */
1.62      millert    51: #endif
                     52:
1.71    ! matthew    53: /*
        !            54:  * POSIX options and option groups we unconditionally do or don't
        !            55:  * implement.  Please keep this list in alphabetical order.
        !            56:  *
        !            57:  * Anything which is defined as zero below **must** have an
        !            58:  * implementation for the corresponding sysconf() which is able to
        !            59:  * determine conclusively whether or not the feature is supported.
        !            60:  * Anything which is defined as other than -1 below **must** have
        !            61:  * complete headers, types, and function declarations as specified by
        !            62:  * the POSIX standard; however, if the relevant sysconf() function
        !            63:  * returns -1, the functions may be stubbed out.
        !            64:  */
        !            65: #define _POSIX_ADVISORY_INFO                   (-1)
        !            66: #define _POSIX_ASYNCHRONOUS_IO                 (-1)
        !            67: #define _POSIX_BARRIERS                                200112L
        !            68: #define _POSIX_CHOWN_RESTRICTED                        1
        !            69: #define _POSIX_CLOCK_SELECTION                 (-1)
        !            70: #define _POSIX_CPUTIME                         (-1)
        !            71: #define _POSIX_FSYNC                           200112L
        !            72: #define _POSIX_IPV6                            0
        !            73: #define _POSIX_JOB_CONTROL                     1
        !            74: #define _POSIX_MAPPED_FILES                    200112L
        !            75: #define _POSIX_MEMLOCK                         200112L
        !            76: #define _POSIX_MEMLOCK_RANGE                   200112L
        !            77: #define _POSIX_MEMORY_PROTECTION               200112L
        !            78: #define _POSIX_MESSAGE_PASSING                 (-1)
        !            79: #define _POSIX_MONOTONIC_CLOCK                 200112L
        !            80: #define _POSIX_NO_TRUNC                                1
        !            81: #define _POSIX_PRIORITIZED_IO                  (-1)
        !            82: #define _POSIX_PRIORITY_SCHEDULING             (-1)
        !            83: #define _POSIX_RAW_SOCKETS                     200112L
        !            84: #define _POSIX_READER_WRITER_LOCKS             200112L
        !            85: #define _POSIX_REALTIME_SIGNALS                        (-1)
        !            86: #define _POSIX_REGEXP                          1
        !            87: #define _POSIX_SAVED_IDS                       1
        !            88: #define _POSIX_SEMAPHORES                      200112L
        !            89: #define _POSIX_SHARED_MEMORY_OBJECTS           (-1)
        !            90: #define _POSIX_SHELL                           1
        !            91: #define _POSIX_SPAWN                           200112L
        !            92: #define _POSIX_SPIN_LOCKS                      200112L
        !            93: #define _POSIX_SPORADIC_SERVER                 (-1)
        !            94: #define _POSIX_SYNCHRONIZED_IO                 (-1)
        !            95: #define _POSIX_THREAD_ATTR_STACKADDR           200112L
        !            96: #define _POSIX_THREAD_ATTR_STACKSIZE           200112L
        !            97: #define _POSIX_THREAD_CPUTIME                  (-1)
        !            98: #define _POSIX_THREAD_PRIO_INHERIT             (-1)
        !            99: #define _POSIX_THREAD_PRIO_PROTECT             (-1)
        !           100: #define _POSIX_THREAD_PRIORITY_SCHEDULING      (-1)
        !           101: #define _POSIX_THREAD_PROCESS_SHARED           (-1)
        !           102: #define _POSIX_THREAD_ROBUST_PRIO_INHERIT      (-1)
        !           103: #define _POSIX_THREAD_ROBUST_PRIO_PROTECT      (-1)
        !           104: #define _POSIX_THREAD_SAFE_FUNCTIONS           200112L
        !           105: #define _POSIX_THREAD_SPORADIC_SERVER          (-1)
        !           106: #define _POSIX_THREADS                         200112L
        !           107: #define _POSIX_TIMEOUTS                                200112L
        !           108: #define _POSIX_TIMERS                          (-1)
        !           109: #define _POSIX_TRACE                           (-1)
        !           110: #define _POSIX_TRACE_EVENT_FILTER              (-1)
        !           111: #define _POSIX_TRACE_INHERIT                   (-1)
        !           112: #define _POSIX_TRACE_LOG                       (-1)
        !           113: #define _POSIX_TYPED_MEMORY_OBJECTS            (-1)
        !           114: #define _POSIX2_C_BIND                         200112L
        !           115: #define _POSIX2_C_DEV                          (-1) /* need C99 utility */
        !           116: #define _POSIX2_CHAR_TERM                      1
        !           117: #define _POSIX2_FORT_DEV                       (-1) /* need fort77 utility */
        !           118: #define _POSIX2_FORT_RUN                       200112L
        !           119: #define _POSIX2_LOCALEDEF                      (-1)
        !           120: #define _POSIX2_PBS                            (-1)
        !           121: #define _POSIX2_PBS_ACCOUNTING                 (-1)
        !           122: #define _POSIX2_PBS_CHECKPOINT                 (-1)
        !           123: #define _POSIX2_PBS_LOCATE                     (-1)
        !           124: #define _POSIX2_PBS_MESSAGE                    (-1)
        !           125: #define _POSIX2_PBS_TRACK                      (-1)
        !           126: #define _POSIX2_SW_DEV                         200112L
        !           127: #define _POSIX2_UPE                            200112L
        !           128: #define _POSIX_V6_ILP32_OFF32                  (-1)
        !           129: #define _POSIX_V6_ILP32_OFFBIG                 0
        !           130: #define _POSIX_V6_LP64_OFF64                   0
        !           131: #define _POSIX_V6_LPBIG_OFFBIG                 0
        !           132: #define _POSIX_V7_ILP32_OFF32                  (-1)
        !           133: #define _POSIX_V7_ILP32_OFFBIG                 0
        !           134: #define _POSIX_V7_LP64_OFF64                   0
        !           135: #define _POSIX_V7_LPBIG_OFFBIG                 0
        !           136:
        !           137: #define _XOPEN_CRYPT                           1
        !           138: #define _XOPEN_ENH_I18N                                (-1) /* mandatory in XSI */
        !           139: #define _XOPEN_LEGACY                          (-1)
        !           140: #define _XOPEN_REALTIME                                (-1)
        !           141: #define _XOPEN_REALTIME_THREADS                        (-1)
        !           142: #define _XOPEN_SHM                             1
        !           143: #define _XOPEN_STREAMS                         (-1)
        !           144: #define _XOPEN_UUCP                            (-1)
        !           145: #define _XOPEN_UNIX                            (-1)
        !           146:
        !           147: /* Define the POSIX.2 version we target for compliance. */
        !           148: #define _POSIX2_VERSION                                199212L
1.57      millert   149:
1.1       deraadt   150: #ifndef NULL
1.26      espie     151: #ifdef         __GNUG__
1.27      espie     152: #define        NULL    __null
1.64      jsg       153: #elif defined(__cplusplus)
                    154: #define        NULL    0L
1.26      espie     155: #else
1.63      miod      156: #define        NULL    ((void *)0)
1.26      espie     157: #endif
1.1       deraadt   158: #endif
                    159:
                    160: __BEGIN_DECLS
1.36      millert   161: __dead void     _exit(int);
                    162: int     access(const char *, int);
                    163: unsigned int alarm(unsigned int);
                    164: int     chdir(const char *);
                    165: int     chown(const char *, uid_t, gid_t);
                    166: int     close(int);
                    167: int     dup(int);
                    168: int     dup2(int, int);
1.40      espie     169: int     execl(const char *, const char *, ...)
                    170:            __attribute__((sentinel));
1.59      espie     171: int     execle(const char *, const char *, ...);
1.40      espie     172: int     execlp(const char *, const char *, ...)
                    173:            __attribute__((sentinel));
1.68      matthew   174: int     execv(const char *, char *const *);
                    175: int     execve(const char *, char *const *, char *const *);
                    176: int     execvp(const char *, char *const *);
                    177: #if __BSD_VISIBLE
                    178: int     execvpe(const char *, char *const *, char *const *);
                    179: #endif
1.36      millert   180: pid_t   fork(void);
                    181: long    fpathconf(int, int);
1.50      avsm      182: char   *getcwd(char *, size_t)
1.66      fgsch     183:                __attribute__((__bounded__(__string__,1,2)));
1.36      millert   184: gid_t   getegid(void);
                    185: uid_t   geteuid(void);
                    186: gid_t   getgid(void);
                    187: int     getgroups(int, gid_t *);
                    188: char   *getlogin(void);
                    189: pid_t   getpgrp(void);
                    190: pid_t   getpid(void);
                    191: pid_t   getppid(void);
                    192: uid_t   getuid(void);
                    193: int     isatty(int);
                    194: int     link(const char *, const char *);
                    195: off_t   lseek(int, off_t, int);
                    196: long    pathconf(const char *, int);
                    197: int     pause(void);
                    198: int     pipe(int *);
1.50      avsm      199: ssize_t         read(int, void *, size_t)
                    200:                __attribute__((__bounded__(__buffer__,2,3)));
1.36      millert   201: int     rmdir(const char *);
                    202: int     setgid(gid_t);
                    203: int     setuid(uid_t);
                    204: unsigned int sleep(unsigned int);
                    205: long    sysconf(int);
                    206: pid_t   tcgetpgrp(int);
                    207: int     tcsetpgrp(int, pid_t);
                    208: char   *ttyname(int);
                    209: int     unlink(const char *);
1.50      avsm      210: ssize_t         write(int, const void *, size_t)
                    211:                __attribute__((__bounded__(__buffer__,2,3)));
1.1       deraadt   212:
1.57      millert   213: #if __POSIX_VISIBLE || __XPG_VISIBLE >= 300
                    214: pid_t   setsid(void);
                    215: int     setpgid(pid_t, pid_t);
                    216: #endif
1.1       deraadt   217:
1.57      millert   218: #if __POSIX_VISIBLE >= 199209 || __XPG_VISIBLE
                    219: size_t  confstr(int, char *, size_t)
                    220:                __attribute__((__bounded__(__string__,2,3)));
                    221: #ifndef _GETOPT_DEFINED_
                    222: #define _GETOPT_DEFINED_
                    223: int     getopt(int, char * const *, const char *);
                    224: extern  char *optarg;                  /* getopt(3) external variables */
                    225: extern  int opterr, optind, optopt, optreset;
                    226: /* XXX - getsubopt does not belong here */
                    227: int     getsubopt(char **, char * const *, char **);
                    228: extern  char *suboptarg;               /* getsubopt(3) external variable */
                    229: #endif /* _GETOPT_DEFINED_ */
                    230: #endif
                    231:
                    232: #if __POSIX_VISIBLE >= 199506 || __XPG_VISIBLE
                    233: int     fsync(int);
                    234: int     ftruncate(int, off_t);
                    235: int     getlogin_r(char *, size_t)
1.66      fgsch     236:                __attribute__((__bounded__(__string__,1,2)));
1.57      millert   237: #endif
1.1       deraadt   238:
1.57      millert   239: #if __XPG_VISIBLE || __BSD_VISIBLE
                    240: char   *crypt(const char *, const char *);
                    241: int     encrypt(char *, int);
                    242: int     fchdir(int);
                    243: int     fchown(int, uid_t, gid_t);
                    244: long    gethostid(void);
                    245: char   *getwd(char *)
                    246:                __attribute__ ((__bounded__(__minbytes__,1,1024)));
                    247: int     lchown(const char *, uid_t, gid_t);
                    248: int     mkstemp(char *);
                    249: char   *mktemp(char *);
                    250: int     nice(int);
                    251: int     readlink(const char *, char *, size_t)
                    252:                __attribute__ ((__bounded__(__string__,2,3)));
                    253: int     setkey(const char *);
                    254: int     setpgrp(pid_t pid, pid_t pgrp);        /* obsoleted by setpgid() */
                    255: int     setregid(gid_t, gid_t);
                    256: int     setreuid(uid_t, uid_t);
                    257: void    swab(const void *, void *, size_t);
                    258: void    sync(void);
                    259: int     truncate(const char *, off_t);
                    260: unsigned int    ualarm(unsigned int, unsigned int);
                    261: int     usleep(useconds_t);
                    262: pid_t   vfork(void);
                    263: #endif
                    264:
                    265: #if __XPG_VISIBLE >= 420
                    266: pid_t   getpgid(pid_t);
                    267: pid_t   getsid(pid_t);
                    268: #endif
                    269:
                    270: #if __XPG_VISIBLE >= 500
1.36      millert   271: ssize_t  pread(int, void *, size_t, off_t);
                    272: ssize_t  pwrite(int, const void *, size_t, off_t);
1.57      millert   273: int     ttyname_r(int, char *, size_t)
                    274:            __attribute__((__bounded__(__string__,2,3)));
1.31      deraadt   275: #endif
                    276:
1.57      millert   277: #if __BSD_VISIBLE ||  __XPG_VISIBLE <= 500
                    278: /* Interfaces withdrawn by X/Open Issue 5 Version 0 */
1.60      kurt      279: int     brk(void *);
1.57      millert   280: int     chroot(const char *);
                    281: int     getdtablesize(void);
                    282: int     getpagesize(void);
                    283: char   *getpass(const char *);
                    284: void   *sbrk(int);
                    285: #endif
                    286:
                    287: #if __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE >= 420
                    288: int     lockf(int, int, off_t);
                    289: #endif
                    290:
                    291: #if __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE >= 420 || __BSD_VISIBLE
                    292: int     symlink(const char *, const char *);
                    293: int     gethostname(char *, size_t)
                    294:                __attribute__ ((__bounded__(__string__,1,2)));
                    295: int     setegid(gid_t);
                    296: int     seteuid(uid_t);
1.65      matthew   297: #endif
                    298:
                    299: #if __POSIX_VISIBLE >= 200809
                    300: int    faccessat(int, const char *, int, int);
                    301: int    fchownat(int, const char *, uid_t, gid_t, int);
                    302: int    linkat(int, const char *, int, const char *, int);
                    303: ssize_t        readlinkat(int, const char *, char *, size_t);
                    304: int    symlinkat(const char *, int, const char *);
                    305: int    unlinkat(int, const char *, int);
1.57      millert   306: #endif
                    307:
                    308: #if __BSD_VISIBLE
1.36      millert   309: int     acct(const char *);
1.52      millert   310: int     closefrom(int);
1.51      deraadt   311: int     des_cipher(const char *, char *, int32_t, int);
1.58      espie     312: int     des_setkey(const char *);
1.36      millert   313: void    endusershell(void);
                    314: int     exect(const char *, char * const *, char * const *);
                    315: char   *fflagstostr(u_int32_t);
1.50      avsm      316: int     getdomainname(char *, size_t)
                    317:                __attribute__ ((__bounded__(__string__,1,2)));
1.69      deraadt   318: int     getdtablecount(void);
1.36      millert   319: int     getgrouplist(const char *, gid_t, gid_t *, int *);
                    320: mode_t  getmode(const void *, mode_t);
1.44      millert   321: int     getresgid(gid_t *, gid_t *, gid_t *);
                    322: int     getresuid(uid_t *, uid_t *, uid_t *);
1.36      millert   323: char   *getusershell(void);
                    324: int     initgroups(const char *, gid_t);
                    325: int     iruserok(u_int32_t, int, const char *, const char *);
                    326: int     iruserok_sa(const void *, int, int, const char *, const char *);
1.57      millert   327: int     issetugid(void);
                    328: char   *mkdtemp(char *);
                    329: int     mkstemps(char *, int);
1.36      millert   330: int     nfssvc(int, void *);
1.50      avsm      331: int     profil(char *, size_t, unsigned long, unsigned int)
                    332:                __attribute__ ((__bounded__(__string__,1,2)));
1.57      millert   333: int     quotactl(const char *, int, int, char *);
1.37      millert   334: int     rcmd(char **, int, const char *,
                    335:            const char *, const char *, int *);
                    336: int     rcmd_af(char **, int, const char *,
                    337:            const char *, const char *, int *, int);
                    338: int     rcmdsh(char **, int, const char *,
                    339:            const char *, const char *, char *);
1.36      millert   340: char   *re_comp(const char *);
                    341: int     re_exec(const char *);
                    342: int     reboot(int);
                    343: int     revoke(const char *);
                    344: int     rresvport(int *);
                    345: int     rresvport_af(int *, int);
                    346: int     ruserok(const char *, int, const char *, const char *);
1.57      millert   347: #ifndef _SELECT_DEFINED_
1.67      nigel     348: #define _SELECT_DEFINED_
1.57      millert   349: struct timeval;
1.36      millert   350: int     select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
1.19      deraadt   351: #endif
1.36      millert   352: int     setdomainname(const char *, size_t);
                    353: int     setgroups(int, const gid_t *);
                    354: int     sethostid(long);
                    355: int     sethostname(const char *, size_t);
                    356: int     setlogin(const char *);
                    357: void   *setmode(const char *);
1.44      millert   358: int     setresgid(gid_t, gid_t, gid_t);
                    359: int     setresuid(uid_t, uid_t, uid_t);
1.36      millert   360: int     setrgid(gid_t);
                    361: int     setruid(uid_t);
                    362: void    setusershell(void);
                    363: int     strtofflags(char **, u_int32_t *, u_int32_t *);
                    364: int     swapctl(int cmd, const void *arg, int misc);
                    365: int     syscall(int, ...);
1.57      millert   366: #endif /* __BSD_VISIBLE */
1.1       deraadt   367: __END_DECLS
                    368:
                    369: #endif /* !_UNISTD_H_ */