1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

syscalls: Add 'statfs'.

* guix/build/syscalls.scm (<file-system>): New record type.
(fsword): New macro.
(%statfs): New C struct.
(statfs): New procedure.
This commit is contained in:
Ludovic Courtès
2016-04-25 17:18:58 +02:00
parent 785cfa8791
commit a1f708787d
2 changed files with 86 additions and 0 deletions

View File

@@ -78,6 +78,21 @@
(rmdir dir)
#t))))
(test-equal "statfs, ENOENT"
ENOENT
(catch 'system-error
(lambda ()
(statfs "/does-not-exist"))
(compose system-error-errno list)))
(test-assert "statfs"
(let ((fs (statfs "/")))
(and (file-system? fs)
(> (file-system-block-size fs) 0)
(>= (file-system-blocks-available fs) 0)
(>= (file-system-blocks-free fs)
(file-system-blocks-available fs)))))
(define (user-namespace pid)
(string-append "/proc/" (number->string pid) "/ns/user"))