1 /* $NetBSD: unistd.h,v 1.7 2015/06/25 18:41:03 joerg Exp $ */ 2 3 /*- 4 * Copyright (c) 2006 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Christos Zoulas. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 #ifndef _SSP_UNISTD_H_ 32 #define _SSP_UNISTD_H_ 33 34 #include <ssp/ssp.h> 35 36 #if __SSP_FORTIFY_LEVEL > 0 37 __BEGIN_DECLS 38 39 #if __POSIX_VISIBLE >= 199209 40 __ssp_redirect(size_t, confstr, (int __name, char *__buf, size_t __len), \ 41 (__name, __buf, __len)); 42 #endif 43 44 __ssp_redirect_raw(char *, getcwd, (char *__buf, size_t __len), 45 (__buf, __len), __buf != 0, __ssp_bos); 46 47 #if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500) 48 __ssp_redirect(int, getdomainname, (char *__buf, size_t __len), \ 49 (__buf, __len)); 50 #endif 51 52 __ssp_decl(int, getgroups, (int __n, gid_t __buf[])) 53 { 54 __ssp_check(__buf, __n * sizeof(gid_t), __ssp_bos); 55 return __ssp_real_getgroups (__n, __buf); 56 } 57 58 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500 59 #if !(defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS)) 60 __ssp_redirect(int, gethostname, (char *__buf, size_t __len), \ 61 (__buf, __len)); 62 #endif 63 #endif 64 65 __ssp_redirect(int, getlogin_r, (char *__buf, size_t __len), \ 66 (__buf, __len)); 67 68 #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 500 69 __ssp_redirect0(ssize_t, pread, (int __fd, void *__buf, size_t __len, off_t __off), \ 70 (__fd, __buf, __len, __off)); 71 #endif 72 73 __ssp_redirect0(ssize_t, read, \ 74 (int __fd, void *__buf, size_t __len), (__fd, __buf, __len)); 75 76 #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 4 77 __ssp_redirect(ssize_t, readlink, (const char *__restrict __path, \ 78 char *__restrict __buf, size_t __len), (__path, __buf, __len)); 79 #endif 80 81 #if __ATFILE_VISIBLE 82 __ssp_redirect(ssize_t, readlinkat, \ 83 (int __dirfd1, const char *__restrict __path, char *__restrict __buf, size_t __len), \ 84 (__dirfd1, __path, __buf, __len)); 85 #endif 86 87 __ssp_redirect(int, ttyname_r, (int __fd, char *__buf, size_t __len), \ 88 (__fd, __buf, __len)); 89 90 __END_DECLS 91 92 #endif /* __SSP_FORTIFY_LEVEL > 0 */ 93 #endif /* _SSP_UNISTD_H_ */ 94