diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2016-11-10 09:28:00 -0200 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2016-11-16 15:53:58 -0200 |
commit | afcf3cd8ebff8fed79238a2d1b95338c4606b1ee (patch) | |
tree | 0e21226d1c0fac1db0af0c829c093d59b121eb85 /hurd/hurd.h | |
parent | Fix SH4 register-dump.h for soft-float. (diff) | |
download | glibc-afcf3cd8ebff8fed79238a2d1b95338c4606b1ee.tar.gz glibc-afcf3cd8ebff8fed79238a2d1b95338c4606b1ee.tar.bz2 glibc-afcf3cd8ebff8fed79238a2d1b95338c4606b1ee.zip |
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.
Diffstat (limited to 'hurd/hurd.h')
-rw-r--r-- | hurd/hurd.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/hurd/hurd.h b/hurd/hurd.h index ec0782797d..c089d4c445 100644 --- a/hurd/hurd.h +++ b/hurd/hurd.h @@ -75,6 +75,35 @@ __hurd_fail (error_t err) errno = err; return -1; } + +_HURD_H_EXTERN_INLINE int +__hurd_fail_noerrno (error_t err) +{ + switch (err) + { + case EMACH_SEND_INVALID_DEST: + case EMIG_SERVER_DIED: + /* The server has disappeared! */ + err = EIEIO; + break; + + case KERN_NO_SPACE: + err = ENOMEM; + break; + + case KERN_INVALID_ARGUMENT: + err = EINVAL; + break; + + case 0: + return 0; + + default: + break; + } + + return -1; +} /* Basic ports and info, initialized by startup. */ |