C++ :Interix 信号

发布于 2024-10-13 06:06:04 字数 1470 浏览 2 评论 0原文

如何在Interix平台上编译/使用信号?我无法编译它,因为 Interix 似乎不符合 POSIX,至少在 signal.h 的实现中是如此。

如果有人找到了一种方法来解决这个问题并允许带有信号的代码在 Interix 上编译,请告诉我如何做!

谢谢。


详细信息:

使用 C、C++ 编写的旧版软件,基于 Linux 和 Interix(适用于 Win XP)构建。

仅在 Interix 上,编译期间出现以下错误;在添加 pthreadsignal 代码后,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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

荭秂 2024-10-20 06:06:04

根据POSIX规范,struct sigaction没有成员sa_sigaction,它有sa_handler

Interix 符合 POSIX 标准,您的代码是移植不是。

请注意,Linux 可以与 sa_handler 一起使用。

不过,您也许可以使用正确的 #DEFINE 来使其工作。

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.

橘亓 2024-10-20 06:06:04

请参阅 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文