delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/12/02/18:12:12

X-Spam-Check-By: sourceware.org
X-T2-Posting-ID: dCnToGxhL58ot4EWY8b+QGwMembwLoz1X2yB7MdtIiA=
X-Cloudmark-Score: 0.000000 []
Date: Sat, 3 Dec 2005 00:09:09 +0100
From: Samuel Thibault <samuel DOT thibault AT ens-lyon DOT org>
To: cygwin AT cygwin DOT com
Subject: SA_SIGINFO and signal info ?
Message-ID: <20051202230909.GM10913@bouh.residence.ens-lyon.fr>
Mail-Followup-To: cygwin AT cygwin DOT com
Mime-Version: 1.0
User-Agent: Mutt/1.5.9i-nntp
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hi,

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).

Regards,
Samuel

#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:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019