The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/types.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $OpenBSD: types.h,v 1.49 2022/08/06 13:31:13 semarie Exp $      */
    2 /*      $NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $   */
    3 
    4 /*-
    5  * Copyright (c) 1982, 1986, 1991, 1993
    6  *      The Regents of the University of California.  All rights reserved.
    7  * (c) UNIX System Laboratories, Inc.
    8  * All or some portions of this file are derived from material licensed
    9  * to the University of California by American Telephone and Telegraph
   10  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
   11  * the permission of UNIX System Laboratories, Inc.
   12  *
   13  * Redistribution and use in source and binary forms, with or without
   14  * modification, are permitted provided that the following conditions
   15  * are met:
   16  * 1. Redistributions of source code must retain the above copyright
   17  *    notice, this list of conditions and the following disclaimer.
   18  * 2. Redistributions in binary form must reproduce the above copyright
   19  *    notice, this list of conditions and the following disclaimer in the
   20  *    documentation and/or other materials provided with the distribution.
   21  * 3. Neither the name of the University nor the names of its contributors
   22  *    may be used to endorse or promote products derived from this software
   23  *    without specific prior written permission.
   24  *
   25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   28  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   35  * SUCH DAMAGE.
   36  *
   37  *      @(#)types.h     8.4 (Berkeley) 1/21/94
   38  */
   39 
   40 #ifndef _SYS_TYPES_H_
   41 #define _SYS_TYPES_H_
   42 
   43 #include <sys/cdefs.h>
   44 #if __BSD_VISIBLE
   45 #include <sys/endian.h>
   46 #else
   47 #include <sys/_endian.h>
   48 #endif
   49 
   50 #if __BSD_VISIBLE
   51 typedef unsigned char   u_char;
   52 typedef unsigned short  u_short;
   53 typedef unsigned int    u_int;
   54 typedef unsigned long   u_long;
   55 
   56 typedef unsigned char   unchar;         /* Sys V compatibility */
   57 typedef unsigned short  ushort;         /* Sys V compatibility */
   58 typedef unsigned int    uint;           /* Sys V compatibility */
   59 typedef unsigned long   ulong;          /* Sys V compatibility */
   60 
   61 typedef __cpuid_t       cpuid_t;        /* CPU id */
   62 typedef __register_t    register_t;     /* register-sized type */
   63 #endif /* __BSD_VISIBLE */
   64 
   65 /*
   66  * XXX The exact-width bit types should only be exposed if __BSD_VISIBLE
   67  *     but the rest of the includes are not ready for that yet.
   68  */
   69 #ifndef __BIT_TYPES_DEFINED__
   70 #define __BIT_TYPES_DEFINED__
   71 #endif
   72 
   73 #ifndef _INT8_T_DEFINED_
   74 #define _INT8_T_DEFINED_
   75 typedef __int8_t                int8_t;
   76 #endif
   77 
   78 #ifndef _UINT8_T_DEFINED_
   79 #define _UINT8_T_DEFINED_
   80 typedef __uint8_t               uint8_t;
   81 #endif
   82 
   83 #ifndef _INT16_T_DEFINED_
   84 #define _INT16_T_DEFINED_
   85 typedef __int16_t               int16_t;
   86 #endif
   87 
   88 #ifndef _UINT16_T_DEFINED_
   89 #define _UINT16_T_DEFINED_
   90 typedef __uint16_t              uint16_t;
   91 #endif
   92 
   93 #ifndef _INT32_T_DEFINED_
   94 #define _INT32_T_DEFINED_
   95 typedef __int32_t               int32_t;
   96 #endif
   97 
   98 #ifndef _UINT32_T_DEFINED_
   99 #define _UINT32_T_DEFINED_
  100 typedef __uint32_t              uint32_t;
  101 #endif
  102 
  103 #ifndef _INT64_T_DEFINED_
  104 #define _INT64_T_DEFINED_
  105 typedef __int64_t               int64_t;
  106 #endif
  107 
  108 #ifndef _UINT64_T_DEFINED_
  109 #define _UINT64_T_DEFINED_
  110 typedef __uint64_t              uint64_t;
  111 #endif
  112 
  113 /* BSD-style unsigned bits types */
  114 typedef __uint8_t       u_int8_t;
  115 typedef __uint16_t      u_int16_t;
  116 typedef __uint32_t      u_int32_t;
  117 typedef __uint64_t      u_int64_t;
  118 
  119 /* quads, deprecated in favor of 64 bit int types */
  120 typedef __int64_t       quad_t;
  121 typedef __uint64_t      u_quad_t;
  122 
  123 #if __BSD_VISIBLE
  124 /* VM system types */
  125 typedef __vaddr_t       vaddr_t;
  126 typedef __paddr_t       paddr_t;
  127 typedef __vsize_t       vsize_t;
  128 typedef __psize_t       psize_t;
  129 #endif /* __BSD_VISIBLE */
  130 
  131 /* Standard system types */
  132 typedef __blkcnt_t      blkcnt_t;       /* blocks allocated for file */
  133 typedef __blksize_t     blksize_t;      /* optimal blocksize for I/O */
  134 typedef char *          caddr_t;        /* core address */
  135 typedef __int32_t       daddr32_t;      /* 32-bit disk address */
  136 typedef __int64_t       daddr_t;        /* 64-bit disk address */
  137 typedef __dev_t         dev_t;          /* device number */
  138 typedef __fixpt_t       fixpt_t;        /* fixed point number */
  139 typedef __gid_t         gid_t;          /* group id */
  140 typedef __id_t          id_t;           /* may contain pid, uid or gid */
  141 typedef __ino_t         ino_t;          /* inode number */
  142 typedef __key_t         key_t;          /* IPC key (for Sys V IPC) */
  143 typedef __mode_t        mode_t;         /* permissions */
  144 typedef __nlink_t       nlink_t;        /* link count */
  145 typedef __rlim_t        rlim_t;         /* resource limit */
  146 typedef __segsz_t       segsz_t;        /* segment size */
  147 typedef __uid_t         uid_t;          /* user id */
  148 typedef __useconds_t    useconds_t;     /* microseconds */
  149 typedef __suseconds_t   suseconds_t;    /* microseconds (signed) */
  150 typedef __fsblkcnt_t    fsblkcnt_t;     /* file system block count */
  151 typedef __fsfilcnt_t    fsfilcnt_t;     /* file system file count */
  152 
  153 /*
  154  * The following types may be defined in multiple header files.
  155  */
  156 #ifndef _CLOCK_T_DEFINED_
  157 #define _CLOCK_T_DEFINED_
  158 typedef __clock_t       clock_t;
  159 #endif
  160 
  161 #ifndef _CLOCKID_T_DEFINED_
  162 #define _CLOCKID_T_DEFINED_
  163 typedef __clockid_t     clockid_t;
  164 #endif
  165 
  166 #ifndef _PID_T_DEFINED_
  167 #define _PID_T_DEFINED_
  168 typedef __pid_t         pid_t;
  169 #endif
  170 
  171 #ifndef _SIZE_T_DEFINED_
  172 #define _SIZE_T_DEFINED_
  173 typedef __size_t        size_t;
  174 #endif
  175 
  176 #ifndef _SSIZE_T_DEFINED_
  177 #define _SSIZE_T_DEFINED_
  178 typedef __ssize_t       ssize_t;
  179 #endif
  180 
  181 #ifndef _TIME_T_DEFINED_
  182 #define _TIME_T_DEFINED_
  183 typedef __time_t        time_t;
  184 #endif
  185 
  186 #ifndef _TIMER_T_DEFINED_
  187 #define _TIMER_T_DEFINED_
  188 typedef __timer_t       timer_t;
  189 #endif
  190 
  191 #ifndef _OFF_T_DEFINED_
  192 #define _OFF_T_DEFINED_
  193 typedef __off_t         off_t;
  194 #endif
  195 
  196 /*
  197  * These belong in unistd.h, but are placed here too to ensure that
  198  * long arguments will be promoted to off_t if the program fails to
  199  * include that header or explicitly cast them to off_t.
  200  */
  201 #if __BSD_VISIBLE && !defined(_KERNEL)
  202 __BEGIN_DECLS
  203 off_t    lseek(int, off_t, int);
  204 int      ftruncate(int, off_t);
  205 int      truncate(const char *, off_t);
  206 __END_DECLS
  207 #endif /* __BSD_VISIBLE && !_KERNEL */
  208 
  209 #if __BSD_VISIBLE
  210 /* Major, minor numbers, dev_t's. */
  211 #define major(x)        (((unsigned)(x) >> 8) & 0xff)
  212 #define minor(x)        ((unsigned)((x) & 0xff) | (((x) & 0xffff0000) >> 8))
  213 #define makedev(x,y)    ((dev_t)((((x) & 0xff) << 8) | ((y) & 0xff) | (((y) & 0xffff00) << 8)))
  214 #endif
  215 
  216 #if defined(__STDC__) && defined(_KERNEL)
  217 /*
  218  * Forward structure declarations for function prototypes.  We include the
  219  * common structures that cross subsystem boundaries here; others are mostly
  220  * used in the same place that the structure is defined.
  221  */
  222 struct  proc;
  223 struct  pgrp;
  224 struct  ucred;
  225 struct  rusage;
  226 struct  file;
  227 struct  buf;
  228 struct  tty;
  229 struct  uio;
  230 #endif
  231 
  232 #ifdef _KERNEL
  233 #if defined(__GNUC__) || \
  234         (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901)
  235 /* Support for C99: type _Bool is already built-in. */
  236 #define false   0
  237 #define true    1
  238 
  239 #else
  240 /* `_Bool' type must promote to `int' or `unsigned int'. */
  241 typedef enum {
  242         false = 0,
  243         true = 1
  244 } _Bool;
  245 
  246 /* And those constants must also be available as macros. */
  247 #define false   false
  248 #define true    true
  249 
  250 #endif
  251 
  252 /* User visible type `bool' is provided as a macro which may be redefined */
  253 #define bool _Bool
  254 
  255 /* Inform that everything is fine */
  256 #define __bool_true_false_are_defined 1
  257 
  258 #endif /* _KERNEL */
  259 
  260 #endif /* !_SYS_TYPES_H_ */

Cache object: 1cb6e43b1bac7aab8b5addc2d01a277a


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.