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 ] }
27 { freebsd [ "unix.stat.freebsd" require ] }
28 { netbsd [ "unix.stat.netbsd" require ] }
29 { openbsd [ "unix.stat.openbsd" require ] }
32 : file-status ( pathname -- stat )
33 \ stat <struct> [ [ stat ] unix-system-call drop ] keep ;
35 : link-status ( pathname -- stat )
36 \ stat <struct> [ [ lstat ] unix-system-call drop ] keep ;