searching for method signatures

Discussion in 'C Programming' started by David Hilton, Sep 2, 2008.

  1. David Hilton

    David Hilton Guest

    I'm working on some legacy code, and I ran across this function that
    is giving the compiler issues:

    void socket_skip(int i,int code,struct sigcontext * scp) {
    fprintf(stderr,"User requested an interupt\n");
    signal(SIGINT,exit);
    sleep(1);
    signal(SIGINT,socket_skip);
    return;
    }

    Not surprisingly, signal doesn't like socket_skip.

    I have searched for any sort of #define that could have specified a
    unique signal, I have read through most of the possibly relevant lines
    (by running 'grep sig `locate signal.h` | less').

    Does anyone know of a good way to search for (possibly obfuscated)
    method signatures?

    How about any other way of finding what I'm looking for?

    Short of that, does anyone know what library might have a signal that
    accepts that signature?

    Thanks,
    David
    David Hilton, Sep 2, 2008
    #1
    1. Advertising

  2. David Hilton <> writes:

    > I'm working on some legacy code, and I ran across this function that
    > is giving the compiler issues:
    >
    > void socket_skip(int i,int code,struct sigcontext * scp) {
    > fprintf(stderr,"User requested an interupt\n");
    > signal(SIGINT,exit);
    > sleep(1);
    > signal(SIGINT,socket_skip);
    > return;
    > }
    >
    > Not surprisingly, signal doesn't like socket_skip.
    >
    > I have searched for any sort of #define that could have specified a
    > unique signal, I have read through most of the possibly relevant lines
    > (by running 'grep sig `locate signal.h` | less').
    >
    > Does anyone know of a good way to search for (possibly obfuscated)
    > method signatures?
    >
    > How about any other way of finding what I'm looking for?
    >
    > Short of that, does anyone know what library might have a signal that
    > accepts that signature?


    signal is standard C. I suspect your code simply dates from a time
    when it was common for signal to vary quite a lot between systems. I
    don't think you will gain anything from trying to find something
    similar -- it is likely that is nothing you have available is an exact
    match.

    If this the only use of signal? If so, I think your simplest solution
    is just to change the definition of socket_skip to match the type expected
    by the standard signal function (void (*)(int)). The extra parameters
    are not used but either handler (exit and socket_skip).

    If there are other uses -- in particular some that set the handler to
    a function that does use the other parameters then you will have to
    find out what these parameters do/did. That may require digging
    through the documentation for the "other" system.

    --
    Ben.
    Ben Bacarisse, Sep 2, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    327
    Chris Uppal
    Feb 19, 2004
  2. David S.
    Replies:
    0
    Views:
    234
    David S.
    May 30, 2005
  3. david.karr
    Replies:
    4
    Views:
    381
    Joshua Cranmer
    Jun 16, 2009
  4. Chuck Insight
    Replies:
    0
    Views:
    138
    Chuck Insight
    Mar 11, 2005
  5. Lyle Johnson
    Replies:
    2
    Views:
    355
    Lyle Johnson
    Oct 20, 2006
Loading...

Share This Page