found stat64 for macosx, so there's a unix-file-info and a bsd-file-info only

db4
Doug Coleman 2008-10-06 22:51:06 -05:00
parent 0e81d4c82c
commit 312f399003
17 changed files with 40 additions and 112 deletions

View File

@ -103,9 +103,9 @@ M: unix stat>file-info ( stat -- file-info )
[ stat>type >>type ]
[ stat-st_size >>size ]
[ stat-st_mode >>permissions ]
[ stat-st_ctim timespec>unix-time >>created ]
[ stat-st_mtim timespec>unix-time >>modified ]
[ stat-st_atim timespec>unix-time >>accessed ]
[ stat-st_ctimespec timespec>unix-time >>created ]
[ stat-st_mtimespec timespec>unix-time >>modified ]
[ stat-st_atimespec timespec>unix-time >>accessed ]
[ stat-st_uid >>uid ]
[ stat-st_gid >>gid ]
[ stat-st_dev >>dev ]
@ -130,9 +130,9 @@ M: unix stat>type ( stat -- type )
! Linux has no extra fields in its stat struct
os {
{ macosx [ "io.unix.files.macosx" require ] }
{ freebsd [ "io.unix.files.freebsd" require ] }
{ netbsd [ "io.unix.files.netbsd" require ] }
{ openbsd [ "io.unix.files.openbsd" require ] }
{ macosx [ "io.unix.files.bsd" require ] }
{ netbsd [ "io.unix.files.bsd" require ] }
{ openbsd [ "io.unix.files.bsd" require ] }
{ freebsd [ "io.unix.files.bsd" require ] }
{ linux [ ] }
} case

View File

@ -1,17 +0,0 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel alien.syntax math io.unix.files system
unix.stat accessors combinators calendar.unix ;
IN: io.unix.files.freebsd
TUPLE: freebsd-file-info < unix-file-info birth-time flags gen ;
M: freebsd new-file-info ( -- class ) freebsd-file-info new ;
M: freebsd stat>file-info ( stat -- file-info )
[ call-next-method ] keep
{
[ stat-st_flags >>flags ]
[ stat-st_gen >>gen ]
[ stat-st_birthtimespec timespec>unix-time >>birth-time ]
} cleave ;

View File

@ -1 +0,0 @@
unportable

View File

@ -1,16 +0,0 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel alien.syntax math io.unix.files system
unix.stat accessors combinators ;
IN: io.unix.files.macosx
TUPLE: macosx-file-info < unix-file-info flags gen ;
M: macosx new-file-info ( -- class ) macosx-file-info new ;
M: macosx stat>file-info ( stat -- file-info )
[ call-next-method ] keep
{
[ stat-st_flags >>flags ]
[ stat-st_gen >>gen ]
} cleave ;

View File

@ -1 +0,0 @@
unportable

View File

@ -1,17 +0,0 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel alien.syntax math io.unix.files system
unix.stat accessors combinators calendar.unix ;
IN: io.unix.files.netbsd
TUPLE: netbsd-file-info < unix-file-info birth-time flags gen ;
M: netbsd new-file-info ( -- class ) netbsd-file-info new ;
M: netbsd stat>file-info ( stat -- file-info )
[ call-next-method ] keep
{
[ stat-st_flags >>flags ]
[ stat-st_gen >>gen ]
[ stat-st_birthtim timespec>unix-time >>birth-time ]
} cleave ;

View File

@ -1 +0,0 @@
unportable

View File

@ -1,17 +0,0 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel alien.syntax math io.unix.files system
unix.stat accessors combinators calendar.unix ;
IN: io.unix.files.openbsd
TUPLE: openbsd-file-info < unix-file-info birth-time flags gen ;
M: openbsd new-file-info ( -- class ) openbsd-file-info new ;
M: openbsd stat>file-info ( stat -- file-info )
[ call-next-method ] keep
{
[ stat-st_flags >>flags ]
[ stat-st_gen >>gen ]
[ stat-st_birthtim timespec>unix-time >>birth-time ]
} cleave ;

View File

@ -1 +0,0 @@
unportable

View File

@ -12,9 +12,9 @@ C-STRUCT: stat
{ "uid_t" "st_uid" }
{ "gid_t" "st_gid" }
{ "__dev_t" "st_rdev" }
{ "timespec" "st_atim" }
{ "timespec" "st_mtim" }
{ "timespec" "st_ctim" }
{ "timespec" "st_atimespec" }
{ "timespec" "st_mtimespec" }
{ "timespec" "st_ctimespec" }
{ "off_t" "st_size" }
{ "blkcnt_t" "st_blocks" }
{ "blksize_t" "st_blksize" }
@ -27,4 +27,4 @@ C-STRUCT: stat
{ "__uint32_t" "pad1" } ;
FUNCTION: int stat ( char* pathname, stat* buf ) ;
FUNCTION: int lstat ( char* pathname, stat* buf ) ;
FUNCTION: int lstat ( char* pathname, stat* buf ) ;

View File

@ -12,9 +12,9 @@ C-STRUCT: stat
{ "uid_t" "st_uid" }
{ "gid_t" "st_gid" }
{ "__dev_t" "st_rdev" }
{ "timespec" "st_atim" }
{ "timespec" "st_mtim" }
{ "timespec" "st_ctim" }
{ "timespec" "st_atimespec" }
{ "timespec" "st_mtimespec" }
{ "timespec" "st_ctimespec" }
{ "off_t" "st_size" }
{ "blkcnt_t" "st_blocks" }
{ "blksize_t" "st_blksize" }

