Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.unix.programmer > #14060

Re: Question about Linux/gcc and the signal() function prototype.

From Ralf Fassel <ralfixx@gmx.de>
Newsgroups comp.unix.programmer, comp.lang.c
Subject Re: Question about Linux/gcc and the signal() function prototype.
Followup-To comp.unix.programmer
Date 2022-11-25 13:03 +0100
Message-ID <ygazgcftf5r.fsf@akutech.de> (permalink)
References <tlq9hg$fuhb$1@news.xmission.com>

Cross-posted to 2 groups.

Followups directed to: comp.unix.programmer

Show all headers | View raw


* gazelle@shell.xmission.com (Kenny McCormack)
| Note: This question is very Linux and gcc specific.  You've been warned!
| Also, don't bother picking nits like how main() is declared or whether or
| not to use the word "stack" in polite company.  Thanks.
>
| I have a small C program that looks basically like:
>
| #define _GNU_SOURCE
| #include <signal.h>
>
| ...
>
| sighandler_t myhandler(int sig)
| {
|     ...
| }

I think that according to signal(2) that should rather be

  void myhandler(int sig) {
    ...
  }


    NAME
           signal - ANSI C signal handling
    SYNOPSIS
           #include <signal.h>
           typedef void (*sighandler_t)(int);

Note that 'sighandler_t' is the typedef for the _signal handler_ (to be
used in the declaration of signal()), not the return value of the signal
handler.  The return value of the signal handler is void, taking one
integer argument.

R'

Back to comp.unix.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Question about Linux/gcc and the signal() function prototype. gazelle@shell.xmission.com (Kenny McCormack) - 2022-11-25 11:39 +0000
  Re: Question about Linux/gcc and the signal() function prototype. Ralf Fassel <ralfixx@gmx.de> - 2022-11-25 13:03 +0100
    Re: Question about Linux/gcc and the signal() function prototype. gazelle@shell.xmission.com (Kenny McCormack) - 2022-11-25 12:28 +0000
      Re: Question about Linux/gcc and the signal() function prototype. Nicolas George <nicolas$george@salle-s.org> - 2022-11-25 13:05 +0000
        Re: Question about Linux/gcc and the signal() function prototype. gazelle@shell.xmission.com (Kenny McCormack) - 2022-11-25 14:01 +0000
      Re: Question about Linux/gcc and the signal() function prototype. scott@slp53.sl.home (Scott Lurndal) - 2022-11-25 16:57 +0000
      Re: Question about Linux/gcc and the signal() function prototype. Rainer Weikusat <rweikusat@talktalk.net> - 2022-11-27 12:27 +0000
        Re: Question about Linux/gcc and the signal() function prototype. gazelle@shell.xmission.com (Kenny McCormack) - 2022-11-27 13:06 +0000
          Re: Question about Linux/gcc and the signal() function prototype. Kaz Kylheku <864-117-4973@kylheku.com> - 2022-11-28 00:43 +0000
            Re: Question about Linux/gcc and the signal() function prototype. Richard Damon <Richard@Damon-Family.org> - 2022-11-27 21:39 -0500
            Re: Question about Linux/gcc and the signal() function prototype. Rainer Weikusat <rweikusat@talktalk.net> - 2022-11-28 11:47 +0000

csiph-web