Skip to content
Snippets Groups Projects
Unverified Commit 25c7ff6a authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

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.
parent a5b34d9d
No related branches found
No related tags found
No related merge requests found
...@@ -46,6 +46,14 @@ (define-module (guix build syscalls) ...@@ -46,6 +46,14 @@ (define-module (guix build syscalls)
MNT_DETACH MNT_DETACH
MNT_EXPIRE MNT_EXPIRE
UMOUNT_NOFOLLOW UMOUNT_NOFOLLOW
AT_FDCWD
AT_SYMLINK_NOFOLLOW
AT_REMOVEDIR
AT_SYMLINK_FOLLOW
AT_NO_AUTOMOUNT
AT_EMPTY_PATH
restart-on-EINTR restart-on-EINTR
mount-points mount-points
swapon swapon
...@@ -667,6 +675,15 @@ (define (free-disk-space file) ...@@ -667,6 +675,15 @@ (define (free-disk-space file)
(* (file-system-block-size fs) (* (file-system-block-size fs)
(file-system-blocks-available fs)))) (file-system-blocks-available fs))))
;; Flags for the *at command, notably the 'utime' procedure of libguile.
;; From <fcntl.h>.
(define AT_FDCWD -100)
(define AT_SYMLINK_NOFOLLOW #x100)
(define AT_REMOVEDIR #x200)
(define AT_SYMLINK_FOLLOW #x400)
(define AT_NO_AUTOMOUNT #x800)
(define AT_EMPTY_PATH #x1000)
;;; ;;;
;;; Containers. ;;; Containers.
......
...@@ -60,6 +60,19 @@ (define temp-file ...@@ -60,6 +60,19 @@ (define temp-file
(any (cute member <> (mount-points)) (any (cute member <> (mount-points))
'("/" "/proc" "/sys" "/dev"))) '("/" "/proc" "/sys" "/dev")))
(false-if-exception (delete-file temp-file))
(test-equal "utime with AT_SYMLINK_NOFOLLOW"
'(0 0)
(begin
;; Test libguile's utime with AT_SYMLINK_NOFOLLOW, which libguile does not
;; define as of Guile 2.2.4.
(symlink "/nowhere" temp-file)
(utime temp-file 0 0 0 0 AT_SYMLINK_NOFOLLOW)
(let ((st (lstat temp-file)))
(delete-file temp-file)
;; Note: 'utimensat' does not change 'ctime'.
(list (stat:mtime st) (stat:atime st)))))
(test-assert "swapon, ENOENT/EPERM" (test-assert "swapon, ENOENT/EPERM"
(catch 'system-error (catch 'system-error
(lambda () (lambda ()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment