[PATCH v2 1/3] Posix asynchronous I/O support: aio files

Mark Geisert mark@maxrnd.com
Wed May 2 08:21:00 GMT 2018


Hi Corinna,
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 */

typedef struct {
   int          si_signo;    /* Signal number */
   int          si_code;     /* Cause of the signal */
   union sigval si_value;    /* Signal value */
} siginfo_t;

...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?
Thanks,

..mark



More information about the Cygwin-patches mailing list