diff options
author | Ludovic Courtès <ludo@gnu.org> | 2017-05-31 15:23:51 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2017-06-02 18:47:07 +0200 |
commit | 65f224dc8d9568232baa07f28474ba5c90f07428 (patch) | |
tree | ff6a0f7e286d59600a5a3e289b355e454ef147fd /guix/build | |
parent | d9bad2f08296fa73b967973aa6648d24c100980f (diff) | |
download | gnu-guix-65f224dc8d9568232baa07f28474ba5c90f07428.tar gnu-guix-65f224dc8d9568232baa07f28474ba5c90f07428.tar.gz |
syscalls: Provide 'free-disk-space'.
* guix/build/syscalls.scm (free-disk-space): New procedure.
* guix/scripts/gc.scm (guix-gc)[ensure-free-space]: Use it instead of
'statfs'.
Diffstat (limited to 'guix/build')
-rw-r--r-- | guix/build/syscalls.scm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 52439afd44..2def2a108f 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -62,6 +62,7 @@ file-system-fragment-size file-system-mount-flags statfs + free-disk-space processes mkdtemp! @@ -697,6 +698,12 @@ mounted at FILE." (list file (strerror err)) (list err))))))) +(define (free-disk-space file) + "Return the free disk space, in bytes, on the file system that hosts FILE." + (let ((fs (statfs file))) + (* (file-system-block-size fs) + (file-system-blocks-available fs)))) + ;;; ;;; Containers. |