]> gitweb.factorcode.org Git - factor.git/commitdiff
use getfsstat instead of getmntinfo on macosx
authorDoug Coleman <doug.coleman@gmail.com>
Wed, 3 Dec 2008 01:18:48 +0000 (19:18 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Wed, 3 Dec 2008 01:18:48 +0000 (19:18 -0600)
basis/io/unix/files/macosx/macosx.factor
basis/unix/getfsstat/macosx/authors.txt [new file with mode: 0644]
basis/unix/getfsstat/macosx/macosx.factor [new file with mode: 0644]
basis/unix/getfsstat/macosx/tags.txt [new file with mode: 0644]
basis/unix/statfs/macosx/macosx.factor

index c5d12a012e12c2dc4eaf8e88fe5424c0a7788919..8a1eb9c89b242533010d47e7623ebf2ff217ef8f 100644 (file)
@@ -2,17 +2,18 @@
 ! 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 ;
 
@@ -47,4 +48,3 @@ M: macosx statvfs>file-system-info ( file-system-info byte-array -- file-system-
         [ statvfs-f_favail >>files-available ]
         [ statvfs-f_namemax >>name-max ]
     } cleave ;
-
diff --git a/basis/unix/getfsstat/macosx/authors.txt b/basis/unix/getfsstat/macosx/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/basis/unix/getfsstat/macosx/macosx.factor b/basis/unix/getfsstat/macosx/macosx.factor
new file mode 100644 (file)
index 0000000..fe39f85
--- /dev/null
@@ -0,0 +1,9 @@
+! 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 ) ;
diff --git a/basis/unix/getfsstat/macosx/tags.txt b/basis/unix/getfsstat/macosx/tags.txt
new file mode 100644 (file)
index 0000000..6bf6830
--- /dev/null
@@ -0,0 +1 @@
+unportable
index 8f9fd2c6efc28d40fa3bc9ec180ffd6e441855f3..1faadb26276ac41c916773afcda1cdf88d9bbfa6 100644 (file)
@@ -115,4 +115,3 @@ C-STRUCT: statfs64
     { { "uint32_t" 8 } "f_reserved" } ;
 
 FUNCTION: int statfs64 ( char* path, statfs64* buf ) ;
-FUNCTION: int getmntinfo64 ( statfs64** mntbufp, int flags ) ;