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

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

1.132   ! christos    1: /*     $NetBSD: unistd.h,v 1.131 2012/04/12 23:16:55 christos Exp $    */
1.22      cgd         2:
1.1       cgd         3: /*-
1.117     ad          4:  * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc.
1.55      kleink      5:  * All rights reserved.
                      6:  *
                      7:  * This code is derived from software contributed to The NetBSD Foundation
                      8:  * by Klaus Klein.
                      9:  *
                     10:  * Redistribution and use in source and binary forms, with or without
                     11:  * modification, are permitted provided that the following conditions
                     12:  * are met:
                     13:  * 1. Redistributions of source code must retain the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer.
                     15:  * 2. Redistributions in binary form must reproduce the above copyright
                     16:  *    notice, this list of conditions and the following disclaimer in the
                     17:  *    documentation and/or other materials provided with the distribution.
                     18:  *
                     19:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     20:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     21:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     22:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     23:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     24:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     25:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     26:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     27:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     28:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     29:  * POSSIBILITY OF SUCH DAMAGE.
                     30:  */
                     31:
                     32: /*
1.49      perry      33:  * Copyright (c) 1991, 1993, 1994
                     34:  *     The Regents of the University of California.  All rights reserved.
1.1       cgd        35:  *
                     36:  * Redistribution and use in source and binary forms, with or without
                     37:  * modification, are permitted provided that the following conditions
                     38:  * are met:
                     39:  * 1. Redistributions of source code must retain the above copyright
                     40:  *    notice, this list of conditions and the following disclaimer.
                     41:  * 2. Redistributions in binary form must reproduce the above copyright
                     42:  *    notice, this list of conditions and the following disclaimer in the
                     43:  *    documentation and/or other materials provided with the distribution.
1.94      agc        44:  * 3. Neither the name of the University nor the names of its contributors
1.1       cgd        45:  *    may be used to endorse or promote products derived from this software
                     46:  *    without specific prior written permission.
                     47:  *
                     48:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     49:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     50:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     51:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     52:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     53:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     54:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     55:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     56:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     57:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     58:  * SUCH DAMAGE.
                     59:  *
1.49      perry      60:  *     @(#)unistd.h    8.12 (Berkeley) 4/27/95
1.1       cgd        61:  */
                     62:
                     63: #ifndef _UNISTD_H_
                     64: #define        _UNISTD_H_
                     65:
1.77      kleink     66: #include <machine/ansi.h>
1.85      kleink     67: #include <machine/int_types.h>
1.1       cgd        68: #include <sys/cdefs.h>
1.64      mycroft    69: #include <sys/featuretest.h>
1.1       cgd        70: #include <sys/types.h>
                     71: #include <sys/unistd.h>
1.50      kleink     72:
1.125     christos   73: #if _FORTIFY_SOURCE > 0
                     74: #include <ssp/unistd.h>
                     75: #endif
1.55      kleink     76:
                     77: /*
                     78:  * IEEE Std 1003.1-90
                     79:  */
1.4       jtc        80: #define        STDIN_FILENO    0       /* standard input file descriptor */
1.1       cgd        81: #define        STDOUT_FILENO   1       /* standard output file descriptor */
                     82: #define        STDERR_FILENO   2       /* standard error file descriptor */
                     83:
1.80      kleink     84: #include <sys/null.h>
1.1       cgd        85:
                     86: __BEGIN_DECLS
1.114     perry      87: __dead  void _exit(int);
1.101     perry      88: int     access(const char *, int);
                     89: unsigned int alarm(unsigned int);
                     90: int     chdir(const char *);
1.55      kleink     91: #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
1.101     perry      92: int    chown(const char *, uid_t, gid_t) __RENAME(__posix_chown);
1.55      kleink     93: #else
1.101     perry      94: int    chown(const char *, uid_t, gid_t);
1.55      kleink     95: #endif /* defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) */
1.101     perry      96: int     close(int);
                     97: size_t  confstr(int, char *, size_t);
1.86      christos   98: #ifndef __CUSERID_DECLARED
                     99: #define __CUSERID_DECLARED
                    100: /* also declared in stdio.h */
1.101     perry     101: char   *cuserid(char *);       /* obsolete */
1.86      christos  102: #endif /* __CUSERID_DECLARED */
1.101     perry     103: int     dup(int);
                    104: int     dup2(int, int);
                    105: int     execl(const char *, const char *, ...);
                    106: int     execle(const char *, const char *, ...);
                    107: int     execlp(const char *, const char *, ...);
                    108: int     execv(const char *, char * const *);
                    109: int     execve(const char *, char * const *, char * const *);
                    110: int     execvp(const char *, char * const *);
                    111: pid_t   fork(void);
                    112: long    fpathconf(int, int);
