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

Annotation of src/sys/sys/types.h, Revision 1.77.6.1

1.77.6.1! mjf         1: /*     $NetBSD: types.h,v 1.79 2008/01/21 00:27:24 rmind Exp $ */
1.16      cgd         2:
1.12      cgd         3: /*-
1.34      fvdl        4:  * Copyright (c) 1982, 1986, 1991, 1993, 1994
1.14      cgd         5:  *     The Regents of the University of California.  All rights reserved.
1.12      cgd         6:  * (c) UNIX System Laboratories, Inc.
                      7:  * All or some portions of this file are derived from material licensed
                      8:  * to the University of California by American Telephone and Telegraph
                      9:  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
                     10:  * the permission of UNIX System Laboratories, Inc.
                     11:  *
                     12:  * Redistribution and use in source and binary forms, with or without
                     13:  * modification, are permitted provided that the following conditions
                     14:  * are met:
                     15:  * 1. Redistributions of source code must retain the above copyright
                     16:  *    notice, this list of conditions and the following disclaimer.
                     17:  * 2. Redistributions in binary form must reproduce the above copyright
                     18:  *    notice, this list of conditions and the following disclaimer in the
                     19:  *    documentation and/or other materials provided with the distribution.
1.62      agc        20:  * 3. Neither the name of the University nor the names of its contributors
1.12      cgd        21:  *    may be used to endorse or promote products derived from this software
                     22:  *    without specific prior written permission.
                     23:  *
                     24:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     25:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     26:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     27:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     28:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     29:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     30:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     31:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     32:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     33:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     34:  * SUCH DAMAGE.
                     35:  *
1.15      cgd        36:  *     @(#)types.h     8.4 (Berkeley) 1/21/94
1.12      cgd        37:  */
                     38:
                     39: #ifndef _SYS_TYPES_H_
1.14      cgd        40: #define        _SYS_TYPES_H_
1.12      cgd        41:
1.58      bjh21      42: #include <sys/featuretest.h>
                     43:
1.12      cgd        44: /* Machine type dependent parameters. */
1.18      cgd        45: #include <machine/types.h>
                     46:
                     47: #include <machine/ansi.h>
1.49      kleink     48: #include <machine/int_types.h>
                     49:
1.12      cgd        50:
1.44      kleink     51: #include <sys/ansi.h>
1.49      kleink     52:
                     53: #ifndef        int8_t
                     54: typedef        __int8_t        int8_t;
                     55: #define        int8_t          __int8_t
                     56: #endif
                     57:
                     58: #ifndef        uint8_t
                     59: typedef        __uint8_t       uint8_t;
                     60: #define        uint8_t         __uint8_t
                     61: #endif
                     62:
                     63: #ifndef        int16_t
                     64: typedef        __int16_t       int16_t;
                     65: #define        int16_t         __int16_t
                     66: #endif
                     67:
                     68: #ifndef        uint16_t
                     69: typedef        __uint16_t      uint16_t;
                     70: #define        uint16_t        __uint16_t
                     71: #endif
                     72:
                     73: #ifndef        int32_t
                     74: typedef        __int32_t       int32_t;
                     75: #define        int32_t         __int32_t
                     76: #endif
                     77:
                     78: #ifndef        uint32_t
                     79: typedef        __uint32_t      uint32_t;
                     80: #define        uint32_t        __uint32_t
                     81: #endif
                     82:
                     83: #ifndef        int64_t
                     84: typedef        __int64_t       int64_t;
                     85: #define        int64_t         __int64_t
                     86: #endif
                     87:
                     88: #ifndef        uint64_t
                     89: typedef        __uint64_t      uint64_t;
                     90: #define        uint64_t        __uint64_t
                     91: #endif
                     92:
                     93: typedef        uint8_t         u_int8_t;
                     94: typedef        uint16_t        u_int16_t;
                     95: typedef        uint32_t        u_int32_t;
                     96: typedef        uint64_t        u_int64_t;
                     97:
                     98: #include <machine/endian.h>
1.44      kleink     99:
1.58      bjh21     100: #if defined(_NETBSD_SOURCE)
1.12      cgd       101: typedef        unsigned char   u_char;
                    102: typedef        unsigned short  u_short;
                    103: typedef        unsigned int    u_int;
                    104: typedef        unsigned long   u_long;
