Fei Jie | 2e069fc | 2016-04-19 15:38:32 +0800 | [diff] [blame^] | 1 | #include "tests.h" |
| 2 | #include <sys/syscall.h> |
| 3 | |
| 4 | #ifdef __NR_ioperm |
| 5 | |
| 6 | # include <errno.h> |
| 7 | # include <stdio.h> |
| 8 | # include <unistd.h> |
| 9 | |
| 10 | int |
| 11 | main(void) |
| 12 | { |
| 13 | const unsigned long port = (unsigned long) 0xdeafbeefffffffff; |
| 14 | long rc = syscall(__NR_ioperm, port, 1, 0); |
| 15 | const char *error_text; |
| 16 | switch (errno) { |
| 17 | case EIO: |
| 18 | error_text = "EIO"; |
| 19 | break; |
| 20 | case ENOSYS: |
| 21 | error_text = "ENOSYS"; |
| 22 | break; |
| 23 | case EPERM: |
| 24 | error_text = "EPERM"; |
| 25 | break; |
| 26 | default: |
| 27 | error_text = "EINVAL"; |
| 28 | } |
| 29 | printf("ioperm(%#lx, %#lx, %d) = %ld %s (%m)\n", |
| 30 | port, 1UL, 0, rc, error_text); |
| 31 | |
| 32 | puts("+++ exited with 0 +++"); |
| 33 | return 0; |
| 34 | } |
| 35 | |
| 36 | #else |
| 37 | |
| 38 | SKIP_MAIN_UNDEFINED("__NR_ioperm") |
| 39 | |
| 40 | #endif |