1.125     christos  113: #if __SSP_FORTIFY_LEVEL == 0
1.101     perry     114: char   *getcwd(char *, size_t);
1.125     christos  115: #endif
1.101     perry     116: gid_t   getegid(void);
                    117: uid_t   geteuid(void);
                    118: gid_t   getgid(void);
                    119: int     getgroups(int, gid_t []);
                    120: __aconst char *getlogin(void);
1.119     lukem     121: int     getlogin_r(char *, size_t);
1.101     perry     122: pid_t   getpgrp(void);
                    123: pid_t   getpid(void);
                    124: pid_t   getppid(void);
                    125: uid_t   getuid(void);
                    126: int     isatty(int);
                    127: int     link(const char *, const char *);
                    128: long    pathconf(const char *, int);
                    129: int     pause(void);
                    130: int     pipe(int *);
1.125     christos  131: #if __SSP_FORTIFY_LEVEL == 0
1.101     perry     132: ssize_t         read(int, void *, size_t);
1.125     christos  133: #endif
1.101     perry     134: int     rmdir(const char *);
                    135: int     setgid(gid_t);
                    136: int     setpgid(pid_t, pid_t);
                    137: pid_t   setsid(void);
                    138: int     setuid(uid_t);
                    139: unsigned int    sleep(unsigned int);
                    140: long    sysconf(int);
                    141: pid_t   tcgetpgrp(int);
                    142: int     tcsetpgrp(int, pid_t);
                    143: __aconst char *ttyname(int);
                    144: int     unlink(const char *);
                    145: ssize_t         write(int, const void *, size_t);
1.1       cgd       146:
1.55      kleink    147:
                    148: /*
1.83      christos  149:  * IEEE Std 1003.2-92, adopted in X/Open Portability Guide Issue 4 and later
                    150:  */
1.115     drochner  151: #if (_POSIX_C_SOURCE - 0) >= 2 || defined(_XOPEN_SOURCE) || \
1.92      bjh21     152:     defined(_NETBSD_SOURCE)
1.101     perry     153: int     getopt(int, char * const [], const char *);
1.83      christos  154:
                    155: extern  char *optarg;                  /* getopt(3) external variables */
                    156: extern  int opterr;
                    157: extern  int optind;
                    158: extern  int optopt;
                    159: #endif
                    160:
1.89      jdolecek  161: /*
1.91      kleink    162:  * The Open Group Base Specifications, Issue 6; IEEE Std 1003.1-2001 (POSIX)
1.89      jdolecek  163:  */
1.92      bjh21     164: #if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600 || \
                    165:     defined(_NETBSD_SOURCE)
1.101     perry     166: int     setegid(gid_t);
                    167: int     seteuid(uid_t);
1.89      jdolecek  168: #endif
1.83      christos  169:
                    170: /*
1.86      christos  171:  * The following three syscalls are also defined in <sys/types.h>
                    172:  * We protect them against double declarations.
                    173:  */
                    174: #ifndef __OFF_T_SYSCALLS_DECLARED
                    175: #define __OFF_T_SYSCALLS_DECLARED
1.101     perry     176: off_t   lseek(int, off_t, int);
                    177: int     truncate(const char *, off_t);
1.86      christos  178: /*
1.55      kleink    179:  * IEEE Std 1003.1b-93,
                    180:  * also found in X/Open Portability Guide >= Issue 4 Verion 2
                    181:  */
