[PATCH v2 1/3] Posix asynchronous I/O support: aio files
Mark Geisert
mark@maxrnd.com
Tue May 15 06:23:00 GMT 2018
On Wed, 2 May 2018, Brian Inglis wrote:
> On 2018-05-02 02:21, Mark Geisert wrote:
>> I found a discrepancy in the Cygwin source tree and would like input on how to
>> resolve it...
>> On Thu, 19 Apr 2018, Corinna Vinschen wrote:
>>>> +static void
>>>> +aionotify (struct aiocb *aio)
>>>> +{
>>>> + /* if signal notification wanted, send AIO-complete signal */
>>>> + //XXX Is sigqueue() the best way to send signo+value within same process?
>>>> + if (aio->aio_sigevent.sigev_notify == SIGEV_SIGNAL)
>>>> + sigqueue (mypid,
>>>> + aio->aio_sigevent.sigev_signo,
>>>> + aio->aio_sigevent.sigev_value);
>>> Given you have direct access to pinfo, you can just as well call
>>> sig_send (myself, ...). This also drop the requirement to know your pid.
>> While making the change from sigqueue() to sig_send() I was researching
>> siginfo_t, and I found that the values for element si_code in Cygwin's
>> /usr/include/sys/signal.h...
>> /* Signal Actions, P1003.1b-1993, p. 64 */
>> /* si_code values, p. 66 */
>> #define SI_USER 1 /* Sent by a user. kill(), abort(), etc */
>> #define SI_QUEUE 2 /* Sent by sigqueue() */
>> #define SI_TIMER 3 /* Sent by expiration of a timer_settime() timer */
>> #define SI_ASYNCIO 4 /* Indicates completion of asycnhronous IO */
>> #define SI_MESGQ 5 /* Indicates arrival of a message at an empty queue */
>> ...are inconsistent with the enum values in internal file
>> winsup/cygwin/include/cygwin/signal.h...
>> enum
>> {
>> SI_USER = 0, /* sent by kill, raise, pthread_kill */
>> SI_ASYNCIO = 2, /* sent by AIO completion (currently unimplemented) */
>> SI_MESGQ, /* sent by real time mesq state change
>> (currently unimplemented) */
>> SI_TIMER, /* sent by timer expiration */
>> SI_QUEUE, /* sent by sigqueue */
>> SI_KERNEL, /* sent by system */
>>
>> ILL_ILLOPC, /* illegal opcode */
>> ILL_ILLOPN, /* illegal operand */
>> [...]
>> };
>> I figure it's the /usr/include/sys/signal.h defines that should be changed,
>> given that Posix doesn't specify values but only the names of the values. And
>> the winsup* enum values are the ones used internally so should likely not be
>> changed.
>> Does this sound like the right way to go?
>
> The other values appear to be used by non-Cygwin newlib implementations
> bracketed by:
>
> #if defined(__CYGWIN__)
> #include <cygwin/signal.h>
> #else
> ... 100+ lines
> #endif /* defined(__CYGWIN__) */
>
> and, if that was required, should be changed via the newlib list.
Finally got this question popped to the top of my stack. Thanks Brian.
It's all good as-is. I had previously not thought to consider the myriad
nestings and cross-definitions accomplished by macros. Props to those on
the team who keep all this stuff straight. No mere mortals they.
..mark
More information about the Cygwin-patches
mailing list