mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: "张 译仁" <zyr_ms@outlook.com>
Cc: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: Re: [musl] Confused length of `sigset_t`
Date: Mon, 27 Jun 2022 18:18:26 +0200	[thread overview]
Message-ID: <87h7469j1p.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <OS3PR01MB557688F859612EEF849912F6ECB99@OS3PR01MB5576.jpnprd01.prod.outlook.com> (=?utf-8?B?IuW8oCDor5Hku4EiJ3M=?= message of "Mon, 27 Jun 2022 15:49:04 +0000")

* 张 译仁:

> When supporting signal handling for my tiny OS, I notice that the defination of `sigset_t`
> which is used in signal handling is weird.
>
> ```
> // include/alltypes.h.in
> TYPEDEF struct __sigset_t { unsigned long __bits[128/sizeof(long)]; } sigset_t;
> ```
>
> 128 bytes (16 * long) are used for sigmask​ when 128 bits (2 * long) is enough.
>
> Why? For strange compatibility?

I suspect it's for glibc compatibility.  glibc did that in case the
kernel ever added support for more signals.  The rt_sigprocmask system
call has a size argument, so it could potentially be extended beyond the
currently supported 64 or 128 bits (most architectures only support 64).

But later system calls that deal with signal sets do not take a size
argument, I think, so the extensibility just isn't there in practice,
and the glibc-reserved space is wasted.

Thanks,
Florian


  reply	other threads:[~2022-06-27 16:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27 15:49 张 译仁
2022-06-27 16:18 ` Florian Weimer [this message]
2022-06-27 20:27   ` 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=87h7469j1p.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=musl@lists.openwall.com \
    --cc=zyr_ms@outlook.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).