Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / NetBSD / getvfsstat.cpp
blobea72e41ede0fa7c1a58bb73e7aef90ce5cc0721b
1 // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
3 #include <sys/types.h>
5 #include <sys/statvfs.h>
7 #include <assert.h>
8 #include <stdio.h>
9 #include <stdlib.h>
11 int main(void) {
12 printf("getvfsstat\n");
14 int rv = getvfsstat(NULL, 0, ST_WAIT);
15 assert(rv != -1);
17 size_t sz = rv * sizeof(struct statvfs);
18 struct statvfs *buf = (struct statvfs *)malloc(sz);
19 assert(buf);
21 rv = getvfsstat(buf, sz, ST_WAIT);
22 assert(rv != -1);
24 for (int i = 0; i < rv; i++) {
25 printf("Filesystem %d\n", i);
26 printf("\tfstypename=%s\n", buf[i].f_fstypename);
27 printf("\tmntonname=%s\n", buf[i].f_mntonname);
28 printf("\tmntfromname=%s\n", buf[i].f_mntfromname);
31 free(buf);
33 // CHECK: getvfsstat
35 return 0;