-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathstat.cpp
59 lines (42 loc) · 1.5 KB
/
stat.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "faasm/faasm.h"
#include <sys/stat.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
struct stat64 s
{};
// NOTE: in the wasm world the struct has different types, so print whines
// here if we don't branch
#ifdef __wasm__
stat64("/", &s);
printf("st_dev: %llu\n", s.st_dev);
printf("st_ino: %llu\n", s.st_ino);
printf("st_nlink: %llu\n", s.st_nlink);
printf("st_mode: %i\n", s.st_mode);
printf("st_uid: %i\n", s.st_uid);
printf("st_gid: %i\n", s.st_gid);
printf("st_rdev: %llu\n", s.st_rdev);
printf("st_size: %lli\n", s.st_size);
printf("st_blksize: %li\n", s.st_blksize);
printf("st_blocks: %lli\n", s.st_blocks);
printf("st_atim.tv_sec: %lli\n", s.st_atim.tv_sec);
printf("st_mtim.tv_sec: %lli\n", s.st_mtim.tv_sec);
printf("st_ctim.tv_sec: %lli\n", s.st_ctim.tv_sec);
#else
stat64("/usr/local/faasm/runtime_root/", &s);
printf("st_dev: %lu\n", s.st_dev);
printf("st_ino: %lu\n", s.st_ino);
printf("st_nlink: %lu\n", s.st_nlink);
printf("st_mode: %i\n", s.st_mode);
printf("st_uid: %i\n", s.st_uid);
printf("st_gid: %i\n", s.st_gid);
printf("st_rdev: %lu\n", s.st_rdev);
printf("st_size: %li\n", s.st_size);
printf("st_blksize: %li\n", s.st_blksize);
printf("st_blocks: %li\n", s.st_blocks);
printf("st_atim.tv_sec: %li\n", s.st_atim.tv_sec);
printf("st_mtim.tv_sec: %li\n", s.st_mtim.tv_sec);
printf("st_ctim.tv_sec: %li\n", s.st_ctim.tv_sec);
#endif
return 0;
}