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