C++ :Interix 信号
如何在Interix平台上编译/使用信号?我无法编译它,因为 Interix 似乎不符合 POSIX,至少在 signal.h
的实现中是如此。
如果有人找到了一种方法来解决这个问题并允许带有信号的代码在 Interix 上编译,请告诉我如何做!
谢谢。
详细信息:
使用 C、C++ 编写的旧版软件,基于 Linux 和 Interix(适用于 Win XP)构建。
仅在 Interix 上,编译期间出现以下错误;在添加 pthread
和 signal
代码后,Linux 上不存在这种情况。无法在没有信号的情况下使用 pthreads,因为与 Xmotif 冲突(编译但在运行时崩溃)。
由于结构差异而导致的错误:
`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'
由于未声明而导致的错误:
`sigqueue' undeclared
`SA_NODEFER' undeclared
`SA_SIGINFO' undeclared
查阅的其他材料:
http://www.mail-archive.com/[电子邮件受保护]/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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据POSIX规范,
struct sigaction
没有成员sa_sigaction
,它有sa_handler
。POSIX:http://pubs.opengroup.org/onlinepubs/009695399/函数/sigaction.html
Interix:http://www.suacommunity.com/man/2/sigaction.2.html
Interix 符合 POSIX 标准,您的代码是移植不是。
请注意,Linux 可以与
sa_handler
一起使用。不过,您也许可以使用正确的
#DEFINE
来使其工作。According to the POSIX specification, there
struct sigaction
has no membersa_sigaction
, it hassa_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
#DEFINE
s though.请参阅 Interix 手册页 和上面的开放组链接。
您可以用 sa_handler 替换 si_sigaction。
See the Interix man page and the open group link above.
You can possibly replace the si_sigaction with sa_handler.