diff options
author | Jakub Jelinek <jakub@redhat.com> | 2005-03-19 21:04:10 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2005-03-19 21:04:10 +0000 |
commit | 8f8ebbc438fcb4b22fba8beb3ef3d1aa59d9d7bf (patch) | |
tree | b7091affa76bbaf47e78a59dfc72b2102554eaf9 /posix/bits | |
parent | f5c3480e830e94e0e51a0bdb1053944daed8bc58 (diff) |
Updated to fedora-glibc-20050319T1907cvs/fedora-glibc-2_3_4-15
Diffstat (limited to 'posix/bits')
-rw-r--r-- | posix/bits/unistd.h | 96 |
1 files changed, 65 insertions, 31 deletions
diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h index dab98af569..988f0167ed 100644 --- a/posix/bits/unistd.h +++ b/posix/bits/unistd.h @@ -21,44 +21,78 @@ # error "Never include <bits/unistd.h> directly; use <unistd.h> instead." #endif -extern void __chk_fail (void) __attribute__((noreturn)); -#define read(fd, buf, nbytes) \ - (__extension__ \ - ({ size_t __nbytes_val = (nbytes); \ - if (__bos0 (buf) != (size_t) -1 && __bos0 (buf) < __nbytes_val) \ - __chk_fail (); \ - read (fd, buf, __nbytes_val); })) +extern void __chk_fail (void) __attribute__((__noreturn__)); +extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf, + size_t __nbytes), read) __wur; + +extern __always_inline __wur ssize_t +read (int __fd, void *__buf, size_t __nbytes) +{ + if (__bos0 (__buf) != (size_t) -1 && __nbytes > __bos0 (__buf)) + __chk_fail (); + return __read_alias (__fd, __buf, __nbytes); +} #ifdef __USE_UNIX98 -# define pread(fd, buf, nbytes, offset) \ - (__extension__ \ - ({ size_t __nbytes_val = (nbytes); \ - if (__bos0 (buf) != (size_t) -1 && __bos0 (buf) < __nbytes_val) \ - __chk_fail (); \ - pread (fd, buf, __nbytes_val, offset); })) +extern ssize_t __REDIRECT (__pread_alias, + (int __fd, void *__buf, size_t __nbytes, + __off_t __offset), pread) __wur; +extern ssize_t __REDIRECT (__pread64_alias, + (int __fd, void *__buf, size_t __nbytes, + __off64_t __offset), pread64) __wur; + +# ifndef __USE_FILE_OFFSET64 +extern __always_inline __wur ssize_t +pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) +{ + if (__bos0 (__buf) != (size_t) -1 && __nbytes > __bos0 (__buf)) + __chk_fail (); + return __pread_alias (__fd, __buf, __nbytes, __offset); +} +# else +extern __always_inline __wur ssize_t +pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset) +{ + if (__bos0 (__buf) != (size_t) -1 && __nbytes > __bos0 (__buf)) + __chk_fail (); + return __pread64_alias (__fd, __buf, __nbytes, __offset); +} +# endif # ifdef __USE_LARGEFILE64 -# define pread64(fd, buf, nbytes, offset) \ - (__extension__ \ - ({ size_t __nbytes_val = (nbytes); \ - if (__bos0 (buf) != (size_t) -1 && __bos0 (buf) < __nbytes_val) \ - __chk_fail (); \ - pread64 (fd, buf, __nbytes_val, offset); })) +extern __always_inline __wur ssize_t +pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) +{ + if (__bos0 (__buf) != (size_t) -1 && __nbytes > __bos0 (__buf)) + __chk_fail (); + return __pread64_alias (__fd, __buf, __nbytes, __offset); +} # endif #endif #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K -# define readlink(path, buf, len) \ - (__extension__ \ - ({ size_t __len_val = (len); \ - if (__bos (buf) != (size_t) -1 && __bos (buf) < __len_val) \ - __chk_fail (); \ - readlink (path, buf, __len_val); })) +extern int __REDIRECT_NTH (__readlink_alias, + (__const char *__restrict __path, + char *__restrict __buf, size_t __len), readlink) + __nonnull ((1, 2)) __wur; + +extern __always_inline __nonnull ((1, 2)) __wur int +__NTH (readlink (__const char *__restrict __path, char *__restrict __buf, + size_t __len)) +{ + if (__bos (__buf) != (size_t) -1 && __len > __bos (__buf)) + __chk_fail (); + return __readlink_alias (__path, __buf, __len); +} #endif -#define getcwd(buf, size) \ - (__extension__ \ - ({ size_t __size_val = (size); \ - if (__bos (buf) != (size_t) -1 && __bos (buf) < __size_val) \ - __chk_fail (); \ - getcwd (buf, __size_val); })) +extern char *__REDIRECT_NTH (__getcwd_alias, + (char *__buf, size_t __size), getcwd) __wur; + +extern __always_inline __wur char * +__NTH (getcwd (char *__buf, size_t __size)) +{ + if (__bos (__buf) != (size_t) -1 && __size > __bos (__buf)) + __chk_fail (); + return __getcwd_alias (__buf, __size); +} |