--- /dev/null
+! Copyright (C) 2009 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types io.directories.unix kernel system unix ;
+IN: io.directories.unix.linux
+
+M: unix find-next-file ( DIR* -- byte-array )
+ "dirent" <c-object>
+ f <void*>
+ [ readdir64_r 0 = [ (io-error) ] unless ] 2keep
+ *void* [ drop f ] unless ;
--- /dev/null
+unportable
continuations destructors fry io io.backend io.backend.unix
io.directories io.encodings.binary io.encodings.utf8 io.files
io.pathnames io.files.types kernel math.bitwise sequences system
-unix unix.stat ;
+unix unix.stat vocabs.loader ;
IN: io.directories.unix
: touch-mode ( -- n )
[ >directory-entry ]
produce nip
] with-unix-directory ;
+
+os linux? [ "io.directories.unix.linux" require ] when
{ "char*" "pw_shell" } ;
! dirent64
-C-STRUCT: dirent64
+C-STRUCT: dirent
{ "ulonglong" "d_ino" }
{ "longlong" "d_off" }
{ "ushort" "d_reclen" }
FUNCTION: int open64 ( char* path, int flags, int prot ) ;
FUNCTION: dirent64* readdir64 ( DIR* dirp ) ;
-FUNCTION: int readdir64_r ( void* dirp, dirent64* entry, dirent64** result ) ;
+FUNCTION: int readdir64_r ( void* dirp, dirent* entry, dirent** result ) ;
M: linux open-file [ open64 ] unix-system-call ;