471,337 Members | 1,177 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Resetting Signal Mask

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 }
Jan 4 '08 #1
0 1355

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Elf M. Sternberg | last post: by
reply views Thread by mike kreiner | last post: by
2 posts views Thread by johnp | last post: by
3 posts views Thread by Martin McCormick | last post: by
11 posts views Thread by Jackie | last post: by
2 posts views Thread by gnutuxy | last post: by
1 post views Thread by Marcus P. | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.