Troubles with SA_RESTART

Hello!

This piece of code doesn’t work.
Do you know why?

{
struct sigaction act;

/* First we retreive the current config
sigaction( SIGUSR1, NULL, &act );

act.sa_flags = act.sa_flags | SA_RESTART;
act.sa_handler = &handler;

/* We set SIGUSR config */
sigaction( SIGUSR1, &act , NULL);
}

Unfortunatly, the second sigaction returns with an error.
If I comment the line act.sa_flags = SA_RESTART, the second sigaction is OK.

Any idea?

Thank you

Vincent

SA_RESTART is unsupported.

  • igor

“Vincent” <vincent.catros_NO_SPAM_@bigfoot.com> wrote in message
news:9mlf2v$ej3$1@inn.qnx.com

Hello!

This piece of code doesn’t work.
Do you know why?

{
struct sigaction act;

/* First we retreive the current config
sigaction( SIGUSR1, NULL, &act );

act.sa_flags = act.sa_flags | SA_RESTART;
act.sa_handler = &handler;

/* We set SIGUSR config */
sigaction( SIGUSR1, &act , NULL);
}

Unfortunatly, the second sigaction returns with an error.
If I comment the line act.sa_flags = SA_RESTART, the second sigaction is
OK.

Any idea?

Thank you

Vincent

Vincent <vincent.catros_NO_SPAM_@bigfoot.com> wrote:

Hello!

This piece of code doesn’t work.
Do you know why?

{
struct sigaction act;

/* First we retreive the current config
sigaction( SIGUSR1, NULL, &act );

act.sa_flags = act.sa_flags | SA_RESTART;
act.sa_handler = &handler;

/* We set SIGUSR config */
sigaction( SIGUSR1, &act , NULL);
}

Unfortunatly, the second sigaction returns with an error.
If I comment the line act.sa_flags = SA_RESTART, the second sigaction is OK.

SA_RESTART is not support under QNX6.

What is SA_RESTART supposed to do? That is, what behaviour does it
modify/change?

-David

QNX Training Services
dagibbs@qnx.com

SA_RESTART tells kernel to automatically restart interrupted system
calls.
It is BSD invention I think.

Code which relies on this feature would need to be heavily patched for
all cases where library calls could potentially return EINTR.

I think it was lame idea for QNX to define SA_RESTART but not implement
it. If it was not defined it would not compile. At least it would not
lead people into false illusions.

  • igor

David Gibbs wrote:

SA_RESTART is not support under QNX6.

What is SA_RESTART supposed to do? That is, what behaviour does it
modify/change?

-David

QNX Training Services
dagibbs@qnx.com

Igor Kovalenko <Igor.Kovalenko@motorola.com> wrote:

I think it was lame idea for QNX to define SA_RESTART but not implement
it. If it was not defined it would not compile. At least it would not
lead people into false illusions.

It isn’t defined (as of 6.1).

#define SA_NOCLDWAIT 0x0020 /* Do not generate zombies on unwaited child /
/
#define SA_RESTART 0x0040 (not supported yet) / / Restart the kernel call on signal return /
#define SA_MASK 0x00ff /
Mask to special bits */

chris

cdm@qnx.com > “The faster I go, the behinder I get.”

Chris McKillop – Lewis Carroll –
Software Engineer, QSSL
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Igor Kovalenko <Igor.Kovalenko@motorola.com> wrote:

SA_RESTART tells kernel to automatically restart interrupted system
calls.
It is BSD invention I think.

Code which relies on this feature would need to be heavily patched for
all cases where library calls could potentially return EINTR.

Actually, if I had a bunch of code that defined that, I would work-around
it another way:

Mask all signals in the threads that set SA_RESTART & create a new thread
to receive the signals.

That should give the minimum work to fix. Might not get quite the same
behaviour, but is going to be reasonably close.

-David

QNX Training Services
dagibbs@qnx.com