1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
/* Checking macros for unistd functions.
Copyright (C) 2005-2024 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#ifndef _UNISTD_H
# error "Never include <bits/unistd.h> directly; use <unistd.h> instead."
#endif
# include <bits/unistd-decl.h>
__fortify_function __attribute_overloadable__ __wur ssize_t
read (int __fd, __fortify_clang_overload_arg0 (void *, ,__buf), size_t __nbytes)
__fortify_clang_warning_only_if_bos0_lt (__nbytes, __buf,
"read called with bigger length than "
"size of the destination buffer")
{
return __glibc_fortify (read, __nbytes, sizeof (char),
__glibc_objsize0 (__buf),
__fd, __buf, __nbytes);
}
#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
# ifndef __USE_FILE_OFFSET64
__fortify_function __attribute_overloadable__ __wur ssize_t
pread (int __fd, __fortify_clang_overload_arg0 (void *, ,__buf),
size_t __nbytes, __off_t __offset)
__fortify_clang_warning_only_if_bos0_lt (__nbytes, __buf,
"pread called with bigger length than "
"size of the destination buffer")
{
return __glibc_fortify (pread, __nbytes, sizeof (char),
__glibc_objsize0 (__buf),
__fd, __buf, __nbytes, __offset);
}
# else
__fortify_function __attribute_overloadable__ __wur ssize_t
pread (int __fd, __fortify_clang_overload_arg0 (void *, ,__buf),
size_t __nbytes, __off64_t __offset)
__fortify_clang_warning_only_if_bos0_lt (__nbytes, __buf,
"pread called with bigger length than "
"size of the destination buffer")
{
return __glibc_fortify (pread64, __nbytes, sizeof (char),
__glibc_objsize0 (__buf),
__fd, __buf, __nbytes, __offset);
}
# endif
# ifdef __USE_LARGEFILE64
__fortify_function __attribute_overloadable__ __wur ssize_t
pread64 (int __fd, __fortify_clang_overload_arg0 (void *, ,__buf),
size_t __nbytes, __off64_t __offset)
__fortify_clang_warning_only_if_bos0_lt (__nbytes, __buf,
"pread64 called with bigger length than "
"size of the destination buffer")
{
return __glibc_fortify (pread64, __nbytes, sizeof (char),
__glibc_objsize0 (__buf),
__fd, __buf, __nbytes, __offset);
}
# endif
#endif
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
__fortify_function __attribute_overloadable__ __nonnull ((1, 2)) __wur ssize_t
__NTH (readlink (const char *__restrict __path,
__fortify_clang_overload_arg0 (char *, __restrict, __buf),
size_t __len))
__fortify_clang_warning_only_if_bos_lt (__len, __buf,
"readlink called with bigger length "
"than size of destination buffer")
{
return __glibc_fortify (readlink, __len, sizeof (char),
__glibc_objsize (__buf),
__path, __buf, __len);
}
#endif
#ifdef __USE_ATFILE
__fortify_function __attribute_overloadable__ __nonnull ((2, 3)) __wur ssize_t
__NTH (readlinkat (int __fd, const char *__restrict __path,
__fortify_clang_overload_arg0 (char *, __restrict, __buf),
size_t __len))
__fortify_clang_warning_only_if_bos_lt (__len, __buf,
"readlinkat called with bigger length "
"than size of destination buffer")
{
return __glibc_fortify (readlinkat, __len, sizeof (char),
__glibc_objsize (__buf),
__fd, __path, __buf, __len);
}
#endif
__fortify_function __attribute_overloadable__ __wur char *
__NTH (getcwd (__fortify_clang_overload_arg (char *, , __buf), size_t __size))
__fortify_clang_warning_only_if_bos_lt (__size, __buf,
"getcwd called with bigger length "
"than size of destination buffer")
{
return __glibc_fortify (getcwd, __size, sizeof (char),
__glibc_objsize (__buf),
__buf, __size);
}
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
__fortify_function __attribute_overloadable__ __nonnull ((1))
__attribute_deprecated__ __wur char *
__NTH (getwd (__fortify_clang_overload_arg (char *,, __buf)))
{
if (__glibc_objsize (__buf) != (size_t) -1)
return __getwd_chk (__buf, __glibc_objsize (__buf));
return __getwd_warn (__buf);
}
#endif
__fortify_function __attribute_overloadable__ size_t
__NTH (confstr (int __name, __fortify_clang_overload_arg (char *, ,__buf),
size_t __len))
__fortify_clang_warning_only_if_bos_lt (__len, __buf,
"confstr called with bigger length than "
"size of destination buffer")
{
return __glibc_fortify (confstr, __len, sizeof (char),
__glibc_objsize (__buf),
__name, __buf, __len);
}
__fortify_function __attribute_overloadable__ int
__NTH (getgroups (int __size,
__fortify_clang_overload_arg (__gid_t *, , __list)))
__fortify_clang_warning_only_if_bos_lt (__size * sizeof (__gid_t), __list,
"getgroups called with bigger group "
"count than what can fit into "
"destination buffer")
{
return __glibc_fortify (getgroups, __size, sizeof (__gid_t),
__glibc_objsize (__list),
__size, __list);
}
__fortify_function __attribute_overloadable__ int
__NTH (ttyname_r (int __fd,
__fortify_clang_overload_arg (char *, ,__buf),
size_t __buflen))
__fortify_clang_warning_only_if_bos_lt (__buflen, __buf,
"ttyname_r called with bigger buflen "
"than size of destination buffer")
{
return __glibc_fortify (ttyname_r, __buflen, sizeof (char),
__glibc_objsize (__buf),
__fd, __buf, __buflen);
}
#ifdef __USE_POSIX199506
__fortify_function __attribute_overloadable__ int
getlogin_r (__fortify_clang_overload_arg (char *, ,__buf), size_t __buflen)
__fortify_clang_warning_only_if_bos_lt (__buflen, __buf,
"getlogin_r called with bigger buflen "
"than size of destination buffer")
{
return __glibc_fortify (getlogin_r, __buflen, sizeof (char),
__glibc_objsize (__buf),
__buf, __buflen);
}
#endif
#if defined __USE_MISC || defined __USE_UNIX98
__fortify_function __attribute_overloadable__ int
__NTH (gethostname (__fortify_clang_overload_arg (char *, ,__buf),
size_t __buflen))
__fortify_clang_warning_only_if_bos_lt (__buflen, __buf,
"gethostname called with bigger buflen "
"than size of destination buffer")
{
return __glibc_fortify (gethostname, __buflen, sizeof (char),
__glibc_objsize (__buf),
__buf, __buflen);
}
#endif
#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_UNIX98)
__fortify_function __attribute_overloadable__ int
__NTH (getdomainname (__fortify_clang_overload_arg (char *, ,__buf),
size_t __buflen))
__fortify_clang_warning_only_if_bos_lt (__buflen, __buf,
"getdomainname called with bigger "
"buflen than size of destination buffer")
{
return __glibc_fortify (getdomainname, __buflen, sizeof (char),
__glibc_objsize (__buf),
__buf, __buflen);
}
#endif
|