delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/12/13/15:11:14

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Message-ID: <008001c3c1b5$6db00780$ed01a8c0@jewel>
From: "Robby Dermody" <robbyd AT p9i DOT com>
To: <cygwin AT cygwin DOT com>
References: <005601c3c1b3$21850ba0$ed01a8c0 AT jewel>
Subject: Re: System calls getting interrupted with signals, even with SA_RESTART
Date: Sat, 13 Dec 2003 15:12:23 -0500
Organization: phase9 industries, inc.
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165

As a reply to my own thread, after some more googling, it seems that
select() ignores SA_RESTART (maybe only when it has a timeout value defined,
and does not just block indefinately)....

http://www.ussg.iu.edu/hypermail/linux/kernel/0003.2/0336.html

Makes sense why.

Also with the semaphore stuff, it seems that's the case as well:
       "semop  is never automatically restarted after being inter­
       rupted by a signal handler, regardless of the  setting  of
       the SA_RESTART flags when establishing a signal handler."

Wierd that I recall both of them working under Linux, which reaffirmed my
previous notions

Move along, nothing to see here. :)

Robby
----- Original Message ----- 
From: "Robby Dermody" <robbyd AT p9i DOT com>
To: <cygwin AT cygwin DOT com>
Sent: Saturday, December 13, 2003 2:55 PM
Subject: System calls getting interrupted with signals, even with SA_RESTART


> Hey guys,
>
> I've ran into a little problem. I have been porting an piece of software
to
> Cygwin. It builds and initially runs fine, but when I get a SIGALRM
signal,
> which I use for asynchronous timers, a few things return with an EINTR:
>
> -select()
> -IPC semaphores (using CygIPC)
>
> Note that I am asserting SA_RESTART when I set up the signal handler. The
> procedure I take is this:
> -----------------
> struct sigaction SigAction;
> memset(&SigAction, 0, sizeof(struct sigaction));
> SigAction.sa_handler = Internal_Act_HandleTimers;
> SigAction.sa_flags = SA_RESTART; //restart system calls interrupted with
> this signal
>
> if(sigaction(SIGALRM, &SigAction, NULL) < 0)
> {
>     leprintf(LOGGING_SELF, LVL_SYSERR, "Error initing SIGALRM handler");
>     return false;
> }
> siginterrupt(SIGALRM, false);
> ----------------
>
> The error returned from select is: (errno, strerror(errno)
>    errno - 4 (Interrupted system call)
> (obviously ENTR)
>
> Obviously the signal handler is set up correctly, and when just asserting
> SA_RESTART didn't work, I tried sticking a call to siginterrupt in there
as
> well, but had no luck there either.
>
> Is it just a stupid mistake on my end, or something I'm failing to see?
The
> only other thing that might be the case is that the restarting of select
and
> the semaphore stuff isn't implemented?
>
> TIA for ANY help!!
>
> Robby
> ---
> Robby Dermody (robbyd AT p9i DOT com)
> phase9 industries, inc. - http://www.p9i.com/
>
> We confide in our strength, without boasting of it; we respect that of
> others, without fearing it.
>     -Thomas Jefferson
>
>
>
> --
> 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/
>
>



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