]> granicus.if.org Git - strace/blob - tests/xetpriority.c
Update NEWS
[strace] / tests / xetpriority.c
1 #include "tests.h"
2 #include <asm/unistd.h>
3
4 #if defined __NR_getpriority && defined __NR_setpriority
5
6 # include <stdio.h>
7 # include <sys/resource.h>
8 # include <unistd.h>
9
10 int
11 main(void)
12 {
13         const int pid = getpid();
14         long rc = syscall(__NR_getpriority, PRIO_PROCESS,
15                           (unsigned long) 0xffffffff00000000ULL | pid);
16         printf("getpriority(PRIO_PROCESS, %d) = %ld\n", pid, rc);
17
18         rc = syscall(__NR_setpriority, PRIO_PROCESS,
19                      (unsigned long) 0xffffffff00000000ULL | pid,
20                      (unsigned long) 0xffffffff00000000ULL);
21         printf("setpriority(PRIO_PROCESS, %d, 0) = %s\n", pid, sprintrc(rc));
22
23         puts("+++ exited with 0 +++");
24         return 0;
25 }
26
27 #else
28
29 SKIP_MAIN_UNDEFINED("__NR_getpriority && _NR_setpriority")
30
31 #endif