Fei Jie | a4128a7 | 2016-03-01 16:55:36 +0800 | [diff] [blame] | 1 | #include "tests.h" |
Fei Jie | a4128a7 | 2016-03-01 16:55:36 +0800 | [diff] [blame] | 2 | #include <sys/syscall.h> |
| 3 | |
| 4 | #ifdef __NR_rename |
| 5 | |
| 6 | # include <stdio.h> |
| 7 | # include <unistd.h> |
| 8 | |
| 9 | # define OLD_FILE "rename_old" |
| 10 | # define NEW_FILE "rename_new" |
| 11 | |
| 12 | int |
| 13 | main(void) |
| 14 | { |
Dmitry V. Levin | f224909 | 2016-04-21 21:16:54 +0000 | [diff] [blame] | 15 | long rc = syscall(__NR_rename, OLD_FILE, NEW_FILE); |
| 16 | printf("rename(\"%s\", \"%s\") = %ld %s (%m)\n", |
| 17 | OLD_FILE, NEW_FILE, rc, errno2name()); |
Fei Jie | a4128a7 | 2016-03-01 16:55:36 +0800 | [diff] [blame] | 18 | |
| 19 | puts("+++ exited with 0 +++"); |
| 20 | return 0; |
| 21 | } |
| 22 | |
| 23 | #else |
| 24 | |
| 25 | SKIP_MAIN_UNDEFINED("__NR_rename") |
| 26 | |
| 27 | #endif |