Skip navigation.
Home
The QNX Community Portal

View topic - Need information about "void handler(int signo, siginfo_t *i

Need information about "void handler(int signo, siginfo_t *i

For discussion of realtime and/or embedded programming.

Need information about "void handler(int signo, siginfo_t *i

Postby wednesday » Tue Sep 18, 2012 5:55 am

I need a usage of "void handler(int signo, siginfo_t *info, void *other)" function in sigaction, how to invoke "handler(int signo, siginfo_t *info, void *other)" function using all its parameters. My requirement is to pass "this" pointer as the third parameter. Would it be possible to provide me an example where all parameters are being used, mainly "void *other".
wednesday
Active Member
 
Posts: 48
Joined: Tue Apr 28, 2009 7:10 am

Re: Need information about "void handler(int signo, siginfo_

Postby maschoen » Wed Sep 19, 2012 8:22 am

wednesday wrote:I need a usage of "void handler(int signo, siginfo_t *info, void *other)" function in sigaction, how to invoke "handler(int signo, siginfo_t *info, void *other)" function using all its parameters. My requirement is to pass "this" pointer as the third parameter. Would it be possible to provide me an example where all parameters are being used, mainly "void *other".


You misunderstand the usage. handler() is not something that you call. This is a function that you provide, which is called when a signal is raised. You do not pass the void *other parameter, but rather it is passed to your function.

The third parameter "void *other" must seem a little mysterious as it is not mentioned in the documentation. A quote from "Programming For The Real World, POSIX.4" Bill O. Gallmeister, O'Reilly & Associates Inc., might help.

"void handler_for_SIGRTMIN(int signu, siginfo_t *data, void *extra);

The signum is as before, and the extra parameter is undefined by POSIX.4
(it has meaning in several standard UNIX systems, however, generally referring to the
machine context at the time of the signal; POSIX.4 defines it so as not to gratuitously
break the function prototypes used in those implementations)."

I hope this helps.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm


Return to Realtime and Embedded

Who is online

Users browsing this forum: No registered users and 3 guests