1.25      jtc       105:
                    106: typedef unsigned char  unchar;         /* Sys V compatibility */
1.12      cgd       107: typedef        unsigned short  ushort;         /* Sys V compatibility */
1.14      cgd       108: typedef        unsigned int    uint;           /* Sys V compatibility */
1.25      jtc       109: typedef unsigned long  ulong;          /* Sys V compatibility */
1.14      cgd       110: #endif
1.12      cgd       111:
1.52      wiz       112: typedef        uint64_t        u_quad_t;       /* quads */
1.18      cgd       113: typedef        int64_t         quad_t;
1.12      cgd       114: typedef        quad_t *        qaddr_t;
1.40      thorpej   115:
1.51      chs       116: /*
                    117:  * The types longlong_t and u_longlong_t exist for use with the
                    118:  * Sun-derived XDR routines involving these types, and their usage
                    119:  * in other contexts is discouraged.  Further note that these types
                    120:  * may not be equivalent to "long long" and "unsigned long long",
                    121:  * they are only guaranteed to be signed and unsigned 64-bit types
                    122:  * respectively.  Portable programs that need 64-bit types should use
                    123:  * the C99 types int64_t and uint64_t instead.
                    124:  */
                    125:
1.52      wiz       126: typedef        int64_t         longlong_t;     /* for XDR */
                    127: typedef        uint64_t        u_longlong_t;   /* for XDR */
1.12      cgd       128:
1.32      kleink    129: typedef        int64_t         blkcnt_t;       /* fs block count */
1.52      wiz       130: typedef        uint32_t        blksize_t;      /* fs optimal block size */
1.50      kleink    131:
1.63      christos  132: #ifndef        fsblkcnt_t
                    133: typedef        __fsblkcnt_t    fsblkcnt_t;     /* fs block count (statvfs) */
                    134: #define fsblkcnt_t     __fsblkcnt_t
                    135: #endif
                    136:
                    137: #ifndef        fsfilcnt_t
                    138: typedef        __fsfilcnt_t    fsfilcnt_t;     /* fs file count */
                    139: #define fsfilcnt_t     __fsfilcnt_t
                    140: #endif
                    141:
1.74      christos  142: #if !defined(_KERNEL) && !defined(_STANDALONE)
                    143: /* We don't and shouldn't use caddr_t in the kernel anymore */
1.50      kleink    144: #ifndef        caddr_t
                    145: typedef        __caddr_t       caddr_t;        /* core address */
                    146: #define        caddr_t         __caddr_t
                    147: #endif
1.74      christos  148: #endif
1.50      kleink    149:
1.56      simonb    150: #ifdef __daddr_t
                    151: typedef        __daddr_t       daddr_t;        /* disk address */
                    152: #undef __daddr_t
                    153: #else
1.55      fvdl      154: typedef        int64_t         daddr_t;        /* disk address */
1.56      simonb    155: #endif
                    156:
1.52      wiz       157: typedef        uint32_t        dev_t;          /* device number */
                    158: typedef        uint32_t        fixpt_t;        /* fixed point number */
1.50      kleink    159:
                    160: #ifndef        gid_t
                    161: typedef        __gid_t         gid_t;          /* group id */
                    162: #define        gid_t           __gid_t
                    163: #endif
                    164:
1.77.6.1! mjf       165: typedef        int             idtype_t;       /* type of the id */
1.52      wiz       166: typedef        uint32_t        id_t;           /* group id, process id or user id */
1.68      christos  167: typedef        uint64_t        ino_t;          /* inode number */
1.18      cgd       168: typedef        long            key_t;          /* IPC key (for Sys V IPC) */
1.45      kleink    169:
                    170: #ifndef        mode_t
                    171: typedef        __mode_t        mode_t;         /* permissions */
1.46      kleink    172: #define        mode_t          __mode_t
1.45      kleink    173: #endif
                    174:
1.52      wiz       175: typedef        uint32_t        nlink_t;        /* link count */
1.44      kleink    176:
                    177: #ifndef        off_t
                    178: typedef        __off_t         off_t;          /* file offset */
1.46      kleink    179: #define        off_t           __off_t
1.44      kleink    180: #endif
                    181:
1.47      kleink    182: #ifndef        pid_t
                    183: typedef        __pid_t         pid_t;          /* process id */
                    184: #define        pid_t           __pid_t
                    185: #endif
