USING: alien.syntax kernel unix.stat math unix
combinators system io.backend accessors alien.c-types
io.encodings.utf8 alien.strings unix.types io.unix.files
-io.files unix.statvfs.netbsd ;
+io.files unix.statvfs.netbsd unix.getfsstat.netbsd
+grouping sequences ;
IN: io.unix.files.netbsd
TUPLE: netbsd-file-system-info < unix-file-system-info
blocks-reserved files-reserved
-owner io-size
-sync-reads sync-writes
-async-reads async-writes
-idx mount-from spare ;
+owner io-size sync-reads sync-writes async-reads async-writes
+idx mount-from ;
M: netbsd new-file-system-info netbsd-file-system-info new ;
[ statvfs-f_fsid >>id ]
[ statvfs-f_namemax >>name-max ]
[ statvfs-f_owner >>owner ]
- [ statvfs-f_spare >>spare ]
+ ! [ statvfs-f_spare >>spare ]
[ statvfs-f_fstypename alien>native-string >>type ]
[ statvfs-f_mntonname alien>native-string >>mount-point ]
[ statvfs-f_mntfromname alien>native-string >>device-name ]
} cleave ;
-FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
+M: netbsd file-systems ( -- array )
+ f 0 0 getvfsstat dup io-error
+ "statvfs" <c-array> dup dup length 0 getvfsstat io-error
+ "statvfs" heap-size group
+ [ statvfs-f_mntonname alien>native-string file-system-info ] map ;
--- /dev/null
+! Copyright (C) 2008 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.syntax ;
+IN: unix.getfsstat.netbsd
+
+: 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
+: MNT_LAZY 3 ; inline ! push data not written by filesystem syncer
+
+FUNCTION: int getvfsstat ( statfs* buf, int bufsize, int flags ) ;