Re: wrapping the linux "C" signal function

new topic     » goto parent     » topic index » view thread      » older message » newer message

>i am having troubles *wrapping* the "C" language signal function in linux.
>when i read the man page for signal the syntax is very confusing and even
>when they tries to make it easier to read, it still confuses me.

>here are both the function header syntaxes for "signal":

>## C code ##

>void (*signal(int signum, void(*handler)(int)))(int);

>or

>typedef void (*sighandler_t)(int);
>sighandler_t signal(int signum, sighandler_t handler);

>## end C code ##

>can anyone clarify what this exactly means? C syntax can get so stupidly
>cryptic sometimes. euphoria is simple, and thats good.


  cense:

    Although I'am not running linux, I think the first parameter should be

    using is a INTEGER type NOT a pointer.

    I think that you are confusing SIGNAL TYPES and SIGNAL ACTION CODES.

    SIGNAL TYPES look like this:

        SIGXXXX ( example SIGABRT ) this is a integer used in the FIRST
                                    parameter of the signal function.

    SIGNAL ACTION CODES look like this:

        SIG_XXXX ( example SIG_DFL ) NOTE the underscore in the name. This
                                          has to be a POINTER and is used
                                          in the SECOND parameter of the
                                          signal function.
                                          This is made into a POINTER with a
                                          MACRO in the signal.h.

  Hope this helps

  Bernie

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu