Fei Jie | 275d135 | 2016-03-09 14:07:06 +0800 | [diff] [blame] | 1 | #include "tests.h" |
| 2 | #include <sys/syscall.h> |
| 3 | |
| 4 | #ifdef __NR_acct |
| 5 | |
| 6 | # include <assert.h> |
| 7 | # include <errno.h> |
| 8 | # include <stdio.h> |
| 9 | # include <unistd.h> |
| 10 | |
| 11 | # define TMP_FILE "acct_tmpfile" |
| 12 | |
| 13 | int |
| 14 | main(void) |
| 15 | { |
| 16 | assert(syscall(__NR_acct, TMP_FILE) == -1); |
| 17 | const char *errno_text; |
| 18 | switch(errno) { |
| 19 | case ENOSYS: |
| 20 | errno_text = "ENOSYS"; |
| 21 | break; |
| 22 | case EPERM: |
| 23 | errno_text = "EPERM"; |
| 24 | break; |
| 25 | default: |
| 26 | errno_text = "ENOENT"; |
| 27 | } |
| 28 | printf("acct(\"%s\") = -1 %s (%m)\n", |
| 29 | TMP_FILE, errno_text); |
| 30 | |
| 31 | puts("+++ exited with 0 +++"); |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | #else |
| 36 | |
| 37 | SKIP_MAIN_UNDEFINED("__NR__acct") |
| 38 | |
| 39 | #endif |