1// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
2//
3// UNSUPPORTED: darwin, target={{.*(linux|solaris).*}}
4
5#include <assert.h>
6#include <errno.h>
7#include <stdio.h>
8#include <string.h>
9#include <fstab.h>
10
11int main(void) {
12 printf(format: "getfsent\n");
13
14 setfsent();
15 struct fstab *fentry = getfsent();
16
17 assert(fentry);
18
19 setfsent();
20 struct fstab *pentry = getfsspec(name: fentry->fs_spec);
21 assert(pentry);
22 setfsent();
23 struct fstab *wentry = getfsfile(name: fentry->fs_file);
24 assert(wentry);
25 assert(!memcmp(fentry, wentry, sizeof(*wentry)));
26 assert(!memcmp(pentry, wentry, sizeof(*pentry)));
27
28 printf(format: "First entry: device block '%s', mounted with '%s'\n",
29 fentry->fs_spec, fentry->fs_mntops);
30
31 endfsent();
32
33 return 0;
34 // CHECK: getfsent
35 // CHECK: First entry: device block '{{.*}}', mounted with '{{.*}}'
36}
37

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