| 1 | // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s |
| 2 | // |
| 3 | // UNSUPPORTED: target={{.*(linux|solaris).*}} |
| 4 | |
| 5 | #include <sys/types.h> |
| 6 | |
| 7 | #if defined(__NetBSD__) |
| 8 | #include <sys/statvfs.h> |
| 9 | #else |
| 10 | #include <sys/mount.h> |
| 11 | #endif |
| 12 | |
| 13 | #include <err.h> |
| 14 | #include <stdio.h> |
| 15 | #include <stdlib.h> |
| 16 | |
| 17 | int main(void) { |
| 18 | printf(format: "getmntinfo\n" ); |
| 19 | |
| 20 | #if defined(__NetBSD__) |
| 21 | struct statvfs *fss; |
| 22 | #else |
| 23 | struct statfs *fss; |
| 24 | #endif |
| 25 | int nfss = getmntinfo(&fss, MNT_NOWAIT); |
| 26 | if (nfss <= 0) |
| 27 | errx(status: 1, format: "getmntinfo" ); |
| 28 | |
| 29 | for (int i = 0; i < nfss; i++) |
| 30 | printf("%d: %s\n" , i, fss[i].f_fstypename); |
| 31 | |
| 32 | // CHECK: getmntinfo |
| 33 | |
| 34 | return 0; |
| 35 | } |
| 36 | |