2008-02-29 00:46:27 -05:00
|
|
|
USING: kernel system combinators alien.syntax alien.c-types
|
2008-10-07 08:43:49 -04:00
|
|
|
math io.unix.backend vocabs.loader unix ;
|
2008-02-27 02:55:49 -05:00
|
|
|
IN: unix.stat
|
|
|
|
|
2008-02-28 13:46:01 -05:00
|
|
|
! File Types
|
|
|
|
|
|
|
|
: S_IFMT OCT: 170000 ; ! These bits determine file type.
|
|
|
|
|
2008-04-11 13:57:43 -04:00
|
|
|
: S_IFDIR OCT: 40000 ; inline ! Directory.
|
|
|
|
: S_IFCHR OCT: 20000 ; inline ! Character device.
|
|
|
|
: S_IFBLK OCT: 60000 ; inline ! Block device.
|
|
|
|
: S_IFREG OCT: 100000 ; inline ! Regular file.
|
|
|
|
: S_IFIFO OCT: 010000 ; inline ! FIFO.
|
|
|
|
: S_IFLNK OCT: 120000 ; inline ! Symbolic link.
|
|
|
|
: S_IFSOCK OCT: 140000 ; inline ! Socket.
|
2008-02-28 13:46:01 -05:00
|
|
|
|
|
|
|
FUNCTION: int chmod ( char* path, mode_t mode ) ;
|
|
|
|
FUNCTION: int fchmod ( int fd, mode_t mode ) ;
|
|
|
|
FUNCTION: int mkdir ( char* path, mode_t mode ) ;
|
|
|
|
|
2008-10-07 08:43:49 -04:00
|
|
|
<< os {
|
2008-04-02 19:25:33 -04:00
|
|
|
{ linux [ "unix.stat.linux" require ] }
|
|
|
|
{ macosx [ "unix.stat.macosx" require ] }
|
|
|
|
{ freebsd [ "unix.stat.freebsd" require ] }
|
|
|
|
{ netbsd [ "unix.stat.netbsd" require ] }
|
|
|
|
{ openbsd [ "unix.stat.openbsd" require ] }
|
2008-10-07 08:43:49 -04:00
|
|
|
} case >>
|
2008-02-28 13:46:01 -05:00
|
|
|
|
2008-05-13 14:32:55 -04:00
|
|
|
: file-status ( pathname -- stat )
|
2008-10-19 14:10:28 -04:00
|
|
|
"stat" <c-object> [ [ stat ] unix-system-call drop ] keep ;
|
2008-02-27 02:55:49 -05:00
|
|
|
|
2008-05-13 14:32:55 -04:00
|
|
|
: link-status ( pathname -- stat )
|
2008-10-19 14:10:28 -04:00
|
|
|
"stat" <c-object> [ [ lstat ] unix-system-call drop ] keep ;
|