ish/tests/stat.c
2017-06-14 20:32:37 -07:00

29 lines
658 B
C

#define _LARGEFILE64_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
int main() {
struct stat64 statbuf;
if (fstat64(1, &statbuf) < 0) {
perror("fstat"); return 1;
}
write(1, &statbuf, sizeof(statbuf));
/* char buf[1000]; */
/* int len; */
/* #define PTIF(n) \ */
/* len = sprintf(buf, #n " %llx\n", (long long) statbuf.st_##n); \ */
/* write(1, buf, len); */
/* PTIF(dev) */
/* PTIF(ino); */
/* PTIF(mode); */
/* PTIF(nlink); */
/* PTIF(uid); */
/* PTIF(gid); */
/* PTIF(rdev); */
/* PTIF(size); */
/* PTIF(blksize); */
/* PTIF(blocks); */
return 0;
}