all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: soeren@soeren-tempel.net
To: 72395@debbugs.gnu.org
Cc: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org,
	othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr
Subject: [bug#72395] [PATCH] syscalls: Support musl libc in openpty and login-tty
Date: Wed, 31 Jul 2024 11:41:58 +0200	[thread overview]
Message-ID: <ecdbe1915ce12e411816a7da2b59d48a6619630d.1722418917.git.soeren@soeren-tempel.net> (raw)

From: Sören Tempel <soeren@soeren-tempel.net>

Contrary to glibc, musl does not define the openpty and login-tty
function in libutil.so. In fact, libutil.so does not exist on musl-based
Linux distributions.  Therefore, on musl-based systems we don't have
to pass any #:library keyword argument to syscall->procedure.
---
 guix/build/syscalls.scm | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 39bcffd516..b92b6955a4 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -2382,8 +2382,10 @@ (define terminal-string-width
         string-length)))                      ;using a statically-linked Guile
 
 (define openpty
-  (let ((proc (syscall->procedure int "openpty" '(* * * * *)
-                                  #:library "libutil")))
+  (let ((proc (if musl-libc?
+                (syscall->procedure int "openpty" '(* * * * *)
+                                    #:library "libutil")
+                (syscall->procedure int "openpty" '(* * * * *)))))
     (lambda ()
       "Return two file descriptors: one for the pseudo-terminal control side,
 and one for the controlled side."
@@ -2404,8 +2406,10 @@ (define openpty
           (values (* head) (* inferior)))))))
 
 (define login-tty
-  (let* ((proc (syscall->procedure int "login_tty" (list int)
-                                   #:library "libutil")))
+  (let* ((proc (if musl-libc?
+                 (syscall->procedure int "login_tty" (list int)
+                                     #:library "libutil")
+                 (syscall->procedure int "login_tty" (list int)))))
     (lambda (fd)
       "Make FD the controlling terminal of the current process (with the
 TIOCSCTTY ioctl), redirect standard input, standard output and standard error

base-commit: 01d4363168ed10ea223047f7a7b83201f161ec0b




             reply	other threads:[~2024-07-31  9:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31  9:41 soeren [this message]
2024-08-01 16:03 ` [bug#72395] [PATCH] syscalls: Support musl libc in openpty and login-tty Z572
2024-08-03 10:38   ` Sören Tempel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ecdbe1915ce12e411816a7da2b59d48a6619630d.1722418917.git.soeren@soeren-tempel.net \
    --to=soeren@soeren-tempel.net \
    --cc=72395@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=guix@cbaines.net \
    --cc=ludo@gnu.org \
    --cc=me@tobias.gr \
    --cc=othacehe@gnu.org \
    --cc=zimon.toutoune@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.