syscalls: Add 'restart-on-EINTR'.
* guix/build/syscalls.scm (call-with-restart-on-EINTR): New procedure. (restart-on-EINTR): New macro.
This commit is contained in:
parent
4520354282
commit
ea98270443
1 changed files with 14 additions and 0 deletions
|
@ -29,6 +29,7 @@ (define-module (guix build syscalls)
|
|||
MS_REMOUNT
|
||||
MS_BIND
|
||||
MS_MOVE
|
||||
restart-on-EINTR
|
||||
mount
|
||||
umount
|
||||
mount-points
|
||||
|
@ -89,6 +90,19 @@ (define errno
|
|||
(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")))
|
||||
|
|
Loading…
Reference in a new issue