Back to index

glibc  2.9
types.h
Go to the documentation of this file.
00001 /* Copyright (C) 1991,1992,1994,1995,1996,1997,1998,1999,2000,2001,2002,2006
00002        Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 /*
00021  *     POSIX Standard: 2.6 Primitive System Data Types  <sys/types.h>
00022  */
00023 
00024 #ifndef       _SYS_TYPES_H
00025 #define       _SYS_TYPES_H  1
00026 
00027 #include <features.h>
00028 
00029 __BEGIN_DECLS
00030 
00031 #include <bits/types.h>
00032 
00033 #ifdef __USE_BSD
00034 # ifndef __u_char_defined
00035 typedef __u_char u_char;
00036 typedef __u_short u_short;
00037 typedef __u_int u_int;
00038 typedef __u_long u_long;
00039 typedef __quad_t quad_t;
00040 typedef __u_quad_t u_quad_t;
00041 typedef __fsid_t fsid_t;
00042 #  define __u_char_defined
00043 # endif
00044 #endif
00045 
00046 typedef __loff_t loff_t;
00047 
00048 #ifndef __ino_t_defined
00049 # ifndef __USE_FILE_OFFSET64
00050 typedef __ino_t ino_t;
00051 # else
00052 typedef __ino64_t ino_t;
00053 # endif
00054 # define __ino_t_defined
00055 #endif
00056 #if defined __USE_LARGEFILE64 && !defined __ino64_t_defined
00057 typedef __ino64_t ino64_t;
00058 # define __ino64_t_defined
00059 #endif
00060 
00061 #ifndef __dev_t_defined
00062 typedef __dev_t dev_t;
00063 # define __dev_t_defined
00064 #endif
00065 
00066 #ifndef __gid_t_defined
00067 typedef __gid_t gid_t;
00068 # define __gid_t_defined
00069 #endif
00070 
00071 #ifndef __mode_t_defined
00072 typedef __mode_t mode_t;
00073 # define __mode_t_defined
00074 #endif
00075 
00076 #ifndef __nlink_t_defined
00077 typedef __nlink_t nlink_t;
00078 # define __nlink_t_defined
00079 #endif
00080 
00081 #ifndef __uid_t_defined
00082 typedef __uid_t uid_t;
00083 # define __uid_t_defined
00084 #endif
00085 
00086 #ifndef __off_t_defined
00087 # ifndef __USE_FILE_OFFSET64
00088 typedef __off_t off_t;
00089 # else
00090 typedef __off64_t off_t;
00091 # endif
00092 # define __off_t_defined
00093 #endif
00094 #if defined __USE_LARGEFILE64 && !defined __off64_t_defined
00095 typedef __off64_t off64_t;
00096 # define __off64_t_defined
00097 #endif
00098 
00099 #ifndef __pid_t_defined
00100 typedef __pid_t pid_t;
00101 # define __pid_t_defined
00102 #endif
00103 
00104 #if (defined __USE_SVID || defined __USE_XOPEN) && !defined __id_t_defined
00105 typedef __id_t id_t;
00106 # define __id_t_defined
00107 #endif
00108 
00109 #ifndef __ssize_t_defined
00110 typedef __ssize_t ssize_t;
00111 # define __ssize_t_defined
00112 #endif
00113 
00114 #ifdef __USE_BSD
00115 # ifndef __daddr_t_defined
00116 typedef __daddr_t daddr_t;
00117 typedef __caddr_t caddr_t;
00118 #  define __daddr_t_defined
00119 # endif
00120 #endif
00121 
00122 #if (defined __USE_SVID || defined __USE_XOPEN) && !defined __key_t_defined
00123 typedef __key_t key_t;
00124 # define __key_t_defined
00125 #endif
00126 
00127 #ifdef __USE_XOPEN
00128 # define __need_clock_t
00129 #endif
00130 #define       __need_time_t
00131 #define __need_timer_t
00132 #define __need_clockid_t
00133 #include <time.h>
00134 
00135 #ifdef __USE_XOPEN
00136 # ifndef __useconds_t_defined
00137 typedef __useconds_t useconds_t;
00138 #  define __useconds_t_defined
00139 # endif
00140 # ifndef __suseconds_t_defined
00141 typedef __suseconds_t suseconds_t;
00142 #  define __suseconds_t_defined
00143 # endif
00144 #endif
00145 
00146 #define       __need_size_t
00147 #include <stddef.h>
00148 
00149 #ifdef __USE_MISC
00150 /* Old compatibility names for C types.  */
00151 typedef unsigned long int ulong;
00152 typedef unsigned short int ushort;
00153 typedef unsigned int uint;
00154 #endif
00155 
00156 /* These size-specific names are used by some of the inet code.  */
00157 
00158 #if !__GNUC_PREREQ (2, 7)
00159 
00160 /* These types are defined by the ISO C99 header <inttypes.h>. */
00161 # ifndef __int8_t_defined
00162 #  define __int8_t_defined
00163 typedef       char int8_t;
00164 typedef       short int int16_t;
00165 typedef       int int32_t;
00166 #  if __WORDSIZE == 64
00167 typedef long int int64_t;
00168 #  elif __GLIBC_HAVE_LONG_LONG
00169 __extension__ typedef long long int int64_t;
00170 #  endif
00171 # endif
00172 
00173 /* But these were defined by ISO C without the first `_'.  */
00174 typedef       unsigned char u_int8_t;
00175 typedef       unsigned short int u_int16_t;
00176 typedef       unsigned int u_int32_t;
00177 # if __WORDSIZE == 64
00178 typedef unsigned long int u_int64_t;
00179 # elif __GLIBC_HAVE_LONG_LONG
00180 __extension__ typedef unsigned long long int u_int64_t;
00181 # endif
00182 
00183 typedef int register_t;
00184 
00185 #else
00186 
00187 /* For GCC 2.7 and later, we can use specific type-size attributes.  */
00188 # define __intN_t(N, MODE) \
00189   typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
00190 # define __u_intN_t(N, MODE) \
00191   typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
00192 
00193 # ifndef __int8_t_defined
00194 #  define __int8_t_defined
00195 __intN_t (8, __QI__);
00196 __intN_t (16, __HI__);
00197 __intN_t (32, __SI__);
00198 __intN_t (64, __DI__);
00199 # endif
00200 
00201 __u_intN_t (8, __QI__);
00202 __u_intN_t (16, __HI__);
00203 __u_intN_t (32, __SI__);
00204 __u_intN_t (64, __DI__);
00205 
00206 typedef int register_t __attribute__ ((__mode__ (__word__)));
00207 
00208 
00209 /* Some code from BIND tests this macro to see if the types above are
00210    defined.  */
00211 #endif
00212 #define __BIT_TYPES_DEFINED__      1
00213 
00214 
00215 #ifdef __USE_BSD
00216 /* In BSD <sys/types.h> is expected to define BYTE_ORDER.  */
00217 # include <endian.h>
00218 
00219 /* It also defines `fd_set' and the FD_* macros for `select'.  */
00220 # include <sys/select.h>
00221 
00222 /* BSD defines these symbols, so we follow.  */
00223 # include <sys/sysmacros.h>
00224 #endif /* Use BSD.  */
00225 
00226 
00227 #if defined __USE_UNIX98 && !defined __blksize_t_defined
00228 typedef __blksize_t blksize_t;
00229 # define __blksize_t_defined
00230 #endif
00231 
00232 /* Types from the Large File Support interface.  */
00233 #ifndef __USE_FILE_OFFSET64
00234 # ifndef __blkcnt_t_defined
00235 typedef __blkcnt_t blkcnt_t;        /* Type to count number of disk blocks.  */
00236 #  define __blkcnt_t_defined
00237 # endif
00238 # ifndef __fsblkcnt_t_defined
00239 typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks.  */
00240 #  define __fsblkcnt_t_defined
00241 # endif
00242 # ifndef __fsfilcnt_t_defined
00243 typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes.  */
00244 #  define __fsfilcnt_t_defined
00245 # endif
00246 #else
00247 # ifndef __blkcnt_t_defined
00248 typedef __blkcnt64_t blkcnt_t;        /* Type to count number of disk blocks.  */
00249 #  define __blkcnt_t_defined
00250 # endif
00251 # ifndef __fsblkcnt_t_defined
00252 typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks.  */
00253 #  define __fsblkcnt_t_defined
00254 # endif
00255 # ifndef __fsfilcnt_t_defined
00256 typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes.  */
00257 #  define __fsfilcnt_t_defined
00258 # endif
00259 #endif
00260 
00261 #ifdef __USE_LARGEFILE64
00262 typedef __blkcnt64_t blkcnt64_t;     /* Type to count number of disk blocks. */
00263 typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks.  */
00264 typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes.  */
00265 #endif
00266 
00267 
00268 /* Now add the thread types.  */
00269 #if defined __USE_POSIX199506 || defined __USE_UNIX98
00270 # include <bits/pthreadtypes.h>
00271 #endif
00272 
00273 __END_DECLS
00274 
00275 #endif /* sys/types.h */