Matty wrote:

> Do folks see any issue with using similar code to add a SIGUSR1 signal 
> handler?:
> 
> if (signal(SIGUSR1, SIG_IGN) != SIG_IGN)
> {
>        (void) signal(SIGUSR1, stats);
> }
> 
> This would minmize the amount of code that would need to be added to
> get stats functionality, and would address the license issues. If this
> solution isn't acceptable, could I get a sponsor assigned to help me
> work through a community approved solution?

Did you read Bart Smaalders' email regarding stdio not being async signal safe? 
  While the window is fairly small for SIGINT, since term() will exit() right 
after calling stats(), the only reason to add SIGUSR1 support is with the idea 
that it may be called repeatedly, widening the window in which a deadlock could 
theoretically occur.

To be safe you should really do something like use sigaction(2) and have it 
install a signal mask that blocks all other signals while stats() is running, 
something like:

         usr_handler.sa_handler = stats;
         usr_handler.sa_flags = SA_RESTART;
         (void) sigfillset(&usr_handler.sa_mask);

         if (sigaction(SIGUSR1, &usr_handler, NULL) != 0) {
                 /* crud, sigaction(2) failed, do something useful here */
         }

         [ ... ]

     William Kucharski
     william.kucharski at sun.com

Reply via email to