summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-07-03 10:52:55 +0200
committerLudovic Courtès <ludo@gnu.org>2018-07-03 17:50:04 +0200
commit25c7ff6a3ecbaa1e93b38d35c8cbff40b7f4edb8 (patch)
tree77aee44c3d14d98dfac93f504e6041f6dfbf5c83
parenta5b34d9d24cababcaa9d5e93813ccb3196e11a95 (diff)
syscalls: Define AT_SYMLINK_NOFOLLOW et al.
* guix/build/syscalls.scm (AT_FDCWD, AT_SYMLINK_NOFOLLOW, AT_REMOVEDIR) (AT_SYMLINK_FOLLOW, AT_NO_AUTOMOUNT, AT_EMPTY_PATH): New variables. * tests/syscalls.scm ("utime with AT_SYMLINK_NOFOLLOW"): New test.
-rw-r--r--guix/build/syscalls.scm17
-rw-r--r--tests/syscalls.scm13
2 files changed, 30 insertions, 0 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 25726b885e9..74cb675fcf4 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -46,6 +46,14 @@
46 MNT_DETACH 46 MNT_DETACH
47 MNT_EXPIRE 47 MNT_EXPIRE
48 UMOUNT_NOFOLLOW 48 UMOUNT_NOFOLLOW
49
50 AT_FDCWD
51 AT_SYMLINK_NOFOLLOW
52 AT_REMOVEDIR
53 AT_SYMLINK_FOLLOW
54 AT_NO_AUTOMOUNT
55 AT_EMPTY_PATH
56
49 restart-on-EINTR 57 restart-on-EINTR
50 mount-points 58 mount-points
51 swapon 59 swapon
@@ -667,6 +675,15 @@ mounted at FILE."
667 (* (file-system-block-size fs) 675 (* (file-system-block-size fs)
668 (file-system-blocks-available fs)))) 676 (file-system-blocks-available fs))))
669 677
678;; Flags for the *at command, notably the 'utime' procedure of libguile.
679;; From <fcntl.h>.
680(define AT_FDCWD -100)
681(define AT_SYMLINK_NOFOLLOW #x100)
682(define AT_REMOVEDIR #x200)
683(define AT_SYMLINK_FOLLOW #x400)
684(define AT_NO_AUTOMOUNT #x800)
685(define AT_EMPTY_PATH #x1000)
686
670 687
671;;; 688;;;
672;;; Containers. 689;;; Containers.
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index 0d07280b998..3e267c9f011 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -60,6 +60,19 @@
60 (any (cute member <> (mount-points)) 60 (any (cute member <> (mount-points))
61 '("/" "/proc" "/sys" "/dev"))) 61 '("/" "/proc" "/sys" "/dev")))
62 62
63(false-if-exception (delete-file temp-file))
64(test-equal "utime with AT_SYMLINK_NOFOLLOW"
65 '(0 0)
66 (begin
67 ;; Test libguile's utime with AT_SYMLINK_NOFOLLOW, which libguile does not
68 ;; define as of Guile 2.2.4.
69 (symlink "/nowhere" temp-file)
70 (utime temp-file 0 0 0 0 AT_SYMLINK_NOFOLLOW)
71 (let ((st (lstat temp-file)))
72 (delete-file temp-file)
73 ;; Note: 'utimensat' does not change 'ctime'.
74 (list (stat:mtime st) (stat:atime st)))))
75
63(test-assert "swapon, ENOENT/EPERM" 76(test-assert "swapon, ENOENT/EPERM"
64 (catch 'system-error 77 (catch 'system-error
65 (lambda () 78 (lambda ()