diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-05-21 23:23:47 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-05-22 11:51:12 +0200 |
commit | ea982704430b061f263580041d4f94174d8ba5cd (patch) | |
tree | 8bf9ef71b798984da2d02cbc78bdd404d3434c7b /guix/build | |
parent | 4520354282de331f82064f52d49a51d5eb28ab5e (diff) | |
download | gnu-guix-ea982704430b061f263580041d4f94174d8ba5cd.tar gnu-guix-ea982704430b061f263580041d4f94174d8ba5cd.tar.gz |
syscalls: Add 'restart-on-EINTR'.
* guix/build/syscalls.scm (call-with-restart-on-EINTR): New procedure.
(restart-on-EINTR): New macro.
Diffstat (limited to 'guix/build')
-rw-r--r-- | guix/build/syscalls.scm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 5bc4595d08..9ec7e8b4a9 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -29,6 +29,7 @@ MS_REMOUNT MS_BIND MS_MOVE + restart-on-EINTR mount umount mount-points @@ -89,6 +90,19 @@ (ref bv)))) (lambda () 0))) +(define (call-with-restart-on-EINTR thunk) + (let loop () + (catch 'system-error + thunk + (lambda args + (if (= (system-error-errno args) EINTR) + (loop) + (apply throw args)))))) + +(define-syntax-rule (restart-on-EINTR expr) + "Evaluate EXPR and restart upon EINTR. Return the value of EXPR." + (call-with-restart-on-EINTR (lambda () expr))) + (define (augment-mtab source target type options) "Augment /etc/mtab with information about the given mount point." (let ((port (open-file "/etc/mtab" "a"))) |