A. Harkous A. Harkous - 1 year ago 102
Linux Question

How to set more than one flag in sigaction.sa_flags

I have the following structure:

struct sigaction sa1;
sa1.sa_sigaction = handler;

How can I use SA_SIGINFO along with SA_NODEFER without making the second flag overrides the first?

Answer Source

The manual page has the answer:

It is formed by the bitwise OR of zero or more of the following: [...]

So you'd do something like

sa1.sa_flags = SA_NODEFER | SA_SIGINFO;