source: Daodan/MinGW/lib/gcc/mingw32/5.3.0/include/ssp/unistd.h@ 1086

Last change on this file since 1086 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

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