update from main archive 961001
[glibc.git] / posix / sys / types.h
blob234936d12faf21a39b0e368509c6d39ea3432a24
1 /* Copyright (C) 1991, 1992, 1994, 1995, 1996 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
20 * POSIX Standard: 2.6 Primitive System Data Types <sys/types.h>
23 #ifndef _SYS_TYPES_H
25 #define _SYS_TYPES_H 1
26 #include <features.h>
28 __BEGIN_DECLS
30 #include <gnu/types.h>
32 #ifdef __USE_BSD
33 typedef __u_char u_char;
34 typedef __u_short u_short;
35 typedef __u_int u_int;
36 typedef __u_long u_long;
37 typedef __quad_t quad_t;
38 typedef __u_quad_t u_quad_t;
39 typedef __fsid_t fsid_t;
40 #endif
42 typedef __dev_t dev_t;
43 typedef __gid_t gid_t;
44 typedef __ino_t ino_t;
45 typedef __mode_t mode_t;
46 typedef __nlink_t nlink_t;
47 typedef __off_t off_t;
48 typedef __loff_t loff_t;
49 typedef __pid_t pid_t;
50 typedef __uid_t uid_t;
52 #ifndef ssize_t
53 typedef __ssize_t ssize_t;
54 #define ssize_t ssize_t
55 #endif
57 #ifdef __USE_BSD
58 typedef __daddr_t daddr_t;
59 typedef __caddr_t caddr_t;
60 #endif
62 #ifdef __USE_SVID
63 typedef __key_t key_t;
64 #endif
66 #define __need_time_t
67 #include <time.h>
69 #define __need_size_t
70 #include <stddef.h>
72 #ifdef __USE_MISC
73 /* Old compatibility names for C types. */
74 typedef unsigned long int ulong;
75 typedef unsigned short int ushort;
76 typedef unsigned int uint;
77 #endif
79 #ifdef __USE_BSD
80 /* These size-specific names are used by some of the inet code. */
82 #if !defined (__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 7
84 typedef char int8_t;
85 typedef unsigned char u_int8_t;
86 typedef short int int16_t;
87 typedef unsigned short int u_int16_t;
88 typedef int int32_t;
89 typedef unsigned int u_int32_t;
90 #ifdef __GNUC__
91 typedef long long int int64_t;
92 typedef unsigned long long int u_int64_t;
93 #endif
94 typedef int register_t;
96 #else
98 /* For GCC 2.7 and later, we can use specific type-size attributes. */
99 #define __intN_t(N, MODE) \
100 typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
101 #define __u_intN_t(N, MODE) \
102 typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
104 __intN_t (8, __QI__);
105 __u_intN_t (8, __QI__);
106 __intN_t (16, __HI__);
107 __u_intN_t (16, __HI__);
108 __intN_t (32, __SI__);
109 __u_intN_t (32, __SI__);
110 __intN_t (64, __DI__);
111 __u_intN_t (64, __DI__);
113 typedef int register_t __attribute__ ((__mode__ (__word__)));
115 #endif
117 /* Some code from BIND tests this macro to see if the types above are
118 defined. */
119 #define __BIT_TYPES_DEFINED__ 1
120 #endif
123 #ifdef __USE_BSD
124 /* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
125 #include <endian.h>
127 /* It also defines `fd_set' and the FD_* macros for `select'. */
128 #include <sys/select.h>
129 #endif /* Use BSD. */
132 __END_DECLS
134 #endif /* sys/types.h */