42-archive/unikernel-demo/fs1/stat/main.c
Louis Solofrizzo 6a1c3734e6 fs: Add stat example
Signed-off-by: Louis Solofrizzo <lsolofrizzo@online.net>
2019-04-25 11:30:39 +02:00

20 lines
338 B
C

#include <stdio.h>
#include <sys/stat.h>
#ifndef USERSPACE
#define main ukl_main
#endif
int main(void)
{
struct stat st = { 0 };
if (stat("/etc/passwd", &st) != 0)
{
fprintf(stderr, "Cannot stat() /etc/passwd\n");
return 1;
}
printf("Size of /etc/passwd: %zu bytes\n", st.st_size);
return 0;
}