[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/06: syscalls: Add 'restart-on-EINTR'.
From: |
Ludovic Courtès |
Subject: |
01/06: syscalls: Add 'restart-on-EINTR'. |
Date: |
Fri, 22 May 2015 09:51:21 +0000 |
civodul pushed a commit to branch master
in repository guix.
commit ea982704430b061f263580041d4f94174d8ba5cd
Author: Ludovic Courtès <address@hidden>
Date: Thu May 21 23:23:47 2015 +0200
syscalls: Add 'restart-on-EINTR'.
* guix/build/syscalls.scm (call-with-restart-on-EINTR): New procedure.
(restart-on-EINTR): New macro.
---
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 5bc4595..9ec7e8b 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")))
- branch master updated (4520354 -> 21461f2), Ludovic Courtès, 2015/05/22
- 01/06: syscalls: Add 'restart-on-EINTR'.,
Ludovic Courtès <=
- 03/06: gnu: guix: Update development snapshot., Ludovic Courtès, 2015/05/22
- 02/06: services: swap: Use 'restart-on-EINTR'., Ludovic Courtès, 2015/05/22
- 05/06: doc: Add a cross-reference to "origin Reference"., Ludovic Courtès, 2015/05/22
- 04/06: doc: Make '--manifest' more visible., Ludovic Courtès, 2015/05/22
- 06/06: doc: More cross-references., Ludovic Courtès, 2015/05/22