1 USING: kernel system combinators alien.syntax alien.c-types
2 math vocabs vocabs.loader unix classes.struct ;
7 CONSTANT: S_IFMT 0o170000 ! These bits determine file type.
9 CONSTANT: S_IFDIR 0o40000 ! Directory.
10 CONSTANT: S_IFCHR 0o20000 ! Character device.
11 CONSTANT: S_IFBLK 0o60000 ! Block device.
12 CONSTANT: S_IFREG 0o100000 ! Regular file.
13 CONSTANT: S_IFIFO 0o010000 ! FIFO.
14 CONSTANT: S_IFLNK 0o120000 ! Symbolic link.
15 CONSTANT: S_IFSOCK 0o140000 ! Socket.
16 CONSTANT: S_IFWHT 0o160000 ! 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 ;