1.53      thorpej   186: typedef int32_t                lwpid_t;        /* LWP id */
1.20      jtc       187: typedef quad_t         rlim_t;         /* resource limit */
1.18      cgd       188: typedef        int32_t         segsz_t;        /* segment size */
                    189: typedef        int32_t         swblk_t;        /* swap offset */
1.50      kleink    190:
                    191: #ifndef        uid_t
                    192: typedef        __uid_t         uid_t;          /* user id */
                    193: #define        uid_t           __uid_t
                    194: #endif
                    195:
1.42      eeh       196: typedef        int32_t         dtime_t;        /* on-disk time_t */
1.57      christos  197:
1.77      rmind     198: typedef int            mqd_t;
                    199:
1.77.6.1! mjf       200: typedef        unsigned long   cpuid_t;
        !           201:
        !           202: typedef        int             psetid_t;
        !           203:
1.69      tsutsui   204: #if defined(_KERNEL) || defined(_STANDALONE)
1.72      thorpej   205: /*
                    206:  * Boolean type definitions for the kernel environment.  User-space
                    207:  * boolean definitions are found in <stdbool.h>.
                    208:  */
                    209: #define bool   _Bool
                    210: #define true   1
                    211: #define false  0
                    212:
                    213: /*
                    214:  * Deprecated Mach-style boolean_t type.  Should not be used by new code.
                    215:  */
1.57      christos  216: typedef int    boolean_t;
                    217: #ifndef TRUE
                    218: #define        TRUE    1
                    219: #endif
                    220: #ifndef FALSE
                    221: #define        FALSE   0
                    222: #endif
1.72      thorpej   223:
                    224: #endif /* _KERNEL || _STANDALONE */
1.39      thorpej   225:
                    226: #if defined(_KERNEL) || defined(_LIBC)
                    227: /*
                    228:  * semctl(2)'s argument structure.  This is here for the benefit of
                    229:  * <sys/syscallargs.h>.  It is not in the user's namespace in SUSv2.
                    230:  * The SUSv2 semctl(2) takes variable arguments.
                    231:  */
                    232: union __semun {
                    233:        int             val;            /* value for SETVAL */
                    234:        struct semid_ds *buf;           /* buffer for IPC_STAT & IPC_SET */
                    235:        unsigned short  *array;         /* array for GETALL & SETALL */
                    236: };
1.54      christos  237: /* For the same reason as above */
                    238: #include <sys/stdint.h>
                    239: typedef intptr_t semid_t;
1.41      simonb    240: #endif /* _KERNEL || _LIBC */
1.12      cgd       241:
                    242: /*
1.22      jtc       243:  * These belong in unistd.h, but are placed here too to ensure that
1.26      cgd       244:  * long arguments will be promoted to off_t if the program fails to
1.22      jtc       245:  * include that header or explicitly cast them to off_t.
1.12      cgd       246:  */
1.58      bjh21     247: #if defined(_NETBSD_SOURCE)
1.48      christos  248: #ifndef __OFF_T_SYSCALLS_DECLARED
                    249: #define __OFF_T_SYSCALLS_DECLARED
1.21      jtc       250: #ifndef _KERNEL
1.12      cgd       251: #include <sys/cdefs.h>
                    252: __BEGIN_DECLS
1.65      perry     253: off_t   lseek(int, off_t, int);
                    254: int     ftruncate(int, off_t);
                    255: int     truncate(const char *, off_t);
1.12      cgd       256: __END_DECLS
1.23      jtc       257: #endif /* !_KERNEL */
1.48      christos  258: #endif /* __OFF_T_SYSCALLS_DECLARED */
1.58      bjh21     259: #endif /* defined(_NETBSD_SOURCE) */
1.12      cgd       260:
1.58      bjh21     261: #if defined(_NETBSD_SOURCE)
1.18      cgd       262: /* Major, minor numbers, dev_t's. */
1.33      mycroft   263: #define        major(x)        ((int32_t)((((x) & 0x000fff00) >>  8)))
                    264: #define        minor(x)        ((int32_t)((((x) & 0xfff00000) >> 12) | \
                    265:                                   (((x) & 0x000000ff) >>  0)))
                    266: #define        makedev(x,y)    ((dev_t)((((x) <<  8) & 0x000fff00) | \
                    267:                                 (((y) << 12) & 0xfff00000) | \
                    268:                                 (((y) <<  0) & 0x000000ff)))
