Merge branch 'master' of git://factorcode.org/git/factor into specialized-arrays
commit
722989d895
|
@ -6,7 +6,7 @@ math.bitwise byte-arrays alien combinators calendar
|
||||||
io.encodings.binary accessors sequences strings system
|
io.encodings.binary accessors sequences strings system
|
||||||
io.files.private destructors vocabs.loader calendar.unix
|
io.files.private destructors vocabs.loader calendar.unix
|
||||||
unix.stat alien.c-types arrays unix.users unix.groups
|
unix.stat alien.c-types arrays unix.users unix.groups
|
||||||
environment fry io.encodings.utf8 alien.strings unix.statfs
|
environment fry io.encodings.utf8 alien.strings
|
||||||
combinators.short-circuit ;
|
combinators.short-circuit ;
|
||||||
IN: io.unix.files
|
IN: io.unix.files
|
||||||
|
|
||||||
|
@ -76,15 +76,64 @@ M: unix copy-file ( from to -- )
|
||||||
[ swap file-info permissions>> chmod io-error ]
|
[ swap file-info permissions>> chmod io-error ]
|
||||||
2bi ;
|
2bi ;
|
||||||
|
|
||||||
HOOK: stat>file-info os ( stat -- file-info )
|
TUPLE: unix-file-system-info < file-system-info
|
||||||
|
block-size preferred-block-size
|
||||||
|
blocks blocks-free blocks-available
|
||||||
|
files files-free files-available
|
||||||
|
name-max flags id ;
|
||||||
|
|
||||||
HOOK: stat>type os ( stat -- file-info )
|
HOOK: new-file-system-info os ( -- file-system-info )
|
||||||
|
|
||||||
HOOK: new-file-info os ( -- class )
|
M: unix new-file-system-info ( -- ) unix-file-system-info new ;
|
||||||
|
|
||||||
|
HOOK: file-system-statfs os ( path -- statfs )
|
||||||
|
|
||||||
|
M: unix file-system-statfs drop f ;
|
||||||
|
|
||||||
|
HOOK: file-system-statvfs os ( path -- statvfs )
|
||||||
|
|
||||||
|
M: unix file-system-statvfs drop f ;
|
||||||
|
|
||||||
|
HOOK: statfs>file-system-info os ( file-system-info statfs -- file-system-info' )
|
||||||
|
|
||||||
|
M: unix statfs>file-system-info drop ;
|
||||||
|
|
||||||
|
HOOK: statvfs>file-system-info os ( file-system-info statvfs -- file-system-info' )
|
||||||
|
|
||||||
|
M: unix statvfs>file-system-info drop ;
|
||||||
|
|
||||||
|
: file-system-calculations ( file-system-info -- file-system-info' )
|
||||||
|
{
|
||||||
|
[ dup [ blocks-available>> ] [ block-size>> ] bi * >>free-space drop ]
|
||||||
|
[ dup [ blocks>> ] [ block-size>> ] bi * >>total-space drop ]
|
||||||
|
[ dup [ total-space>> ] [ free-space>> ] bi - >>used-space drop ]
|
||||||
|
[ ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
M: unix file-system-info
|
||||||
|
normalize-path
|
||||||
|
[ new-file-system-info ] dip
|
||||||
|
[ file-system-statfs statfs>file-system-info ]
|
||||||
|
[ file-system-statvfs statvfs>file-system-info ] bi
|
||||||
|
file-system-calculations ;
|
||||||
|
|
||||||
|
os {
|
||||||
|
{ linux [ "io.unix.files.linux" require ] }
|
||||||
|
{ macosx [ "io.unix.files.macosx" require ] }
|
||||||
|
{ freebsd [ "io.unix.files.freebsd" require ] }
|
||||||
|
{ netbsd [ "io.unix.files.netbsd" require ] }
|
||||||
|
{ openbsd [ "io.unix.files.openbsd" require ] }
|
||||||
|
} case
|
||||||
|
|
||||||
TUPLE: unix-file-info < file-info uid gid dev ino
|
TUPLE: unix-file-info < file-info uid gid dev ino
|
||||||
nlink rdev blocks blocksize ;
|
nlink rdev blocks blocksize ;
|
||||||
|
|
||||||
|
HOOK: new-file-info os ( -- file-info )
|
||||||
|
|
||||||
|
HOOK: stat>file-info os ( stat -- file-info )
|
||||||
|
|
||||||
|
HOOK: stat>type os ( stat -- file-info )
|
||||||
|
|
||||||
M: unix file-info ( path -- info )
|
M: unix file-info ( path -- info )
|
||||||
normalize-path file-status stat>file-info ;
|
normalize-path file-status stat>file-info ;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: accessors alien.c-types alien.syntax combinators
|
||||||
|
io.backend io.files io.unix.files kernel math system unix
|
||||||
|
unix.statfs unix.statvfs.freebsd ;
|
||||||
|
IN: io.unix.files.freebsd
|
||||||
|
|
||||||
|
M: freebsd file-system-statvfs ( path -- byte-array )
|
||||||
|
"statvfs" <c-object> tuck statvfs io-error ;
|
||||||
|
|
||||||
|
M: freebsd statvfs>file-system-info ( file-system-info statvfs -- file-system-info )
|
||||||
|
{
|
||||||
|
[ statvfs-f_bavail >>blocks-available ]
|
||||||
|
[ statvfs-f_bfree >>blocks-free ]
|
||||||
|
[ statvfs-f_blocks >>blocks ]
|
||||||
|
[ statvfs-f_favail >>files-available ]
|
||||||
|
[ statvfs-f_ffree >>files-free ]
|
||||||
|
[ statvfs-f_files >>files ]
|
||||||
|
[ statvfs-f_bsize >>block-size ]
|
||||||
|
[ statvfs-f_flag >>flags ]
|
||||||
|
[ statvfs-f_frsize >>preferred-block-size ]
|
||||||
|
[ statvfs-f_fsid >>id ]
|
||||||
|
[ statvfs-f_namemax >>name-max ]
|
||||||
|
} cleave ;
|
|
@ -0,0 +1,70 @@
|
||||||
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: accessors alien.c-types alien.syntax combinators csv
|
||||||
|
io.encodings.utf8 io.files io.streams.string io.unix.files
|
||||||
|
kernel namespaces sequences system unix unix.statfs.linux
|
||||||
|
unix.statvfs.linux ;
|
||||||
|
IN: io.unix.files.linux
|
||||||
|
|
||||||
|
TUPLE: linux-file-system-info < unix-file-system-info
|
||||||
|
namelen spare ;
|
||||||
|
|
||||||
|
M: linux new-file-system-info linux-file-system-info new ;
|
||||||
|
|
||||||
|
M: linux file-system-statfs ( path -- byte-array )
|
||||||
|
"statfs64" <c-object> tuck statfs64 io-error ;
|
||||||
|
|
||||||
|
M: linux statfs>file-system-info ( struct -- statfs )
|
||||||
|
{
|
||||||
|
[ statfs64-f_type >>type ]
|
||||||
|
[ statfs64-f_bsize >>block-size ]
|
||||||
|
[ statfs64-f_blocks >>blocks ]
|
||||||
|
[ statfs64-f_bfree >>blocks-free ]
|
||||||
|
[ statfs64-f_bavail >>blocks-available ]
|
||||||
|
[ statfs64-f_files >>files ]
|
||||||
|
[ statfs64-f_ffree >>files-free ]
|
||||||
|
[ statfs64-f_fsid >>id ]
|
||||||
|
[ statfs64-f_namelen >>namelen ]
|
||||||
|
[ statfs64-f_frsize >>preferred-block-size ]
|
||||||
|
[ statfs64-f_spare >>spare ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
M: linux file-system-statvfs ( path -- byte-array )
|
||||||
|
"statvfs64" <c-object> tuck statvfs64 io-error ;
|
||||||
|
|
||||||
|
M: linux statvfs>file-system-info ( struct -- statfs )
|
||||||
|
{
|
||||||
|
[ statvfs64-f_flag >>flags ]
|
||||||
|
[ statvfs64-f_namemax >>name-max ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
TUPLE: mtab-entry file-system-name mount-point type options
|
||||||
|
frequency pass-number ;
|
||||||
|
|
||||||
|
: mtab-csv>mtab-entry ( csv -- mtab-entry )
|
||||||
|
[ mtab-entry new ] dip
|
||||||
|
{
|
||||||
|
[ first >>file-system-name ]
|
||||||
|
[ second >>mount-point ]
|
||||||
|
[ third >>type ]
|
||||||
|
[ fourth <string-reader> csv first >>options ]
|
||||||
|
[ 4 swap nth >>frequency ]
|
||||||
|
[ 5 swap nth >>pass-number ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
: parse-mtab ( -- array )
|
||||||
|
[
|
||||||
|
"/etc/mtab" utf8 <file-reader>
|
||||||
|
CHAR: \s delimiter set csv
|
||||||
|
] with-scope
|
||||||
|
[ mtab-csv>mtab-entry ] map ;
|
||||||
|
|
||||||
|
M: linux file-systems
|
||||||
|
parse-mtab [
|
||||||
|
[ mount-point>> file-system-info ] keep
|
||||||
|
{
|
||||||
|
[ file-system-name>> >>device-name ]
|
||||||
|
[ mount-point>> >>mount-point ]
|
||||||
|
[ type>> >>type ]
|
||||||
|
} cleave
|
||||||
|
] map ;
|
|
@ -0,0 +1,50 @@
|
||||||
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
|
! 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 ;
|
||||||
|
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 ;
|
||||||
|
|
||||||
|
M: macosx new-file-system-info macosx-file-system-info new ;
|
||||||
|
|
||||||
|
M: macosx file-system-statfs ( normalized-path -- statfs )
|
||||||
|
"statfs64" <c-object> tuck statfs64 io-error ;
|
||||||
|
|
||||||
|
M: macosx file-system-statvfs ( normalized-path -- statvfs )
|
||||||
|
"statvfs" <c-object> tuck statvfs io-error ;
|
||||||
|
|
||||||
|
M: macosx statfs>file-system-info ( file-system-info byte-array -- file-system-info' )
|
||||||
|
{
|
||||||
|
[ statfs64-f_bsize >>block-size ]
|
||||||
|
[ statfs64-f_iosize >>io-size ]
|
||||||
|
[ statfs64-f_blocks >>blocks ]
|
||||||
|
[ statfs64-f_bfree >>blocks-free ]
|
||||||
|
[ statfs64-f_bavail >>blocks-available ]
|
||||||
|
[ statfs64-f_files >>files ]
|
||||||
|
[ statfs64-f_ffree >>files-free ]
|
||||||
|
[ statfs64-f_fsid >>id ]
|
||||||
|
[ statfs64-f_owner >>owner ]
|
||||||
|
[ statfs64-f_type >>type-id ]
|
||||||
|
[ statfs64-f_flags >>flags ]
|
||||||
|
[ statfs64-f_fssubtype >>filesystem-subtype ]
|
||||||
|
[ statfs64-f_fstypename utf8 alien>string >>type ]
|
||||||
|
[ statfs64-f_mntonname utf8 alien>string >>mount-point ]
|
||||||
|
[ statfs64-f_mntfromname utf8 alien>string >>device-name ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
|
M: macosx statvfs>file-system-info ( file-system-info byte-array -- file-system-info' )
|
||||||
|
{
|
||||||
|
[ statvfs-f_frsize >>preferred-block-size ]
|
||||||
|
[ statvfs-f_favail >>files-available ]
|
||||||
|
[ statvfs-f_namemax >>name-max ]
|
||||||
|
} cleave ;
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: alien.syntax kernel unix.stat math unix
|
||||||
|
combinators system io.backend accessors alien.c-types
|
||||||
|
io.encodings.utf8 alien.strings unix.types unix.statfs
|
||||||
|
io.unix.files io.files unix.statvfs.netbsd ;
|
||||||
|
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 ;
|
||||||
|
|
||||||
|
M: netbsd new-file-system-info netbsd-file-system-info new ;
|
||||||
|
|
||||||
|
M: netbsd file-system-statvfs
|
||||||
|
"statvfs" <c-object> tuck statvfs io-error ;
|
||||||
|
|
||||||
|
M: netbsd statvfs>file-system-info ( file-system-info statvfs -- file-system-info' )
|
||||||
|
{
|
||||||
|
[ statvfs-f_flag >>flags ]
|
||||||
|
[ statvfs-f_bsize >>block-size ]
|
||||||
|
[ statvfs-f_frsize >>preferred-block-size ]
|
||||||
|
[ statvfs-f_iosize >>io-size ]
|
||||||
|
[ statvfs-f_blocks >>blocks ]
|
||||||
|
[ statvfs-f_bfree >>blocks-free ]
|
||||||
|
[ statvfs-f_bavail >>blocks-available ]
|
||||||
|
[ statvfs-f_bresvd >>blocks-reserved ]
|
||||||
|
[ statvfs-f_files >>files ]
|
||||||
|
[ statvfs-f_ffree >>files-free ]
|
||||||
|
[ statvfs-f_favail >>files-available ]
|
||||||
|
[ statvfs-f_fresvd >>files-reserved ]
|
||||||
|
[ statvfs-f_syncreads >>sync-reads ]
|
||||||
|
[ statvfs-f_syncwrites >>sync-writes ]
|
||||||
|
[ statvfs-f_asyncreads >>async-reads ]
|
||||||
|
[ statvfs-f_asyncwrites >>async-writes ]
|
||||||
|
[ statvfs-f_fsidx >>idx ]
|
||||||
|
[ statvfs-f_fsid >>id ]
|
||||||
|
[ statvfs-f_namemax >>name-max ]
|
||||||
|
[ statvfs-f_owner >>owner ]
|
||||||
|
[ 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 ) ;
|
|
@ -0,0 +1,24 @@
|
||||||
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: alien.syntax accessors combinators kernel
|
||||||
|
unix.types math system io.backend alien.c-types unix
|
||||||
|
io.files io.unix.files unix.statvfs.openbsd ;
|
||||||
|
IN: io.unix.files.openbsd
|
||||||
|
|
||||||
|
M: openbsd file-system-statvfs ( normalized-path -- statvfs )
|
||||||
|
"statvfs" <c-object> tuck statvfs io-error ;
|
||||||
|
|
||||||
|
M: openbsd statvfs>file-system-info ( file-system-info statvfs -- file-system-info' )
|
||||||
|
{
|
||||||
|
[ statvfs-f_bsize >>block-size ]
|
||||||
|
[ statvfs-f_frsize >>preferred-block-size ]
|
||||||
|
[ statvfs-f_blocks >>blocks ]
|
||||||
|
[ statvfs-f_bfree >>blocks-free ]
|
||||||
|
[ statvfs-f_bavail >>blocks-available ]
|
||||||
|
[ statvfs-f_files >>files ]
|
||||||
|
[ statvfs-f_ffree >>files-free ]
|
||||||
|
[ statvfs-f_favail >>files-available ]
|
||||||
|
[ statvfs-f_fsid >>id ]
|
||||||
|
[ statvfs-f_flag >>flags ]
|
||||||
|
[ statvfs-f_namemax >>name-max ]
|
||||||
|
} cleave ;
|
|
@ -257,9 +257,6 @@ M: winnt link-info ( path -- info )
|
||||||
|
|
||||||
HOOK: root-directory os ( string -- string' )
|
HOOK: root-directory os ( string -- string' )
|
||||||
|
|
||||||
TUPLE: winnt-file-system-info < file-system-info
|
|
||||||
total-bytes total-free-bytes ;
|
|
||||||
|
|
||||||
: file-system-type ( normalized-path -- str )
|
: file-system-type ( normalized-path -- str )
|
||||||
MAX_PATH 1+ <byte-array>
|
MAX_PATH 1+ <byte-array>
|
||||||
MAX_PATH 1+
|
MAX_PATH 1+
|
||||||
|
@ -269,21 +266,28 @@ total-bytes total-free-bytes ;
|
||||||
[ GetVolumeInformation win32-error=0/f ] 2keep drop
|
[ GetVolumeInformation win32-error=0/f ] 2keep drop
|
||||||
utf16n alien>string ;
|
utf16n alien>string ;
|
||||||
|
|
||||||
: file-system-space ( normalized-path -- free-space total-bytes total-free-bytes )
|
: file-system-space ( normalized-path -- available-space total-space free-space )
|
||||||
"ULARGE_INTEGER" <c-object>
|
"ULARGE_INTEGER" <c-object>
|
||||||
"ULARGE_INTEGER" <c-object>
|
"ULARGE_INTEGER" <c-object>
|
||||||
"ULARGE_INTEGER" <c-object>
|
"ULARGE_INTEGER" <c-object>
|
||||||
[ GetDiskFreeSpaceEx win32-error=0/f ] 3keep ;
|
[ GetDiskFreeSpaceEx win32-error=0/f ] 3keep ;
|
||||||
|
|
||||||
|
: calculate-file-system-info ( file-system-info -- file-system-info' )
|
||||||
|
{
|
||||||
|
[ dup [ total-space>> ] [ free-space>> ] bi - >>used-space drop ]
|
||||||
|
[ ]
|
||||||
|
} cleave ;
|
||||||
|
|
||||||
M: winnt file-system-info ( path -- file-system-info )
|
M: winnt file-system-info ( path -- file-system-info )
|
||||||
normalize-path root-directory
|
normalize-path root-directory
|
||||||
dup [ file-system-type ] [ file-system-space ] bi
|
dup [ file-system-type ] [ file-system-space ] bi
|
||||||
\ winnt-file-system-info new
|
\ file-system-info new
|
||||||
swap *ulonglong >>total-free-bytes
|
|
||||||
swap *ulonglong >>total-bytes
|
|
||||||
swap *ulonglong >>free-space
|
swap *ulonglong >>free-space
|
||||||
|
swap *ulonglong >>total-space
|
||||||
|
swap *ulonglong >>available-space
|
||||||
swap >>type
|
swap >>type
|
||||||
swap >>mount-point ;
|
swap >>mount-point
|
||||||
|
calculate-file-system-info ;
|
||||||
|
|
||||||
: volume>paths ( string -- array )
|
: volume>paths ( string -- array )
|
||||||
16384 "ushort" <c-array> tuck dup length
|
16384 "ushort" <c-array> tuck dup length
|
||||||
|
@ -324,7 +328,7 @@ M: winnt file-systems ( -- array )
|
||||||
find-volumes [ volume>paths ] map
|
find-volumes [ volume>paths ] map
|
||||||
concat [
|
concat [
|
||||||
[ file-system-info ]
|
[ file-system-info ]
|
||||||
[ drop winnt-file-system-info new swap >>mount-point ] recover
|
[ drop \ file-system-info new swap >>mount-point ] recover
|
||||||
] map ;
|
] map ;
|
||||||
|
|
||||||
: file-times ( path -- timestamp timestamp timestamp )
|
: file-times ( path -- timestamp timestamp timestamp )
|
||||||
|
|
|
@ -22,32 +22,3 @@ C-STRUCT: statvfs
|
||||||
{ "ulong" "f_namemax" } ;
|
{ "ulong" "f_namemax" } ;
|
||||||
|
|
||||||
FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
|
FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
|
||||||
|
|
||||||
TUPLE: freebsd-file-system-info < file-system-info
|
|
||||||
bavail bfree blocks favail ffree files
|
|
||||||
bsize flag frsize fsid namemax ;
|
|
||||||
|
|
||||||
M: freebsd >file-system-info ( struct -- statfs )
|
|
||||||
[ \ freebsd-file-system-info new ] dip
|
|
||||||
{
|
|
||||||
[
|
|
||||||
[ statvfs-f_bsize ]
|
|
||||||
[ statvfs-f_bavail ] bi * >>free-space
|
|
||||||
]
|
|
||||||
[ statvfs-f_bavail >>bavail ]
|
|
||||||
[ statvfs-f_bfree >>bfree ]
|
|
||||||
[ statvfs-f_blocks >>blocks ]
|
|
||||||
[ statvfs-f_favail >>favail ]
|
|
||||||
[ statvfs-f_ffree >>ffree ]
|
|
||||||
[ statvfs-f_files >>files ]
|
|
||||||
[ statvfs-f_bsize >>bsize ]
|
|
||||||
[ statvfs-f_flag >>flag ]
|
|
||||||
[ statvfs-f_frsize >>frsize ]
|
|
||||||
[ statvfs-f_fsid >>fsid ]
|
|
||||||
[ statvfs-f_namemax >>namemax ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
M: freebsd file-system-info ( path -- byte-array )
|
|
||||||
normalize-path
|
|
||||||
"statvfs" <c-object> tuck statvfs io-error
|
|
||||||
>file-system-info ;
|
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
|
||||||
USING: alien.c-types combinators kernel unix.stat
|
|
||||||
math accessors system unix io.backend layouts vocabs.loader
|
|
||||||
alien.syntax unix.statfs io.files ;
|
|
||||||
IN: unix.statfs.linux
|
|
||||||
|
|
||||||
C-STRUCT: statfs
|
|
||||||
{ "long" "f_type" }
|
|
||||||
{ "long" "f_bsize" }
|
|
||||||
{ "long" "f_blocks" }
|
|
||||||
{ "long" "f_bfree" }
|
|
||||||
{ "long" "f_bavail" }
|
|
||||||
{ "long" "f_files" }
|
|
||||||
{ "long" "f_ffree" }
|
|
||||||
{ "fsid_t" "f_fsid" }
|
|
||||||
{ "long" "f_namelen" } ;
|
|
||||||
|
|
||||||
FUNCTION: int statfs ( char* path, statfs* buf ) ;
|
|
||||||
|
|
||||||
TUPLE: linux32-file-system-info < file-system-info
|
|
||||||
bsize blocks bfree bavail files ffree fsid namelen
|
|
||||||
frsize spare ;
|
|
||||||
|
|
||||||
M: linux >file-system-info ( struct -- statfs )
|
|
||||||
[ \ linux32-file-system-info new ] dip
|
|
||||||
{
|
|
||||||
[
|
|
||||||
[ statfs-f_bsize ]
|
|
||||||
[ statfs-f_bavail ] bi * >>free-space
|
|
||||||
]
|
|
||||||
[ statfs-f_type >>type ]
|
|
||||||
[ statfs-f_bsize >>bsize ]
|
|
||||||
[ statfs-f_blocks >>blocks ]
|
|
||||||
[ statfs-f_bfree >>bfree ]
|
|
||||||
[ statfs-f_bavail >>bavail ]
|
|
||||||
[ statfs-f_files >>files ]
|
|
||||||
[ statfs-f_ffree >>ffree ]
|
|
||||||
[ statfs-f_fsid >>fsid ]
|
|
||||||
[ statfs-f_namelen >>namelen ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
M: linux file-system-info ( path -- byte-array )
|
|
||||||
normalize-path
|
|
||||||
"statfs" <c-object> tuck statfs io-error
|
|
||||||
>file-system-info ;
|
|
|
@ -1 +0,0 @@
|
||||||
Doug Coleman
|
|
|
@ -1,50 +0,0 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
|
||||||
USING: alien.c-types combinators kernel unix.stat
|
|
||||||
math accessors system unix io.backend layouts vocabs.loader
|
|
||||||
alien.syntax unix.statfs io.files ;
|
|
||||||
IN: unix.statfs.linux
|
|
||||||
|
|
||||||
C-STRUCT: statfs64
|
|
||||||
{ "__SWORD_TYPE" "f_type" }
|
|
||||||
{ "__SWORD_TYPE" "f_bsize" }
|
|
||||||
{ "__fsblkcnt64_t" "f_blocks" }
|
|
||||||
{ "__fsblkcnt64_t" "f_bfree" }
|
|
||||||
{ "__fsblkcnt64_t" "f_bavail" }
|
|
||||||
{ "__fsfilcnt64_t" "f_files" }
|
|
||||||
{ "__fsfilcnt64_t" "f_ffree" }
|
|
||||||
{ "__fsid_t" "f_fsid" }
|
|
||||||
{ "__SWORD_TYPE" "f_namelen" }
|
|
||||||
{ "__SWORD_TYPE" "f_frsize" }
|
|
||||||
{ { "__SWORD_TYPE" 5 } "f_spare" } ;
|
|
||||||
|
|
||||||
FUNCTION: int statfs64 ( char* path, statfs64* buf ) ;
|
|
||||||
|
|
||||||
TUPLE: linux64-file-system-info < file-system-info
|
|
||||||
bsize blocks bfree bavail files ffree fsid namelen
|
|
||||||
frsize spare ;
|
|
||||||
|
|
||||||
M: linux >file-system-info ( struct -- statfs )
|
|
||||||
[ \ linux64-file-system-info new ] dip
|
|
||||||
{
|
|
||||||
[
|
|
||||||
[ statfs64-f_bsize ]
|
|
||||||
[ statfs64-f_bavail ] bi * >>free-space
|
|
||||||
]
|
|
||||||
[ statfs64-f_type >>type ]
|
|
||||||
[ statfs64-f_bsize >>bsize ]
|
|
||||||
[ statfs64-f_blocks >>blocks ]
|
|
||||||
[ statfs64-f_bfree >>bfree ]
|
|
||||||
[ statfs64-f_bavail >>bavail ]
|
|
||||||
[ statfs64-f_files >>files ]
|
|
||||||
[ statfs64-f_ffree >>ffree ]
|
|
||||||
[ statfs64-f_fsid >>fsid ]
|
|
||||||
[ statfs64-f_namelen >>namelen ]
|
|
||||||
[ statfs64-f_frsize >>frsize ]
|
|
||||||
[ statfs64-f_spare >>spare ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
M: linux file-system-info ( path -- byte-array )
|
|
||||||
normalize-path
|
|
||||||
"statfs64" <c-object> tuck statfs64 io-error
|
|
||||||
>file-system-info ;
|
|
|
@ -1 +0,0 @@
|
||||||
Doug Coleman
|
|
|
@ -1,43 +1,19 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien.c-types combinators kernel unix.stat
|
USING: alien.syntax ;
|
||||||
math accessors system unix io.backend layouts vocabs.loader
|
|
||||||
sequences csv io.streams.string io.encodings.utf8 namespaces
|
|
||||||
unix.statfs io.files ;
|
|
||||||
IN: unix.statfs.linux
|
IN: unix.statfs.linux
|
||||||
|
|
||||||
cell-bits {
|
C-STRUCT: statfs64
|
||||||
{ 32 [ "unix.statfs.linux.32" require ] }
|
{ "__SWORD_TYPE" "f_type" }
|
||||||
{ 64 [ "unix.statfs.linux.64" require ] }
|
{ "__SWORD_TYPE" "f_bsize" }
|
||||||
} case
|
{ "__fsblkcnt64_t" "f_blocks" }
|
||||||
|
{ "__fsblkcnt64_t" "f_bfree" }
|
||||||
|
{ "__fsblkcnt64_t" "f_bavail" }
|
||||||
|
{ "__fsfilcnt64_t" "f_files" }
|
||||||
|
{ "__fsfilcnt64_t" "f_ffree" }
|
||||||
|
{ "__fsid_t" "f_fsid" }
|
||||||
|
{ "__SWORD_TYPE" "f_namelen" }
|
||||||
|
{ "__SWORD_TYPE" "f_frsize" }
|
||||||
|
{ { "__SWORD_TYPE" 5 } "f_spare" } ;
|
||||||
|
|
||||||
TUPLE: mtab-entry file-system-name mount-point type options
|
FUNCTION: int statfs64 ( char* path, statfs64* buf ) ;
|
||||||
frequency pass-number ;
|
|
||||||
|
|
||||||
: mtab-csv>mtab-entry ( csv -- mtab-entry )
|
|
||||||
[ mtab-entry new ] dip
|
|
||||||
{
|
|
||||||
[ first >>file-system-name ]
|
|
||||||
[ second >>mount-point ]
|
|
||||||
[ third >>type ]
|
|
||||||
[ fourth <string-reader> csv first >>options ]
|
|
||||||
[ 4 swap nth >>frequency ]
|
|
||||||
[ 5 swap nth >>pass-number ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
: parse-mtab ( -- array )
|
|
||||||
[
|
|
||||||
"/etc/mtab" utf8 <file-reader>
|
|
||||||
CHAR: \s delimiter set csv
|
|
||||||
] with-scope
|
|
||||||
[ mtab-csv>mtab-entry ] map ;
|
|
||||||
|
|
||||||
M: linux file-systems
|
|
||||||
parse-mtab [
|
|
||||||
[ mount-point>> file-system-info ] keep
|
|
||||||
{
|
|
||||||
[ file-system-name>> >>device-name ]
|
|
||||||
[ mount-point>> >>mount-point ]
|
|
||||||
[ type>> >>type ]
|
|
||||||
} cleave
|
|
||||||
] map ;
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
USING: alien.c-types io.encodings.utf8 io.encodings.string
|
USING: alien.c-types io.encodings.utf8 io.encodings.string
|
||||||
kernel sequences unix.stat accessors unix combinators math
|
kernel sequences unix.stat accessors unix combinators math
|
||||||
grouping system unix.statfs io.files io.backend alien.strings
|
grouping system unix.statfs io.files io.backend alien.strings
|
||||||
math.bitwise alien.syntax ;
|
math.bitwise alien.syntax io.unix.files ;
|
||||||
IN: unix.statfs.macosx
|
IN: unix.statfs.macosx
|
||||||
|
|
||||||
: MNT_RDONLY HEX: 00000001 ; inline
|
: MNT_RDONLY HEX: 00000001 ; inline
|
||||||
|
@ -116,50 +116,3 @@ C-STRUCT: statfs64
|
||||||
|
|
||||||
FUNCTION: int statfs64 ( char* path, statfs64* buf ) ;
|
FUNCTION: int statfs64 ( char* path, statfs64* buf ) ;
|
||||||
FUNCTION: int getmntinfo64 ( statfs64** mntbufp, int flags ) ;
|
FUNCTION: int getmntinfo64 ( statfs64** mntbufp, int flags ) ;
|
||||||
|
|
||||||
|
|
||||||
TUPLE: macosx-file-system-info < file-system-info
|
|
||||||
block-size io-size blocks blocks-free blocks-available files
|
|
||||||
files-free file-system-id owner type-id flags 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
|
|
||||||
[ >file-system-info ] map ;
|
|
||||||
|
|
||||||
M: macosx >file-system-info ( byte-array -- file-system-info )
|
|
||||||
[ \ macosx-file-system-info new ] dip
|
|
||||||
{
|
|
||||||
[
|
|
||||||
[ statfs64-f_bavail ] [ statfs64-f_bsize ] bi *
|
|
||||||
>>free-space
|
|
||||||
]
|
|
||||||
[ statfs64-f_mntonname utf8 alien>string >>mount-point ]
|
|
||||||
[ statfs64-f_bsize >>block-size ]
|
|
||||||
|
|
||||||
[ statfs64-f_iosize >>io-size ]
|
|
||||||
[ statfs64-f_blocks >>blocks ]
|
|
||||||
[ statfs64-f_bfree >>blocks-free ]
|
|
||||||
[ statfs64-f_bavail >>blocks-available ]
|
|
||||||
[ statfs64-f_files >>files ]
|
|
||||||
[ statfs64-f_ffree >>files-free ]
|
|
||||||
[ statfs64-f_fsid >>file-system-id ]
|
|
||||||
[ statfs64-f_owner >>owner ]
|
|
||||||
[ statfs64-f_type >>type-id ]
|
|
||||||
[ statfs64-f_flags >>flags ]
|
|
||||||
[ statfs64-f_fssubtype >>filesystem-subtype ]
|
|
||||||
[
|
|
||||||
statfs64-f_fstypename utf8 alien>string
|
|
||||||
>>type
|
|
||||||
]
|
|
||||||
[
|
|
||||||
statfs64-f_mntfromname
|
|
||||||
utf8 alien>string >>device-name
|
|
||||||
]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
M: macosx file-system-info ( path -- file-system-info )
|
|
||||||
normalize-path
|
|
||||||
"statfs64" <c-object> tuck statfs64 io-error
|
|
||||||
>file-system-info ;
|
|
||||||
|
|
|
@ -4,75 +4,3 @@ USING: alien.syntax kernel unix.stat math unix
|
||||||
combinators system io.backend accessors alien.c-types
|
combinators system io.backend accessors alien.c-types
|
||||||
io.encodings.utf8 alien.strings unix.types unix.statfs io.files ;
|
io.encodings.utf8 alien.strings unix.types unix.statfs io.files ;
|
||||||
IN: unix.statfs.netbsd
|
IN: unix.statfs.netbsd
|
||||||
|
|
||||||
: _VFS_NAMELEN 32 ; inline
|
|
||||||
: _VFS_MNAMELEN 1024 ; inline
|
|
||||||
|
|
||||||
C-STRUCT: statvfs
|
|
||||||
{ "ulong" "f_flag" }
|
|
||||||
{ "ulong" "f_bsize" }
|
|
||||||
{ "ulong" "f_frsize" }
|
|
||||||
{ "ulong" "f_iosize" }
|
|
||||||
{ "fsblkcnt_t" "f_blocks" }
|
|
||||||
{ "fsblkcnt_t" "f_bfree" }
|
|
||||||
{ "fsblkcnt_t" "f_bavail" }
|
|
||||||
{ "fsblkcnt_t" "f_bresvd" }
|
|
||||||
{ "fsfilcnt_t" "f_files" }
|
|
||||||
{ "fsfilcnt_t" "f_ffree" }
|
|
||||||
{ "fsfilcnt_t" "f_favail" }
|
|
||||||
{ "fsfilcnt_t" "f_fresvd" }
|
|
||||||
{ "uint64_t" "f_syncreads" }
|
|
||||||
{ "uint64_t" "f_syncwrites" }
|
|
||||||
{ "uint64_t" "f_asyncreads" }
|
|
||||||
{ "uint64_t" "f_asyncwrites" }
|
|
||||||
{ "fsid_t" "f_fsidx" }
|
|
||||||
{ "ulong" "f_fsid" }
|
|
||||||
{ "ulong" "f_namemax" }
|
|
||||||
{ "uid_t" "f_owner" }
|
|
||||||
{ { "uint32_t" 4 } "f_spare" }
|
|
||||||
{ { "char" _VFS_NAMELEN } "f_fstypename" }
|
|
||||||
{ { "char" _VFS_MNAMELEN } "f_mntonname" }
|
|
||||||
{ { "char" _VFS_MNAMELEN } "f_mntfromname" } ;
|
|
||||||
|
|
||||||
FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
|
|
||||||
|
|
||||||
TUPLE: netbsd-file-system-info < file-system-info
|
|
||||||
flag bsize frsize io-size
|
|
||||||
blocks blocks-free blocks-available blocks-reserved
|
|
||||||
files ffree sync-reads sync-writes async-reads async-writes
|
|
||||||
fsidx fsid namemax owner spare fstype mnotonname mntfromname
|
|
||||||
file-system-type-name mount-from ;
|
|
||||||
|
|
||||||
M: netbsd >file-system-info ( byte-array -- netbsd-file-system-info )
|
|
||||||
[ \ netbsd-file-system-info new ] dip
|
|
||||||
{
|
|
||||||
[
|
|
||||||
[ statvfs-f_bsize ]
|
|
||||||
[ statvfs-f_bavail ] bi * >>free-space
|
|
||||||
]
|
|
||||||
[ statvfs-f_flag >>flag ]
|
|
||||||
[ statvfs-f_bsize >>bsize ]
|
|
||||||
[ statvfs-f_frsize >>frsize ]
|
|
||||||
[ statvfs-f_iosize >>io-size ]
|
|
||||||
[ statvfs-f_blocks >>blocks ]
|
|
||||||
[ statvfs-f_bfree >>blocks-free ]
|
|
||||||
[ statvfs-f_favail >>blocks-available ]
|
|
||||||
[ statvfs-f_fresvd >>blocks-reserved ]
|
|
||||||
[ statvfs-f_files >>files ]
|
|
||||||
[ statvfs-f_ffree >>ffree ]
|
|
||||||
[ statvfs-f_syncreads >>sync-reads ]
|
|
||||||
[ statvfs-f_syncwrites >>sync-writes ]
|
|
||||||
[ statvfs-f_asyncreads >>async-reads ]
|
|
||||||
[ statvfs-f_asyncwrites >>async-writes ]
|
|
||||||
[ statvfs-f_fsidx >>fsidx ]
|
|
||||||
[ statvfs-f_namemax >>namemax ]
|
|
||||||
[ statvfs-f_owner >>owner ]
|
|
||||||
[ statvfs-f_spare >>spare ]
|
|
||||||
[ statvfs-f_fstypename utf8 alien>string >>file-system-type-name ]
|
|
||||||
[ statvfs-f_mntonname utf8 alien>string >>mount-point ]
|
|
||||||
[ statvfs-f_mntfromname utf8 alien>string >>mount-from ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
M: netbsd file-system-info
|
|
||||||
normalize-path "statvfs" <c-object> tuck statvfs io-error
|
|
||||||
>file-system-info ;
|
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
|
||||||
USING: alien.syntax kernel unix ;
|
|
||||||
IN: unix.statfs.openbsd.32
|
|
||||||
|
|
||||||
: MFSNAMELEN 16 ; inline
|
|
||||||
: MNAMELEN 90 ; inline
|
|
||||||
|
|
||||||
C-STRUCT: statfs
|
|
||||||
{ "u_int32_t" "f_flags" }
|
|
||||||
{ "int32_t" "f_bsize" }
|
|
||||||
{ "u_int32_t" "f_iosize" }
|
|
||||||
{ "u_int32_t" "f_blocks" }
|
|
||||||
{ "u_int32_t" "f_bfree" }
|
|
||||||
{ "int32_t" "f_bavail" }
|
|
||||||
{ "u_int32_t" "f_files" }
|
|
||||||
{ "u_int32_t" "f_ffree" }
|
|
||||||
{ "fsid_t" "f_fsid" }
|
|
||||||
{ "uid_t" "f_owner" }
|
|
||||||
{ "u_int32_t" "f_syncwrites" }
|
|
||||||
{ "u_int32_t" "f_asyncwrites" }
|
|
||||||
{ "u_int32_t" "f_ctime" }
|
|
||||||
{ { "u_int32_t" 3 } "f_spare" }
|
|
||||||
{ { "char" MFSNAMELEN } "f_fstypename" }
|
|
||||||
{ { "char" MNAMELEN } "f_mntonname" }
|
|
||||||
{ { "char" MNAMELEN } "f_mntfromname" } ;
|
|
|
@ -1 +0,0 @@
|
||||||
Doug Coleman
|
|
|
@ -1,32 +0,0 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
|
||||||
USING: alien.syntax unix ;
|
|
||||||
IN: unix.statfs.openbsd.64
|
|
||||||
|
|
||||||
: MFSNAMELEN 16 ; inline
|
|
||||||
: MNAMELEN 90 ; inline
|
|
||||||
|
|
||||||
C-STRUCT: statfss
|
|
||||||
{ "u_int32_t" "f_flags" }
|
|
||||||
{ "u_int32_t" "f_bsize" }
|
|
||||||
{ "u_int32_t" "f_iosize" }
|
|
||||||
{ "u_int64_t" "f_blocks" }
|
|
||||||
{ "u_int64_t" "f_bfree" }
|
|
||||||
{ "int64_t" "f_bavail" }
|
|
||||||
{ "u_int64_t" "f_files" }
|
|
||||||
{ "u_int64_t" "f_ffree" }
|
|
||||||
{ "int64_t" "f_favail" }
|
|
||||||
{ "u_int64_t" "f_syncwrites" }
|
|
||||||
{ "u_int64_t" "f_syncreads" }
|
|
||||||
{ "u_int64_t" "f_asyncwrites" }
|
|
||||||
{ "u_int64_t" "f_asyncreads" }
|
|
||||||
{ "fsid_t" "f_fsid" }
|
|
||||||
{ "u_int32_t" "f_namemax" }
|
|
||||||
{ "uid_t" "f_owner" }
|
|
||||||
{ "u_int32_t" "f_ctime" }
|
|
||||||
{ { "u_int32_t" 3 } " f_spare" }
|
|
||||||
{ { "char" MFSNAMELEN } "f_fstypename" }
|
|
||||||
{ { "char" MNAMELEN } "f_mntonname" }
|
|
||||||
{ { "char" MNAMELEN } "f_mntfromname" }
|
|
||||||
{ { "char" 512 } "mount_info" } ;
|
|
||||||
! { "mount_info" "mount_info" } ;
|
|
|
@ -1 +0,0 @@
|
||||||
Doug Coleman
|
|
|
@ -1 +0,0 @@
|
||||||
Doug Coleman
|
|
|
@ -1,53 +0,0 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
|
||||||
USING: alien.syntax accessors combinators kernel
|
|
||||||
unix.types math system io.backend alien.c-types unix
|
|
||||||
unix.statfs io.files ;
|
|
||||||
IN: unix.statfs.openbsd
|
|
||||||
|
|
||||||
C-STRUCT: statvfs
|
|
||||||
{ "ulong" "f_bsize" }
|
|
||||||
{ "ulong" "f_frsize" }
|
|
||||||
{ "fsblkcnt_t" "f_blocks" }
|
|
||||||
{ "fsblkcnt_t" "f_bfree" }
|
|
||||||
{ "fsblkcnt_t" "f_bavail" }
|
|
||||||
{ "fsfilcnt_t" "f_files" }
|
|
||||||
{ "fsfilcnt_t" "f_ffree" }
|
|
||||||
{ "fsfilcnt_t" "f_favail" }
|
|
||||||
{ "ulong" "f_fsid" }
|
|
||||||
{ "ulong" "f_flag" }
|
|
||||||
{ "ulong" "f_namemax" } ;
|
|
||||||
|
|
||||||
: ST_RDONLY 1 ; inline
|
|
||||||
: ST_NOSUID 2 ; inline
|
|
||||||
|
|
||||||
FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
|
|
||||||
|
|
||||||
TUPLE: openbsd-file-system-info < file-system-info
|
|
||||||
bsize frsize blocks bfree bavail files ffree favail
|
|
||||||
fsid flag namemax ;
|
|
||||||
|
|
||||||
M: openbsd >file-system-info ( struct -- statfs )
|
|
||||||
[ \ openbsd-file-system-info new ] dip
|
|
||||||
{
|
|
||||||
[
|
|
||||||
[ statvfs-f_bsize ]
|
|
||||||
[ statvfs-f_bavail ] bi * >>free-space
|
|
||||||
]
|
|
||||||
[ statvfs-f_bsize >>bsize ]
|
|
||||||
[ statvfs-f_frsize >>frsize ]
|
|
||||||
[ statvfs-f_blocks >>blocks ]
|
|
||||||
[ statvfs-f_bfree >>bfree ]
|
|
||||||
[ statvfs-f_bavail >>bavail ]
|
|
||||||
[ statvfs-f_files >>files ]
|
|
||||||
[ statvfs-f_ffree >>ffree ]
|
|
||||||
[ statvfs-f_favail >>favail ]
|
|
||||||
[ statvfs-f_fsid >>fsid ]
|
|
||||||
[ statvfs-f_flag >>flag ]
|
|
||||||
[ statvfs-f_namemax >>namemax ]
|
|
||||||
} cleave ;
|
|
||||||
|
|
||||||
M: openbsd file-system-info ( path -- byte-array )
|
|
||||||
normalize-path
|
|
||||||
"statvfs" <c-object> tuck statvfs io-error
|
|
||||||
>file-system-info ;
|
|
|
@ -4,8 +4,6 @@ USING: sequences system vocabs.loader combinators accessors
|
||||||
kernel math.order sorting ;
|
kernel math.order sorting ;
|
||||||
IN: unix.statfs
|
IN: unix.statfs
|
||||||
|
|
||||||
HOOK: >file-system-info os ( struct -- statfs )
|
|
||||||
|
|
||||||
os {
|
os {
|
||||||
{ linux [ "unix.statfs.linux" require ] }
|
{ linux [ "unix.statfs.linux" require ] }
|
||||||
{ macosx [ "unix.statfs.macosx" require ] }
|
{ macosx [ "unix.statfs.macosx" require ] }
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Doug Coleman
|
|
@ -0,0 +1 @@
|
||||||
|
Doug Coleman
|
|
@ -0,0 +1,23 @@
|
||||||
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: alien.syntax ;
|
||||||
|
IN: unix.statvfs.freebsd
|
||||||
|
|
||||||
|
C-STRUCT: statvfs
|
||||||
|
{ "fsblkcnt_t" "f_bavail" }
|
||||||
|
{ "fsblkcnt_t" "f_bfree" }
|
||||||
|
{ "fsblkcnt_t" "f_blocks" }
|
||||||
|
{ "fsfilcnt_t" "f_favail" }
|
||||||
|
{ "fsfilcnt_t" "f_ffree" }
|
||||||
|
{ "fsfilcnt_t" "f_files" }
|
||||||
|
{ "ulong" "f_bsize" }
|
||||||
|
{ "ulong" "f_flag" }
|
||||||
|
{ "ulong" "f_frsize" }
|
||||||
|
{ "ulong" "f_fsid" }
|
||||||
|
{ "ulong" "f_namemax" } ;
|
||||||
|
|
||||||
|
! Flags
|
||||||
|
: ST_RDONLY HEX: 1 ; inline ! Read-only file system
|
||||||
|
: ST_NOSUID HEX: 2 ; inline ! Does not honor setuid/setgid
|
||||||
|
|
||||||
|
FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
|
|
@ -0,0 +1 @@
|
||||||
|
Doug Coleman
|
|
@ -0,0 +1,31 @@
|
||||||
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: alien.syntax ;
|
||||||
|
IN: unix.statvfs.linux
|
||||||
|
|
||||||
|
C-STRUCT: statvfs64
|
||||||
|
{ "ulong" "f_bsize" }
|
||||||
|
{ "ulong" "f_frsize" }
|
||||||
|
{ "__fsblkcnt64_t" "f_blocks" }
|
||||||
|
{ "__fsblkcnt64_t" "f_bfree" }
|
||||||
|
{ "__fsblkcnt64_t" "f_bavail" }
|
||||||
|
{ "__fsfilcnt64_t" "f_files" }
|
||||||
|
{ "__fsfilcnt64_t" "f_ffree" }
|
||||||
|
{ "__fsfilcnt64_t" "f_favail" }
|
||||||
|
{ "ulong" "f_fsid" }
|
||||||
|
{ "ulong" "f_flag" }
|
||||||
|
{ "ulong" "f_namemax" }
|
||||||
|
{ { "int" 6 } "__f_spare" } ;
|
||||||
|
|
||||||
|
FUNCTION: int statvfs64 ( char* path, statvfs64* buf ) ;
|
||||||
|
|
||||||
|
: ST_RDONLY 1 ; inline ! Mount read-only.
|
||||||
|
: ST_NOSUID 2 ; inline ! Ignore suid and sgid bits.
|
||||||
|
: ST_NODEV 4 ; inline ! Disallow access to device special files.
|
||||||
|
: ST_NOEXEC 8 ; inline ! Disallow program execution.
|
||||||
|
: ST_SYNCHRONOUS 16 ; inline ! Writes are synced at once.
|
||||||
|
: ST_MANDLOCK 64 ; inline ! Allow mandatory locks on an FS.
|
||||||
|
: ST_WRITE 128 ; inline ! Write on file/directory/symlink.
|
||||||
|
: ST_APPEND 256 ; inline ! Append-only file.
|
||||||
|
: ST_IMMUTABLE 512 ; inline ! Immutable file.
|
||||||
|
: ST_NOATIME 1024 ; inline ! Do not update access times.
|
|
@ -0,0 +1 @@
|
||||||
|
unportable
|
|
@ -0,0 +1 @@
|
||||||
|
Doug Coleman
|
|
@ -0,0 +1,23 @@
|
||||||
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: alien.syntax ;
|
||||||
|
IN: unix.statvfs.macosx
|
||||||
|
|
||||||
|
C-STRUCT: statvfs
|
||||||
|
{ "ulong" "f_bsize" }
|
||||||
|
{ "ulong" "f_frsize" }
|
||||||
|
{ "fsblkcnt_t" "f_blocks" }
|
||||||
|
{ "fsblkcnt_t" "f_bfree" }
|
||||||
|
{ "fsblkcnt_t" "f_bavail" }
|
||||||
|
{ "fsfilcnt_t" "f_files" }
|
||||||
|
{ "fsfilcnt_t" "f_ffree" }
|
||||||
|
{ "fsfilcnt_t" "f_favail" }
|
||||||
|
{ "ulong" "f_fsid" }
|
||||||
|
{ "ulong" "f_flag" }
|
||||||
|
{ "ulong" "f_namemax" } ;
|
||||||
|
|
||||||
|
! Flags
|
||||||
|
: ST_RDONLY HEX: 1 ; inline ! Read-only file system
|
||||||
|
: ST_NOSUID HEX: 2 ; inline ! Does not honor setuid/setgid
|
||||||
|
|
||||||
|
FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
|
|
@ -0,0 +1 @@
|
||||||
|
unportable
|
|
@ -0,0 +1 @@
|
||||||
|
Doug Coleman
|
|
@ -0,0 +1,35 @@
|
||||||
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: alien.syntax ;
|
||||||
|
IN: unix.statvfs.netbsd
|
||||||
|
|
||||||
|
: _VFS_NAMELEN 32 ; inline
|
||||||
|
: _VFS_MNAMELEN 1024 ; inline
|
||||||
|
|
||||||
|
C-STRUCT: statvfs
|
||||||
|
{ "ulong" "f_flag" }
|
||||||
|
{ "ulong" "f_bsize" }
|
||||||
|
{ "ulong" "f_frsize" }
|
||||||
|
{ "ulong" "f_iosize" }
|
||||||
|
{ "fsblkcnt_t" "f_blocks" }
|
||||||
|
{ "fsblkcnt_t" "f_bfree" }
|
||||||
|
{ "fsblkcnt_t" "f_bavail" }
|
||||||
|
{ "fsblkcnt_t" "f_bresvd" }
|
||||||
|
{ "fsfilcnt_t" "f_files" }
|
||||||
|
{ "fsfilcnt_t" "f_ffree" }
|
||||||
|
{ "fsfilcnt_t" "f_favail" }
|
||||||
|
{ "fsfilcnt_t" "f_fresvd" }
|
||||||
|
{ "uint64_t" "f_syncreads" }
|
||||||
|
{ "uint64_t" "f_syncwrites" }
|
||||||
|
{ "uint64_t" "f_asyncreads" }
|
||||||
|
{ "uint64_t" "f_asyncwrites" }
|
||||||
|
{ "fsid_t" "f_fsidx" }
|
||||||
|
{ "ulong" "f_fsid" }
|
||||||
|
{ "ulong" "f_namemax" }
|
||||||
|
{ "uid_t" "f_owner" }
|
||||||
|
{ { "uint32_t" 4 } "f_spare" }
|
||||||
|
{ { "char" _VFS_NAMELEN } "f_fstypename" }
|
||||||
|
{ { "char" _VFS_MNAMELEN } "f_mntonname" }
|
||||||
|
{ { "char" _VFS_MNAMELEN } "f_mntfromname" } ;
|
||||||
|
|
||||||
|
FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
|
|
@ -0,0 +1 @@
|
||||||
|
unportable
|
|
@ -0,0 +1 @@
|
||||||
|
Doug Coleman
|
|
@ -0,0 +1,22 @@
|
||||||
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: alien.syntax ;
|
||||||
|
IN: unix.statvfs.openbsd
|
||||||
|
|
||||||
|
C-STRUCT: statvfs
|
||||||
|
{ "ulong" "f_bsize" }
|
||||||
|
{ "ulong" "f_frsize" }
|
||||||
|
{ "fsblkcnt_t" "f_blocks" }
|
||||||
|
{ "fsblkcnt_t" "f_bfree" }
|
||||||
|
{ "fsblkcnt_t" "f_bavail" }
|
||||||
|
{ "fsfilcnt_t" "f_files" }
|
||||||
|
{ "fsfilcnt_t" "f_ffree" }
|
||||||
|
{ "fsfilcnt_t" "f_favail" }
|
||||||
|
{ "ulong" "f_fsid" }
|
||||||
|
{ "ulong" "f_flag" }
|
||||||
|
{ "ulong" "f_namemax" } ;
|
||||||
|
|
||||||
|
: ST_RDONLY 1 ; inline
|
||||||
|
: ST_NOSUID 2 ; inline
|
||||||
|
|
||||||
|
FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
|
|
@ -0,0 +1 @@
|
||||||
|
unportable
|
|
@ -0,0 +1,12 @@
|
||||||
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: combinators system vocabs.loader ;
|
||||||
|
IN: unix.statvfs
|
||||||
|
|
||||||
|
os {
|
||||||
|
{ linux [ "unix.statvfs.linux" require ] }
|
||||||
|
{ macosx [ "unix.statvfs.macosx" require ] }
|
||||||
|
{ freebsd [ "unix.statvfs.freebsd" require ] }
|
||||||
|
{ netbsd [ "unix.statvfs.netbsd" require ] }
|
||||||
|
{ openbsd [ "unix.statvfs.openbsd" require ] }
|
||||||
|
} case
|
|
@ -0,0 +1 @@
|
||||||
|
unportable
|
|
@ -187,7 +187,8 @@ SYMBOL: +unknown+
|
||||||
|
|
||||||
HOOK: file-systems os ( -- array )
|
HOOK: file-systems os ( -- array )
|
||||||
|
|
||||||
TUPLE: file-system-info device-name mount-point type free-space ;
|
TUPLE: file-system-info device-name mount-point type
|
||||||
|
available-space free-space used-space total-space ;
|
||||||
|
|
||||||
HOOK: file-system-info os ( path -- file-system-info )
|
HOOK: file-system-info os ( path -- file-system-info )
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Joe Groff
|
|
|
@ -1 +0,0 @@
|
||||||
Stanford Bunny rendered with cartoon-style lines instead of shading
|
|
|
@ -1,3 +0,0 @@
|
||||||
demos
|
|
||||||
opengl
|
|
||||||
glsl
|
|
Loading…
Reference in New Issue