]> git.ipfire.org Git - thirdparty/glibc.git/blame - posix/sys/types.h
Update.
[thirdparty/glibc.git] / posix / sys / types.h
CommitLineData
d1462d2e 1/* Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
54d79e99
UD
2 This file is part of the GNU C Library.
3
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.
8
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.
13
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 not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
28f540f4
RM
18
19/*
20 * POSIX Standard: 2.6 Primitive System Data Types <sys/types.h>
21 */
22
23#ifndef _SYS_TYPES_H
28f540f4 24#define _SYS_TYPES_H 1
5107cf1d 25
28f540f4
RM
26#include <features.h>
27
28__BEGIN_DECLS
29
5107cf1d 30#include <bits/types.h>
28f540f4
RM
31
32#ifdef __USE_BSD
a68b0d31
UD
33typedef __u_char u_char;
34typedef __u_short u_short;
35typedef __u_int u_int;
36typedef __u_long u_long;
37typedef __quad_t quad_t;
38typedef __u_quad_t u_quad_t;
39typedef __fsid_t fsid_t;
28f540f4
RM
40#endif
41
a68b0d31 42typedef __loff_t loff_t;
a5a0310d 43
9756dfe1
UD
44#ifndef ino_t
45# ifndef __USE_FILE_OFFSET64
dfd2257a 46typedef __ino_t ino_t;
9756dfe1 47# else
dfd2257a 48typedef __ino64_t ino_t;
9756dfe1
UD
49# endif
50# define ino_t ino_t
dfd2257a
UD
51#endif
52#ifdef __USE_LARGEFILE64
53typedef __ino64_t ino64_t;
54#endif
55
9756dfe1
UD
56#ifndef dev_t
57typedef __dev_t dev_t;
58# define dev_t dev_t
59#endif
60
a5a0310d
UD
61#ifndef gid_t
62typedef __gid_t gid_t;
63# define gid_t gid_t
64#endif
65
9756dfe1
UD
66#ifndef mode_t
67typedef __mode_t mode_t;
68# define mode_t mode_t
69#endif
70
71#ifndef nlink_t
72typedef __nlink_t nlink_t;
73# define nlink_t nlink_t
74#endif
75
a5a0310d 76#ifndef uid_t
a68b0d31 77typedef __uid_t uid_t;
a5a0310d
UD
78# define uid_t uid_t
79#endif
80
81#ifndef off_t
dfd2257a 82# ifndef __USE_FILE_OFFSET64
a5a0310d 83typedef __off_t off_t;
dfd2257a
UD
84# else
85typedef __off64_t off_t;
86# endif
a5a0310d
UD
87# define off_t off_t
88#endif
dfd2257a
UD
89#if defined __USE_LARGEFILE64 && !defined off64_t
90typedef __off64_t off64_t;
91# define off64_t off64_t
92#endif
a5a0310d
UD
93
94#ifndef pid_t
95typedef __pid_t pid_t;
96# define pid_t pid_t
97#endif
a68b0d31 98
bd355af0
UD
99#if defined __USE_SVID || defined __USE_XOPEN
100typedef __id_t id_t;
101#endif
102
a68b0d31
UD
103#ifndef ssize_t
104typedef __ssize_t ssize_t;
55c14926 105# define ssize_t ssize_t
28f540f4
RM
106#endif
107
108#ifdef __USE_BSD
a68b0d31
UD
109typedef __daddr_t daddr_t;
110typedef __caddr_t caddr_t;
111#endif
112
df4ef2ab 113#if defined __USE_SVID || defined __USE_XOPEN
a68b0d31 114typedef __key_t key_t;
28f540f4
RM
115#endif
116
9756dfe1
UD
117#ifdef __USE_XOPEN
118# define __need_clock_t
119#endif
28f540f4
RM
120#define __need_time_t
121#include <time.h>
122
123#define __need_size_t
124#include <stddef.h>
125
126#ifdef __USE_MISC
127/* Old compatibility names for C types. */
510ca033 128typedef unsigned long int ulong;
28f540f4
RM
129typedef unsigned short int ushort;
130typedef unsigned int uint;
131#endif
132
28f540f4
RM
133/* These size-specific names are used by some of the inet code. */
134
4360eafd 135#if !__GNUC_PREREQ (2, 7)
4ca84cff 136
5107cf1d 137/* These types are defined by the ISO C 9x header <inttypes.h>. */
55c14926
UD
138# ifndef __int8_t_defined
139# define __int8_t_defined
28f540f4 140typedef char int8_t;
3d61b63c 141typedef short int int16_t;
3d61b63c 142typedef int int32_t;
55c14926 143# ifdef __GNUC__
7782d0bf 144__extension__ typedef long long int int64_t;
55c14926
UD
145# endif
146# endif
5107cf1d
UD
147
148/* But these were defined by ISO C without the first `_'. */
149typedef unsigned char u_int8_t;
150typedef unsigned short int u_int16_t;
151typedef unsigned int u_int32_t;
55c14926 152# ifdef __GNUC__
7782d0bf 153__extension__ typedef unsigned long long int u_int64_t;
55c14926 154# endif
5107cf1d 155
a68b0d31 156typedef int register_t;
3d61b63c 157
4ca84cff
RM
158#else
159
160/* For GCC 2.7 and later, we can use specific type-size attributes. */
55c14926 161# define __intN_t(N, MODE) \
4ca84cff 162 typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
55c14926 163# define __u_intN_t(N, MODE) \
4ca84cff
RM
164 typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
165
55c14926
UD
166# ifndef __int8_t_defined
167# define __int8_t_defined
4ca84cff 168__intN_t (8, __QI__);
4ca84cff 169__intN_t (16, __HI__);
4ca84cff 170__intN_t (32, __SI__);
4ca84cff 171__intN_t (64, __DI__);
55c14926 172# endif
5107cf1d
UD
173
174__u_intN_t (8, __QI__);
175__u_intN_t (16, __HI__);
176__u_intN_t (32, __SI__);
4ca84cff
RM
177__u_intN_t (64, __DI__);
178
179typedef int register_t __attribute__ ((__mode__ (__word__)));
180
4ca84cff 181
3d61b63c
RM
182/* Some code from BIND tests this macro to see if the types above are
183 defined. */
28f540f4 184#endif
55c14926 185#define __BIT_TYPES_DEFINED__ 1
28f540f4
RM
186
187
fc4026d8
RM
188#ifdef __USE_BSD
189/* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
55c14926 190# include <endian.h>
28f540f4 191
503054c0 192/* It also defines `fd_set' and the FD_* macros for `select'. */
55c14926 193# include <sys/select.h>
d1462d2e
UD
194
195/* BSD defines these symbols, so we follow. */
196# include <sys/sysmacros.h>
28f540f4
RM
197#endif /* Use BSD. */
198
199
dfd2257a
UD
200/* Types from the Large File Support interface. */
201#ifndef __USE_FILE_OFFSET64
202typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */
203typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */
204typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */
205#else
206typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */
207typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */
208typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */
209#endif
210
211#ifdef __USE_LARGEFILE64
212typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */
213typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */
214typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */
215#endif
216
28f540f4
RM
217__END_DECLS
218
219#endif /* sys/types.h */