]> gitweb.factorcode.org Git - factor.git/commitdiff
unix: adding truncate-file.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 26 Oct 2012 04:51:08 +0000 (21:51 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 26 Oct 2012 04:51:08 +0000 (21:51 -0700)
basis/unix/ffi/ffi.factor
basis/unix/unix.factor

index ba1b7646d2694769ab8240eed287460ca2a61c50..8d8f6d41970de27c28d68b390439c38ea690810e 100644 (file)
@@ -176,6 +176,8 @@ FUNCTION: int setuid ( uid_t uid ) ;
 FUNCTION: int socket ( int domain, int type, int protocol ) ;
 FUNCTION: int symlink ( c-string path1, c-string path2 ) ;
 FUNCTION: int link ( c-string path1, c-string path2 ) ;
+FUNCTION: int ftruncate ( int fd, int length ) ;
+FUNCTION: int truncate ( c-string path, int length ) ;
 FUNCTION: int unlink ( c-string path ) ;
 FUNCTION: int utimes ( c-string path, timeval[2] times ) ;
 FUNCTION: ssize_t write ( int fd, void* buf, size_t nbytes ) ;
index 7d5549e4336447537440a45f90305e298bb164ee..3ac845aab497b889107cf3c8fc4f6e282293a5c9 100644 (file)
@@ -56,6 +56,8 @@ M: unix open-file [ open ] unix-system-call ;
 
 : make-fifo ( path mode -- ) [ mkfifo ] unix-system-call drop ;
 
+: truncate-file ( path n -- ) [ truncate ] unix-system-call drop ;
+
 : touch ( filename -- ) f [ utime ] unix-system-call drop ;
 
 : change-file-times ( filename access modification -- )