mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: "张 译仁" <zyr_ms@outlook.com>,
	"musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: Re: [musl] Confused length of `sigset_t`
Date: Mon, 27 Jun 2022 16:27:53 -0400	[thread overview]
Message-ID: <20220627202752.GU7074@brightrain.aerifal.cx> (raw)
In-Reply-To: <87h7469j1p.fsf@oldenburg.str.redhat.com>

On Mon, Jun 27, 2022 at 06:18:26PM +0200, Florian Weimer wrote:
> * 张 译仁:
> 
> > 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.

Yes, that was the reason. However in musl it's also used in the
jmp_buf for a few extra words of storage to implement sigsetjmp.

Rich

      reply	other threads:[~2022-06-27 20:28 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
2022-06-27 20:27   ` Rich Felker [this message]

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=20220627202752.GU7074@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=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).