#define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../kselftest.h" static long sys_kcmp(int pid1, int pid2, int type, int fd1, int fd2) { return syscall(__NR_kcmp, pid1, pid2, type, fd1, fd2); } int main(int argc, char **argv) { const char kpath[] = "kcmp-test-file"; int pid1, pid2; int fd1, fd2; int status; fd1 = open(kpath, O_RDWR | O_CREAT | O_TRUNC, 0644); pid1 = getpid(); if (fd1 < 0) { perror("Can't create file"); ksft_exit_fail(); } pid2 = fork(); if (pid2 < 0) { perror("fork failed"); ksft_exit_fail(); } if (!pid2) { int pid2 = getpid(); int ret; fd2 = open(kpath, O_RDWR, 0644); if (fd2 < 0) { perror("Can't open file"); ksft_exit_fail(); } /* An example of output and arguments */ printf("pid1: %6d pid2: %6d FD: %2ld FILES: %2ld VM: %2ld " "FS: %2ld SIGHAND: %2ld IO: %2ld SYSVSEM: %2ld " "INV: %2ld\n", pid1, pid2, sys_kcmp(pid1, pid2, KCMP_FILE, fd1, fd2), sys_kcmp(pid1, pid2, KCMP_FILES, 0, 0), sys_kcmp(pid1, pid2, KCMP_VM, 0, 0), sys_kcmp(pid1, pid2, KCMP_FS, 0, 0), sys_kcmp(pid1, pid2, KCMP_SIGHAND, 0, 0), sys_kcmp(pid1, pid2, KCMP_IO, 0, 0), sys_kcmp(pid1, pid2, KCMP_SYSVSEM, 0, 0), /* This one should fail */ sys_kcmp(pid1, pid2, KCMP_TYPES + 1, 0, 0)); /* This one should return same fd */ ret = sys_kcmp(pid1, pid2, KCMP_FILE, fd1, fd1); if (ret) { printf("FAIL: 0 expected but %d returned (%s)\n", ret, strerror(errno)); ksft_inc_fail_cnt(); ret = -1; } else { printf("PASS: 0 returned as expected\n"); ksft_inc_pass_cnt(); } /* Compare with self */ ret = sys_kcmp(pid1, pid1, KCMP_VM, 0, 0); if (ret) { printf("FAIL: 0 expected but %d returned (%s)\n", ret, strerror(errno)); ksft_inc_fail_cnt(); ret = -1; } else { printf("PASS: 0 returned as expected\n"); ksft_inc_pass_cnt(); } ksft_print_cnts(); if (ret) ksft_exit_fail(); else ksft_exit_pass(); } waitpid(pid2, &status, P_ALL); return ksft_exit_pass(); } ' method='get' action='/cgit.cgi/linux/net-next.git/log/tools/gpio/gpio-utils.h'>
diff options
context:
space:
mode:
authorSedat Dilek <sedat.dilek@gmail.com>2016-12-26 11:05:11 +0100
committerThomas Gleixner <tglx@linutronix.de>2016-12-27 11:42:12 +0100
commit7e164ce4e8ecd7e9a58a83750bd3ee03125df154 (patch)
tree72014145699b741f20d3533c9b352e6db263c5a2 /tools/gpio/gpio-utils.h
parent0dad3a3014a0b9e72521ff44f17e0054f43dcdea (diff)
perf/x86/amd/ibs: Fix typo after cleanup state names in cpu/hotplug
Fix a small typo after cleanup state names in cpu/hotplug. The new convention is 'subsys/xxx/yyy:state' where "state" here is called "starting" not "STARTING". Fixes: 73c1b41e63f0 ("cpu/hotplug: Cleanup state names") Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Borislav Petkov <bp@suse.de> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Link: http://lkml.kernel.org/r/20161226100511.8662-1-sedat.dilek@gmail.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'tools/gpio/gpio-utils.h')