diff --git a/tests/uid.awk b/tests/uid.awk index 6f07b44f..b79aa79f 100644 --- a/tests/uid.awk +++ b/tests/uid.awk @@ -1,6 +1,6 @@ BEGIN { r_uint = "(0|[1-9][0-9]*)" - regexp = "^getuid" suffix "\\(\\)[[:space:]]+= " r_uint "$" + regexp = "^getx?uid" suffix "\\(\\)[[:space:]]+= " r_uint "$" expected = "getuid" fail = 0 } diff --git a/tests/uid.c b/tests/uid.c index 28f548bd..f316d805 100644 --- a/tests/uid.c +++ b/tests/uid.c @@ -9,7 +9,7 @@ int main(void) { -#if defined(__NR_getuid) \ +#if (defined __NR_getuid || defined __NR_getxuid) \ && defined(__NR_setuid) \ && defined(__NR_getresuid) \ && defined(__NR_setreuid) \ @@ -20,6 +20,9 @@ main(void) int size; int *list = 0; +#ifndef __NR_getuid +# define __NR_getuid __NR_getxuid +#endif uid = syscall(__NR_getuid); assert(syscall(__NR_setuid, uid) == 0); { diff --git a/tests/uid.test b/tests/uid.test index 7bbcca7b..e214272d 100755 --- a/tests/uid.test +++ b/tests/uid.test @@ -9,7 +9,17 @@ w="${uid_t_size-}" run_prog ./uid$s$w -syscalls="getuid$s,setuid$s,getresuid$s,setreuid$s,setresuid$s,fchown$s,getgroups$s" +syscalls= +for n in "getuid$s" "getxuid$s"; do + if $STRACE -e "$n" -h > /dev/null; then + syscalls="$n" + break + fi +done +test -n "$syscalls" || + fail_ "neither getuid$s nor getxuid$s is supported on this architecture" + +syscalls="$syscalls,setuid$s,getresuid$s,setreuid$s,setresuid$s,fchown$s,getgroups$s" run_strace -e trace="$syscalls" $args AWK=gawk