From afcf3cd8ebff8fed79238a2d1b95338c4606b1ee Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Thu, 10 Nov 2016 09:28:00 -0200 Subject: New internal function __access_noerrno Implement an internal version of __access called __access_noerrno that avoids setting errno. This is useful to check accessibility of files very early on in process startup i.e. before TLS setup. This allows tunables to replace MALLOC_CHECK_ safely (i.e. check existence of /etc/suid-debug to enable/disable MALLOC_CHECK) and at the same time initialize very early so that it can override IFUNCs. Checked on x86_64. * hurd/hurd.h (__hurd_fail_noerrno): New function. * include/unistd.h [IS_IN (rtld) || !defined SHARED]: Declare __access_noerrno. * io/access.c (__access_noerrno): New function. * sysdeps/mach/hurd/access.c (hurd_fail_seterrno): New function. (hurd_fail_seterrno): Likewise. (access_common): Likewise. (__access_noerrno): Likewise. * sysdeps/nacl/access.c (__access_noerrno): Likewise. * sysdeps/unix/sysv/linux/access.c (__access_noerrno): Likewise. * sysdeps/nacl/nacl-interfaces.h (NACL_CALL_NOERRNO): New macro. --- include/unistd.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/unistd.h b/include/unistd.h index d2802b2b3e..6144f411aa 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -181,6 +181,12 @@ extern int __getlogin_r_loginuid (char *name, size_t namesize) # include # endif +# if IS_IN (rtld) || !defined SHARED +/* __access variant that does not set errno. Used in very early initialization + code in libc.a and ld.so. */ +extern __typeof (__access) __access_noerrno attribute_hidden; +# endif + __END_DECLS # endif -- cgit v1.2.3