Fei Jie | 8346e63 | 2016-03-25 17:47:14 +0800 | [diff] [blame] | 1 | #include "tests.h" |
| 2 | #include <sys/syscall.h> |
| 3 | |
| 4 | #ifdef __NR_creat |
| 5 | |
| 6 | # include <errno.h> |
| 7 | # include <stdio.h> |
| 8 | # include <sys/stat.h> |
| 9 | # include <unistd.h> |
| 10 | |
| 11 | # define TMP_FILE "creat" |
| 12 | |
| 13 | int |
| 14 | main(void) |
| 15 | { |
| 16 | int rc = syscall(__NR_creat, TMP_FILE, S_IRUSR); |
| 17 | printf("creat(\"%s\", %#o) = %d %s (%m)\n", |
| 18 | TMP_FILE, S_IRUSR, rc, |
| 19 | errno == ENOSYS ? "ENOSYS" : "ETXTBSY"); |
| 20 | |
| 21 | puts("+++ exited with 0 +++"); |
| 22 | return 0; |
| 23 | } |
| 24 | |
| 25 | #else |
| 26 | |
| 27 | SKIP_MAIN_UNDEFINED("__NR_creat") |
| 28 | |
| 29 | #endif |