1 #include "tests.h" 2 #include <asm/unistd.h> 3 4 #ifdef __NR_vhangup 5 6 # include <stdio.h> 7 # include <unistd.h> 8 9 int main(void)10main(void) 11 { 12 if (setsid() == -1) 13 perror_msg_and_skip("setsid"); 14 15 long rc = syscall(__NR_vhangup); 16 17 /* 18 * On setsid() success, the new session has no controlling terminal, 19 * therefore a subsequent vhangup() has nothing to hangup. 20 * 21 * The system call, however, returns 0 iff the calling process 22 * has CAP_SYS_TTY_CONFIG capability. 23 */ 24 printf("vhangup() = %s\n", sprintrc(rc)); 25 26 puts("+++ exited with 0 +++"); 27 return 0; 28 } 29 30 #else 31 32 SKIP_MAIN_UNDEFINED("__NR_vhangup") 33 34 #endif 35