diff options
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r-- | sysdeps/unix/sysv/linux/Versions | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/fips-private.h | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/gethostid.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/getloadavg.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/getlogin_r.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/getsysstats.c | 4 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/smp.h | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/has_cpuclock.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/libc_fatal.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/malloc-sysdep.h | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/not-cancel.h | 10 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/pthread_getname.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/read.c | 12 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sysconf.c | 2 |
14 files changed, 28 insertions, 19 deletions
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions index 3c64077f05..b553514c27 100644 --- a/sysdeps/unix/sysv/linux/Versions +++ b/sysdeps/unix/sysv/linux/Versions @@ -170,6 +170,7 @@ libc { # functions used in other libraries __syscall_rt_sigqueueinfo; __open_nocancel; + __read_nocancel; # functions used by nscd __netlink_assert_response; } diff --git a/sysdeps/unix/sysv/linux/fips-private.h b/sysdeps/unix/sysv/linux/fips-private.h index 3a83a0f158..775f2c2b50 100644 --- a/sysdeps/unix/sysv/linux/fips-private.h +++ b/sysdeps/unix/sysv/linux/fips-private.h @@ -49,7 +49,7 @@ fips_enabled_p (void) /* This is more than enough, the file contains a single integer. */ char buf[32]; ssize_t n; - n = TEMP_FAILURE_RETRY (read_not_cancel (fd, buf, sizeof (buf) - 1)); + n = TEMP_FAILURE_RETRY (__read_nocancel (fd, buf, sizeof (buf) - 1)); close_not_cancel_no_status (fd); if (n > 0) diff --git a/sysdeps/unix/sysv/linux/gethostid.c b/sysdeps/unix/sysv/linux/gethostid.c index 3ea8656b05..6e19dee30a 100644 --- a/sysdeps/unix/sysv/linux/gethostid.c +++ b/sysdeps/unix/sysv/linux/gethostid.c @@ -80,7 +80,7 @@ gethostid (void) fd = __open_nocancel (HOSTIDFILE, O_RDONLY|O_LARGEFILE, 0); if (fd >= 0) { - ssize_t n = read_not_cancel (fd, &id, sizeof (id)); + ssize_t n = __read_nocancel (fd, &id, sizeof (id)); close_not_cancel_no_status (fd); diff --git a/sysdeps/unix/sysv/linux/getloadavg.c b/sysdeps/unix/sysv/linux/getloadavg.c index 0bfe41dae4..64bad17046 100644 --- a/sysdeps/unix/sysv/linux/getloadavg.c +++ b/sysdeps/unix/sysv/linux/getloadavg.c @@ -42,7 +42,7 @@ getloadavg (double loadavg[], int nelem) ssize_t nread; int i; - nread = read_not_cancel (fd, buf, sizeof buf - 1); + nread = __read_nocancel (fd, buf, sizeof buf - 1); close_not_cancel_no_status (fd); if (nread <= 0) return -1; diff --git a/sysdeps/unix/sysv/linux/getlogin_r.c b/sysdeps/unix/sysv/linux/getlogin_r.c index 2519792267..1de746b3d3 100644 --- a/sysdeps/unix/sysv/linux/getlogin_r.c +++ b/sysdeps/unix/sysv/linux/getlogin_r.c @@ -41,7 +41,7 @@ __getlogin_r_loginuid (char *name, size_t namesize) /* We are reading a 32-bit number. 12 bytes are enough for the text representation. If not, something is wrong. */ char uidbuf[12]; - ssize_t n = TEMP_FAILURE_RETRY (read_not_cancel (fd, uidbuf, + ssize_t n = TEMP_FAILURE_RETRY (__read_nocancel (fd, uidbuf, sizeof (uidbuf))); close_not_cancel_no_status (fd); diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c index e21a34cb9b..d1400d6cc6 100644 --- a/sysdeps/unix/sysv/linux/getsysstats.c +++ b/sysdeps/unix/sysv/linux/getsysstats.c @@ -85,7 +85,7 @@ next_line (int fd, char *const buffer, char **cp, char **re, *re = buffer + (*re - *cp); *cp = buffer; - ssize_t n = read_not_cancel (fd, *re, buffer_end - *re); + ssize_t n = __read_nocancel (fd, *re, buffer_end - *re); if (n < 0) return NULL; @@ -96,7 +96,7 @@ next_line (int fd, char *const buffer, char **cp, char **re, { /* Truncate too long lines. */ *re = buffer + 3 * (buffer_end - buffer) / 4; - n = read_not_cancel (fd, *re, buffer_end - *re); + n = __read_nocancel (fd, *re, buffer_end - *re); if (n < 0) return NULL; diff --git a/sysdeps/unix/sysv/linux/i386/smp.h b/sysdeps/unix/sysv/linux/i386/smp.h index c24f2fd748..eb1ac5ddea 100644 --- a/sysdeps/unix/sysv/linux/i386/smp.h +++ b/sysdeps/unix/sysv/linux/i386/smp.h @@ -43,7 +43,7 @@ is_smp_system (void) /* This was not successful. Now try reading the /proc filesystem. */ int fd = __open_nocancel ("/proc/sys/kernel/version", O_RDONLY); if (__builtin_expect (fd, 0) == -1 - || read_not_cancel (fd, u.buf, sizeof (u.buf)) <= 0) + || __read_nocancel (fd, u.buf, sizeof (u.buf)) <= 0) /* This also didn't work. We give up and say it's a UP machine. */ u.buf[0] = '\0'; diff --git a/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c b/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c index 04e395bc8d..6aab1e87a6 100644 --- a/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c +++ b/sysdeps/unix/sysv/linux/ia64/has_cpuclock.c @@ -37,7 +37,7 @@ has_cpuclock (void) /* We expect the file to contain a single digit followed by a newline. If the format changes we better not rely on the file content. */ - if (read_not_cancel (fd, buf, sizeof buf) != 2 + if (__read_nocancel (fd, buf, sizeof buf) != 2 || buf[0] != '0' || buf[1] != '\n') newval = -1; diff --git a/sysdeps/unix/sysv/linux/libc_fatal.c b/sysdeps/unix/sysv/linux/libc_fatal.c index 5b484cf591..ca838a7eca 100644 --- a/sysdeps/unix/sysv/linux/libc_fatal.c +++ b/sysdeps/unix/sysv/linux/libc_fatal.c @@ -56,7 +56,7 @@ backtrace_and_maps (int do_abort, bool written, int fd) int fd2 = __open_nocancel ("/proc/self/maps", O_RDONLY); char buf[1024]; ssize_t n2; - while ((n2 = read_not_cancel (fd2, buf, sizeof (buf))) > 0) + while ((n2 = __read_nocancel (fd2, buf, sizeof (buf))) > 0) if (write_not_cancel (fd, buf, n2) != n2) break; close_not_cancel_no_status (fd2); diff --git a/sysdeps/unix/sysv/linux/malloc-sysdep.h b/sysdeps/unix/sysv/linux/malloc-sysdep.h index cb87b58637..7a7acbadb8 100644 --- a/sysdeps/unix/sysv/linux/malloc-sysdep.h +++ b/sysdeps/unix/sysv/linux/malloc-sysdep.h @@ -47,7 +47,7 @@ check_may_shrink_heap (void) if (fd >= 0) { char val; - ssize_t n = read_not_cancel (fd, &val, 1); + ssize_t n = __read_nocancel (fd, &val, 1); may_shrink_heap = n > 0 && val == '2'; close_not_cancel_no_status (fd); } diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h index 8d897f0a4c..3d26075e11 100644 --- a/sysdeps/unix/sysv/linux/not-cancel.h +++ b/sysdeps/unix/sysv/linux/not-cancel.h @@ -34,9 +34,9 @@ libc_hidden_proto (__open_nocancel) __typeof (open64) __open64_nocancel; libc_hidden_proto (__open64_nocancel) -/* Uncancelable read. */ -#define __read_nocancel(fd, buf, len) \ - INLINE_SYSCALL (read, 3, fd, buf, len) +/* Non cancellable read syscall. */ +__typeof (__read) __read_nocancel; +libc_hidden_proto (__read_nocancel) /* Uncancelable write. */ #define __write_nocancel(fd, buf, len) \ @@ -61,10 +61,6 @@ libc_hidden_proto (__open64_nocancel) (void) ({ INTERNAL_SYSCALL_DECL (err); \ INTERNAL_SYSCALL (close, err, 1, (fd)); }) -/* Uncancelable read. */ -#define read_not_cancel(fd, buf, n) \ - __read_nocancel (fd, buf, n) - /* Uncancelable write. */ #define write_not_cancel(fd, buf, n) \ __write_nocancel (fd, buf, n) diff --git a/sysdeps/unix/sysv/linux/pthread_getname.c b/sysdeps/unix/sysv/linux/pthread_getname.c index caab2ccb25..93c1dfd729 100644 --- a/sysdeps/unix/sysv/linux/pthread_getname.c +++ b/sysdeps/unix/sysv/linux/pthread_getname.c @@ -50,7 +50,7 @@ pthread_getname_np (pthread_t th, char *buf, size_t len) return errno; int res = 0; - ssize_t n = TEMP_FAILURE_RETRY (read_not_cancel (fd, buf, len)); + ssize_t n = TEMP_FAILURE_RETRY (__read_nocancel (fd, buf, len)); if (n < 0) res = errno; else diff --git a/sysdeps/unix/sysv/linux/read.c b/sysdeps/unix/sysv/linux/read.c index 2a02c1bae4..e021df89b4 100644 --- a/sysdeps/unix/sysv/linux/read.c +++ b/sysdeps/unix/sysv/linux/read.c @@ -18,6 +18,7 @@ #include <unistd.h> #include <sysdep-cancel.h> +#include <not-cancel.h> /* Read NBYTES into BUF from FD. Return the number read or -1. */ ssize_t @@ -31,3 +32,14 @@ libc_hidden_def (__read) weak_alias (__libc_read, __read) libc_hidden_def (read) weak_alias (__libc_read, read) + +#if !IS_IN (rtld) +ssize_t +__read_nocancel (int fd, void *buf, size_t nbytes) +{ + return INLINE_SYSCALL_CALL (read, fd, buf, nbytes); +} +#else +strong_alias (__libc_read, __read_nocancel) +#endif +libc_hidden_def (__read_nocancel) diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c index ab068ab43f..f9becfbb33 100644 --- a/sysdeps/unix/sysv/linux/sysconf.c +++ b/sysdeps/unix/sysv/linux/sysconf.c @@ -121,7 +121,7 @@ __sysconf (int name) /* This is more than enough, the file contains a single integer. */ char buf[32]; ssize_t n; - n = TEMP_FAILURE_RETRY (read_not_cancel (fd, buf, sizeof (buf) - 1)); + n = TEMP_FAILURE_RETRY (__read_nocancel (fd, buf, sizeof (buf) - 1)); close_not_cancel_no_status (fd); if (n > 0) |