View File

@ -18,9 +18,9 @@ C-STRUCT: stat
{ "off_t" "st_size" }
{ "blksize_t" "st_blksize" }
{ "blkcnt_t" "st_blocks" }
{ "timespec" "st_atim" }
{ "timespec" "st_mtim" }
{ "timespec" "st_ctim" }
{ "timespec" "st_atimespec" }
{ "timespec" "st_mtimespec" }
{ "timespec" "st_ctimespec" }
{ "ulong" "unused4" }
{ "ulong" "unused5" } ;
@ -30,4 +30,4 @@ FUNCTION: int __xstat ( int ver, char* pathname, stat* buf ) ;
FUNCTION: int __lxstat ( int ver, char* pathname, stat* buf ) ;
: stat ( pathname buf -- int ) 3 -rot __xstat ;
: lstat ( pathname buf -- int ) 3 -rot __lxstat ;
: lstat ( pathname buf -- int ) 3 -rot __lxstat ;

View File

@ -17,9 +17,9 @@ C-STRUCT: stat
{ "off_t" "st_size" }
{ "blksize_t" "st_blksize" }
{ "blkcnt_t" "st_blocks" }
{ "timespec" "st_atim" }
{ "timespec" "st_mtim" }
{ "timespec" "st_ctim" }
{ "timespec" "st_atimespec" }
{ "timespec" "st_mtimespec" }
{ "timespec" "st_ctimespec" }
{ "long" "__unused0" }
{ "long" "__unused1" }
{ "long" "__unused2" } ;

View File

@ -1,21 +1,21 @@
USING: kernel alien.syntax math ;
IN: unix.stat
! Mac OS X ppc
! stat64 structure
C-STRUCT: stat
{ "dev_t" "st_dev" }
{ "ino_t" "st_ino" }
{ "mode_t" "st_mode" }
{ "nlink_t" "st_nlink" }
{ "ino_t" "st_ino" }
{ "uid_t" "st_uid" }
{ "gid_t" "st_gid" }
{ "dev_t" "st_rdev" }
{ "timespec" "st_atimespec" }
{ "timespec" "st_mtimespec" }
{ "timespec" "st_ctimespec" }
{ "timespec" "st_birthtimespec" }
{ "off_t" "st_size" }
{ "blkcnt_t" "st_blocks" }
{ "blksize_t" "st_blksize" }
@ -25,9 +25,8 @@ C-STRUCT: stat
{ "__int64_t" "st_qspare0" }
{ "__int64_t" "st_qspare1" } ;
FUNCTION: int stat ( char* pathname, stat* buf ) ;
FUNCTION: int lstat ( char* pathname, stat* buf ) ;
FUNCTION: int stat64 ( char* pathname, stat* buf ) ;
FUNCTION: int lstat64 ( char* pathname, stat* buf ) ;
: stat-st_atim ( stat -- timespec ) stat-st_atimespec ;
: stat-st_mtim ( stat -- timespec ) stat-st_mtimespec ;
: stat-st_ctim ( stat -- timespec ) stat-st_ctimespec ;
: stat ( path buf -- n ) stat64 ;
: lstat ( path buf -- n ) lstat64 ;

View File

@ -11,10 +11,10 @@ C-STRUCT: stat
{ "uid_t" "st_uid" }
{ "gid_t" "st_gid" }
{ "dev_t" "st_rdev" }
{ "timespec" "st_atim" }
{ "timespec" "st_mtim" }
{ "timespec" "st_ctim" }
{ "timespec" "st_birthtim" }
{ "timespec" "st_atimespec" }
{ "timespec" "st_mtimespec" }
{ "timespec" "st_ctimespec" }
{ "timespec" "st_birthtimespec" }
{ "off_t" "st_size" }
{ "blkcnt_t" "st_blocks" }
{ "blksize_t" "st_blksize" }

View File

@ -11,16 +11,16 @@ C-STRUCT: stat
{ "uid_t" "st_uid" }
{ "gid_t" "st_gid" }
{ "dev_t" "st_rdev" }
{ "timespec" "st_atim" }
{ "timespec" "st_mtim" }
{ "timespec" "st_ctim" }
{ "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" }
{ "uint32_t" "st_spare0" }
{ "timespec" "st_birthtim" } ;
{ "timespec" "st_birthtimespec" } ;
FUNCTION: int __stat13 ( char* pathname, stat* buf ) ;
FUNCTION: int __lstat13 ( char* pathname, stat* buf ) ;

View File

@ -12,16 +12,16 @@ C-STRUCT: stat
{ "gid_t" "st_gid" }
{ "dev_t" "st_rdev" }
{ "int32_t" "st_lspare0" }
{ "timespec" "st_atim" }
{ "timespec" "st_mtim" }
{ "timespec" "st_ctim" }
{ "timespec" "st_atimespec" }
{ "timespec" "st_mtimespec" }
{ "timespec" "st_ctimespec" }
{ "off_t" "st_size" }
{ "int64_t" "st_blocks" }
{ "u_int32_t" "st_blksize" }
{ "u_int32_t" "st_flags" }
{ "u_int32_t" "st_gen" }
{ "int32_t" "st_lspare1" }
{ "timespec" "st_birthtim" }
{ "timespec" "st_birthtimespec" }
{ { "int64_t" 2 } "st_qspare" } ;
FUNCTION: int stat ( char* pathname, stat* buf ) ;