Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 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 1 2 3 4 5 6


unistd.h
001: /* Checking macros for unistd functions.
002:    Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
003:    This file is part of the GNU C Library.
004: 
005:    The GNU C Library is free software; you can redistribute it and/or
006:    modify it under the terms of the GNU Lesser General Public
007:    License as published by the Free Software Foundation; either
008:    version 2.1 of the License, or (at your option) any later version.
009: 
010:    The GNU C Library is distributed in the hope that it will be useful,
011:    but WITHOUT ANY WARRANTY; without even the implied warranty of
012:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:    Lesser General Public License for more details.
014: 
015:    You should have received a copy of the GNU Lesser General Public
016:    License along with the GNU C Library; if not, write to the Free
017:    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
018:    02111-1307 USA.  */
019: 
020: #ifndef _UNISTD_H
021: # error "Never include <bits/unistd.h> directly; use <unistd.h> instead."
022: #endif
023: 
024: extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes,
025:                            size_t __buflen) __wur;
026: extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf,
027:                                           size_t __nbytes), read) __wur;
028: extern ssize_t __REDIRECT (__read_chk_warn,
029:                            (int __fd, void *__buf, size_t __nbytes,
030:                             size_t __buflen), __read_chk)
031:      __wur __warnattr ("read called with bigger length than size of "
032:                        "the destination buffer");
033: 
034: __extern_always_inline __wur ssize_t
035: read (int __fd, void *__buf, size_t __nbytes)
036: {
037:   if (__bos0 (__buf) != (size_t) -1)
038:     {
039:       if (!__builtin_constant_p (__nbytes))
040:         return __read_chk (__fd, __buf, __nbytes, __bos0 (__buf));
041: 
042:       if (__nbytes > __bos0 (__buf))
043:         return __read_chk_warn (__fd, __buf, __nbytes, __bos0 (__buf));
044:     }
045:   return __read_alias (__fd, __buf, __nbytes);
046: }
047: 
048: #ifdef __USE_UNIX98
049: extern ssize_t __pread_chk (int __fd, void *__buf, size_t __nbytes,
050:                             __off_t __offset, size_t __bufsize) __wur;
051: extern ssize_t __pread64_chk (int __fd, void *__buf, size_t __nbytes,
052:                               __off64_t __offset, size_t __bufsize) __wur;
053: extern ssize_t __REDIRECT (__pread_alias,
054:                            (int __fd, void *__buf, size_t __nbytes,
055:                             __off_t __offset), pread) __wur;
056: extern ssize_t __REDIRECT (__pread64_alias,
057:                            (int __fd, void *__buf, size_t __nbytes,
058:                             __off64_t __offset), pread64) __wur;
059: extern ssize_t __REDIRECT (__pread_chk_warn,
060:                            (int __fd, void *__buf, size_t __nbytes,
061:                             __off_t __offset, size_t __bufsize), __pread_chk)
062:      __wur __warnattr ("pread called with bigger length than size of "
063:                        "the destination buffer");
064: extern ssize_t __REDIRECT (__pread64_chk_warn,
065:                            (int __fd, void *__buf, size_t __nbytes,
066:                             __off64_t __offset, size_t __bufsize),
067:                             __pread64_chk)
068:      __wur __warnattr ("pread64 called with bigger length than size of "
069:                        "the destination buffer");
070: 
071: # ifndef __USE_FILE_OFFSET64
072: __extern_always_inline __wur ssize_t
073: pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
074: {
075:   if (__bos0 (__buf) != (size_t) -1)
076:     {
077:       if (!__builtin_constant_p (__nbytes))
078:         return __pread_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
079: 
080:       if ( __nbytes > __bos0 (__buf))
081:         return __pread_chk_warn (__fd, __buf, __nbytes, __offset,
082:                                  __bos0 (__buf));
083:     }
084:   return __pread_alias (__fd, __buf, __nbytes, __offset);
085: }
086: # else
087: __extern_always_inline __wur ssize_t
088: pread (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
089: {
090:   if (__bos0 (__buf) != (size_t) -1)
091:     {
092:       if (!__builtin_constant_p (__nbytes))
093:         return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
094: 
095:       if ( __nbytes > __bos0 (__buf))
096:         return __pread64_chk_warn (__fd, __buf, __nbytes, __offset,
097:                                    __bos0 (__buf));
098:     }
099: 
100:   return __pread64_alias (__fd, __buf, __nbytes, __offset);
101: }
102: # endif
103: 
104: # ifdef __USE_LARGEFILE64
105: __extern_always_inline __wur ssize_t
106: pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
107: {
108:   if (__bos0 (__buf) != (size_t) -1)
109:     {
110:       if (!__builtin_constant_p (__nbytes))
111:         return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
112: 
113:       if ( __nbytes > __bos0 (__buf))
114:         return __pread64_chk_warn (__fd, __buf, __nbytes, __offset,
115:                                    __bos0 (__buf));
116:     }
117: 
118:   return __pread64_alias (__fd, __buf, __nbytes, __offset);
119: }
120: # endif
121: #endif
122: 
123: #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
124: extern ssize_t __readlink_chk (__const char *__restrict __path,
125:                                char *__restrict __buf, size_t __len,
126:                                size_t __buflen)
127:      __THROW __nonnull ((1, 2)) __wur;
128: extern ssize_t __REDIRECT_NTH (__readlink_alias,
129:                                (__const char *__restrict __path,
130:                                 char *__restrict __buf, size_t __len), readlink)
131:      __nonnull ((1, 2)) __wur;
132: extern ssize_t __REDIRECT_NTH (__readlink_chk_warn,
133:                                (__const char *__restrict __path,
134:                                 char *__restrict __buf, size_t __len,
135:                                 size_t __buflen), __readlink_chk)
136:      __nonnull ((1, 2)) __wur __warnattr ("readlink called with bigger length "
137:                                           "than size of destination buffer");
138: 
139: __extern_always_inline __nonnull ((1, 2)) __wur ssize_t
140: __NTH (readlink (__const char *__restrict __path, char *__restrict __buf,
141:                  size_t __len))
142: {
143:   if (__bos (__buf) != (size_t) -1)
144:     {
145:       if (!__builtin_constant_p (__len))
146:         return __readlink_chk (__path, __buf, __len, __bos (__buf));
147: 
148:       if ( __len > __bos (__buf))
149:         return __readlink_chk_warn (__path, __buf, __len, __bos (__buf));
150:     }
151:   return __readlink_alias (__path, __buf, __len);
152: }
153: #endif
154: 
155: #ifdef __USE_ATFILE
156: extern ssize_t __readlinkat_chk (int __fd, __const char *__restrict __path,
157:                                  char *__restrict __buf, size_t __len,
158:                                  size_t __buflen)
159:      __THROW __nonnull ((2, 3)) __wur;
160: extern ssize_t __REDIRECT_NTH (__readlinkat_alias,
161:                                (int __fd, __const char *__restrict __path,
162:                                 char *__restrict __buf, size_t __len),
163:                                readlinkat)
164:      __nonnull ((2, 3)) __wur;
165: extern ssize_t __REDIRECT_NTH (__readlinkat_chk_warn,
166:                                (int __fd, __const char *__restrict __path,
167:                                 char *__restrict __buf, size_t __len,
168:                                 size_t __buflen), __readlinkat_chk)
169:      __nonnull ((2, 3)) __wur __warnattr ("readlinkat called with bigger "
170:                                           "length than size of destination "
171:                                           "buffer");
172: 
173: __extern_always_inline __nonnull ((2, 3)) __wur ssize_t
174: __NTH (readlinkat (int __fd, __const char *__restrict __path,
175:                    char *__restrict __buf, size_t __len))
176: {
177:   if (__bos (__buf) != (size_t) -1)
178:     {
179:       if (!__builtin_constant_p (__len))
180:         return __readlinkat_chk (__fd, __path, __buf, __len, __bos (__buf));
181: 
182:       if (__len > __bos (__buf))
183:         return __readlinkat_chk_warn (__fd, __path, __buf, __len,
184:                                       __bos (__buf));
185:     }
186:   return __readlinkat_alias (__fd, __path, __buf, __len);
187: }
188: #endif
189: 
190: extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen)
191:      __THROW __wur;
192: extern char *__REDIRECT_NTH (__getcwd_alias,
193:                              (char *__buf, size_t __size), getcwd) __wur;
194: extern char *__REDIRECT_NTH (__getcwd_chk_warn,
195:                              (char *__buf, size_t __size, size_t __buflen),
196:                              __getcwd_chk)
197:      __wur __warnattr ("getcwd caller with bigger length than size of "
198:                        "destination buffer");
199: 
200: __extern_always_inline __wur char *
201: __NTH (getcwd (char *__buf, size_t __size))
202: {
203:   if (__bos (__buf) != (size_t) -1)
204:     {
205:       if (!__builtin_constant_p (__size))
206:         return __getcwd_chk (__buf, __size, __bos (__buf));
207: 
208:       if (__size > __bos (__buf))
209:         return __getcwd_chk_warn (__buf, __size, __bos (__buf));
210:     }
211:   return __getcwd_alias (__buf, __size);
212: }
213: 
214: #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
215: extern char *__getwd_chk (char *__buf, size_t buflen)
216:      __THROW __nonnull ((1)) __wur;
217: extern char *__REDIRECT_NTH (__getwd_warn, (char *__buf), getwd)
218:      __nonnull ((1)) __wur __warnattr ("please use getcwd instead, as getwd "
219:                                        "doesn't specify buffer size");
220: 
221: __extern_always_inline __nonnull ((1)) __attribute_deprecated__ __wur char *
222: __NTH (getwd (char *__buf))
223: {
224:   if (__bos (__buf) != (size_t) -1)
225:     return __getwd_chk (__buf, __bos (__buf));
226:   return __getwd_warn (__buf);
227: }
228: #endif
229: 
230: extern size_t __confstr_chk (int __name, char *__buf, size_t __len,
231:                              size_t __buflen) __THROW;
232: extern size_t __REDIRECT_NTH (__confstr_alias, (int __name, char *__buf,
233:                                                 size_t __len), confstr);
234: extern size_t __REDIRECT_NTH (__confstr_chk_warn,
235:                               (int __name, char *__buf, size_t __len,
236:                                size_t __buflen), __confstr_chk)
237:      __warnattr ("confstr called with bigger length than size of destination "
238:                  "buffer");
239: 
240: __extern_always_inline size_t
241: __NTH (confstr (int __name, char *__buf, size_t __len))
242: {
243:   if (__bos (__buf) != (size_t) -1)
244:     {
245:       if (!__builtin_constant_p (__len))
246:         return __confstr_chk (__name, __buf, __len, __bos (__buf));
247: 
248:       if (__bos (__buf) < __len)
249:         return __confstr_chk_warn (__name, __buf, __len, __bos (__buf));
250:     }
251:   return __confstr_alias (__name, __buf, __len);
252: }
253: 
254: 
255: extern int __getgroups_chk (int __size, __gid_t __list[], size_t __listlen)
256:      __THROW __wur;
257: extern int __REDIRECT_NTH (__getgroups_alias, (int __size, __gid_t __list[]),
258:                            getgroups) __wur;
259: extern int __REDIRECT_NTH (__getgroups_chk_warn,
260:                            (int __size, __gid_t __list[], size_t __listlen),
261:                            __getgroups_chk)
262:      __wur __warnattr ("getgroups called with bigger group count than what "
263:                        "can fit into destination buffer");
264: 
265: __extern_always_inline int
266: __NTH (getgroups (int __size, __gid_t __list[]))
267: {
268:   if (__bos (__list) != (size_t) -1)
269:     {
270:       if (!__builtin_constant_p (__size) || __size < 0)
271:         return __getgroups_chk (__size, __list, __bos (__list));
272: 
273:       if (__size * sizeof (__gid_t) > __bos (__list))
274:         return __getgroups_chk_warn (__size, __list, __bos (__list));
275:     }
276:   return __getgroups_alias (__size, __list);
277: }
278: 
279: 
280: extern int __ttyname_r_chk (int __fd, char *__buf, size_t __buflen,
281:                             size_t __nreal) __THROW __nonnull ((2));
282: extern int __REDIRECT_NTH (__ttyname_r_alias, (int __fd, char *__buf,
283:                                                size_t __buflen), ttyname_r)
284:      __nonnull ((2));
285: extern int __REDIRECT_NTH (__ttyname_r_chk_warn,
286:                            (int __fd, char *__buf, size_t __buflen,
287:                             size_t __nreal), __ttyname_r_chk)
288:      __nonnull ((2)) __warnattr ("ttyname_r called with bigger buflen than "
289:                                  "size of destination buffer");
290: 
291: __extern_always_inline int
292: __NTH (ttyname_r (int __fd, char *__buf, size_t __buflen))
293: {
294:   if (__bos (__buf) != (size_t) -1)
295:     {
296:       if (!__builtin_constant_p (__buflen))
297:         return __ttyname_r_chk (__fd, __buf, __buflen, __bos (__buf));
298: 
299:       if (__buflen > __bos (__buf))
300:         return __ttyname_r_chk_warn (__fd, __buf, __buflen, __bos (__buf));
301:     }
302:   return __ttyname_r_alias (__fd, __buf, __buflen);
303: }
304: 
305: 
306: #if defined __USE_REENTRANT || defined __USE_POSIX199506
307: extern int __getlogin_r_chk (char *__buf, size_t __buflen, size_t __nreal)
308:      __nonnull ((1));
309: extern int __REDIRECT (__getlogin_r_alias, (char *__buf, size_t __buflen),
310:                        getlogin_r) __nonnull ((1));
311: extern int __REDIRECT (__getlogin_r_chk_warn,
312:                        (char *__buf, size_t __buflen, size_t __nreal),
313:                        __getlogin_r_chk)
314:      __nonnull ((1)) __warnattr ("getlogin_r called with bigger buflen than "
315:                                  "size of destination buffer");
316: 
317: __extern_always_inline int
318: getlogin_r (char *__buf, size_t __buflen)
319: {
320:   if (__bos (__buf) != (size_t) -1)
321:     {
322:       if (!__builtin_constant_p (__buflen))
323:         return __getlogin_r_chk (__buf, __buflen, __bos (__buf));
324: 
325:       if (__buflen > __bos (__buf))
326:         return __getlogin_r_chk_warn (__buf, __buflen, __bos (__buf));
327:     }
328:   return __getlogin_r_alias (__buf, __buflen);
329: }
330: #endif
331: 
332: 
333: #if defined __USE_BSD || defined __USE_UNIX98
334: extern int __gethostname_chk (char *__buf, size_t __buflen, size_t __nreal)
335:      __THROW __nonnull ((1));
336: extern int __REDIRECT_NTH (__gethostname_alias, (char *__buf, size_t __buflen),
337:                            gethostname) __nonnull ((1));
338: extern int __REDIRECT_NTH (__gethostname_chk_warn,
339:                            (char *__buf, size_t __buflen, size_t __nreal),
340:                            __gethostname_chk)
341:      __nonnull ((1)) __warnattr ("gethostname called with bigger buflen than "
342:                                  "size of destination buffer");
343: 
344: __extern_always_inline int
345: __NTH (gethostname (char *__buf, size_t __buflen))
346: {
347:   if (__bos (__buf) != (size_t) -1)
348:     {
349:       if (!__builtin_constant_p (__buflen))
350:         return __gethostname_chk (__buf, __buflen, __bos (__buf));
351: 
352:       if (__buflen > __bos (__buf))
353:         return __gethostname_chk_warn (__buf, __buflen, __bos (__buf));
354:     }
355:   return __gethostname_alias (__buf, __buflen);
356: }
357: #endif
358: 
359: 
360: #if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
361: extern int __getdomainname_chk (char *__buf, size_t __buflen, size_t __nreal)
362:      __THROW __nonnull ((1)) __wur;
363: extern int __REDIRECT_NTH (__getdomainname_alias, (char *__buf,
364:                                                    size_t __buflen),
365:                            getdomainname) __nonnull ((1)) __wur;
366: extern int __REDIRECT_NTH (__getdomainname_chk_warn,
367:                            (char *__buf, size_t __buflen, size_t __nreal),
368:                            __getdomainname_chk)
369:      __nonnull ((1)) __wur __warnattr ("getdomainname called with bigger "
370:                                        "buflen than size of destination "
371:                                        "buffer");
372: 
373: __extern_always_inline int
374: __NTH (getdomainname (char *__buf, size_t __buflen))
375: {
376:   if (__bos (__buf) != (size_t) -1)
377:     {
378:       if (!__builtin_constant_p (__buflen))
379:         return __getdomainname_chk (__buf, __buflen, __bos (__buf));
380: 
381:       if (__buflen > __bos (__buf))
382:         return __getdomainname_chk_warn (__buf, __buflen, __bos (__buf));
383:     }
384:   return __getdomainname_alias (__buf, __buflen);
385: }
386: #endif
387: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/