1 | // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s |
---|---|
2 | // UNSUPPORTED: target={{.*(linux|solaris).*}} |
3 | |
4 | #include <sys/cdefs.h> |
5 | #include <sys/stat.h> |
6 | |
7 | #include <assert.h> |
8 | #include <stdio.h> |
9 | #include <stdlib.h> |
10 | |
11 | int main(void) { |
12 | struct stat st; |
13 | char name[100]; |
14 | mode_t type; |
15 | |
16 | assert(!stat("/dev/null", &st)); |
17 | |
18 | type = S_ISCHR(st.st_mode) ? S_IFCHR : S_IFBLK; |
19 | |
20 | #if defined(__NetBSD__) |
21 | assert(!devname_r(st.st_rdev, type, name, sizeof(name))); |
22 | #else |
23 | assert(devname_r(st.st_rdev, type, name, sizeof(name))); |
24 | #endif |
25 | |
26 | printf(format: "%s\n", name); |
27 | |
28 | // CHECK: null |
29 | |
30 | return 0; |
31 | } |
32 |