From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16024 invoked from network); 27 Jun 2022 20:28:15 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 27 Jun 2022 20:28:15 -0000 Received: (qmail 1228 invoked by uid 550); 27 Jun 2022 20:28:11 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 32688 invoked from network); 27 Jun 2022 20:28:05 -0000 Date: Mon, 27 Jun 2022 16:27:53 -0400 From: Rich Felker To: Florian Weimer Cc: =?utf-8?B?5bygIOivkeS7gQ==?= , "musl@lists.openwall.com" Message-ID: <20220627202752.GU7074@brightrain.aerifal.cx> References: <87h7469j1p.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87h7469j1p.fsf@oldenburg.str.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] Confused length of `sigset_t` 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