signals

Which signals should a wrapper script pass along to a subprogram?

If I have a script that is a wrapper for another program (e.g., a daemonizer wrapper or a wrapper for mathematica), it is sometimes useful to trap signals in the wrapper program and pass them along to the subprogram. For example, here's some Perl code to deal with the INT (interrupt) signal so that if you do ctrl-C after launching the wr...

Does any function from the exec family in unix not ignore SIGINT?

Is it possible to start a process with exec and have that process run in the background, and (unlike System()), will that process be killed once an interrupt signal is passed to the parent process that created it? ...

Setting an alarm in milliseconds in C

I currently have some C code that uses sigaction to associate a handler to the SIGALRM signal. Then I do alarm(TIME_OUT_IN_SECONDS). Problem is, I need milliseconds, not seconds and alarm takes an integer. How can I set the signal to fire off in milliseconds? ...

Ignoring ctrl-c

I'm trying to write a shell and I'm at the point where I want to ignore ctrl-c. I currently have my program ignoring SIGINT and printing a new line when the signal comes, but how can I prevent the ^C from being printed? When pressing ctrl-c, here is what I get: myshell>^C myshell>^C myshell>^C but I want: myshell> myshell> myshell>...

How to interpolate between data points?

I am currently developing a piece of software using opencv and qt that plots data points. I need to be able fill in an image from incomplete data. I want to interpolate between the points I have. Can anyone recommend a library or function that could help me. I thought maybe the opencv reMap method but I can't seem to get that to work. T...

Why aren't signals simply called events?

From what I can tell, in Python and and Django, signals are simply delegated events. Is there anything that functionally differentiates them from the typical notion of events in C#, Java, ActionScript, etc? ...

how to emit cross-thread signal in qt?

QT documentation states that signals and slots can be 'direct', 'queued' and 'auto'. It also stated that if object that owns slot 'lives' in a thread different from object that owns signal, emitting such signal will be like posting message - signal emit will return instantly and slot method will be called in target thread's event loop....

Capturing kill signal in Eclipse RCP application

I've got a command line version of an Eclipse RCP GUI application that can makes use of a lot of the same plugins (this is handy for integration testing). One thing it does is connects to a server, requests stuff and starts an interactive loop. To exit, the user of the GUI app can stop the loop and close the application. In my command l...

What signals should I catch for clipboard pasting and character insertion in GTK ?

I have a Window with a TextView, and I would like to perform some actions when the user pastes some text. I would also like to know what signal(s) should I catch in order to perform something when the user presses a key inside the TextView. Can you tell me what are the signals I must connect? ...

SDL/C++ OpenGL Program, how do I stop SDL from catching SIGINT

Hi I am using SDL for an OpenGL application, running on Linux. My problem is that SDL is catching SIGINT and ignoring it. This is a pain because I am developing through a screen session, and I can't kill the running program with CTRL-C (the program the computer is running on is connected to a projector and has no input devices). Is the...

In what order should I send signals to gracefully shutdown processes?

In a comment on this answer of another question, the commenter says: don’t use kill -9 unless absolutely necessary! SIGKILL can’t be trapped so the killed program can’t run any shutdown routines to e.g. erase temporary files. First try HUP (1), then INT (2), then QUIT (3) I agree in principle about SIGKILL, but the rest i...

What should I do to modify my fork() in C to run well?

I dont understand why my code does not work. This is my code. I don't know why I'm get an error segment. Could somebody explain the reason to me? #include <iostream> #include <string> #include <sys/types.h> #include <unistd.h> int id_process; void manager_signal () { kill (id_process, SIGKILL); kill (getppid(),SIGKILL); } in...

Can I send a ctrl-C (SIGINT) to an application on Windows?

I have (in the past) written cross-platform (Windows/Unix) applications which, when started from the command line, handled a user-typed Ctrl-C combination in the same way (i.e. to terminate the application cleanly). Is it possible on Windows to send a Ctrl-C/SIGINT/equivalent to a process from another (unrelated) process to request that...

How to free dynamic allocated variable by SIGTERM?

Hi, I work on code something like this ... HEADERS ... int *var; void child() { ... //some work free(var); exit(EXIT_SUCCESSFUL); } int main(void) { ... //allocate variable var = (int *) malloc(N*sizeof(int)); ... //work with var for(int i; i<PROC_COUNT; i++) { pid_t child = fork(); if(pid == 0) { child...

Signal Stack

I did read that signals need to have a separate stack, why and how do you think it is implemented ? Are they dynamically allocated or statically allocated ? How is memory allocation done ? Is it the same for all signals ? ...

QT: having problems responding on QWebView::linkClicked(QUrl) - slot signal issue

I am preaty new with QT. I want to respond to linkClicked in QWebView... I tried connect like this: QObject::connect(ui->webView,SIGNAL(linkClicked(QUrl)),MainWindow,SLOT(linkClicked(QUrl))); But I was getting error: C:/Documents and Settings/irfan/My Documents/browser1/mainwindow.cpp:9: error: expected primary-expression before ',...

How to properly wait for foreground/background processes in my own shell in C?

In this previous question I posted most of my own shell code. My next step is to implement foreground and background process execution and properly wait for them to terminate so they don't stay as "zombies". Before adding the possibility to run them in the background, all processes were running in the foreground. And for that, I simply ...

How to properly make my makefile to compile and run?

The question is probably not the best one to describe my issue but I couldn't think of a better one. My makefile goes like this: PROGRAM_NAME = prog OBJECT_FILES = $(PROGRAM_NAME).o CFLAGS = -O2 -Wall -g $(PROGRAM_NAME) : $(OBJECT_FILES) gcc $(CFLAGS) -o $@ $(OBJECT_FILES) $(PROGRAM_NAME).o : $(PROGRAM_NAME).c data.h gcc $(CF...

master / worker threads and signal handling

I am writing a program, with a master thread and some worker threads, and I would like to get the signal handling right. My problem is the following : Master thread starts and do all allocation Master thread sets a SIGINT signal handler Master threads start worker threads. worker threads don't need special cleanup, however they can b...

Redefine signal handling flaws

This is about the design decision and understand the procs and cons for adopting another service. So we have two services with two unrelated servers, one listening on port 10000 and another is a xinetd server responding 3 different requests via 3 different ports (its client uses nc server port1|port2|port3 to retrieve data). One day be...