11

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/bug-gnulib@gnu.org/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

Community
  • 1
  • 1
bguiz
  • 27,371
  • 47
  • 154
  • 243
  • @Alexandre C. : nfortunately, it is stipulated by the customer's requirements/deployment environment. Would love to switch to mingw or cygwin if we could decide! – bguiz Jan 20 '11 at 23:00
  • oh, good luck then, especially with pthreads. – Alexandre C. Jan 21 '11 at 09:20

2 Answers2

1

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

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.

Ben
  • 34,935
  • 6
  • 74
  • 113
  • 2
    I see an sa_sigaction member listed in the specifications on the POSIX page you linked to. sa_handler is supposed to be used when the SA_SIGINFO flag is not set. If that flag is set, then sigaction.sa_sigaction is a pointer to the handler function, or filled with the macro that defines the action. – BraedenP Mar 04 '12 at 20:52
  • @BraedenP, OK yeah, not sure how I made that mistake. – Ben Mar 04 '12 at 21:50
0

See the Interix man page and the open group link above.

You can possibly replace the si_sigaction with sa_handler.

Keith
  • 6,756
  • 19
  • 23