Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Wed, 26 Jun 2024 11:30:46 -0400
From: Rich Felker <>
To: 仇玉加 <>
Cc: musl <>
Subject: Re: The sigtimedwait function can't return EINTR

On Tue, Jun 25, 2024 at 02:14:29PM +0800, 仇玉加 wrote:
> Hi,
> Why not check for EINTR errors in sigwait function instead of sigtimedwait function?
> In posix, the sigtimedwait function can return an EINTR error.

It's a may fail, not a shall fail, so either behavior is allowed.

> Can you give me a reason for this situation?

Commit 0a949ebdf0b9fc054ea868bd049c8f2c7aed973e documents that it was
necessary that sigwait not fail with EINTR, so the logic to retry in
EINTR had to be added either in sigwait or sigtimedwait.

Generally we don't utilize "may fail" unless there's a good reason. In
the case of sigtimedwait, I think my reasoning was that it's already
waiting for one of a set of signals, and you could just include the
signal(s) you want to be interrupted by in that set. Since the EINTR
condition is not mandatory, this is the only portable way to do it.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.