193514Smike/*- 293514Smike * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> 393514Smike * All rights reserved. 493514Smike * 593514Smike * Redistribution and use in source and binary forms, with or without 693514Smike * modification, are permitted provided that the following conditions 793514Smike * are met: 893514Smike * 1. Redistributions of source code must retain the above copyright 993514Smike * notice, this list of conditions and the following disclaimer. 1093514Smike * 2. Redistributions in binary form must reproduce the above copyright 1193514Smike * notice, this list of conditions and the following disclaimer in the 1293514Smike * documentation and/or other materials provided with the distribution. 1393514Smike * 1493514Smike * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1593514Smike * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1693514Smike * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1793514Smike * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1893514Smike * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1993514Smike * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2093514Smike * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2193514Smike * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2293514Smike * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2393514Smike * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2493514Smike * SUCH DAMAGE. 2593514Smike * 2693514Smike * $FreeBSD$ 2793514Smike */ 2893514Smike 2993514Smike#ifndef _SYS__TYPES_H_ 3093514Smike#define _SYS__TYPES_H_ 3193514Smike 3293514Smike#include <sys/cdefs.h> 33102227Smike#include <machine/_types.h> 3493514Smike 35102315Smike/* 36102315Smike * Standard type definitions. 37102315Smike */ 38143952Sdastypedef __uint32_t __blksize_t; /* file block size */ 39143952Sdastypedef __int64_t __blkcnt_t; /* file block count */ 40105690Smiketypedef __int32_t __clockid_t; /* clock_gettime()... */ 41105690Smiketypedef __uint32_t __fflags_t; /* file flags */ 42102227Smiketypedef __uint64_t __fsblkcnt_t; 43102227Smiketypedef __uint64_t __fsfilcnt_t; 44102227Smiketypedef __uint32_t __gid_t; 45105690Smiketypedef __int64_t __id_t; /* can hold a gid_t, pid_t, or uid_t */ 46111705Smiketypedef __uint32_t __ino_t; /* inode number */ 47105690Smiketypedef long __key_t; /* IPC key (for Sys V IPC) */ 48130735Smarceltypedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) */ 49105690Smiketypedef __uint16_t __mode_t; /* permissions */ 50184413Strasztypedef int __accmode_t; /* access permissions */ 51103521Smiketypedef int __nl_item; 52111705Smiketypedef __uint16_t __nlink_t; /* link count */ 53105690Smiketypedef __int64_t __off_t; /* file offset */ 54105690Smiketypedef __int32_t __pid_t; /* process [group] */ 55137390Sdestypedef __int64_t __rlim_t; /* resource limit - intentionally */ 56137390Sdes /* signed, because of legacy code */ 57137390Sdes /* that uses -1 for RLIM_INFINITY */ 58102227Smiketypedef __uint8_t __sa_family_t; 59102315Smiketypedef __uint32_t __socklen_t; 60108190Smiketypedef long __suseconds_t; /* microseconds (signed) */ 61156134Sdavidxutypedef struct __timer *__timer_t; /* timer_gettime()... */ 62156134Sdavidxutypedef struct __mq *__mqd_t; /* mq_open()... */ 63102227Smiketypedef __uint32_t __uid_t; 64108190Smiketypedef unsigned int __useconds_t; /* microseconds (unsigned) */ 65176730Sjefftypedef int __cpuwhich_t; /* which parameter for cpuset. */ 66176730Sjefftypedef int __cpulevel_t; /* level parameter for cpuset. */ 67176730Sjefftypedef int __cpusetid_t; /* cpuset identifier. */ 6893514Smike 69102315Smike/* 70102315Smike * Unusual type definitions. 71102315Smike */ 72102315Smike/* 73102315Smike * rune_t is declared to be an ``int'' instead of the more natural 74102315Smike * ``unsigned long'' or ``long''. Two things are happening here. It is not 75102315Smike * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, 76102315Smike * it looks like 10646 will be a 31 bit standard. This means that if your 77102315Smike * ints cannot hold 32 bits, you will be in trouble. The reason an int was 78102315Smike * chosen over a long is that the is*() and to*() routines take ints (says 79102315Smike * ANSI C), but they use __ct_rune_t instead of int. 80102315Smike * 81102315Smike * NOTE: rune_t is not covered by ANSI nor other standards, and should not 82237517Sandrew * be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and 83237517Sandrew * rune_t must be the same type. Also, wint_t should be able to hold all 84237517Sandrew * members of the largest character set plus one extra value (WEOF), and 85237517Sandrew * must be at least 16 bits. 86102315Smike */ 87130473Sbdetypedef int __ct_rune_t; /* arg type for ctype funcs */ 88130473Sbdetypedef __ct_rune_t __rune_t; /* rune_t (see above) */ 89130473Sbdetypedef __ct_rune_t __wint_t; /* wint_t (see above) */ 90102315Smike 91250883Sed/* Clang already provides these types as built-ins, but only in C++ mode. */ 92250883Sed#if !defined(__clang__) || !defined(__cplusplus) 93250883Sedtypedef __uint_least16_t __char16_t; 94250883Sedtypedef __uint_least32_t __char32_t; 95250883Sed#endif 96250985Sed/* In C++11, char16_t and char32_t are built-in types. */ 97250985Sed#if defined(__cplusplus) && __cplusplus >= 201103L 98250985Sed#define _CHAR16_T_DECLARED 99250985Sed#define _CHAR32_T_DECLARED 100250985Sed#endif 101250883Sed 102130640Sphktypedef __uint32_t __dev_t; /* device number */ 103112745Smike 104130473Sbdetypedef __uint32_t __fixpt_t; /* fixed point number */ 105130434Sdas 106112745Smike/* 107102315Smike * mbstate_t is an opaque object to keep conversion state during multibyte 108102315Smike * stream conversions. 109102315Smike */ 110102315Smiketypedef union { 111102315Smike char __mbstate8[128]; 112130473Sbde __int64_t _mbstateL; /* for alignment */ 113102315Smike} __mbstate_t; 114102315Smike 11593514Smike#endif /* !_SYS__TYPES_H_ */ 116