types.h

Go to the documentation of this file.
00001 /*-
00002  * © Portions copyright (c) 2005 Nokia Corporation.  All rights reserved.
00003  * Copyright (c) 1982, 1986, 1991, 1993, 1994
00004  *      The Regents of the University of California.  All rights reserved.
00005  * (c) UNIX System Laboratories, Inc.
00006  * All or some portions of this file are derived from material licensed
00007  * to the University of California by American Telephone and Telegraph
00008  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
00009  * the permission of UNIX System Laboratories, Inc.
00010  *
00011  * Redistribution and use in source and binary forms, with or without
00012  * modification, are permitted provided that the following conditions
00013  * are met:
00014  * 1. Redistributions of source code must retain the above copyright
00015  *    notice, this list of conditions and the following disclaimer.
00016  * 2. Redistributions in binary form must reproduce the above copyright
00017  *    notice, this list of conditions and the following disclaimer in the
00018  *    documentation and/or other materials provided with the distribution.
00019  * 4. Neither the name of the University nor the names of its contributors
00020  *    may be used to endorse or promote products derived from this software
00021  *    without specific prior written permission.
00022  *
00023  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00024  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00025  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00026  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00027  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00028  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00029  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00030  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00032  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00033  * SUCH DAMAGE.
00034  *
00035  *      @(#)types.h     8.6 (Berkeley) 2/19/95
00036  * $FreeBSD: src/sys/sys/types.h,v 1.92 2005/05/31 15:18:17 rodrigc Exp $
00037  */
00038 
00039 #ifndef _SYS_TYPES_H_
00040 #define _SYS_TYPES_H_
00041 #ifdef __ARMCC__
00042 // Turn off the 'extended constant initialiser used' warning
00043 #pragma diag_remark 1296
00044 #endif
00045 
00046 #include <sys/cdefs.h>
00047 
00048 /* Machine type dependent parameters. */
00049 #ifndef __SYMBIAN32__
00050 #include <machine/endian.h>
00051 #endif
00052 
00053 #include <sys/_types.h>
00054 
00055 #ifndef __SYMBIAN32__
00056 #include <sys/_pthreadtypes.h>
00057 #endif
00058 
00059 #if __BSD_VISIBLE
00060 typedef unsigned char   u_char;
00061 typedef unsigned short  u_short;
00062 typedef unsigned int    u_int;
00063 typedef unsigned long   u_long;
00064 #ifndef _KERNEL
00065 typedef unsigned short  ushort;         /* Sys V compatibility */
00066 typedef unsigned int    uint;           /* Sys V compatibility */
00067 #endif
00068 #endif
00069 
00070 /*
00071  * XXX POSIX sized integrals that should appear only in <sys/stdint.h>.
00072  */
00073 #ifndef _INT8_T_DECLARED
00074 typedef __int8_t        int8_t;
00075 #define _INT8_T_DECLARED
00076 #endif
00077 
00078 #ifndef _INT16_T_DECLARED
00079 typedef __int16_t       int16_t;
00080 #define _INT16_T_DECLARED
00081 #endif
00082 
00083 #ifndef _INT32_T_DECLARED
00084 typedef __int32_t       int32_t;
00085 #define _INT32_T_DECLARED
00086 #endif
00087 
00088 #ifndef _INT64_T_DECLARED
00089 typedef __int64_t       int64_t;
00090 #define _INT64_T_DECLARED
00091 #endif
00092 
00093 #ifndef _UINT8_T_DECLARED
00094 typedef __uint8_t       uint8_t;
00095 #define _UINT8_T_DECLARED
00096 #endif
00097 
00098 #ifndef _UINT16_T_DECLARED
00099 typedef __uint16_t      uint16_t;
00100 #define _UINT16_T_DECLARED
00101 #endif
00102 
00103 #ifndef _UINT32_T_DECLARED
00104 typedef __uint32_t      uint32_t;
00105 #define _UINT32_T_DECLARED
00106 #endif
00107 
00108 #ifndef _UINT64_T_DECLARED
00109 typedef __uint64_t      uint64_t;
00110 #define _UINT64_T_DECLARED
00111 #endif
00112 
00113 #ifndef _INTPTR_T_DECLARED
00114 typedef __intptr_t      intptr_t;
00115 typedef __uintptr_t     uintptr_t;
00116 #define _INTPTR_T_DECLARED
00117 #endif
00118 
00119 typedef __uint8_t       u_int8_t;       /* unsigned integrals (deprecated) */
00120 typedef __uint16_t      u_int16_t;
00121 typedef __uint32_t      u_int32_t;
00122 typedef __uint64_t      u_int64_t;
00123 
00124 typedef __uint64_t      u_quad_t;       /* quads (deprecated) */
00125 typedef __int64_t       quad_t;
00126 typedef quad_t *        qaddr_t;
00127 
00128 typedef char *          caddr_t;        /* core address */
00129 typedef __const char *  c_caddr_t;      /* core address, pointer to const */
00130 typedef __volatile char *v_caddr_t;     /* core address, pointer to volatile */
00131 
00132 #ifndef _BLKSIZE_T_DECLARED
00133 typedef __blksize_t     blksize_t;
00134 #define _BLKSIZE_T_DECLARED
00135 #endif
00136 
00137 #ifndef _BLKCNT_T_DECLARED
00138 typedef __blkcnt_t      blkcnt_t;
00139 #define _BLKCNT_T_DECLARED
00140 #endif
00141 
00142 #ifndef _CLOCK_T_DECLARED
00143 typedef __clock_t       clock_t;
00144 #define _CLOCK_T_DECLARED
00145 #endif
00146 
00147 #ifndef _CLOCKID_T_DECLARED
00148 typedef __clockid_t     clockid_t;
00149 #define _CLOCKID_T_DECLARED
00150 #endif
00151 
00152 typedef __critical_t    critical_t;     /* Critical section value */
00153 typedef __int64_t       daddr_t;        /* disk address */
00154 
00155 #ifndef _DEV_T_DECLARED
00156 typedef __dev_t         dev_t;          /* device number or struct cdev */
00157 #define _DEV_T_DECLARED
00158 #endif
00159 
00160 #ifndef _FFLAGS_T_DECLARED
00161 typedef __fflags_t      fflags_t;       /* file flags */
00162 #define _FFLAGS_T_DECLARED
00163 #endif
00164 
00165 typedef __fixpt_t       fixpt_t;        /* fixed point number */
00166 
00167 #ifndef _FSBLKCNT_T_DECLARED            /* for statvfs() */
00168 typedef __fsblkcnt_t    fsblkcnt_t;
00169 typedef __fsfilcnt_t    fsfilcnt_t;
00170 #define _FSBLKCNT_T_DECLARED
00171 #endif
00172 
00173 #ifndef _GID_T_DECLARED
00174 typedef __gid_t         gid_t;          /* group id */
00175 #define _GID_T_DECLARED
00176 #endif
00177 
00178 #ifndef _IN_ADDR_T_DECLARED
00179 typedef __uint32_t      in_addr_t;      /* base type for internet address */
00180 #define _IN_ADDR_T_DECLARED
00181 #endif
00182 
00183 #ifndef _IN_PORT_T_DECLARED
00184 typedef __uint16_t      in_port_t;
00185 #define _IN_PORT_T_DECLARED
00186 #endif
00187 
00188 #ifndef _ID_T_DECLARED
00189 typedef __id_t          id_t;           /* can hold a uid_t or pid_t */
00190 #define _ID_T_DECLARED
00191 #endif
00192 
00193 #ifndef _INO_T_DECLARED
00194 typedef __ino_t         ino_t;          /* inode number */
00195 #define _INO_T_DECLARED
00196 #endif
00197 
00198 #ifndef _KEY_T_DECLARED
00199 typedef __key_t         key_t;          /* IPC key (for Sys V IPC) */
00200 #define _KEY_T_DECLARED
00201 #endif
00202 
00203 #ifndef _LWPID_T_DECLARED
00204 typedef __lwpid_t       lwpid_t;        /* Thread ID (a.k.a. LWP) */
00205 #define _LWPID_T_DECLARED
00206 #endif
00207 
00208 #ifndef _MODE_T_DECLARED
00209 typedef __mode_t        mode_t;         /* permissions */
00210 #define _MODE_T_DECLARED
00211 #endif
00212 
00213 #ifndef _NLINK_T_DECLARED
00214 typedef __nlink_t       nlink_t;        /* link count */
00215 #define _NLINK_T_DECLARED
00216 #endif
00217 
00218 #ifndef _OFF_T_DECLARED
00219 typedef __off_t         off_t;          /* file offset */
00220 #define _OFF_T_DECLARED
00221 #endif
00222 
00223 #ifndef _PID_T_DECLARED
00224 typedef __pid_t         pid_t;          /* process id */
00225 #define _PID_T_DECLARED
00226 #endif
00227 
00228 typedef __register_t    register_t;
00229 
00230 #ifndef _RLIM_T_DECLARED
00231 typedef __rlim_t        rlim_t;         /* resource limit */
00232 #define _RLIM_T_DECLARED
00233 #endif
00234 
00235 typedef __segsz_t       segsz_t;        /* segment size (in pages) */
00236 
00237 #ifndef _SIZE_T_DECLARED
00238 typedef __size_t        size_t;
00239 #define _SIZE_T_DECLARED
00240 #endif
00241 
00242 #ifndef _SSIZE_T_DECLARED
00243 typedef __ssize_t       ssize_t;
00244 #define _SSIZE_T_DECLARED
00245 #endif
00246 
00247 #ifndef _SUSECONDS_T_DECLARED
00248 typedef __suseconds_t   suseconds_t;    /* microseconds (signed) */
00249 #define _SUSECONDS_T_DECLARED
00250 #endif
00251 
00252 #ifndef _TIME_T_DECLARED
00253 typedef __time_t        time_t;
00254 #define _TIME_T_DECLARED
00255 #endif
00256 
00257 #ifndef _TIMER_T_DECLARED
00258 typedef __timer_t       timer_t;
00259 #define _TIMER_T_DECLARED
00260 #endif
00261 
00262 typedef __u_register_t  u_register_t;
00263 
00264 #ifndef _UID_T_DECLARED
00265 typedef __uid_t         uid_t;          /* user id */
00266 #define _UID_T_DECLARED
00267 #endif
00268 
00269 #ifndef _USECONDS_T_DECLARED
00270 typedef __useconds_t    useconds_t;     /* microseconds (unsigned) */
00271 #define _USECONDS_T_DECLARED
00272 #endif
00273 
00274 typedef __vm_offset_t   vm_offset_t;
00275 typedef __vm_ooffset_t  vm_ooffset_t;
00276 typedef __vm_paddr_t    vm_paddr_t;
00277 typedef __vm_pindex_t   vm_pindex_t;
00278 typedef __vm_size_t     vm_size_t;
00279 
00280 #ifdef _KERNEL
00281 typedef int             boolean_t;
00282 typedef __cpumask_t     cpumask_t;
00283 typedef __intfptr_t     intfptr_t;
00284 
00285 /*-
00286  * XXX this is fixed width for historical reasons.  It should have had type
00287  * __int_fast32_t.  Fixed-width types should not be used unless binary
00288  * compatibility is essential.  Least-width types should be used even less
00289  * since they provide smaller benefits.
00290  * XXX should be MD.
00291  * XXX this is bogus in -current, but still used for spl*().
00292  */
00293 typedef __uint32_t      intrmask_t;     /* Interrupt mask (spl, xxx_imask...) */
00294 
00295 typedef __uintfptr_t    uintfptr_t;
00296 typedef __uint64_t      uoff_t;
00297 typedef struct vm_page  *vm_page_t;
00298 
00299 #define offsetof(type, field) __offsetof(type, field)
00300 
00301 #endif /* !_KERNEL */
00302 
00303 /*
00304  * The following are all things that really shouldn't exist in this header,
00305  * since its purpose is to provide typedefs, not miscellaneous doodads.
00306  */
00307 #if __BSD_VISIBLE
00308 
00309 //#include <sys/select.h>
00310 
00311 #ifndef _KERNEL
00312 /*
00313  * minor() gives a cookie instead of an index since we don't want to
00314  * change the meanings of bits 0-15 or waste time and space shifting
00315  * bits 16-31 for devices that don't use them.
00316  */
00317 #define major(x)        ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
00318 #define minor(x)        ((int)((x)&0xffff00ff))         /* minor number */
00319 #endif /* !_KERNEL */
00320 
00321 #define makedev(x,y)    ((dev_t)(((x) << 8) | (y)))     /* create dev_t */
00322 
00323 /*
00324  * These declarations belong elsewhere, but are repeated here and in
00325  * <stdio.h> to give broken programs a better chance of working with
00326  * 64-bit off_t's.
00327  */
00328 #ifndef _KERNEL
00329 __BEGIN_DECLS
00330 #ifndef _FTRUNCATE_DECLARED
00331 #define _FTRUNCATE_DECLARED
00332 IMPORT_C int     ftruncate(int, off_t);
00333 #endif
00334 #ifndef _LSEEK_DECLARED
00335 #define _LSEEK_DECLARED
00336 IMPORT_C off_t   lseek(int, off_t, int);
00337 #endif
00338 #ifndef _MMAP_DECLARED
00339 #define _MMAP_DECLARED
00340 IMPORT_C void *  mmap(void *, size_t, int, int, int, off_t);
00341 #endif
00342 #ifndef _TRUNCATE_DECLARED
00343 #define _TRUNCATE_DECLARED
00344 IMPORT_C int     truncate(const char *, off_t);
00345 #endif
00346 __END_DECLS
00347 #endif /* !_KERNEL */
00348 
00349 #endif /* __BSD_VISIBLE */
00350 
00351 #endif /* !_SYS_TYPES_H_ */

Copyright © Nokia Corporation 2001-2008
Back to top