9 main(int argc, char* argv[])
12 printf("missing operand\n");
16 int fd = open(argv[1], FO_RDONLY | FO_NOFOLLOW);
18 printf("fail to open %d\n", errno);
22 struct file_stat stat;
23 if (fstat(fd, &stat) < 0) {
24 printf("fail to get stat %d\n", errno);
28 printf("File: %s ", argv[1]);
30 char* ftype = "directory";
33 ftype = "mappable (sequential) device";
35 if (!((mode & F_SVDEV) ^ F_SVDEV)) {
36 ftype = "volumetric device";
39 } else if ((mode & F_SYMLINK)) {
40 if (readlinkat(fd, NULL, buf, 256) < 0) {
41 printf("fail to readlink %d\n", errno);
45 ftype = "symbolic link";
46 } else if (mode == F_FILE) {
47 ftype = "regular file";
50 printf("\nType: %s\n", ftype);
51 printf("Size: %d; Blocks: %d; FS Block: %d; IO Blocks: %d\n",
56 printf("Inode: %d; ", stat.st_ino);
59 if (!(stat.mode & F_DEV)) {
65 printf("Device: %xh:%xh@%d;\n", dev->meta, dev->unique, dev->index);