1169695Skan/* Checking macros for unistd functions. 2169695Skan Copyright (C) 2005 Free Software Foundation, Inc. 3169695Skan 4169695SkanThis file is part of GCC. 5169695Skan 6169695SkanGCC is free software; you can redistribute it and/or modify it under 7169695Skanthe terms of the GNU General Public License as published by the Free 8169695SkanSoftware Foundation; either version 2, or (at your option) any later 9169695Skanversion. 10169695Skan 11169695SkanIn addition to the permissions in the GNU General Public License, the 12169695SkanFree Software Foundation gives you unlimited permission to link the 13169695Skancompiled version of this file into combinations with other programs, 14169695Skanand to distribute those combinations without any restriction coming 15169695Skanfrom the use of this file. (The General Public License restrictions 16169695Skando apply in other respects; for example, they cover modification of 17169695Skanthe file, and distribution when not linked into a combine 18169695Skanexecutable.) 19169695Skan 20169695SkanGCC is distributed in the hope that it will be useful, but WITHOUT ANY 21169695SkanWARRANTY; without even the implied warranty of MERCHANTABILITY or 22169695SkanFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23169695Skanfor more details. 24169695Skan 25169695SkanYou should have received a copy of the GNU General Public License 26169695Skanalong with GCC; see the file COPYING. If not, write to the Free 27169695SkanSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 28169695Skan02110-1301, USA. */ 29169695Skan 30169695Skan/* As a special exception, if you link this library with files compiled with 31169695Skan GCC to produce an executable, this does not cause the resulting executable 32169695Skan to be covered by the GNU General Public License. This exception does not 33169695Skan however invalidate any other reasons why the executable file might be 34169695Skan covered by the GNU General Public License. */ 35169695Skan 36169695Skan#ifndef _SSP_UNISTD_H 37169695Skan#define _SSP_UNISTD_H 1 38169695Skan 39169695Skan#include <ssp.h> 40169695Skan#include_next <unistd.h> 41169695Skan 42169695Skan#if __SSP_FORTIFY_LEVEL > 0 43169695Skan 44169695Skan#undef read 45169695Skan#undef readlink 46169695Skan#undef getcwd 47169695Skan 48169695Skanextern ssize_t __SSP_REDIRECT (__read_alias, (int __fd, void *__buf, 49169695Skan size_t __nbytes), read); 50169695Skan 51169695Skanextern inline __attribute__((__always_inline__)) ssize_t 52169695Skanread (int __fd, void *__buf, size_t __nbytes) 53169695Skan{ 54169695Skan if (__ssp_bos0 (__buf) != (size_t) -1 && __nbytes > __ssp_bos0 (__buf)) 55169695Skan __chk_fail (); 56169695Skan return __read_alias (__fd, __buf, __nbytes); 57169695Skan} 58169695Skan 59169695Skanextern int __SSP_REDIRECT (__readlink_alias, 60169695Skan (const char *__restrict__ __path, 61169695Skan char *__restrict__ __buf, size_t __len), 62169695Skan readlink); 63169695Skan 64169695Skanextern inline __attribute__((__always_inline__)) int 65169695Skanreadlink (const char *__restrict__ __path, char *__restrict__ __buf, 66169695Skan size_t __len) 67169695Skan{ 68169695Skan if (__ssp_bos (__buf) != (size_t) -1 && __len > __ssp_bos (__buf)) 69169695Skan __chk_fail (); 70169695Skan return __readlink_alias (__path, __buf, __len); 71169695Skan} 72169695Skan 73169695Skanextern char *__SSP_REDIRECT (__getcwd_alias, 74169695Skan (char *__buf, size_t __size), getcwd); 75169695Skan 76169695Skanextern inline __attribute__((__always_inline__)) char * 77169695Skangetcwd (char *__buf, size_t __size) 78169695Skan{ 79169695Skan if (__ssp_bos (__buf) != (size_t) -1 && __size > __ssp_bos (__buf)) 80169695Skan __chk_fail (); 81169695Skan return __getcwd_alias (__buf, __size); 82169695Skan} 83169695Skan 84169695Skan#endif /* __SSP_FORTIFY_LEVEL > 0 */ 85169695Skan#endif /* _SSP_UNISTD_H */ 86