Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ : Interix signals

How to compile/ use signals on the Interix platform? I am unable to get it to compile because Interix appears to be non-POSIX compliant, at least in its implementation of signal.h.

If anyone has found a way to work around this and allow code with signals to compile on Interix, please do let me know how!

Thanks.


Details:

Legacy software in C, C++, and is built on Linux and Interix (for Win XP).

Am getting the following errors during compilation, on Interix only; not on Linux, after adding pthread and signal code. Cannot use pthreads without signals because conflicts with Xmotif (compiles but crashes at run time).

errors due to struct differences:

`struct siginfo' has no member named `si_value'
aggregate `sigval val' has incomplete type and cannot be defined
`struct sigaction' has no member named `sa_sigaction'

errors due to undeclared:

`sigqueue' undeclared
`SA_NODEFER' undeclared
`SA_SIGINFO' undeclared

Other material consulted:

http://www.mail-archive.com/[email protected]/msg10425.html
http://www.gnu.org/software/hello/manual/gnulib/signal_002eh.html
http://en.wikipedia.org/wiki/Interix
http://www.opengroup.org/susv3xbd/signal.h.html

like image 255
bguiz Avatar asked Jan 20 '11 03:01

bguiz


1 Answers

According to the POSIX specification, there struct sigaction has no member sa_sigaction, it has sa_handler.

  • POSIX: http://pubs.opengroup.org/onlinepubs/009695399/functions/sigaction.html

  • Interix: http://www.suacommunity.com/man/2/sigaction.2.html

Interix is POSIX compliant in the case, the code you are porting is not.

Note that Linux can be made to work with sa_handler.

You may be able to get it work using the correct #DEFINEs though.

like image 67
Ben Avatar answered Sep 28 '22 08:09

Ben