mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-09 23:00:07 +00:00
(read, pread, pread64, readlink, getcwd, getwd): Change macros into extern inline functions. (__read_alias, __pread_alias, __pread64_alias, __readlink_alias, __getcwd_alias, __getwd_alias): New prototypes.
This commit is contained in:
parent
959184846b
commit
60bd9f7c41
@ -23,37 +23,58 @@
|
|||||||
|
|
||||||
extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes,
|
extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes,
|
||||||
size_t __buflen) __wur;
|
size_t __buflen) __wur;
|
||||||
#define read(fd, buf, nbytes) \
|
extern ssize_t __REDIRECT (__read_alias, (int __fd, void *__buf,
|
||||||
(__bos0 (buf) != (size_t) -1 \
|
size_t __nbytes), read) __wur;
|
||||||
&& (!__builtin_constant_p (nbytes) || (nbytes) > __bos0 (buf)) \
|
|
||||||
? __read_chk (fd, buf, nbytes, __bos0 (buf)) \
|
extern __inline __wur ssize_t
|
||||||
: read (fd, buf, nbytes))
|
read (int __fd, void *__buf, size_t __nbytes)
|
||||||
|
{
|
||||||
|
if (__bos0 (__buf) != (size_t) -1
|
||||||
|
&& (!__builtin_constant_p (__nbytes) || __nbytes > __bos0 (__buf)))
|
||||||
|
return __read_chk (__fd, __buf, __nbytes, __bos0 (__buf));
|
||||||
|
return __read_alias (__fd, __buf, __nbytes);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __USE_UNIX98
|
#ifdef __USE_UNIX98
|
||||||
extern ssize_t __pread_chk (int __fd, void *__buf, size_t __nbytes,
|
extern ssize_t __pread_chk (int __fd, void *__buf, size_t __nbytes,
|
||||||
__off_t __offset, size_t __bufsize) __wur;
|
__off_t __offset, size_t __bufsize) __wur;
|
||||||
extern ssize_t __pread64_chk (int __fd, void *__buf, size_t __nbytes,
|
extern ssize_t __pread64_chk (int __fd, void *__buf, size_t __nbytes,
|
||||||
__off64_t __offset, size_t __bufsize) __wur;
|
__off64_t __offset, size_t __bufsize) __wur;
|
||||||
|
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
|
# ifndef __USE_FILE_OFFSET64
|
||||||
# define pread(fd, buf, nbytes, offset) \
|
extern __inline __wur ssize_t
|
||||||
(__bos0 (buf) != (size_t) -1 \
|
pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
|
||||||
&& (!__builtin_constant_p (nbytes) || (nbytes) > __bos0 (buf)) \
|
{
|
||||||
? __pread64_chk (fd, buf, nbytes, offset, __bos0 (buf)) \
|
if (__bos0 (__buf) != (size_t) -1
|
||||||
: pread64 (fd, buf, nbytes, offset))
|
&& (!__builtin_constant_p (__nbytes) || __nbytes > __bos0 (__buf)))
|
||||||
|
return __pread_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
|
||||||
|
return __pread_alias (__fd, __buf, __nbytes, __offset);
|
||||||
|
}
|
||||||
# else
|
# else
|
||||||
# define pread(fd, buf, nbytes, offset) \
|
extern __inline __wur ssize_t
|
||||||
(__bos0 (buf) != (size_t) -1 \
|
pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset)
|
||||||
&& (!__builtin_constant_p (nbytes) || (nbytes) > __bos0 (buf)) \
|
{
|
||||||
? __pread_chk (fd, buf, nbytes, offset, __bos0 (buf)) \
|
if (__bos0 (__buf) != (size_t) -1
|
||||||
: pread (fd, buf, nbytes, offset))
|
&& (!__builtin_constant_p (__nbytes) || __nbytes > __bos0 (__buf)))
|
||||||
|
return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
|
||||||
|
return __pread64_alias (__fd, __buf, __nbytes, __offset);
|
||||||
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef __USE_LARGEFILE64
|
# ifdef __USE_LARGEFILE64
|
||||||
# define pread64(fd, buf, nbytes, offset) \
|
extern __inline __wur ssize_t
|
||||||
(__bos0 (buf) != (size_t) -1 \
|
pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
|
||||||
&& (!__builtin_constant_p (nbytes) || (nbytes) > __bos0 (buf)) \
|
{
|
||||||
? __pread64_chk (fd, buf, nbytes, offset, __bos0 (buf)) \
|
if (__bos0 (__buf) != (size_t) -1
|
||||||
: pread64 (fd, buf, nbytes, offset))
|
&& (!__builtin_constant_p (__nbytes) || __nbytes > __bos0 (__buf)))
|
||||||
|
return __pread64_chk (__fd, __buf, __nbytes, __offset, __bos0 (__buf));
|
||||||
|
return __pread64_alias (__fd, __buf, __nbytes, __offset);
|
||||||
|
}
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -62,23 +83,44 @@ extern int __readlink_chk (__const char *__restrict __path,
|
|||||||
char *__restrict __buf, size_t __len,
|
char *__restrict __buf, size_t __len,
|
||||||
size_t __buflen)
|
size_t __buflen)
|
||||||
__THROW __nonnull ((1, 2)) __wur;
|
__THROW __nonnull ((1, 2)) __wur;
|
||||||
# define readlink(path, buf, len) \
|
extern int __REDIRECT_NTH (__readlink_alias,
|
||||||
(__bos (buf) != (size_t) -1 \
|
(__const char *__restrict __path,
|
||||||
&& (!__builtin_constant_p (len) || (len) > __bos (buf)) \
|
char *__restrict __buf, size_t __len), readlink)
|
||||||
? __readlink_chk (path, buf, len, __bos (buf)) \
|
__nonnull ((1, 2)) __wur;
|
||||||
: readlink (path, buf, len))
|
extern __inline __nonnull ((1, 2)) __wur int
|
||||||
|
__NTH (readlink (__const char *__restrict __path, char *__restrict __buf,
|
||||||
|
size_t __len))
|
||||||
|
{
|
||||||
|
if (__bos (__buf) != (size_t) -1
|
||||||
|
&& (!__builtin_constant_p (__len) || __len > __bos (__buf)))
|
||||||
|
return __readlink_chk (__path, __buf, __len, __bos (__buf));
|
||||||
|
return __readlink_alias (__path, __buf, __len);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen)
|
extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen)
|
||||||
__THROW __wur;
|
__THROW __wur;
|
||||||
#define getcwd(buf, size) \
|
extern char *__REDIRECT_NTH (__getcwd_alias,
|
||||||
(__bos (buf) != (size_t) -1 \
|
(char *__buf, size_t __size), getcwd) __wur;
|
||||||
&& (!__builtin_constant_p (size) || (size) > __bos (buf)) \
|
extern __inline __wur char *
|
||||||
? __getcwd_chk (buf, size, buflen) : getcwd (buf, size))
|
__NTH (getcwd (char *__buf, size_t __size))
|
||||||
|
{
|
||||||
|
if (__bos (__buf) != (size_t) -1
|
||||||
|
&& (!__builtin_constant_p (__size) || __size > __bos (__buf)))
|
||||||
|
return __getcwd_chk (__buf, __size, __bos (__buf));
|
||||||
|
return __getcwd_alias (__buf, __size);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
|
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
|
||||||
extern char *__getwd_chk (char *__buf, size_t buflen)
|
extern char *__getwd_chk (char *__buf, size_t buflen)
|
||||||
__THROW __nonnull ((1)) __attribute_deprecated__ __wur;
|
__THROW __nonnull ((1)) __wur;
|
||||||
#define getwd(buf) \
|
extern char *__REDIRECT_NTH (__getwd_alias, (char *__buf), getwd)
|
||||||
(__bos (buf) != (size_t) -1 ? __getwd_chk (buf, buflen) : getwd (buf))
|
__nonnull ((1)) __wur;
|
||||||
|
extern __inline __nonnull ((1)) __attribute_deprecated__ __wur char *
|
||||||
|
__NTH (getwd (char *__buf))
|
||||||
|
{
|
||||||
|
if (__bos (__buf) != (size_t) -1)
|
||||||
|
return __getwd_chk (__buf, __bos (__buf));
|
||||||
|
return __getwd_alias (__buf);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user