Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

_types.h

00001 /*-
00002  * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  *
00014  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
00015  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00016  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00017  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
00018  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00019  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00020  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00021  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00022  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00023  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00024  * SUCH DAMAGE.
00025  *
00026  * $FreeBSD: src/sys/sys/_types.h,v 1.14 2003/03/28 15:27:30 mike Exp $
00027  */
00028 
00029 #ifndef _SYS__TYPES_H_
00030 #define _SYS__TYPES_H_
00031 
00032 #include <sys/cdefs.h>
00033 
00034 #include <stddef.h>
00035 
00036 #ifndef _SIZE_T_DECLARED
00037 #ifndef __size_t
00038 typedef size_t __size_t;
00039 #endif
00040 #define _SIZE_T_DECLARED
00041 #endif
00042 
00043 typedef long __int32_t;
00044 typedef long long __int64_t;
00045 typedef short __int16_t;
00046 typedef signed char __int8_t;
00047 
00048 typedef unsigned long __uint32_t;
00049 typedef unsigned long long __uint64_t;
00050 typedef unsigned short __uint16_t;
00051 typedef unsigned char __uint8_t;
00052 
00053 typedef unsigned long u_int32_t;
00054 
00055 /*
00056  * Standard type definitions.
00057  */
00058 typedef __int32_t       __clockid_t;    /* clock_gettime()... */
00059 typedef __uint32_t      __fflags_t;     /* file flags */
00060 typedef __uint64_t      __fsblkcnt_t;
00061 typedef __uint64_t      __fsfilcnt_t;
00062 typedef __uint32_t      __gid_t;
00063 typedef __int64_t       __id_t;         /* can hold a gid_t, pid_t, or uid_t */
00064 typedef __uint32_t      __ino_t;        /* inode number */
00065 typedef long            __key_t;        /* IPC key (for Sys V IPC) */
00066 typedef __uint16_t      __mode_t;       /* permissions */
00067 typedef int             __nl_item;
00068 typedef __uint16_t      __nlink_t;      /* link count */
00069 typedef __int64_t       __off_t;        /* file offset */
00070 typedef __int32_t       __pid_t;        /* process [group] */
00071 typedef __int64_t       __rlim_t;       /* resource limit (XXX not unsigned) */
00072 typedef __uint8_t       __sa_family_t;
00073 typedef __uint32_t      __socklen_t;
00074 typedef long            __suseconds_t;  /* microseconds (signed) */
00075 typedef __int32_t       __timer_t;      /* timer_gettime()... */
00076 typedef __uint32_t      __udev_t;       /* device number */
00077 typedef __uint32_t      __uid_t;
00078 typedef unsigned int    __useconds_t;   /* microseconds (unsigned) */
00079 
00080 /*
00081  * Unusual type definitions.
00082  */
00083 /*
00084  * rune_t is declared to be an ``int'' instead of the more natural
00085  * ``unsigned long'' or ``long''.  Two things are happening here.  It is not
00086  * unsigned so that EOF (-1) can be naturally assigned to it and used.  Also,
00087  * it looks like 10646 will be a 31 bit standard.  This means that if your
00088  * ints cannot hold 32 bits, you will be in trouble.  The reason an int was
00089  * chosen over a long is that the is*() and to*() routines take ints (says
00090  * ANSI C), but they use __ct_rune_t instead of int.
00091  *
00092  * NOTE: rune_t is not covered by ANSI nor other standards, and should not
00093  * be instantiated outside of lib/libc/locale.  Use wchar_t.  wchar_t and
00094  * rune_t must be the same type.  Also, wint_t must be no narrower than
00095  * wchar_t, and should be able to hold all members of the largest
00096  * character set plus one extra value (WEOF), and must be at least 16 bits.
00097  */
00098 typedef int             __ct_rune_t;
00099 typedef __ct_rune_t     __rune_t;
00100 typedef __ct_rune_t     __wchar_t;
00101 typedef __ct_rune_t     __wint_t;
00102 
00103 /*
00104  * dev_t has differing meanings in userland and the kernel.
00105  */
00106 #ifdef _KERNEL
00107 struct cdev;
00108 typedef struct cdev     *__dev_t;
00109 #else
00110 typedef __udev_t        __dev_t;                /* device number */
00111 #endif
00112 
00113 /*
00114  * mbstate_t is an opaque object to keep conversion state during multibyte
00115  * stream conversions.
00116  */
00117 typedef union {
00118         char            __mbstate8[128];
00119         __int64_t       _mbstateL;              /* for alignment */
00120 } __mbstate_t;
00121 
00122 #endif /* !_SYS__TYPES_H_ */