1 USING: kernel system combinators alien.syntax alien.c-types
2 math io.backend.unix vocabs.loader unix ;
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.
18 FUNCTION: int chmod ( char* path, mode_t mode ) ;
19 FUNCTION: int fchmod ( int fd, mode_t mode ) ;
20 FUNCTION: int mkdir ( char* path, mode_t mode ) ;
23 { { "int" 2 } "__val" } ;
25 TYPEDEF: fsid __fsid_t
29 { linux [ "unix.stat.linux" require ] }
30 { macosx [ "unix.stat.macosx" require ] }
31 { freebsd [ "unix.stat.freebsd" require ] }
32 { netbsd [ "unix.stat.netbsd" require ] }
33 { openbsd [ "unix.stat.openbsd" require ] }
36 : file-status ( pathname -- stat )
37 "stat" <c-object> [ [ stat ] unix-system-call drop ] keep ;
39 : link-status ( pathname -- stat )
40 "stat" <c-object> [ [ lstat ] unix-system-call drop ] keep ;