1.12      cgd       269: #endif
                    270:
1.14      cgd       271: #ifdef _BSD_CLOCK_T_
1.32      kleink    272: typedef        _BSD_CLOCK_T_           clock_t;
1.14      cgd       273: #undef _BSD_CLOCK_T_
1.12      cgd       274: #endif
                    275:
1.14      cgd       276: #ifdef _BSD_SIZE_T_
1.32      kleink    277: typedef        _BSD_SIZE_T_            size_t;
1.36      eeh       278: #define _SIZE_T
1.14      cgd       279: #undef _BSD_SIZE_T_
1.12      cgd       280: #endif
                    281:
1.14      cgd       282: #ifdef _BSD_SSIZE_T_
1.32      kleink    283: typedef        _BSD_SSIZE_T_           ssize_t;
1.14      cgd       284: #undef _BSD_SSIZE_T_
1.12      cgd       285: #endif
                    286:
1.14      cgd       287: #ifdef _BSD_TIME_T_
1.32      kleink    288: typedef        _BSD_TIME_T_            time_t;
1.14      cgd       289: #undef _BSD_TIME_T_
1.29      jtc       290: #endif
                    291:
                    292: #ifdef _BSD_CLOCKID_T_
1.32      kleink    293: typedef        _BSD_CLOCKID_T_         clockid_t;
1.29      jtc       294: #undef _BSD_CLOCKID_T_
                    295: #endif
                    296:
                    297: #ifdef _BSD_TIMER_T_
1.32      kleink    298: typedef        _BSD_TIMER_T_           timer_t;
1.29      jtc       299: #undef _BSD_TIMER_T_
1.32      kleink    300: #endif
                    301:
                    302: #ifdef _BSD_SUSECONDS_T_
                    303: typedef        _BSD_SUSECONDS_T_       suseconds_t;
                    304: #undef _BSD_SUSECONDS_T_
                    305: #endif
                    306:
                    307: #ifdef _BSD_USECONDS_T_
                    308: typedef        _BSD_USECONDS_T_        useconds_t;
                    309: #undef _BSD_USECONDS_T_
1.12      cgd       310: #endif
                    311:
1.67      kleink    312: #ifdef _NETBSD_SOURCE
                    313: #include <sys/fd_set.h>
                    314: #define        NBBY    __NBBY
1.71      elad      315:
                    316: typedef struct kauth_cred *kauth_cred_t;
                    317:
1.76      ad        318: typedef int pri_t;
1.73      yamt      319:
1.43      christos  320: #endif
1.12      cgd       321:
1.21      jtc       322: #if defined(__STDC__) && defined(_KERNEL)
1.12      cgd       323: /*
1.14      cgd       324:  * Forward structure declarations for function prototypes.  We include the
                    325:  * common structures that cross subsystem boundaries here; others are mostly
                    326:  * used in the same place that the structure is defined.
1.12      cgd       327:  */
1.53      thorpej   328: struct lwp;
1.75      yamt      329: typedef struct lwp lwp_t;
1.53      thorpej   330: struct user;
                    331: struct __ucontext;
1.12      cgd       332: struct proc;
1.76      ad        333: typedef struct proc proc_t;
1.12      cgd       334: struct pgrp;
                    335: struct rusage;
                    336: struct file;
1.76      ad        337: typedef struct file file_t;
1.12      cgd       338: struct buf;
1.76      ad        339: typedef struct buf buf_t;
1.12      cgd       340: struct tty;
                    341: struct uio;
                    342: #endif
                    343:
1.70      christos  344: #ifdef _KERNEL
                    345: #define SET(t, f)      ((t) |= (f))
                    346: #define        ISSET(t, f)     ((t) & (f))
                    347: #define        CLR(t, f)       ((t) &= ~(f))
                    348: #endif
                    349:
1.59      thorpej   350: #if !defined(_KERNEL) && !defined(_STANDALONE)
1.61      nathanw   351: #if (_POSIX_C_SOURCE - 0L) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
1.60      nathanw   352:     defined(_NETBSD_SOURCE)
1.59      thorpej   353: #include <pthread_types.h>
1.60      nathanw   354: #endif
1.59      thorpej   355: #endif
                    356:
1.12      cgd       357: #endif /* !_SYS_TYPES_H_ */

CVSweb <webmaster@jp.NetBSD.org>