sys/_types.h

Go to the documentation of this file.
00001 /*-
00002  * Copyright (c) 2002 Mike Barcroft <[email protected]>
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.21 2005/03/22 01:19:17 das Exp $
00027  */
00028 
00029 #ifndef _SYS__TYPES_H_
00030 #define _SYS__TYPES_H_
00031 
00032 #include <sys/cdefs.h>
00033 #include <machine/_types.h>
00034 
00035 /*
00036  * Standard type definitions.
00037  */
00038 typedef __uint32_t      __blksize_t;    /* file block size */
00039 typedef __int64_t       __blkcnt_t;     /* file block count */
00040 typedef __int32_t       __clockid_t;    /* clock_gettime()... */
00041 typedef __uint32_t      __fflags_t;     /* file flags */
00042 typedef __uint64_t      __fsblkcnt_t;
00043 typedef __uint64_t      __fsfilcnt_t;
00044 typedef __uint32_t      __gid_t;
00045 typedef __int64_t       __id_t;         /* can hold a gid_t, pid_t, or uid_t */
00046 typedef __uint32_t      __ino_t;        /* inode number */
00047 typedef long            __key_t;        /* IPC key (for Sys V IPC) */
00048 typedef __int32_t       __lwpid_t;      /* Thread ID (a.k.a. LWP) */
00049 typedef __uint16_t      __mode_t;       /* permissions */
00050 typedef int             __nl_item;
00051 typedef __uint16_t      __nlink_t;      /* link count */
00052 typedef __int64_t       __off_t;        /* file offset */
00053 typedef __int32_t       __pid_t;        /* process [group] */
00054 typedef __int64_t       __rlim_t;       /* resource limit - intentionally */
00055                                         /* signed, because of legacy code */
00056                                         /* that uses -1 for RLIM_INFINITY */
00057 typedef __uint8_t       __sa_family_t;
00058 typedef __uint32_t      __socklen_t;
00059 typedef long            __suseconds_t;  /* microseconds (signed) */
00060 typedef __int32_t       __timer_t;      /* timer_gettime()... */
00061 typedef __uint32_t      __uid_t;
00062 typedef unsigned int    __useconds_t;   /* microseconds (unsigned) */
00063 
00064 /*
00065  * Unusual type definitions.
00066  */
00067 /*
00068  * rune_t is declared to be an ``int'' instead of the more natural
00069  * ``unsigned long'' or ``long''.  Two things are happening here.  It is not
00070  * unsigned so that EOF (-1) can be naturally assigned to it and used.  Also,
00071  * it looks like 10646 will be a 31 bit standard.  This means that if your
00072  * ints cannot hold 32 bits, you will be in trouble.  The reason an int was
00073  * chosen over a long is that the is*() and to*() routines take ints (says
00074  * ANSI C), but they use __ct_rune_t instead of int.
00075  *
00076  * NOTE: rune_t is not covered by ANSI nor other standards, and should not
00077  * be instantiated outside of lib/libc/locale.  Use wchar_t.  wchar_t and
00078  * rune_t must be the same type.  Also, wint_t must be no narrower than
00079  * wchar_t, and should be able to hold all members of the largest
00080  * character set plus one extra value (WEOF), and must be at least 16 bits.
00081  */
00082 typedef int             __ct_rune_t;    /* arg type for ctype funcs */
00083 typedef __ct_rune_t     __rune_t;       /* rune_t (see above) */
00084 #ifndef __SYMBIAN32__
00085 typedef __ct_rune_t     __wchar_t;      /* wchar_t (see above) */
00086 #else //__SYMBIAN32__
00087 typedef unsigned short int      __wchar_t;      /* wchar_t (see above) */
00088 //__SYMBIAN32__
00089 #endif
00090 typedef __ct_rune_t     __wint_t;       /* wint_t (see above) */
00091 
00092 typedef __uint32_t      __dev_t;        /* device number */
00093 
00094 typedef __uint32_t      __fixpt_t;      /* fixed point number */
00095 
00096 /*
00097  * mbstate_t is an opaque object to keep conversion state during multibyte
00098  * stream conversions.
00099  */
00100 #ifndef __SYMBIAN32__ 
00101 typedef union {
00102         char            __mbstate8[128];
00103         __int64_t       _mbstateL;      /* for alignment */
00104 } __mbstate_t;
00105 #else //__SYMBIAN32__
00106 
00107 #define MAX_STATE_CHAR_LEN 4
00108 
00109 typedef struct _mb_state_t
00110 {
00111   int __count; //int  iState;
00112   
00113   union
00114   {
00115     int __wch;
00116     char __wchb[MAX_STATE_CHAR_LEN];
00117     short lead;
00118   } __value;            /* Value so far.  */
00119 } __mbstate_t;
00120 //__SYMBIAN32__
00121 #endif
00122 #endif /* !_SYS__TYPES_H_ */

Copyright © Nokia Corporation 2001-2008
Back to top