C
Charles Sullivan
I have existing code in which the signal() and signal
handler functions appear (for example) like this:
----------------------
#include <signal.h>
void my_handler(int signo);
signal(SIGALRM, my_handler);
---------------------
It appears to work on all Unix-like platforms reported on
(including Linux, various BSDs, Mac OSX, SYSV, AT&TSysVr4).
However on AT&TSysVr4 there are compiler warnings for the
signal() statements:
"warning: argument is incompatible with prototype: arg #2"
According to the signal man page (which I received from a
user of this OS):
------------------
#include <signal.h>
void (*signal(int sig, void (*disp)(int)))(int);
-----------------
I thought I would just change the declaration of the
signal handler to match the OS (ATTSYSVR4 is defined at
configuration) like this:
-------------------
#include <signal.h>
#ifdef ATTSYSVR4
typedef void (*disp)(int) SIGHANDLER;
#else
typedef void SIGHANDLER;
#endif
SIGHANDLER my_handler(int signo);
------------------
Does that look correct? I don't have access to a
computer running this OS and can't try it myself.
Thanks for your help.
Regards,
Charles Sullivan
handler functions appear (for example) like this:
----------------------
#include <signal.h>
void my_handler(int signo);
signal(SIGALRM, my_handler);
---------------------
It appears to work on all Unix-like platforms reported on
(including Linux, various BSDs, Mac OSX, SYSV, AT&TSysVr4).
However on AT&TSysVr4 there are compiler warnings for the
signal() statements:
"warning: argument is incompatible with prototype: arg #2"
According to the signal man page (which I received from a
user of this OS):
------------------
#include <signal.h>
void (*signal(int sig, void (*disp)(int)))(int);
-----------------
I thought I would just change the declaration of the
signal handler to match the OS (ATTSYSVR4 is defined at
configuration) like this:
-------------------
#include <signal.h>
#ifdef ATTSYSVR4
typedef void (*disp)(int) SIGHANDLER;
#else
typedef void SIGHANDLER;
#endif
SIGHANDLER my_handler(int signo);
------------------
Does that look correct? I don't have access to a
computer running this OS and can't try it myself.
Thanks for your help.
Regards,
Charles Sullivan