Python, sigaction(2) available?
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.
精彩评论