]> gitweb.factorcode.org Git - factor.git/blob - basis/unix/stat/stat.factor
classes.struct: moving to new/boa instead of <struct>/<struct-boa>
[factor.git] / basis / unix / stat / stat.factor
1 USING: accessors alien.c-types alien.syntax classes.struct
2 kernel sequences system unix vocabs ;
3 IN: unix.stat
4
5 ! File Types
6
7 CONSTANT: S_IFMT   0o170000   ! These bits determine file type.
8
9 CONSTANT: S_IFDIR  0o040000   ! Directory.
10 CONSTANT: S_IFCHR  0o020000   ! Character device.
11 CONSTANT: S_IFBLK  0o060000   ! 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.
17
18 STRUCT: fsid
19     { __val int[2] } ;
20
21 TYPEDEF: fsid __fsid_t
22 TYPEDEF: fsid fsid_t
23
24 << "unix.stat." os name>> append require >>
25
26 : file-status ( pathname -- stat )
27     \ stat new [ [ stat-func ] unix-system-call drop ] keep ;
28
29 : link-status ( pathname -- stat )
30     \ stat new [ [ lstat ] unix-system-call drop ] keep ;