! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types alien.strings combinators
grouping io.encodings.utf8 io.files kernel math sequences
-system unix unix.statfs.macosx io.unix.files unix.statvfs.macosx ;
+system unix io.unix.files
+unix.statfs.macosx unix.statvfs.macosx unix.getfsstat.macosx ;
IN: io.unix.files.macosx
TUPLE: macosx-file-system-info < unix-file-system-info
io-size owner type-id filesystem-subtype ;
M: macosx file-systems ( -- array )
- f <void*> dup 0 getmntinfo64 dup io-error
- [ *void* ] dip
- "statfs64" heap-size [ * memory>byte-array ] keep group
- [ [ new-file-system-info ] dip statfs>file-system-info ] map ;
+ f 0 0 getfsstat64 dup io-error
+ "statfs" <c-array> dup dup length 0 getfsstat64 io-error
+ "statfs" heap-size group
+ [ statfs64-f_mntonname alien>native-string file-system-info ] map ;
M: macosx new-file-system-info macosx-file-system-info new ;
[ statvfs-f_favail >>files-available ]
[ statvfs-f_namemax >>name-max ]
} cleave ;
-
--- /dev/null
+! Copyright (C) 2008 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.syntax ;
+IN: unix.getfsstat.macosx
+
+: MNT_WAIT 1 ; inline ! synchronously wait for I/O to complete
+: MNT_NOWAIT 2 ; inline ! start all I/O, but do not wait for it
+
+FUNCTION: int getfsstat64 ( statfs* buf, int bufsize, int flags ) ;