Message ID | 87illsb71w.fsf@gnu.org |
---|---|
State | New |
Headers | show |
Series | [bug#57730] syscalls: Adjust for glibc 2.34 and later. | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git-branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
Ludovic Courtès <ludo@gnu.org> skriver: >> (define openpty >> - (let ((proc (syscall->procedure int "openpty" '(* * * * *) >> - #:library "libutil"))) >> - (lambda () >> - "Return two file descriptors: one for the pseudo-terminal control side, >> + (lambda* (#:optional library) >> + "Return two file descriptors: one for the pseudo-terminal control side, >> and one for the controlled side." >> + (let ((proc (syscall->procedure int "openpty" '(* * * * *) >> + #:library library))) > > In general, we must ensure that ‘syscall->procedure’ is called only once > per procedure, because it’s expensive compared to the function we’re > wrapping (it’s doing dlopen, dlsym, and all that). That makes sense. > Anyway, I think this should work: > > diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm > index 7842b0a9fc..e081aaca44 100644 > --- a/guix/build/syscalls.scm > +++ b/guix/build/syscalls.scm > @@ -445,9 +445,14 @@ (define* (syscall->procedure return-type name argument-types > the returned procedure is called." > (catch #t > (lambda () > + ;; Note: When #:library is set, try it first and fall back to libc > + ;; proper. This is because libraries like libutil.so have been subsumed > + ;; by libc.so with glibc >= 2.34. > (let ((ptr (dynamic-func name > (if library > - (dynamic-link library) > + (or (false-if-exception > + (dynamic-link library)) > + (dynamic-link)) > (dynamic-link))))) > ;; The #:return-errno? facility was introduced in Guile 2.0.12. > (pointer->procedure return-type ptr argument-types > > WDYT? I can confirm this works after reverting 3c8b6fd94ceb1e89821. Can you commit it, or should I do it on your behalf? I think we should try to get it in 1.4.0 so Guix works when linked against system libc on foreign distributions. I'll revert 3c8b6fd94ce once this lands on 'core-updates'. Thanks!
Hey, > Can you commit it, or should I do it on your behalf? I think we should > try to get it in 1.4.0 so Guix works when linked against system libc on > foreign distributions. This indeed seems like the right thing to do :) Marius or Ludo, I think you can go ahead :) Thanks, Mathieu
Hi, Mathieu Othacehe <othacehe@gnu.org> skribis: > Hey, > >> Can you commit it, or should I do it on your behalf? I think we should >> try to get it in 1.4.0 so Guix works when linked against system libc on >> foreign distributions. > > This indeed seems like the right thing to do :) Marius or Ludo, I think > you can go ahead :) Pushed on ‘core-updates’ as 3f6c32a88fc7a4d707ae1ed8ef3f7bd995461aff! Ludo’.
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 7842b0a9fc..e081aaca44 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -445,9 +445,14 @@ (define* (syscall->procedure return-type name argument-types the returned procedure is called." (catch #t (lambda () + ;; Note: When #:library is set, try it first and fall back to libc + ;; proper. This is because libraries like libutil.so have been subsumed + ;; by libc.so with glibc >= 2.34. (let ((ptr (dynamic-func name (if library - (dynamic-link library) + (or (false-if-exception + (dynamic-link library)) + (dynamic-link)) (dynamic-link))))) ;; The #:return-errno? facility was introduced in Guile 2.0.12. (pointer->procedure return-type ptr argument-types