开发者

Python, sigaction(2) available?

开发者 https://www.devze.com 2023-03-16 04:45 出处:网络
Is there an equivalent to the POSIX sigaction available through Python? I realize python has traditional support for 开发者_JS百科signals, but I need sigaction.

Is there an equivalent to the POSIX sigaction available through Python? I realize python has traditional support for 开发者_JS百科signals, but I need sigaction.

I'm trying to identify the pid of a process that is the source of a signal being issued. From what I can see from the documentation, there isn't a way to do this.

I'm only concerned with functionality on Linux.


There is a standard module called, unsurprisingly, signal. This seems to carry out the functionality of sigaction(2). However I'm guessing that what you really need is the siginfo_t struct, which gives the PID of the source of the signal, which is not part of the module at the moment (possibly because it is not implemented on all UNIXs).

The only alternative I can suggest is to use ctypes.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号