diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-07-18 21:07:28 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-07-18 21:07:28 +0000 |
commit | 9f3731cf7f8f1d1b4718fdbeae2ca5d46bbc6950 (patch) | |
tree | 1cbff2cd7ef38c777aa3a6c713b1513e038f2483 /posix/bits/unistd.h | |
parent | 0396de518e3ed6b4bebea10026ca5c7aaafa783f (diff) | |
download | glibc-9f3731cf7f8f1d1b4718fdbeae2ca5d46bbc6950.tar.gz glibc-9f3731cf7f8f1d1b4718fdbeae2ca5d46bbc6950.tar.xz glibc-9f3731cf7f8f1d1b4718fdbeae2ca5d46bbc6950.zip |
* nscd/grpcache.c (cache_addgr): Use correct maximum for group ID
length. Patch by Ivan Gyurdiev <ivg2@cornell.edu>. * debug/confstr_chk.c: New file. * debug/getdomainname_chk.c: New file. * debug/getgroups_chk.c: New file. * debug/gethostname_chk.c: New file. * debug/getlogin_r_chk.c: New file. * debug/ttyname_r_chk.c: New file. * posix/bits/unistd.h: Add definitions for new debug versions. * debug/tst-chk1.c: Add tests for new functions. * debug/Versions: Export new functions. * debug/Makefile (routines): Add new files. * stdlib/bits/stdlib.h: Fix typo. * manual/Makefile (libc/index.html): Depend on dir-add.texi.
Diffstat (limited to 'posix/bits/unistd.h')
-rw-r--r-- | posix/bits/unistd.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h index cb82818ade..b6c756a9de 100644 --- a/posix/bits/unistd.h +++ b/posix/bits/unistd.h @@ -128,3 +128,101 @@ __NTH (getwd (char *__buf)) return __getwd_alias (__buf); } #endif + +extern size_t __confstr_chk (int __name, char *__buf, size_t __len, + size_t __buflen) __THROW; +extern size_t __REDIRECT_NTH (__confstr_alias, (int __name, char *__buf, + size_t __len), confstr); + +extern __always_inline size_t +confstr (int __name, char *__buf, size_t __len) +{ + if (__bos (__buf) != (size_t) -1 + && (!__builtin_constant_p (__len) || __bos (__buf) < __len)) + return __confstr_chk (__name, __buf, __len, __bos (__buf)); + return __confstr_alias (__name, __buf, __len); +} + + +extern int __getgroups_chk (int __size, __gid_t __list[], size_t listlen) + __THROW __wur; +extern int __REDIRECT_NTH (__getgroups_alias, (int __size, __gid_t __list[]), + getgroups) __wur; + +extern __always_inline int +getgroups (int __size, __gid_t __list[]) +{ + if (__bos (__list) != (size_t) -1 + && (!__builtin_constant_p (__size) + || __size * sizeof (__gid_t) > __bos (__list))) + return __getgroups_chk (__size, __list, __bos (__list)); + return __getgroups_alias (__size, __list); +} + + +extern int __ttyname_r_chk (int __fd, char *__buf, size_t __buflen, + size_t __nreal) __THROW __nonnull ((2)); +extern int __REDIRECT_NTH (__ttyname_r_alias, (int __fd, char *__buf, + size_t __buflen), ttyname_r) + __nonnull ((2)); + +extern __always_inline int +ttyname_r (int __fd, char *__buf, size_t __buflen) +{ + if (__bos (__buf) != (size_t) -1 + && (!__builtin_constant_p (__buflen) || __buflen > __bos (__buf))) + return __ttyname_r_chk (__fd, __buf, __buflen, __bos (__buf)); + return __ttyname_r_alias (__fd, __buf, __buflen); +} + + +#if defined __USE_REENTRANT || defined __USE_UNIX98 +extern int __getlogin_r_chk (char *__buf, size_t __buflen, size_t __nreal) + __nonnull ((1)); +extern int __REDIRECT (__getlogin_r_alias, (char *__buf, size_t __buflen), + getlogin_r) __nonnull ((1)); + +extern __always_inline int +getlogin_r (char *__buf, size_t __buflen) +{ + if (__bos (__buf) != (size_t) -1 + && (!__builtin_constant_p (__buflen) || __buflen > __bos (__buf))) + return __getlogin_r_chk (__buf, __buflen, __bos (__buf)); + return __getlogin_r_alias (__buf, __buflen); +} +#endif + + +#if defined __USE_BSD || defined __USE_UNIX98 +extern int __gethostname_chk (char *__buf, size_t __buflen, size_t __nreal) + __THROW __nonnull ((1)); +extern int __REDIRECT_NTH (__gethostname_alias, (char *__buf, size_t __buflen), + gethostname) __nonnull ((1)); + +extern __always_inline int +gethostname (char *__buf, size_t __buflen) +{ + if (__bos (__buf) != (size_t) -1 + && (!__builtin_constant_p (__buflen) || __buflen > __bos (__buf))) + return __gethostname_chk (__buf, __buflen, __bos (__buf)); + return __gethostname_alias (__buf, __buflen); +} +#endif + + +#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98) +extern int __getdomainname_chk (char *__buf, size_t __buflen, size_t __nreal) + __THROW __nonnull ((1)) __wur; +extern int __REDIRECT_NTH (__getdomainname_alias, (char *__buf, + size_t __buflen), + getdomainname) __nonnull ((1)) __wur; + +extern __always_inline int +getdomainname (char *__buf, size_t __buflen) +{ + if (__bos (__buf) != (size_t) -1 + && (!__builtin_constant_p (__buflen) || __buflen > __bos (__buf))) + return __getdomainname_chk (__buf, __buflen, __bos (__buf)); + return __getdomainname_alias (__buf, __buflen); +} +#endif |