unix: Factor out what corresponds to <sys/types.h> into unix.types
unix.stat: Add a macosx branchdb4
parent
951b2c174b
commit
208b88c753
|
@ -0,0 +1,52 @@
|
|||
|
||||
USING: kernel alien.syntax math ;
|
||||
|
||||
IN: unix.stat
|
||||
|
||||
! Mac OS X ppc
|
||||
|
||||
C-STRUCT: stat
|
||||
{ "dev_t" "st_dev" }
|
||||
{ "ino_t" "st_ino" }
|
||||
{ "mode_t" "st_mode" }
|
||||
{ "nlink_t" "st_nlink" }
|
||||
{ "uid_t" "st_uid" }
|
||||
{ "gid_t" "st_gid" }
|
||||
{ "dev_t" "st_rdev" }
|
||||
{ "timespec" "st_atimespec" }
|
||||
{ "timespec" "st_mtimespec" }
|
||||
{ "timespec" "st_ctimespec" }
|
||||
{ "off_t" "st_size" }
|
||||
{ "blkcnt_t" "st_blocks" }
|
||||
{ "blksize_t" "st_blksize" }
|
||||
{ "__uint32_t" "st_flags" }
|
||||
{ "__uint32_t" "st_gen" }
|
||||
{ "__int32_t" "st_lspare" }
|
||||
{ "__int64_t" "st_qspare0" }
|
||||
{ "__int64_t" "st_qspare1" } ;
|
||||
|
||||
FUNCTION: int stat ( char* pathname, stat* buf ) ;
|
||||
FUNCTION: int lstat ( char* pathname, stat* buf ) ;
|
||||
|
||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
: S_IFMT OCT: 170000 ; ! These bits determine file type.
|
||||
|
||||
: S_IFDIR OCT: 40000 ; ! Directory.
|
||||
: S_IFCHR OCT: 20000 ; ! Character device.
|
||||
: S_IFBLK OCT: 60000 ; ! Block device.
|
||||
: S_IFREG OCT: 100000 ; ! Regular file.
|
||||
: S_IFIFO OCT: 010000 ; ! FIFO.
|
||||
: S_IFLNK OCT: 120000 ; ! Symbolic link.
|
||||
: S_IFSOCK OCT: 140000 ; ! Socket.
|
||||
|
||||
: S_ISTYPE ( mode mask -- val ) >r S_IFMT bitand r> = ;
|
||||
|
||||
: S_ISREG ( mode -- value ) S_IFREG S_ISTYPE ;
|
||||
: S_ISDIR ( mode -- value ) S_IFDIR S_ISTYPE ;
|
||||
: S_ISCHR ( mode -- value ) S_IFCHR S_ISTYPE ;
|
||||
: S_ISBLK ( mode -- value ) S_IFBLK S_ISTYPE ;
|
||||
: S_ISFIFO ( mode -- value ) S_IFIFO S_ISTYPE ;
|
||||
: S_ISLNK ( mode -- value ) S_IFLNK S_ISTYPE ;
|
||||
: S_ISSOCK ( mode -- value ) S_IFSOCK S_ISTYPE ;
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
USING: alien.syntax ;
|
||||
|
||||
IN: unix.types
|
||||
|
||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
TYPEDEF: ulonglong __uquad_type
|
||||
TYPEDEF: ulong __ulongword_type
|
||||
TYPEDEF: uint __uword_type
|
||||
TYPEDEF: long __slongword_type
|
||||
TYPEDEF: int __sword_type
|
||||
TYPEDEF: uint __u32_type
|
||||
TYPEDEF: int __s32_type
|
||||
|
||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
TYPEDEF: __uquad_type dev_t
|
||||
TYPEDEF: __ulongword_type ino_t
|
||||
TYPEDEF: __u32_type mode_t
|
||||
TYPEDEF: __uword_type nlink_t
|
||||
TYPEDEF: __u32_type uid_t
|
||||
TYPEDEF: __u32_type gid_t
|
||||
TYPEDEF: __slongword_type off_t
|
||||
TYPEDEF: __slongword_type blksize_t
|
||||
TYPEDEF: __slongword_type blkcnt_t
|
||||
TYPEDEF: __sword_type ssize_t
|
||||
TYPEDEF: __s32_type pid_t
|
||||
TYPEDEF: __slongword_type time_t
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
IN: unix.types
|
||||
|
||||
! Darwin 9.1.0 ppc
|
||||
|
||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
TYPEDEF: ushort __uint16_t
|
||||
TYPEDEF: uint __uint32_t
|
||||
TYPEDEF: int __int32_t
|
||||
TYPEDEF: longlong __int64_t
|
||||
|
||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
TYPEDEF: __int32_t dev_t
|
||||
TYPEDEF: __uint32_t ino_t
|
||||
TYPEDEF: __uint16_t mode_t
|
||||
TYPEDEF: __uint16_t nlink_t
|
||||
TYPEDEF: __uint32_t uid_t
|
||||
TYPEDEF: __uint32_t gid_t
|
||||
TYPEDEF: __int64_t off_t
|
||||
TYPEDEF: __int64_t blkcnt_t
|
||||
TYPEDEF: __int32_t blksize_t
|
||||
TYPEDEF: long ssize_t
|
||||
TYPEDEF: __int32_t pid_t
|
||||
TYPEDEF: long time_t
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
USING: kernel system alien.syntax combinators vocabs.loader ;
|
||||
|
||||
IN: unix.types
|
||||
|
||||
TYPEDEF: void* caddr_t
|
||||
|
||||
os
|
||||
{
|
||||
{ "linux" [ "unix.types.linux" require ] }
|
||||
{ "macosx" [ "unix.types.macosx" require ] }
|
||||
[ drop ]
|
||||
}
|
||||
case
|
Loading…
Reference in New Issue