473,320 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 1451

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Elf M. Sternberg | last post by:
I'm having a devil of a time with signal handling under BSD 4.4 with Python and I was hoping that this might ring a bell with someone. Using the Webware Application Server (a multi-threaded Python...
0
by: mike kreiner | last post by:
I'm using the convolve2d(image, mask) function from scipy to blur an image. The image I'm using is 512 by 384. When I display the image that convolve2d returns, the the left-most square of pixels...
2
by: johnp | last post by:
Hi, Our Tech department updated users to Office 2003 this week. Now the input mask in one of the applications is showing up as: (###) ###-### The input mask wizard works correctly when I...
3
by: AA Arens | last post by:
When I want the first character of a field to be Uppercased, I need to make an input mask, like >L< followed by ??????? for example. But this mask creates ____ in an unfilled field, which I don't...
11
by: ex laguna | last post by:
How do I find the lowest bit position of a mask using only macros? I want to do everything in compile time. That mean, there cannot be control statements such as if, while, for, etc. in the...
3
by: Martin McCormick | last post by:
A C program contains several signal statements to remove a lock file if the program gets killed: /*Set up interrupt handler to catch ctrl-C so that lock file can be removed.*/...
11
by: Jackie | last post by:
Hi everyone, I'd like to know when and how signals are used (e.g. SIGFPE, SIGABRT, SIGTERM, SIGSEGV, SIGINT)? Thank you so much.
2
by: gnutuxy | last post by:
Hi, I am newbie in the Unix system programming and in learning phase. I usually read the libc manual and then try to implement small programs to test/check the learnt thing. I read the libc...
1
by: Marcus P. | last post by:
Hi, I have a COM server that appears to be stepping on the FPU mask for my client program. In the short term, before I get the COM server fixed I have read that I can manually reset the FPU...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.