1 USING: kernel system combinators alien.syntax alien.c-types
2 math vocabs vocabs.loader unix classes.struct ;
7 CONSTANT: S_IFMT OCT: 170000 ! These bits determine file type.
9 CONSTANT: S_IFDIR OCT: 40000 ! Directory.
10 CONSTANT: S_IFCHR OCT: 20000 ! Character device.
11 CONSTANT: S_IFBLK OCT: 60000 ! Block device.
12 CONSTANT: S_IFREG OCT: 100000 ! Regular file.
13 CONSTANT: S_IFIFO OCT: 010000 ! FIFO.
14 CONSTANT: S_IFLNK OCT: 120000 ! Symbolic link.
15 CONSTANT: S_IFSOCK OCT: 140000 ! Socket.
16 CONSTANT: S_IFWHT OCT: 160000 ! Whiteout.
21 TYPEDEF: fsid __fsid_t
25 { linux [ "unix.stat.linux" require ] }
26 { macosx [ "unix.stat.macosx" require ] }
29 : file-status ( pathname -- stat )
30 \ stat <struct> [ [ stat ] unix-system-call drop ] keep ;
32 : link-status ( pathname -- stat )
33 \ stat <struct> [ [ lstat ] unix-system-call drop ] keep ;