* gcc.dg/stack-usage-1.c: Remove dg-options line for sh targets
[official-gcc.git] / libssp / ssp / unistd.h
blob343fe5034eb3e05d145510a3cc4eaf4ed74785d6
1 /* Checking macros for unistd functions.
2 Copyright (C) 2005, 2009 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 In addition to the permissions in the GNU General Public License, the
12 Free Software Foundation gives you unlimited permission to link the
13 compiled version of this file into combinations with other programs,
14 and to distribute those combinations without any restriction coming
15 from the use of this file. (The General Public License restrictions
16 do apply in other respects; for example, they cover modification of
17 the file, and distribution when not linked into a combine
18 executable.)
20 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
21 WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 for more details.
25 Under Section 7 of GPL version 3, you are granted additional
26 permissions described in the GCC Runtime Library Exception, version
27 3.1, as published by the Free Software Foundation.
29 You should have received a copy of the GNU General Public License and
30 a copy of the GCC Runtime Library Exception along with this program;
31 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
32 <http://www.gnu.org/licenses/>. */
35 #ifndef _SSP_UNISTD_H
36 #define _SSP_UNISTD_H 1
38 #include <ssp.h>
39 #include_next <unistd.h>
41 #if __SSP_FORTIFY_LEVEL > 0
43 #undef read
44 #undef readlink
45 #undef getcwd
47 extern ssize_t __SSP_REDIRECT (__read_alias, (int __fd, void *__buf,
48 size_t __nbytes), read);
50 extern inline __attribute__((__always_inline__)) ssize_t
51 read (int __fd, void *__buf, size_t __nbytes)
53 if (__ssp_bos0 (__buf) != (size_t) -1 && __nbytes > __ssp_bos0 (__buf))
54 __chk_fail ();
55 return __read_alias (__fd, __buf, __nbytes);
58 extern int __SSP_REDIRECT (__readlink_alias,
59 (const char *__restrict__ __path,
60 char *__restrict__ __buf, size_t __len),
61 readlink);
63 extern inline __attribute__((__always_inline__)) int
64 readlink (const char *__restrict__ __path, char *__restrict__ __buf,
65 size_t __len)
67 if (__ssp_bos (__buf) != (size_t) -1 && __len > __ssp_bos (__buf))
68 __chk_fail ();
69 return __readlink_alias (__path, __buf, __len);
72 extern char *__SSP_REDIRECT (__getcwd_alias,
73 (char *__buf, size_t __size), getcwd);
75 extern inline __attribute__((__always_inline__)) char *
76 getcwd (char *__buf, size_t __size)
78 if (__ssp_bos (__buf) != (size_t) -1 && __size > __ssp_bos (__buf))
79 __chk_fail ();
80 return __getcwd_alias (__buf, __size);
83 #endif /* __SSP_FORTIFY_LEVEL > 0 */
84 #endif /* _SSP_UNISTD_H */