The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: "Gerrit Bruchhäuser" <gbruchhaeuser@orga-systems.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: accept does not return in case a signal arrives
Date: Wed, 03 Nov 2004 15:18:17 +0100	[thread overview]
Message-ID: <je3bzrrp7a.fsf@sykes.suse.de> (raw)
In-Reply-To: <4188DC90.9030503@orga-systems.com> (Gerrit Bruchhäuser's message of "Wed, 03 Nov 2004 14:26:40 +0100")

Gerrit Bruchhäuser <gbruchhaeuser@orga-systems.com> writes:

> Given the following sample:
>
> ,----[ main.cc ]
> | #include <sys/types.h>
> | #include <sys/socket.h>
> | #include <errno.h>
> | #include <string.h>
> | #include <stdio.h>
> | #include <stdlib.h>
> | #include <resolv.h>
> | #include <signal.h>
> |
> | #define CHECK_RET_M(arg, x) \
> |   if (-1 == (x) && errno != EINTR) { \
> |      printf("System call '%s' failed: %s\n", #arg, strerror(errno)); \
> |      exit(1); \
> |   }
> |
> | typedef struct sockaddr SA;
> |
> | static void TermHandler(int signu)
> | {
> |    // Nothing
> | }
> |
> | int main(int argc, char *argv[])
> | {
> |   // Create signal handler 4 SIGTERM
> |   signal(SIGTERM, &TermHandler);

Use sigaction.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

      parent reply	other threads:[~2004-11-03 14:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-03 13:26 accept does not return in case a signal arrives Gerrit Bruchhäuser
2004-11-03 13:21 ` Alan Cox
2004-11-03 14:18 ` Andreas Schwab [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=je3bzrrp7a.fsf@sykes.suse.de \
    --to=schwab@suse.de \
    --cc=gbruchhaeuser@orga-systems.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox