1 /* $OpenBSD: test_stdio.c,v 1.2 2016/04/27 13:05:05 semarie Exp $ */ 2 /* 3 * Copyright (c) 2015 Sebastien Marie <semarie@openbsd.org> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18 #include <sys/types.h> 19 #include <sys/resource.h> 20 #include <sys/stat.h> 21 22 #include <errno.h> 23 #include <unistd.h> 24 25 void 26 test_request_stdio() 27 { 28 if (pledge("stdio", NULL) == -1) 29 _exit(errno); 30 31 clock_getres(CLOCK_MONOTONIC, NULL); 32 { struct timespec tp; clock_gettime(CLOCK_MONOTONIC, &tp); } 33 /* fchdir(); */ 34 getdtablecount(); 35 getegid(); 36 geteuid(); 37 getgid(); 38 getgroups(0, NULL); 39 { struct itimerval v; getitimer(ITIMER_REAL, &v); } 40 getlogin(); 41 getpgid(0); 42 getpgrp(); 43 getpid(); 44 getppid(); 45 /* getresgid(); */ 46 /* getresuid(); */ 47 { struct rlimit rl; getrlimit(RLIMIT_CORE, &rl); } 48 getsid(0); 49 getthrid(); 50 { struct timeval tp; gettimeofday(&tp, NULL); } 51 getuid(); 52 geteuid(); 53 issetugid(); 54 /* nanosleep(); */ 55 /* sigreturn(); */ 56 umask(0000); 57 /* wait4(); */ 58 } 59