tests: use sprintrc in set_mempolicy.test
* tests/set_mempolicy.c (main, print_nodes): Use sprintrc.
This commit is contained in:
parent
416896888d
commit
746d6eb2e2
@ -58,7 +58,7 @@ print_nodes(const unsigned long maxnode, unsigned int offset)
|
||||
memset(nodemask, 0, size);
|
||||
|
||||
long rc = syscall(__NR_set_mempolicy, 0, nodemask, maxnode);
|
||||
int saved_errno = errno;
|
||||
const char *errstr = sprintrc(rc);
|
||||
|
||||
fputs("set_mempolicy(MPOL_DEFAULT, ", stdout);
|
||||
|
||||
@ -88,13 +88,7 @@ print_nodes(const unsigned long maxnode, unsigned int offset)
|
||||
printf("[]");
|
||||
}
|
||||
|
||||
printf(", %lu) = ", maxnode);
|
||||
if (rc) {
|
||||
errno = saved_errno;
|
||||
printf("%ld %s (%m)\n", rc, errno2name());
|
||||
} else {
|
||||
puts("0");
|
||||
}
|
||||
printf(", %lu) = %s\n", maxnode, errstr);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -135,8 +129,8 @@ main(void)
|
||||
const unsigned long *nodemask = (void *) 0xfacefeedfffffffe;
|
||||
const unsigned long maxnode = (unsigned long) 0xcafef00dbadc0ded;
|
||||
long rc = syscall(__NR_set_mempolicy, 1, nodemask, maxnode);
|
||||
printf("set_mempolicy(MPOL_PREFERRED, %p, %lu) = %ld %s (%m)\n",
|
||||
nodemask, maxnode, rc, errno2name());
|
||||
printf("set_mempolicy(MPOL_PREFERRED, %p, %lu) = %s\n",
|
||||
nodemask, maxnode, sprintrc(rc));
|
||||
|
||||
test_offset(0);
|
||||
test_offset(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user