diff options
Diffstat (limited to 'include/unistd.h')
| -rw-r--r-- | include/unistd.h | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/include/unistd.h b/include/unistd.h index 5074d33..69095d5 100644 --- a/include/unistd.h +++ b/include/unistd.h | |||
| @@ -41,13 +41,13 @@ extern "C" { | |||
| 41 | #undef ttyname_r | 41 | #undef ttyname_r |
| 42 | #undef write | 42 | #undef write |
| 43 | 43 | ||
| 44 | __access(write_only, 2, 3) | 44 | __fh_access(write_only, 2, 3) |
| 45 | #if __has_builtin(__builtin_confstr) | 45 | #if __has_builtin(__builtin_confstr) |
| 46 | __diagnose_as_builtin(__builtin_confstr, 1, 2, 3) | 46 | __diagnose_as_builtin(__builtin_confstr, 1, 2, 3) |
| 47 | #endif | 47 | #endif |
| 48 | _FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __l) | 48 | _FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __l) |
| 49 | { | 49 | { |
| 50 | __fh_size_t __b = __bos(__s, 0); | 50 | __fh_size_t __b = __fh_bos(__s, 0); |
| 51 | __fh_size_t __r = __orig_confstr(__n, __s, __b > __l ? __l : __b); | 51 | __fh_size_t __r = __orig_confstr(__n, __s, __b > __l ? __l : __b); |
| 52 | 52 | ||
| 53 | if (__l > __b && __r > __b) | 53 | if (__l > __b && __r > __b) |
| @@ -55,13 +55,13 @@ _FORTIFY_FN(confstr) size_t confstr(int __n, char * _FORTIFY_POS0 __s, size_t __ | |||
| 55 | return __r; | 55 | return __r; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | __access(write_only, 1, 2) | 58 | __fh_access(write_only, 1, 2) |
| 59 | #if __has_builtin(__builtin_getcwd) | 59 | #if __has_builtin(__builtin_getcwd) |
| 60 | __diagnose_as_builtin(__builtin_getcwd, 1, 2) | 60 | __diagnose_as_builtin(__builtin_getcwd, 1, 2) |
| 61 | #endif | 61 | #endif |
| 62 | _FORTIFY_FN(getcwd) char *getcwd(char * _FORTIFY_POS0 __s, size_t __l) | 62 | _FORTIFY_FN(getcwd) char *getcwd(char * _FORTIFY_POS0 __s, size_t __l) |
| 63 | { | 63 | { |
| 64 | __fh_size_t __b = __bos(__s, 0); | 64 | __fh_size_t __b = __fh_bos(__s, 0); |
| 65 | 65 | ||
| 66 | if (__l > __b) | 66 | if (__l > __b) |
| 67 | __builtin_trap(); | 67 | __builtin_trap(); |
| @@ -70,13 +70,13 @@ _FORTIFY_FN(getcwd) char *getcwd(char * _FORTIFY_POS0 __s, size_t __l) | |||
| 70 | 70 | ||
| 71 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | 71 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
| 72 | #undef getdomainname | 72 | #undef getdomainname |
| 73 | __access(write_only, 1, 2) | 73 | __fh_access(write_only, 1, 2) |
| 74 | #if __has_builtin(__builtin_getdomainname) | 74 | #if __has_builtin(__builtin_getdomainname) |
| 75 | __diagnose_as_builtin(__builtin_getdomainname, 1, 2) | 75 | __diagnose_as_builtin(__builtin_getdomainname, 1, 2) |
| 76 | #endif | 76 | #endif |
| 77 | _FORTIFY_FN(getdomainname) int getdomainname(char * _FORTIFY_POS0 __s, size_t __l) | 77 | _FORTIFY_FN(getdomainname) int getdomainname(char * _FORTIFY_POS0 __s, size_t __l) |
| 78 | { | 78 | { |
| 79 | __fh_size_t __b = __bos(__s, 0); | 79 | __fh_size_t __b = __fh_bos(__s, 0); |
| 80 | 80 | ||
| 81 | if (__l > __b) | 81 | if (__l > __b) |
| 82 | __builtin_trap(); | 82 | __builtin_trap(); |
| @@ -89,33 +89,33 @@ __diagnose_as_builtin(__builtin_getgroups, 1, 2) | |||
| 89 | #endif | 89 | #endif |
| 90 | _FORTIFY_FN(getgroups) int getgroups(int __l, gid_t * _FORTIFY_POS0 __s) | 90 | _FORTIFY_FN(getgroups) int getgroups(int __l, gid_t * _FORTIFY_POS0 __s) |
| 91 | { | 91 | { |
| 92 | __fh_size_t __b = __bos(__s, 0); | 92 | __fh_size_t __b = __fh_bos(__s, 0); |
| 93 | 93 | ||
| 94 | if (__l > 0 && (unsigned)__l > __b / sizeof(gid_t)) | 94 | if (__l > 0 && (unsigned)__l > __b / sizeof(gid_t)) |
| 95 | __builtin_trap(); | 95 | __builtin_trap(); |
| 96 | return __orig_getgroups(__l, __s); | 96 | return __orig_getgroups(__l, __s); |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | __access(write_only, 1, 2) | 99 | __fh_access(write_only, 1, 2) |
| 100 | #if __has_builtin(__builtin_gethostname) | 100 | #if __has_builtin(__builtin_gethostname) |
| 101 | __diagnose_as_builtin(__builtin_gethostname, 1, 2) | 101 | __diagnose_as_builtin(__builtin_gethostname, 1, 2) |
| 102 | #endif | 102 | #endif |
| 103 | _FORTIFY_FN(gethostname) int gethostname(char * _FORTIFY_POS0 __s, size_t __l) | 103 | _FORTIFY_FN(gethostname) int gethostname(char * _FORTIFY_POS0 __s, size_t __l) |
| 104 | { | 104 | { |
| 105 | __fh_size_t __b = __bos(__s, 0); | 105 | __fh_size_t __b = __fh_bos(__s, 0); |
| 106 | 106 | ||
| 107 | if (__l > __b) | 107 | if (__l > __b) |
| 108 | __builtin_trap(); | 108 | __builtin_trap(); |
| 109 | return __orig_gethostname(__s, __l); | 109 | return __orig_gethostname(__s, __l); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | __access(write_only, 1, 2) | 112 | __fh_access(write_only, 1, 2) |
| 113 | #if __has_builtin(__builtin_getlogin_r) | 113 | #if __has_builtin(__builtin_getlogin_r) |
| 114 | __diagnose_as_builtin(__builtin_getlogin_r, 1, 2) | 114 | __diagnose_as_builtin(__builtin_getlogin_r, 1, 2) |
| 115 | #endif | 115 | #endif |
| 116 | _FORTIFY_FN(getlogin_r) int getlogin_r(char * _FORTIFY_POS0 __s, size_t __l) | 116 | _FORTIFY_FN(getlogin_r) int getlogin_r(char * _FORTIFY_POS0 __s, size_t __l) |
| 117 | { | 117 | { |
| 118 | __fh_size_t __b = __bos(__s, 0); | 118 | __fh_size_t __b = __fh_bos(__s, 0); |
| 119 | 119 | ||
| 120 | if (__l > __b) | 120 | if (__l > __b) |
| 121 | __builtin_trap(); | 121 | __builtin_trap(); |
| @@ -128,76 +128,76 @@ __diagnose_as_builtin(__builtin_pread, 1, 2, 3, 4) | |||
| 128 | _FORTIFY_FN(pread) ssize_t pread(int __f, void * _FORTIFY_POS0 __s, | 128 | _FORTIFY_FN(pread) ssize_t pread(int __f, void * _FORTIFY_POS0 __s, |
| 129 | size_t __n, off_t __o) | 129 | size_t __n, off_t __o) |
| 130 | { | 130 | { |
| 131 | __fh_size_t __b = __bos(__s, 0); | 131 | __fh_size_t __b = __fh_bos(__s, 0); |
| 132 | 132 | ||
| 133 | if (__n > __b) | 133 | if (__n > __b) |
| 134 | __builtin_trap(); | 134 | __builtin_trap(); |
| 135 | return __orig_pread(__f, __s, __n, __o); | 135 | return __orig_pread(__f, __s, __n, __o); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | __access(write_only, 2, 3) | 138 | __fh_access(write_only, 2, 3) |
| 139 | #if __has_builtin(__builtin_read) | 139 | #if __has_builtin(__builtin_read) |
| 140 | __diagnose_as_builtin(__builtin_read, 1, 2, 3) | 140 | __diagnose_as_builtin(__builtin_read, 1, 2, 3) |
| 141 | #endif | 141 | #endif |
| 142 | _FORTIFY_FN(read) ssize_t read(int __f, void * _FORTIFY_POS0 __s, size_t __n) | 142 | _FORTIFY_FN(read) ssize_t read(int __f, void * _FORTIFY_POS0 __s, size_t __n) |
| 143 | { | 143 | { |
| 144 | __fh_size_t __b = __bos(__s, 0); | 144 | __fh_size_t __b = __fh_bos(__s, 0); |
| 145 | 145 | ||
| 146 | if (__n > __b) | 146 | if (__n > __b) |
| 147 | __builtin_trap(); | 147 | __builtin_trap(); |
| 148 | return __orig_read(__f, __s, __n); | 148 | return __orig_read(__f, __s, __n); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | __access(write_only, 2, 3) | 151 | __fh_access(write_only, 2, 3) |
| 152 | #if __has_builtin(__builtin_readlink) | 152 | #if __has_builtin(__builtin_readlink) |
| 153 | __diagnose_as_builtin(__builtin_readlink, 1, 2, 3) | 153 | __diagnose_as_builtin(__builtin_readlink, 1, 2, 3) |
| 154 | #endif | 154 | #endif |
| 155 | _FORTIFY_FN(readlink) ssize_t readlink(const char *__p, | 155 | _FORTIFY_FN(readlink) ssize_t readlink(const char *__p, |
| 156 | char * _FORTIFY_POS0 __s, size_t __n) | 156 | char * _FORTIFY_POS0 __s, size_t __n) |
| 157 | { | 157 | { |
| 158 | __fh_size_t __b = __bos(__s, 0); | 158 | __fh_size_t __b = __fh_bos(__s, 0); |
| 159 | 159 | ||
| 160 | if (__n > __b) | 160 | if (__n > __b) |
| 161 | __builtin_trap(); | 161 | __builtin_trap(); |
| 162 | return __orig_readlink(__p, __s, __n); | 162 | return __orig_readlink(__p, __s, __n); |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | __access(write_only, 3, 4) | 165 | __fh_access(write_only, 3, 4) |
| 166 | #if __has_builtin(__builtin_readlinkat) | 166 | #if __has_builtin(__builtin_readlinkat) |
| 167 | __diagnose_as_builtin(__builtin_readlinkat, 1, 2, 3, 4) | 167 | __diagnose_as_builtin(__builtin_readlinkat, 1, 2, 3, 4) |
| 168 | #endif | 168 | #endif |
| 169 | _FORTIFY_FN(readlinkat) ssize_t readlinkat(int __f, const char *__p, | 169 | _FORTIFY_FN(readlinkat) ssize_t readlinkat(int __f, const char *__p, |
| 170 | char * _FORTIFY_POS0 __s, size_t __n) | 170 | char * _FORTIFY_POS0 __s, size_t __n) |
| 171 | { | 171 | { |
| 172 | __fh_size_t __b = __bos(__s, 0); | 172 | __fh_size_t __b = __fh_bos(__s, 0); |
| 173 | 173 | ||
| 174 | if (__n > __b) | 174 | if (__n > __b) |
| 175 | __builtin_trap(); | 175 | __builtin_trap(); |
| 176 | return __orig_readlinkat(__f, __p, __s, __n); | 176 | return __orig_readlinkat(__f, __p, __s, __n); |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | __access(write_only, 2, 3) | 179 | __fh_access(write_only, 2, 3) |
| 180 | #if __has_builtin(__builtin_ttyname_r) | 180 | #if __has_builtin(__builtin_ttyname_r) |
| 181 | __diagnose_as_builtin(__builtin_ttyname_r, 1, 2, 3) | 181 | __diagnose_as_builtin(__builtin_ttyname_r, 1, 2, 3) |
| 182 | #endif | 182 | #endif |
| 183 | _FORTIFY_FN(ttyname_r) int ttyname_r(int __f, char * _FORTIFY_POS0 __s, | 183 | _FORTIFY_FN(ttyname_r) int ttyname_r(int __f, char * _FORTIFY_POS0 __s, |
| 184 | size_t __n) | 184 | size_t __n) |
| 185 | { | 185 | { |
| 186 | __fh_size_t __b = __bos(__s, 0); | 186 | __fh_size_t __b = __fh_bos(__s, 0); |
| 187 | 187 | ||
| 188 | if (__n > __b) | 188 | if (__n > __b) |
| 189 | __builtin_trap(); | 189 | __builtin_trap(); |
| 190 | return __orig_ttyname_r(__f, __s, __n); | 190 | return __orig_ttyname_r(__f, __s, __n); |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | __access(read_only, 2, 3) | 193 | __fh_access(read_only, 2, 3) |
| 194 | #if __has_builtin(__builtin_write) | 194 | #if __has_builtin(__builtin_write) |
| 195 | __diagnose_as_builtin(__builtin_write, 1, 2, 3) | 195 | __diagnose_as_builtin(__builtin_write, 1, 2, 3) |
| 196 | #endif | 196 | #endif |
| 197 | _FORTIFY_FN(write) ssize_t write(int __f, const void * _FORTIFY_POS0 __s, | 197 | _FORTIFY_FN(write) ssize_t write(int __f, const void * _FORTIFY_POS0 __s, |
| 198 | size_t __n) | 198 | size_t __n) |
| 199 | { | 199 | { |
| 200 | __fh_size_t __b = __bos(__s, 0); | 200 | __fh_size_t __b = __fh_bos(__s, 0); |
| 201 | 201 | ||
| 202 | if (__n > __b) | 202 | if (__n > __b) |
| 203 | __builtin_trap(); | 203 | __builtin_trap(); |
| @@ -210,7 +210,7 @@ __diagnose_as_builtin(__builtin_pwrite, 1, 2, 3, 4) | |||
| 210 | _FORTIFY_FN(pwrite) ssize_t pwrite(int __f, const void * _FORTIFY_POS0 __s, | 210 | _FORTIFY_FN(pwrite) ssize_t pwrite(int __f, const void * _FORTIFY_POS0 __s, |
| 211 | size_t __n, off_t __o) | 211 | size_t __n, off_t __o) |
| 212 | { | 212 | { |
| 213 | __fh_size_t __b = __bos(__s, 0); | 213 | __fh_size_t __b = __fh_bos(__s, 0); |
| 214 | 214 | ||
| 215 | if (__n > __b) | 215 | if (__n > __b) |
| 216 | __builtin_trap(); | 216 | __builtin_trap(); |
