[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Resetting Signal Mask

Thomas Guettler

1/4/2008 8:03:00 AM

Hi,

with mod_wsgi (apache2) a process created with os.system()
has a modified signal mask, that SIGPWR gets ignored.

A small wrapper (see bottom) resets the signal mask and uses execv to
run the programm.

Unfortunately python does not support sigprocmask. Is there
any other way to reset the signal mask? I guess it could
be done with ctypes (I never used it up to now).

Why is sigprocmask not available in Python? Python exposes most of the other
POSIX API.

Thomas

1 #include <signal.h>
2 #include <unistd.h>
3 #include <stdio.h>
4
5 int main(int argc, char *argv[]) {
6 sigset_t newmask;
7
8 sigemptyset(&newmask);
9 sigprocmask(SIG_SETMASK, &newmask, NULL);
10 int ret=execv(argv[1], &argv[1]);
11 if (ret != 0) { perror(argv[0]); }
12 return ret;
13 }