summary refs log tree commit diff
diff options
context:
space:
mode:
authorJan (janneke) Nieuwenhuizen <janneke@gnu.org>2020-05-30 15:11:49 +0200
committerJan Nieuwenhuizen <janneke@gnu.org>2020-06-08 13:51:17 +0200
commit1428926f1f0d7577cd2de8d019a27f8082855d03 (patch)
tree71eef8575bdf3944e3f309c867f48a7323b4396c
parent4c26229ccbbcac843567aa6c52a0287ff6eb1494 (diff)
downloadguix-1428926f1f0d7577cd2de8d019a27f8082855d03.tar.gz
syscalls: set-thread-name, thread-name: Stub for the Hurd.
Avoid crash

    Backtrace:
    guix/build/syscalls.scm:405:8: In procedure prctl: Function not implemented

because of missing prctl on the Hurd.

* guix/build/syscalls.scm (set-thread-name, thread-name): Rename to ...
(set-thread-name!/linux,thread-name/linux): ...this.
(set-thread-name, thread-name): Swtich between linux implementation and or
stub.
-rw-r--r--guix/build/syscalls.scm14
1 files changed, 12 insertions, 2 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index d69b178a0a..549346c5f9 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -1218,7 +1218,7 @@ handler if the lock is already held by another process."
   ;; zero.
   16)
 
-(define (set-thread-name name)
+(define (set-thread-name!/linux name)
   "Set the name of the calling thread to NAME.  NAME is truncated to 15
 bytes."
   (let ((ptr (string->pointer name)))
@@ -1231,7 +1231,7 @@ bytes."
                (list (strerror err))
                (list err))))))
 
-(define (thread-name)
+(define (thread-name/linux)
   "Return the name of the calling thread as a string."
   (let ((buf (make-bytevector %max-thread-name-length)))
     (let-values (((ret err)
@@ -1245,6 +1245,16 @@ bytes."
                  (list (strerror err))
                  (list err))))))
 
+(define set-thread-name
+  (if (string-contains %host-type "linux")
+      set-thread-name!/linux
+      (cute const #f)))
+
+(define thread-name
+  (if (string-contains %host-type "linux")
+      thread-name/linux
+      (cute const "")))
+
 
 ;;;
 ;;; Network interfaces.