mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 00:34:20 +08:00
proc: fixup uptime selftest
[ Upstream commit5cc81d5c81
] syscall(3) returns -1 and sets errno on error, unlike "syscall" instruction. Systems which have <= 32/64 CPUs are unaffected. Test won't bounce to all CPUs before completing if there are more of them. Link: https://lkml.kernel.org/r/Y1bUiT7VRXlXPQa1@p183 Fixes:1f5bd05476
("proc: selftests: test /proc/uptime") Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
07b8659b8e
commit
0df7d9ab6b
@ -17,6 +17,7 @@
|
|||||||
// while shifting across CPUs.
|
// while shifting across CPUs.
|
||||||
#undef NDEBUG
|
#undef NDEBUG
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -54,7 +55,7 @@ int main(void)
|
|||||||
len += sizeof(unsigned long);
|
len += sizeof(unsigned long);
|
||||||
free(m);
|
free(m);
|
||||||
m = malloc(len);
|
m = malloc(len);
|
||||||
} while (sys_sched_getaffinity(0, len, m) == -EINVAL);
|
} while (sys_sched_getaffinity(0, len, m) == -1 && errno == EINVAL);
|
||||||
|
|
||||||
fd = open("/proc/uptime", O_RDONLY);
|
fd = open("/proc/uptime", O_RDONLY);
|
||||||
assert(fd >= 0);
|
assert(fd >= 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user