SA_SIGINFO and signal info ?

Samuel Thibault
Fri Dec 2 23:12:00 GMT 2005


Cygwin defines SA_SIGINFO, but it doesn't seem to be implemented: the
following program gets in "info" just 0x0 or a strange pointer. Could
it be supported somehow? The bit of information I'd really need is
info->si_code, so as to know whether the signal is sent by "kernelspace"
(because of alarm, setitimer, ...) or by "userspace" (kill, raise).


#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>

void handler (int sig, siginfo_t *info, void *uc) {
	fprintf (stderr,"%d: %p %p\n", sig, info, uc);

void *foo (void *bar) {
	while(1) pause ();
	return NULL;

int main (void) {
	struct sigaction sa;
	pthread_t t;
	sigemptyset (&sa.sa_mask);
	sa.sa_flags = SA_SIGINFO;
	sa.sa_sigaction = handler;
	sigaction (SIGALRM, &sa, NULL);
	sigaction (SIGINT, &sa, NULL);
	sigaction (SIGWINCH, &sa, NULL);
	pthread_create (&t,NULL,foo,NULL);
	alarm (5);
	pthread_kill (t,SIGINT);
	raise (SIGINT);
	sleep (10);
	sleep (10);
	return 0;

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list