From 7ea793f39ca1362bc1d6587d29b1e7f52eb8a9a1 Mon Sep 17 00:00:00 2001 From: Chris Metcalf Date: Mon, 5 Jan 2015 12:06:15 -0500 Subject: tile: check error properly for vDSO calls The tile vDSO vsyscalls were not properly setting the error value. Conventionally, tile returns the same "non-negative success, negative errno" value that x86 does (in r0), but it also returns "zero or positive errno" in r1, which is what the regular syscall code checks. This change uses that convention for the vDSO calls as well. --- sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h | 12 ++++++++++-- sysdeps/unix/sysv/linux/tile/init-first.c | 6 ++++-- sysdeps/unix/sysv/linux/tile/sysdep.h | 8 ++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'sysdeps/unix') diff --git a/sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h b/sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h index cc720f1db6..44f828630f 100644 --- a/sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h +++ b/sysdeps/unix/sysv/linux/tile/bits/libc-vdso.h @@ -22,10 +22,18 @@ #ifdef SHARED -extern long int (*__vdso_gettimeofday) (struct timeval *, void *) +struct syscall_return_value +{ + long int value; + long int error; +}; + +extern struct syscall_return_value (*__vdso_gettimeofday) (struct timeval *, + void *) attribute_hidden; -extern long int (*__vdso_clock_gettime) (clockid_t, struct timespec *); +extern struct syscall_return_value (*__vdso_clock_gettime) (clockid_t, + struct timespec *); #endif diff --git a/sysdeps/unix/sysv/linux/tile/init-first.c b/sysdeps/unix/sysv/linux/tile/init-first.c index 6e7917c341..75dbfd79b9 100644 --- a/sysdeps/unix/sysv/linux/tile/init-first.c +++ b/sysdeps/unix/sysv/linux/tile/init-first.c @@ -19,9 +19,11 @@ #include #include -long int (*__vdso_gettimeofday) (struct timeval *, void *) attribute_hidden; +struct syscall_return_value (*__vdso_gettimeofday) (struct timeval *, void *) + attribute_hidden; -long int (*__vdso_clock_gettime) (clockid_t, struct timespec *) +struct syscall_return_value (*__vdso_clock_gettime) (clockid_t, + struct timespec *) __attribute__ ((nocommon)); strong_alias (__vdso_clock_gettime, __GI___vdso_clock_gettime attribute_hidden) diff --git a/sysdeps/unix/sysv/linux/tile/sysdep.h b/sysdeps/unix/sysv/linux/tile/sysdep.h index 074b916764..64c8920645 100644 --- a/sysdeps/unix/sysv/linux/tile/sysdep.h +++ b/sysdeps/unix/sysv/linux/tile/sysdep.h @@ -217,7 +217,9 @@ __typeof (__vdso_##name) vdsop = __vdso_##name; \ if (vdsop != NULL) \ { \ - sc_ret = vdsop (args); \ + struct syscall_return_value rv = vdsop (args); \ + sc_ret = rv.value; \ + sc_err = rv.error; \ if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ goto out; \ if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \ @@ -242,7 +244,9 @@ __typeof (__vdso_##name) vdsop = __vdso_##name; \ if (vdsop != NULL) \ { \ - v_ret = vdsop (args); \ + struct syscall_return_value rv = vdsop (args); \ + v_ret = rv.value; \ + err = rv.error; \ if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \ || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \ goto out; \ -- cgit v1.2.3