1// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
2// UNSUPPORTED: target={{.*(linux|solaris).*}}
3
4#include <assert.h>
5#include <stdio.h>
6#include <stdlib.h>
7#include <sys/stat.h>
8
9int main(void) {
10 struct stat st;
11 char *name;
12
13 assert(!stat("/dev/null", &st));
14 assert((name = devname(st.st_rdev, S_ISCHR(st.st_mode) ? S_IFCHR : S_IFBLK)));
15
16 printf(format: "%s\n", name);
17
18 // CHECK: null
19
20 return 0;
21}
22

source code of compiler-rt/test/sanitizer_common/TestCases/Posix/devname.cpp