_types.h revision 102227
1244756Sdelphij/*- 2244756Sdelphij * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> 3244757Sdelphij * Copyright (c) 1990, 1993 4244756Sdelphij * The Regents of the University of California. All rights reserved. 5244757Sdelphij * 6244757Sdelphij * Redistribution and use in source and binary forms, with or without 7244756Sdelphij * modification, are permitted provided that the following conditions 8244756Sdelphij * are met: 9244756Sdelphij * 1. Redistributions of source code must retain the above copyright 10244756Sdelphij * notice, this list of conditions and the following disclaimer. 11244757Sdelphij * 2. Redistributions in binary form must reproduce the above copyright 12244756Sdelphij * notice, this list of conditions and the following disclaimer in the 13244757Sdelphij * documentation and/or other materials provided with the distribution. 14244756Sdelphij * 3. All advertising materials mentioning features or use of this software 15244757Sdelphij * must display the following acknowledgement: 16244756Sdelphij * This product includes software developed by the University of 17244757Sdelphij * California, Berkeley and its contributors. 18244756Sdelphij * 4. Neither the name of the University nor the names of its contributors 19244757Sdelphij * may be used to endorse or promote products derived from this software 20244756Sdelphij * without specific prior written permission. 21244757Sdelphij * 22244756Sdelphij * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23244757Sdelphij * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24244756Sdelphij * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25244757Sdelphij * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26244756Sdelphij * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27244757Sdelphij * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28244756Sdelphij * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29244757Sdelphij * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30244756Sdelphij * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31244757Sdelphij * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32244756Sdelphij * SUCH DAMAGE. 33244757Sdelphij * 34244756Sdelphij * From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 35244757Sdelphij * From: @(#)types.h 8.3 (Berkeley) 1/5/94 36244756Sdelphij * $FreeBSD: head/sys/i386/include/_types.h 102227 2002-08-21 16:20:02Z mike $ 37244757Sdelphij */ 38244756Sdelphij 39244757Sdelphij#ifndef _MACHINE__TYPES_H_ 40244756Sdelphij#define _MACHINE__TYPES_H_ 41244757Sdelphij 42244756Sdelphij/* 43244757Sdelphij * Basic types upon which most other types are built. 44244756Sdelphij */ 45244757Sdelphijtypedef __signed char __int8_t; 46244756Sdelphijtypedef unsigned char __uint8_t; 47244757Sdelphijtypedef short __int16_t; 48244756Sdelphijtypedef unsigned short __uint16_t; 49244757Sdelphijtypedef int __int32_t; 50244756Sdelphijtypedef unsigned int __uint32_t; 51244757Sdelphij 52244756Sdelphij#if defined(__GNUC__) 53244757Sdelphijtypedef int __attribute__((__mode__(__DI__))) __int64_t; 54244756Sdelphijtypedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t; 55244757Sdelphij#else 56244756Sdelphij/* LONGLONG */ 57244757Sdelphijtypedef long long __int64_t; 58244756Sdelphij/* LONGLONG */ 59244757Sdelphijtypedef unsigned long long __uint64_t; 60244756Sdelphij#endif 61244757Sdelphij 62244756Sdelphij/* 63244757Sdelphij * Standard type definitions. 64244756Sdelphij */ 65244757Sdelphijtypedef __uint32_t __clock_t; /* clock()... */ 66244756Sdelphijtypedef __int32_t __clockid_t; /* clock_gettime()... */ 67244757Sdelphijtypedef __int32_t __critical_t; 68244756Sdelphijtypedef __uint32_t __fflags_t; /* file flags */ 69244757Sdelphijtypedef __int32_t __intfptr_t; 70244756Sdelphijtypedef __int64_t __intmax_t; 71244757Sdelphijtypedef __int32_t __intptr_t; 72244756Sdelphijtypedef __uint32_t __intrmask_t; 73244757Sdelphijtypedef __int32_t __int_fast8_t; 74244756Sdelphijtypedef __int32_t __int_fast16_t; 75244757Sdelphijtypedef __int32_t __int_fast32_t; 76244756Sdelphijtypedef __int64_t __int_fast64_t; 77244757Sdelphijtypedef __int8_t __int_least8_t; 78244756Sdelphijtypedef __int16_t __int_least16_t; 79244757Sdelphijtypedef __int32_t __int_least32_t; 80244756Sdelphijtypedef __int64_t __int_least64_t; 81244757Sdelphijtypedef __int64_t __off_t; /* file offset */ 82244756Sdelphijtypedef __int32_t __pid_t; /* process [group] */ 83244757Sdelphijtypedef __int32_t __ptrdiff_t; /* ptr1 - ptr2 */ 84244756Sdelphijtypedef __int32_t __register_t; 85244757Sdelphijtypedef __int32_t __segsz_t; /* segment size (in pages) */ 86244756Sdelphijtypedef __uint32_t __size_t; /* sizeof() */ 87244757Sdelphijtypedef __uint32_t __socklen_t; 88244756Sdelphijtypedef __int32_t __ssize_t; /* byte count or error */ 89244757Sdelphijtypedef __int32_t __time_t; /* time()... */ 90244756Sdelphijtypedef __int32_t __timer_t; /* timer_gettime()... */ 91244757Sdelphijtypedef __uint32_t __uintfptr_t; 92244756Sdelphijtypedef __uint64_t __uintmax_t; 93244757Sdelphijtypedef __uint32_t __uintptr_t; 94244756Sdelphijtypedef __uint32_t __uint_fast8_t; 95244757Sdelphijtypedef __uint32_t __uint_fast16_t; 96244756Sdelphijtypedef __uint32_t __uint_fast32_t; 97244757Sdelphijtypedef __uint64_t __uint_fast64_t; 98244756Sdelphijtypedef __uint8_t __uint_least8_t; 99244757Sdelphijtypedef __uint16_t __uint_least16_t; 100244756Sdelphijtypedef __uint32_t __uint_least32_t; 101244757Sdelphijtypedef __uint64_t __uint_least64_t; 102244756Sdelphijtypedef __uint32_t __u_register_t; 103244757Sdelphijtypedef __uint32_t __vm_offset_t; 104244756Sdelphijtypedef __int64_t __vm_ooffset_t; 105244757Sdelphijtypedef __uint64_t __vm_pindex_t; 106244756Sdelphijtypedef __uint32_t __vm_size_t; 107244757Sdelphij 108244756Sdelphij/* 109244757Sdelphij * Unusual type definitions. 110244756Sdelphij */ 111244757Sdelphij/* 112244756Sdelphij * The rune type above is declared to be an ``int'' instead of the more natural 113244757Sdelphij * ``unsigned long'' or ``long''. Two things are happening here. It is not 114244756Sdelphij * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, 115244757Sdelphij * it looks like 10646 will be a 31 bit standard. This means that if your 116244756Sdelphij * ints cannot hold 32 bits, you will be in trouble. The reason an int was 117244757Sdelphij * chosen over a long is that the is*() and to*() routines take ints (says 118244756Sdelphij * ANSI C), but they use __ct_rune_t instead of int. By changing it here, you 119244757Sdelphij * lose a bit of ANSI conformance, but your programs will still work. 120244756Sdelphij * 121244757Sdelphij * NOTE: rune_t is not covered by ANSI nor other standards, and should not 122244756Sdelphij * be instantiated outside of lib/libc/locale. Use wchar_t. wchar_t and 123244757Sdelphij * rune_t must be the same type. Also wint_t must be no narrower than 124244756Sdelphij * wchar_t, and should also be able to hold all members of the largest 125244757Sdelphij * character set plus one extra value (WEOF). wint_t must be at least 16 bits. 126244756Sdelphij */ 127244757Sdelphijtypedef __int32_t __ct_rune_t; 128244756Sdelphijtypedef __int32_t __rune_t; 129244757Sdelphijtypedef __int32_t __wchar_t; 130244756Sdelphijtypedef __int32_t __wint_t; 131244757Sdelphij 132244756Sdelphij/* 133244757Sdelphij * mbstate_t is an opaque object to keep conversion state, during multibyte 134244756Sdelphij * stream conversions. The content must not be referenced by user programs. 135244757Sdelphij */ 136244756Sdelphijtypedef union { 137244757Sdelphij char __mbstate8[128]; 138244756Sdelphij __int64_t _mbstateL; /* for alignment */ 139244757Sdelphij} __mbstate_t; 140244756Sdelphij 141244757Sdelphij#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3) 142244756Sdelphijtypedef __builtin_va_list __va_list; /* internally known to gcc */ 143244757Sdelphij#else 144244756Sdelphijtypedef char * __va_list; 145244757Sdelphij#endif /* post GCC 2.95 */ 146244756Sdelphij#if defined __GNUC__ && !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST) 147244757Sdelphij#define __GNUC_VA_LIST 148244756Sdelphijtypedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ 149244757Sdelphij#endif 150244756Sdelphij 151244757Sdelphij#endif /* !_MACHINE__TYPES_H_ */ 152244756Sdelphij