mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Subject: Re: [musl] Add SYSCALL_USE_SOCKETCALL for old arch
Date: Tue, 4 Aug 2020 20:56:42 +0200	[thread overview]
Message-ID: <20200804185642.GG2076@voyager> (raw)
In-Reply-To: <20200804181845.GI6949@brightrain.aerifal.cx>

On Tue, Aug 04, 2020 at 02:18:45PM -0400, Rich Felker wrote:
> Of these, only ppc, ppc64, sh, and possibly s390 (we only support
> 64-bit "s390x" and I'm not sure if it ever lacked the broken-down
> syscalls) are relevant. The rest are either unsupported by musl
> (including pre-EABI arm) or already using SYS_socketcall.

According to musl source, all currently supported architectures have
__NR_socket (I didn't check the other calls; I just assumed that
__NR_socket was a stand-in for all the other ones).

Therefore the required change can be performed by changing the
__socketcall macro (and __socketcall_cp of course). Something like this,
maybe? (If using GCC statement expressions is alright):

#ifdef __NR_socketcall
#define __socketcall(nm, a, b, c, d, e, f) \
    ({int r = __syscall(__NR_ ## nm, a, b, c, d, e, f); \
    if (r == -ENOSYS) \
        r = __syscall(__NR_socketcall, __SC_ ## nm, \
            (long[6]){(long)a, (long) b, (long)c, (long)d, (long)e, (long) f});
    r;})
#else
#define __socketcall(nm, a, b, c, d, e, f) __syscall(__NR_ ## nm, a, b, c, d, e, f)
#endif

Ciao,
Markus

  reply	other threads:[~2020-08-04 18:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03  7:41 David Timber
2020-08-03 13:33 ` Rich Felker
     [not found]   ` <CAGYH49BV-SG0THP2kzbSVVRypkk0APF1MQb74geskos=dDLv6A@mail.gmail.com>
     [not found]     ` <CAGYH49Dd6qMK0pL+eGBzMZPxBqoZhRRfejnsvkkSsN+xcw4njg@mail.gmail.com>
     [not found]       ` <20200803141513.GD6949@brightrain.aerifal.cx>
     [not found]         ` <CAGYH49AEpS9_ndXP=x20Qpj7tx0RBEyt+iB5nEjD4odUW02wiQ@mail.gmail.com>
2020-08-04 18:18           ` Rich Felker
2020-08-04 18:56             ` Markus Wichmann [this message]
2020-08-04 19:15               ` Rich Felker
2020-08-06  2:18                 ` [musl] [PATCH] use new socket syscalls, fallback to socketcall Rich Felker

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=20200804185642.GG2076@voyager \
    --to=nullplan@gmx.net \
    --cc=musl@lists.openwall.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 public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).