diff options
| -rw-r--r-- | tools/testing/selftests/proc/read.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/testing/selftests/proc/read.c b/tools/testing/selftests/proc/read.c index b2bd8da58efe..b3ef9e14d6cc 100644 --- a/tools/testing/selftests/proc/read.c +++ b/tools/testing/selftests/proc/read.c | |||
| @@ -26,8 +26,10 @@ | |||
| 26 | #include <dirent.h> | 26 | #include <dirent.h> |
| 27 | #include <stdbool.h> | 27 | #include <stdbool.h> |
| 28 | #include <stdlib.h> | 28 | #include <stdlib.h> |
| 29 | #include <stdio.h> | ||
| 29 | #include <string.h> | 30 | #include <string.h> |
| 30 | #include <sys/stat.h> | 31 | #include <sys/stat.h> |
| 32 | #include <sys/vfs.h> | ||
| 31 | #include <fcntl.h> | 33 | #include <fcntl.h> |
| 32 | #include <unistd.h> | 34 | #include <unistd.h> |
| 33 | 35 | ||
| @@ -123,10 +125,22 @@ static void f(DIR *d, unsigned int level) | |||
| 123 | int main(void) | 125 | int main(void) |
| 124 | { | 126 | { |
| 125 | DIR *d; | 127 | DIR *d; |
| 128 | struct statfs sfs; | ||
| 126 | 129 | ||
| 127 | d = opendir("/proc"); | 130 | d = opendir("/proc"); |
| 128 | if (!d) | 131 | if (!d) |
| 129 | return 4; | 132 | return 4; |
| 133 | |||
| 134 | /* Ensure /proc is proc. */ | ||
| 135 | if (fstatfs(dirfd(d), &sfs) == -1) { | ||
| 136 | return 1; | ||
| 137 | } | ||
| 138 | if (sfs.f_type != 0x9fa0) { | ||
| 139 | fprintf(stderr, "error: unexpected f_type %lx\n", (long)sfs.f_type); | ||
| 140 | return 2; | ||
| 141 | } | ||
| 142 | |||
| 130 | f(d, 0); | 143 | f(d, 0); |
| 144 | |||
| 131 | return 0; | 145 | return 0; |
| 132 | } | 146 | } |
