1/* Copyright (C) 1991-2024 Free Software Foundation, Inc.
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 Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the 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 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
17
18/*
19 * POSIX Standard: 2.6 Primitive System Data Types <sys/types.h>
20 */
21
22#ifndef _SYS_TYPES_H
23#define _SYS_TYPES_H 1
24
25#include <features.h>
26
27__BEGIN_DECLS
28
29#include <bits/types.h>
30
31#ifdef __USE_MISC
32# ifndef __u_char_defined
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;
40# define __u_char_defined
41# endif
42typedef __loff_t loff_t;
43#endif
44
45#ifndef __ino_t_defined
46# ifndef __USE_FILE_OFFSET64
47typedef __ino_t ino_t;
48# else
49typedef __ino64_t ino_t;
50# endif
51# define __ino_t_defined
52#endif
53#if defined __USE_LARGEFILE64 && !defined __ino64_t_defined
54typedef __ino64_t ino64_t;
55# define __ino64_t_defined
56#endif
57
58#ifndef __dev_t_defined
59typedef __dev_t dev_t;
60# define __dev_t_defined
61#endif
62
63#ifndef __gid_t_defined
64typedef __gid_t gid_t;
65# define __gid_t_defined
66#endif
67
68#ifndef __mode_t_defined
69typedef __mode_t mode_t;
70# define __mode_t_defined
71#endif
72
73#ifndef __nlink_t_defined
74typedef __nlink_t nlink_t;
75# define __nlink_t_defined
76#endif
77
78#ifndef __uid_t_defined
79typedef __uid_t uid_t;
80# define __uid_t_defined
81#endif
82
83#ifndef __off_t_defined
84# ifndef __USE_FILE_OFFSET64
85typedef __off_t off_t;
86# else
87typedef __off64_t off_t;
88# endif
89# define __off_t_defined
90#endif
91#if defined __USE_LARGEFILE64 && !defined __off64_t_defined
92typedef __off64_t off64_t;
93# define __off64_t_defined
94#endif
95
96#ifndef __pid_t_defined
97typedef __pid_t pid_t;
98# define __pid_t_defined
99#endif
100
101#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) \
102 && !defined __id_t_defined
103typedef __id_t id_t;
104# define __id_t_defined
105#endif
106
107#ifndef __ssize_t_defined
108typedef __ssize_t ssize_t;
109# define __ssize_t_defined
110#endif
111
112#ifdef __USE_MISC
113# ifndef __daddr_t_defined
114typedef __daddr_t daddr_t;
115typedef __caddr_t caddr_t;
116# define __daddr_t_defined
117# endif
118#endif
119
120#if (defined __USE_MISC || defined __USE_XOPEN) && !defined __key_t_defined
121typedef __key_t key_t;
122# define __key_t_defined
123#endif
124
125#if defined __USE_XOPEN || defined __USE_XOPEN2K8
126# include <bits/types/clock_t.h>
127#endif
128#include <bits/types/clockid_t.h>
129#include <bits/types/time_t.h>
130#include <bits/types/timer_t.h>
131
132#ifdef __USE_XOPEN
133# ifndef __useconds_t_defined
134typedef __useconds_t useconds_t;
135# define __useconds_t_defined
136# endif
137# ifndef __suseconds_t_defined
138typedef __suseconds_t suseconds_t;
139# define __suseconds_t_defined
140# endif
141#endif
142
143#define __need_size_t
144#include <stddef.h>
145
146#ifdef __USE_MISC
147/* Old compatibility names for C types. */
148typedef unsigned long int ulong;
149typedef unsigned short int ushort;
150typedef unsigned int uint;
151#endif
152
153/* These size-specific names are used by some of the inet code. */
154
155#include <bits/stdint-intn.h>
156
157/* These were defined by ISO C without the first `_'. */
158typedef __uint8_t u_int8_t;
159typedef __uint16_t u_int16_t;
160typedef __uint32_t u_int32_t;
161typedef __uint64_t u_int64_t;
162
163#if __GNUC_PREREQ (2, 7)
164typedef int register_t __attribute__ ((__mode__ (__word__)));
165#else
166typedef int register_t;
167#endif
168
169/* Some code from BIND tests this macro to see if the types above are
170 defined. */
171#define __BIT_TYPES_DEFINED__ 1
172
173
174#ifdef __USE_MISC
175/* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
176# include <endian.h>
177
178/* It also defines `fd_set' and the FD_* macros for `select'. */
179# include <sys/select.h>
180#endif /* Use misc. */
181
182
183#if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) \
184 && !defined __blksize_t_defined
185typedef __blksize_t blksize_t;
186# define __blksize_t_defined
187#endif
188
189/* Types from the Large File Support interface. */
190#ifndef __USE_FILE_OFFSET64
191# ifndef __blkcnt_t_defined
192typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */
193# define __blkcnt_t_defined
194# endif
195# ifndef __fsblkcnt_t_defined
196typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */
197# define __fsblkcnt_t_defined
198# endif
199# ifndef __fsfilcnt_t_defined
200typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */
201# define __fsfilcnt_t_defined
202# endif
203#else
204# ifndef __blkcnt_t_defined
205typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */
206# define __blkcnt_t_defined
207# endif
208# ifndef __fsblkcnt_t_defined
209typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */
210# define __fsblkcnt_t_defined
211# endif
212# ifndef __fsfilcnt_t_defined
213typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */
214# define __fsfilcnt_t_defined
215# endif
216#endif
217
218#ifdef __USE_LARGEFILE64
219typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */
220typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */
221typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */
222#endif
223
224
225/* Now add the thread types. */
226#if defined __USE_POSIX199506 || defined __USE_UNIX98
227# include <bits/pthreadtypes.h>
228#endif
229
230__END_DECLS
231
232#endif /* sys/types.h */
233

source code of glibc/posix/sys/types.h