fix mac stat
parent
bc5f19b919
commit
d656509e24
|
@ -8,7 +8,7 @@ C-STRUCT: stat
|
||||||
{ "dev_t" "st_dev" }
|
{ "dev_t" "st_dev" }
|
||||||
{ "mode_t" "st_mode" }
|
{ "mode_t" "st_mode" }
|
||||||
{ "nlink_t" "st_nlink" }
|
{ "nlink_t" "st_nlink" }
|
||||||
{ "ino_t" "st_ino" }
|
{ "ino64_t" "st_ino" }
|
||||||
{ "uid_t" "st_uid" }
|
{ "uid_t" "st_uid" }
|
||||||
{ "gid_t" "st_gid" }
|
{ "gid_t" "st_gid" }
|
||||||
{ "dev_t" "st_rdev" }
|
{ "dev_t" "st_rdev" }
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
|
|
||||||
USING: kernel system combinators alien.syntax alien.c-types
|
USING: kernel system combinators alien.syntax alien.c-types
|
||||||
math io.unix.backend vocabs.loader unix ;
|
math io.unix.backend vocabs.loader unix ;
|
||||||
|
|
||||||
IN: unix.stat
|
IN: unix.stat
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
! File Types
|
! File Types
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
|
|
||||||
: S_IFMT OCT: 170000 ; ! These bits determine file type.
|
: S_IFMT OCT: 170000 ; ! These bits determine file type.
|
||||||
|
|
||||||
|
@ -18,54 +14,38 @@ IN: unix.stat
|
||||||
: S_IFLNK OCT: 120000 ; inline ! Symbolic link.
|
: S_IFLNK OCT: 120000 ; inline ! Symbolic link.
|
||||||
: S_IFSOCK OCT: 140000 ; inline ! Socket.
|
: S_IFSOCK OCT: 140000 ; inline ! Socket.
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
! File Access Permissions
|
! File Access Permissions
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
: S_ISUID OCT: 0004000 ; inline
|
||||||
|
: S_ISGID OCT: 0002000 ; inline
|
||||||
! Read, write, execute/search by owner
|
: S_ISVTX OCT: 0001000 ; inline
|
||||||
: S_IRWXU OCT: 0000700 ; inline ! rwx mask owner
|
|
||||||
: S_IRUSR OCT: 0000400 ; inline ! r owner
|
: S_IRUSR OCT: 0000400 ; inline ! r owner
|
||||||
: S_IWUSR OCT: 0000200 ; inline ! w owner
|
: S_IWUSR OCT: 0000200 ; inline ! w owner
|
||||||
: S_IXUSR OCT: 0000100 ; inline ! x owner
|
: S_IXUSR OCT: 0000100 ; inline ! x owner
|
||||||
! Read, write, execute/search by group
|
|
||||||
: S_IRWXG OCT: 0000070 ; inline ! rwx mask group
|
|
||||||
: S_IRGRP OCT: 0000040 ; inline ! r group
|
: S_IRGRP OCT: 0000040 ; inline ! r group
|
||||||
: S_IWGRP OCT: 0000020 ; inline ! w group
|
: S_IWGRP OCT: 0000020 ; inline ! w group
|
||||||
: S_IXGRP OCT: 0000010 ; inline ! x group
|
: S_IXGRP OCT: 0000010 ; inline ! x group
|
||||||
! Read, write, execute/search by others
|
|
||||||
: S_IRWXO OCT: 0000007 ; inline ! rwx mask other
|
|
||||||
: S_IROTH OCT: 0000004 ; inline ! r other
|
: S_IROTH OCT: 0000004 ; inline ! r other
|
||||||
: S_IWOTH OCT: 0000002 ; inline ! w other
|
: S_IWOTH OCT: 0000002 ; inline ! w other
|
||||||
: S_IXOTH OCT: 0000001 ; inline ! x other
|
: S_IXOTH OCT: 0000001 ; inline ! x other
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
|
|
||||||
FUNCTION: int chmod ( char* path, mode_t mode ) ;
|
FUNCTION: int chmod ( char* path, mode_t mode ) ;
|
||||||
|
|
||||||
FUNCTION: int fchmod ( int fd, mode_t mode ) ;
|
FUNCTION: int fchmod ( int fd, mode_t mode ) ;
|
||||||
|
|
||||||
FUNCTION: int mkdir ( char* path, mode_t mode ) ;
|
FUNCTION: int mkdir ( char* path, mode_t mode ) ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
<< os {
|
||||||
<<
|
|
||||||
os
|
|
||||||
{
|
|
||||||
{ linux [ "unix.stat.linux" require ] }
|
{ linux [ "unix.stat.linux" require ] }
|
||||||
{ macosx [ "unix.stat.macosx" require ] }
|
{ macosx [ "unix.stat.macosx" require ] }
|
||||||
{ freebsd [ "unix.stat.freebsd" require ] }
|
{ freebsd [ "unix.stat.freebsd" require ] }
|
||||||
{ netbsd [ "unix.stat.netbsd" require ] }
|
{ netbsd [ "unix.stat.netbsd" require ] }
|
||||||
{ openbsd [ "unix.stat.openbsd" require ] }
|
{ openbsd [ "unix.stat.openbsd" require ] }
|
||||||
}
|
} case >>
|
||||||
case
|
|
||||||
>>
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
|
|
||||||
: file-status ( pathname -- stat )
|
: file-status ( pathname -- stat )
|
||||||
"stat" <c-object> dup >r
|
"stat" <c-object> [
|
||||||
[ stat ] unix-system-call drop
|
[ stat ] unix-system-call drop
|
||||||
r> ;
|
] keep ;
|
||||||
|
|
||||||
: link-status ( pathname -- stat )
|
: link-status ( pathname -- stat )
|
||||||
"stat" <c-object> dup >r
|
"stat" <c-object> [
|
||||||
[ lstat ] unix-system-call drop
|
[ lstat ] unix-system-call drop
|
||||||
r> ;
|
] keep ;
|
||||||
|
|
|
@ -22,6 +22,7 @@ TYPEDEF: __uint32_t uid_t
|
||||||
TYPEDEF: __uint32_t gid_t
|
TYPEDEF: __uint32_t gid_t
|
||||||
TYPEDEF: __int64_t off_t
|
TYPEDEF: __int64_t off_t
|
||||||
TYPEDEF: __int64_t blkcnt_t
|
TYPEDEF: __int64_t blkcnt_t
|
||||||
|
TYPEDEF: __int64_t ino64_t
|
||||||
TYPEDEF: __int32_t blksize_t
|
TYPEDEF: __int32_t blksize_t
|
||||||
TYPEDEF: long ssize_t
|
TYPEDEF: long ssize_t
|
||||||
TYPEDEF: __int32_t pid_t
|
TYPEDEF: __int32_t pid_t
|
||||||
|
|
Loading…
Reference in New Issue