Find the answer to your Linux question:
Results 1 to 5 of 5
Hi all, Iam using uclibc on uclinux and writing a timer application (where on expiry of timer, a user specified signal is generated). The possible signal handlers are void func(int ...
  1. #1
    Just Joined!
    Join Date
    Aug 2008
    Posts
    6

    Passing user input to signal handlers.

    Hi all,
    Iam using uclibc on uclinux and writing a timer application (where on expiry of timer, a user specified signal is generated). The possible signal handlers are

    void func(int signal) and
    void func(int signo ,siginfo_t* pInfo,void* context) depending whether or not SA_SIGINFO is reset ot not.

    But the problem is that there is no way of passing a user input to the signal handler.

    Any way of achieving this ?


    Vasanth

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Do this at the command line:
    Code:
    man sigqueue
    If that man page is not installed on your system, google for this:
    Code:
    linux man sigqueue
    If you choose the linux.die.net site, note that they have written this up under both section 2 and section 3 of the manual. I have no idea why they did that; the documentation under section 2 seems slightly more useful.

    Hope this helps.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  3. #3
    Just Joined!
    Join Date
    Aug 2008
    Posts
    6
    Hi,
    Thanks for the reply.

    But the issue is that the signal generation is done automatically on expiration of timer and is not under my control. I can atmost specify the signal to be sent and the signal handler.

    glibc does have a provision for specifying a notification function and a notification attribute on expiration of timer.But this facility is unavailable in uclibc.

  4. #4
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Oops. My bad. I saw that you were using uclibc, but I didn't know what uclibc was: a replacement, effectively, for glibc.

    I imagine you've already eliminated the following possibility, but in case you haven't:

    If you only have one timer counting down at a time, why not put the parameter in question into a global, and upon expiration of the timer, let the signal handler pick it up from there?

    Maybe a stupid question, but stupid questions are my specialty. :)
    --
    Bill

    Old age and treachery will overcome youth and skill.

  5. #5
    Just Joined!
    Join Date
    Aug 2008
    Posts
    6
    Hi,
    Having the input parameter as global is not possible in the present scenario because iam encapsulating the POSIX timer as a C++ class and each object of that class will have a separate input argument. and its not practical for having many global variables as there will be lots of timer objects.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...