1.92      bjh21     182: #if (_POSIX_C_SOURCE - 0) >= 199309L || \
1.55      kleink    183:     (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
1.92      bjh21     184:     (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
1.101     perry     185: int     ftruncate(int, off_t);
1.55      kleink    186: #endif
1.86      christos  187: #endif /* __OFF_T_SYSCALLS_DECLARED */
1.55      kleink    188:
                    189:
                    190: /*
                    191:  * IEEE Std 1003.1b-93, adopted in X/Open CAE Specification Issue 5 Version 2
                    192:  */
1.92      bjh21     193: #if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
                    194:     defined(_NETBSD_SOURCE)
1.101     perry     195: int     fdatasync(int);
                    196: int     fsync(int);
1.49      perry     197: #endif
1.55      kleink    198:
                    199:
                    200: /*
1.108     kleink    201:  * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2
                    202:  */
                    203: #if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
                    204:     defined(_REENTRANT) || defined(_NETBSD_SOURCE)
                    205: int     ttyname_r(int, char *, size_t);
1.118     ad        206: int     pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
1.108     kleink    207: #endif
                    208:
                    209: /*
1.55      kleink    210:  * X/Open Portability Guide, all issues
                    211:  */
1.92      bjh21     212: #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
1.101     perry     213: int     chroot(const char *);
                    214: int     nice(int);
1.55      kleink    215: #endif
                    216:
                    217:
                    218: /*
                    219:  * X/Open Portability Guide >= Issue 4
                    220:  */
1.115     drochner  221: #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
1.101     perry     222: __aconst char *crypt(const char *, const char *);
                    223: int     encrypt(char *, int);
                    224: char   *getpass(const char *);
                    225: pid_t   getsid(pid_t);
1.55      kleink    226: #endif
                    227:
                    228:
                    229: /*
                    230:  * X/Open Portability Guide >= Issue 4 Version 2
                    231:  */
1.92      bjh21     232: #if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
                    233:     (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
1.85      kleink    234: #ifndef        intptr_t
                    235: typedef        __intptr_t      intptr_t;
1.87      kleink    236: #define        intptr_t        __intptr_t
1.77      kleink    237: #endif
                    238:
1.55      kleink    239: #define F_ULOCK                0
                    240: #define F_LOCK         1
                    241: #define F_TLOCK                2
                    242: #define F_TEST         3
                    243:
1.101     perry     244: int     brk(void *);
                    245: int     fchdir(int);
1.55      kleink    246: #if defined(_XOPEN_SOURCE)
1.101     perry     247: int     fchown(int, uid_t, gid_t) __RENAME(__posix_fchown);
1.55      kleink    248: #else
1.101     perry     249: int     fchown(int, uid_t, gid_t);
1.55      kleink    250: #endif
1.101     perry     251: int     getdtablesize(void);
                    252: long    gethostid(void);
                    253: int     gethostname(char *, size_t);
1.55      kleink    254: __pure int
1.101     perry     255:         getpagesize(void);             /* legacy */
                    256: pid_t   getpgid(pid_t);
1.55      kleink    257: #if defined(_XOPEN_SOURCE)
1.101     perry     258: int     lchown(const char *, uid_t, gid_t) __RENAME(__posix_lchown);
1.55      kleink    259: #else
1.101     perry     260: int     lchown(const char *, uid_t, gid_t);
1.55      kleink    261: #endif
1.101     perry     262: int     lockf(int, int, off_t);
1.125     christos  263: #if __SSP_FORTIFY_LEVEL == 0
1.101     perry     264: ssize_t         readlink(const char * __restrict, char * __restrict, size_t);
1.125     christos  265: #endif
1.101     perry     266: void   *sbrk(intptr_t);
1.55      kleink    267: /* XXX prototype wrong! */
1.101     perry     268: int     setpgrp(pid_t, pid_t);                 /* obsoleted by setpgid() */
                    269: int     setregid(gid_t, gid_t);
                    270: int     setreuid(uid_t, uid_t);
1.123     christos  271: void    swab(const void * __restrict, void * __restrict, ssize_t);
1.101     perry     272: int     symlink(const char *, const char *);
                    273: void    sync(void);
                    274: useconds_t ualarm(useconds_t, useconds_t);
                    275: int     usleep(useconds_t);
1.105     christos  276: #ifndef __LIBC12_SOURCE__
1.128     joerg     277: pid_t   vfork(void) __RENAME(__vfork14) __returns_twice;
1.55      kleink    278: #endif
                    279:
1.63      mycroft   280: #ifndef __AUDIT__
1.101     perry     281: char   *getwd(char *);                         /* obsoleted by getcwd() */
1.63      mycroft   282: #endif
1.92      bjh21     283: #endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
1.58      kleink    284:
                    285:
                    286: /*
                    287:  * X/Open CAE Specification Issue 5 Version 2
                    288:  */
1.92      bjh21     289: #if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
1.101     perry     290: ssize_t         pread(int, void *, size_t, off_t);
                    291: ssize_t         pwrite(int, const void *, size_t, off_t);
1.58      kleink    292: #endif
1.55      kleink    293:
1.127     manu      294: /*
                    295:  * X/Open Extended API set 2 (a.k.a. C063)
                    296:  */
                    297: #if defined(_INCOMPLETE_XOPEN_C063)
                    298: int    linkat(int, const char *, int, const char *, int);
                    299: int    renameat(int, const char *, int, const char *);
                    300: int    mkfifoat(int, const char *, mode_t);
                    301: int    mknodat(int, const char *, mode_t, uint32_t);
                    302: int    mkdirat(int, const char *, mode_t);
                    303: int    faccessat(int, const char *, int, int);
                    304: int    fchmodat(int, const char *, mode_t, int);
                    305: int    fchownat(int, const char *, uid_t, gid_t, int);
                    306: int    fexecve(int, char * const *, char * const *);
                    307: int    readlinkat(int, const char *, char *, size_t);
                    308: int    symlinkat(const char *, int, const char *);
                    309: int    unlinkat(int, const char *, int);
                    310: #endif
                    311:
1.55      kleink    312:
                    313: /*
                    314:  * Implementation-defined extensions
                    315:  */
1.92      bjh21     316: #if defined(_NETBSD_SOURCE)
1.101     perry     317: int     acct(const char *);
                    318: int     closefrom(int);
                    319: int     des_cipher(const char *, char *, long, int);
                    320: int     des_setkey(const char *);
1.126     christos  321: int     dup3(int, int, int);
1.101     perry     322: void    endusershell(void);
                    323: int     exect(const char *, char * const *, char * const *);
                    324: int     fchroot(int);
                    325: int     fsync_range(int, int, off_t, off_t);
                    326: int     getdomainname(char *, size_t);
                    327: int     getgrouplist(const char *, gid_t, gid_t *, int *);
                    328: int     getgroupmembership(const char *, gid_t, gid_t *, int, int *);
                    329: mode_t  getmode(const void *, mode_t);
1.132   ! christos  330: char   *getpassfd(const char *, char *, size_t, int[], int, int);
1.130     christos  331: #define        GETPASS_NEED_TTY        0x01    /* Fail if we cannot set tty */
                    332: #define        GETPASS_FAIL_EOF        0x02    /* Fail on EOF */
                    333: #define        GETPASS_BUF_LIMIT       0x04    /* beep on buffer limit */
                    334: #define        GETPASS_NO_SIGNAL       0x08    /* don't make ttychars send signals */
                    335: #define        GETPASS_NO_BEEP         0x10    /* don't beep */
1.131     christos  336: #define        GETPASS_ECHO            0x20    /* echo characters as they are typed */
                    337: #define        GETPASS_ECHO_STAR       0x40    /* ech '*' for each character */
1.129     christos  338: char   *getpass_r(const char *, char *, size_t);
1.113     he        339: int     getpeereid(int, uid_t *, gid_t *);
1.101     perry     340: int     getsubopt(char **, char * const *, char **);
                    341: __aconst char *getusershell(void);
                    342: int     initgroups(const char *, gid_t);
1.110     perry     343: int     iruserok(uint32_t, int, const char *, const char *);
1.101     perry     344: int      issetugid(void);
                    345: int     nfssvc(int, void *);
1.126     christos  346: int     pipe2(int *, int);
1.101     perry     347: int     profil(char *, size_t, u_long, u_int);
1.86      christos  348: #ifndef __PSIGNAL_DECLARED
                    349: #define __PSIGNAL_DECLARED
                    350: /* also in signal.h */
1.126     christos  351: void    psignal(int, const char *);
1.86      christos  352: #endif /* __PSIGNAL_DECLARED */
1.101     perry     353: int     rcmd(char **, int, const char *, const char *, const char *, int *);
                    354: int     reboot(int, char *);
                    355: int     revoke(const char *);
                    356: int     rresvport(int *);
                    357: int     ruserok(const char *, int, const char *, const char *);
                    358: int     setdomainname(const char *, size_t);
                    359: int     setgroups(int, const gid_t *);
                    360: int     sethostid(long);
                    361: int     sethostname(const char *, size_t);
                    362: int     setlogin(const char *);
                    363: void   *setmode(const char *);
                    364: int     setrgid(gid_t);
                    365: int     setruid(uid_t);
                    366: void    setusershell(void);
                    367: void    strmode(mode_t, char *);
1.121     kleink    368: #ifndef __STRSIGNAL_DECLARED
                    369: #define __STRSIGNAL_DECLARED
                    370: /* backwards-compatibility; also in string.h */
1.101     perry     371: __aconst char *strsignal(int);
1.121     kleink    372: #endif /* __STRSIGNAL_DECLARED */
1.104     christos  373: int     swapctl(int, void *, int);
1.101     perry     374: int     swapon(const char *);                  /* obsoleted by swapctl() */
                    375: int     syscall(int, ...);
                    376: quad_t  __syscall(quad_t, ...);
                    377: int     undelete(const char *);
1.1       cgd       378:
1.76      kleink    379: #if 1 /*INET6*/
1.101     perry     380: int     rcmd_af(char **, int, const char *,
                    381:            const char *, const char *, int *, int);
                    382: int     rresvport_af(int *, int);
                    383: int     iruserok_sa(const void *, int, int, const char *, const char *);
1.76      kleink    384: #endif
                    385:
1.86      christos  386: #ifndef __SYS_SIGLIST_DECLARED
                    387: #define __SYS_SIGLIST_DECLARED
                    388: /* also in signal.h */
1.109     perry     389: extern const char *const *sys_siglist __RENAME(__sys_siglist14);
1.86      christos  390: #endif /* __SYS_SIGLIST_DECLARED */
1.83      christos  391: extern  int optreset;          /* getopt(3) external variable */
                    392: extern  char *suboptarg;       /* getsubopt(3) external variable */
1.54      kleink    393: #endif
1.46      kleink    394:
1.1       cgd       395: __END_DECLS
                    396: #endif /* !_UNISTD_H_ */

CVSweb <webmaster@jp.NetBSD.org>