2 USING: kernel system combinators alien.syntax alien.c-types
3 math io.unix.backend vocabs.loader unix ;
7 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11 : S_IFMT OCT: 170000 ; ! These bits determine file type.
13 : S_IFDIR OCT: 40000 ; inline ! Directory.
14 : S_IFCHR OCT: 20000 ; inline ! Character device.
15 : S_IFBLK OCT: 60000 ; inline ! Block device.
16 : S_IFREG OCT: 100000 ; inline ! Regular file.
17 : S_IFIFO OCT: 010000 ; inline ! FIFO.
18 : S_IFLNK OCT: 120000 ; inline ! Symbolic link.
19 : S_IFSOCK OCT: 140000 ; inline ! Socket.
21 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
22 ! File Access Permissions
23 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
25 ! Read, write, execute/search by owner
26 : S_IRWXU OCT: 0000700 ; inline ! rwx mask owner
27 : S_IRUSR OCT: 0000400 ; inline ! r owner
28 : S_IWUSR OCT: 0000200 ; inline ! w owner
29 : S_IXUSR OCT: 0000100 ; inline ! x owner
30 ! Read, write, execute/search by group
31 : S_IRWXG OCT: 0000070 ; inline ! rwx mask group
32 : S_IRGRP OCT: 0000040 ; inline ! r group
33 : S_IWGRP OCT: 0000020 ; inline ! w group
34 : S_IXGRP OCT: 0000010 ; inline ! x group
35 ! Read, write, execute/search by others
36 : S_IRWXO OCT: 0000007 ; inline ! rwx mask other
37 : S_IROTH OCT: 0000004 ; inline ! r other
38 : S_IWOTH OCT: 0000002 ; inline ! w other
39 : S_IXOTH OCT: 0000001 ; inline ! x other
41 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
43 FUNCTION: int chmod ( char* path, mode_t mode ) ;
45 FUNCTION: int fchmod ( int fd, mode_t mode ) ;
47 FUNCTION: int mkdir ( char* path, mode_t mode ) ;
49 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
53 { linux [ "unix.stat.linux" require ] }
54 { macosx [ "unix.stat.macosx" require ] }
55 { freebsd [ "unix.stat.freebsd" require ] }
56 { netbsd [ "unix.stat.netbsd" require ] }
57 { openbsd [ "unix.stat.openbsd" require ] }
61 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
63 : file-status ( pathname -- stat )
64 "stat" <c-object> dup >r
65 [ stat ] unix-system-call drop
68 : link-status ( pathname -- stat )
69 "stat" <c-object> dup >r
70 [ lstat ] unix-system-call drop