This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] tst-getcpu: decode errno when sched_getcpu fails
- From: Mike Frysinger <vapier at gentoo dot org>
- To: libc-alpha at sourceware dot org
- Date: Sun, 3 Jun 2012 02:56:38 -0400
- Subject: [PATCH] tst-getcpu: decode errno when sched_getcpu fails
The tst-getcpu test is failing on ia64 platforms due to sched_getcpu
returning an error. But the current test only considers -1 when it's
also ENOSYS. Tweak the logic a bit to make the output clearer.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-06 Mike Frysinger <vapier@gentoo.org>
* sysdeps/unix/sysv/linux/tst-getcpu.c (do_test): Call perror when
cpu2 is -1 and errno is not ENOSYS.
---
sysdeps/unix/sysv/linux/tst-getcpu.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/tst-getcpu.c b/sysdeps/unix/sysv/linux/tst-getcpu.c
index bf3cb57..77baebc 100644
--- a/sysdeps/unix/sysv/linux/tst-getcpu.c
+++ b/sysdeps/unix/sysv/linux/tst-getcpu.c
@@ -31,10 +31,15 @@ do_test (void)
else
{
int cpu2 = sched_getcpu ();
- if (cpu2 == -1 && errno == ENOSYS)
+ if (cpu2 == -1)
{
- puts ("getcpu syscall not implemented");
- return 0;
+ if (errno == ENOSYS)
+ {
+ puts ("getcpu syscall not implemented");
+ return 0;
+ }
+ perror ("getcpu failed");
+ result = 1;
}
if (cpu2 != cpu)
{
--
1.7.9.7