guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: syscalls: Add 'setxattr'.


From: guix-commits
Subject: branch master updated: syscalls: Add 'setxattr'.
Date: Wed, 13 May 2020 17:26:19 -0400

This is an automated email from the git hooks/post-receive script.

janneke pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new d155c9d  syscalls: Add 'setxattr'.
d155c9d is described below

commit d155c9d93496ae620829fbc33b5694e74cda9683
Author: Jan (janneke) Nieuwenhuizen <address@hidden>
AuthorDate: Wed May 13 22:49:54 2020 +0200

    syscalls: Add 'setxattr'.
    
    * guix/build/syscalls.scm (setxattr): New procedure.
    
    Co-authored-by: Ludovic Courtès <address@hidden>
---
 guix/build/syscalls.scm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 4ee2b97..3bb4545 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -79,6 +79,7 @@
             fdatasync
             pivot-root
             scandir*
+            setxattr
 
             fcntl-flock
             lock-file
@@ -723,6 +724,23 @@ backend device."
              (list (strerror err))
              (list err))))))
 
+(define setxattr
+  (let ((proc (syscall->procedure int "setxattr"
+                                  `(* * * ,size_t ,int))))
+    (lambda* (file key value #:optional (flags 0))
+      "Set extended attribute KEY to VALUE on FILE."
+      (let*-values (((bv) (string->utf8 value))
+                    ((ret err)
+                     (proc (string->pointer/utf-8 file)
+                           (string->pointer key)
+                           (bytevector->pointer bv)
+                           (bytevector-length bv)
+                           flags)))
+        (unless (zero? ret)
+          (throw 'system-error "setxattr" "~S: ~A"
+                 (list file key value (strerror err))
+                 (list err)))))))
+
 
 ;;;
 ;;; Random.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]