1 USING: kernel system combinators alien.syntax alien.c-types
2 math io.backend.unix vocabs.loader unix ;
7 : S_IFMT OCT: 170000 ; ! These bits determine file type.
9 : S_IFDIR OCT: 40000 ; inline ! Directory.
10 : S_IFCHR OCT: 20000 ; inline ! Character device.
11 : S_IFBLK OCT: 60000 ; inline ! Block device.
12 : S_IFREG OCT: 100000 ; inline ! Regular file.
13 : S_IFIFO OCT: 010000 ; inline ! FIFO.
14 : S_IFLNK OCT: 120000 ; inline ! Symbolic link.
15 : S_IFSOCK OCT: 140000 ; inline ! Socket.
16 : S_IFWHT OCT: 160000 ; inline ! 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 ;