ADescribe how to use sigaction such that a process receiving

A-Describe how to use sigaction such that a process receiving a signal can know the pid of the originating process of this signal.

B- Describe how to use sigaction such that a process can send a payload with the signal that can be retrieved by the receiving process.

Solution

A)In order to use sigaction so that a process receiving a signal can know the pid of the originating process of this signal we will first call sigaction() and then pass it to the struct sigaction.Moreover this struct sigaction has a signal handler in sa_sigaction and the SA_SIGINFO flag which is present in the sa_flags set.The signal handler can receive three arguements with the help of this given flag.One of the most important arguement is siginfo_t which contains the sender\'s PID(process identity) and UID(user identity).This is how by calling the function sigaction we can get to know the PID of the signal.

B)On the other hand we can use sigaction so that a process can send a payload with the signal that can be retrieved by the receiving process by calling the signalfd() function .This is followed by reading signalfd_siginfo structures from the same.The contents retireved by this are compared with siginfo_t which is shown when sigaction() is called.The payload sent and received is matched by caomparing signinfo_t and value returned by signalfd() function.If the two match then the message sent is received .If not then the message has been manipulated or a wrong message has been send.This is how it allows a process to send a payload.

A-Describe how to use sigaction such that a process receiving a signal can know the pid of the originating process of this signal. B- Describe how to use sigact

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site