unistd.h 3.4 KB

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