[PATCH] syscalls: Consistently use existing linux? definition

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • soeren
Owner
unassigned
Submitted by
soeren
Severity
normal
S
S
soeren wrote on 3 Aug 2023 13:20
(address . guix-patches@gnu.org)
20230803112123.6866-1-soeren@soeren-tempel.net
From: Sören Tempel <soeren@soeren-tempel.net>

Instead of duplicating this existing logic across the source file. This
will make it easier to add additional linux targets (e.g. linux-musl) in
the future.

* guix/build/syscalls.scm (readdir*): Use linux? constant.
* guix/build/syscalls.scm (write-socket-address!): Use linux? constant.
* guix/build/syscalls.scm (read-socket-address): Use linux? constant.

Signed-off-by: Sören Tempel <soeren@soeren-tempel.net>
---
guix/build/syscalls.scm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Toggle diff (30 lines)
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index d947b010d3..c9c0bf594d 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -1244,7 +1244,7 @@ (define (readdir-procedure name-field-offset sizeof-dirent-header
(define readdir*
;; Decide at run time which one must be used.
- (if (string-contains %host-type "linux-gnu")
+ (if linux?
(readdir-procedure (c-struct-field-offset %struct-dirent-header/linux
name)
sizeof-dirent-header/linux
@@ -1664,7 +1664,7 @@ (define (write-socket-address!/hurd sockaddr bv index)
(error "unsupported socket address" sockaddr)))))
(define write-socket-address!
- (if (string-contains %host-type "linux-gnu")
+ (if linux?
write-socket-address!/linux
write-socket-address!/hurd))
@@ -1696,7 +1696,7 @@ (define* (read-socket-address/hurd bv #:optional (index 0))
(vector family)))))
(define read-socket-address
- (if (string-contains %host-type "linux-gnu")
+ (if linux?
read-socket-address/linux
read-socket-address/hurd))
L
L
Ludovic Courtès wrote on 15 Aug 2023 00:07
(address . soeren@soeren-tempel.net)(address . 65036-done@debbugs.gnu.org)
87wmxx9t2e.fsf@gnu.org
Hi,

soeren@soeren-tempel.net skribis:

Toggle quote (12 lines)
> From: Sören Tempel <soeren@soeren-tempel.net>
>
> Instead of duplicating this existing logic across the source file. This
> will make it easier to add additional linux targets (e.g. linux-musl) in
> the future.
>
> * guix/build/syscalls.scm (readdir*): Use linux? constant.
> * guix/build/syscalls.scm (write-socket-address!): Use linux? constant.
> * guix/build/syscalls.scm (read-socket-address): Use linux? constant.
>
> Signed-off-by: Sören Tempel <soeren@soeren-tempel.net>

Applied and tweaked the commit log. Thanks!

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 65036@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 65036
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch