Wanted: info about signal handling routines

Wanted: info about signal handling routines

Post by mo.. » Mon, 02 Apr 1990 20:15:00




> I found undefined refs in a program that does job control to sighold,
> sigrelse, and sigset.  Are they part of BSD4.2,

I believe those are 4.1c -ljobs routines.  Under 4.2 they migrated into
libc and got renamed: sighold to sigblock, sigrelse disappeared, sigset
to sigvec.  The arguments also changed somewhat.

Quote:> what do they do,

Been a while since I used 4.1.  But as I recall, sighold blocks
delivery of a signal but does not throw away instances the way
sigignore does.  Under 4.2, use sigblock instead.

Sigrelse is necessary when longjmp()ing out of a signal handler.  Under
4.2 this is handled correctly by longjmp, so sigrelse vanished.

Sigset was the primitive for installing a handler.  Under 4.2, use
signal() or sigvec().

Quote:> and can I replace them with something?

You don't say what operating system you want the replacements to run
under, so I can't help you.  Above are rough equivalents for 4.2 and
4.3, though I think the arguments have changed.

                                        der Mouse


USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!musocs!mcgill-vision!mouse
     think!mosart!mcgill-vision!mouse

 
 
 

Wanted: info about signal handling routines

Post by ch.. » Tue, 03 Apr 1990 00:23:00



>> I found undefined refs in a program that does job control to sighold,
>> sigrelse, and sigset.  Are they part of BSD4.2,


writes:

Quote:>I believe those are 4.1c -ljobs routines.

They date back to 4.1BSD.

Quote:>Under 4.2 they migrated into libc and got renamed: sighold to sigblock,
>sigrelse disappeared,

sigrelse was replaced with sigsetmask, and sigpause was not renamed at
all.

Quote:>sigset to sigvec.  The arguments also changed somewhat.

Not quite: sigvec was `internal use only except after vfork' (horrid
but true).

Quote:>>what do they do, and can I replace them with something?

Under 4.2 or 4.3BSD, use the following:

        #include <signal.h>

        #ifndef sigmask
        #define sigmask(s) (1 << ((s) - 1))
        #endif

        #define sighold(s) (void) sigblock(sigmask(s))
        #define sigrelse(s) (void) sigsetmask(sigblock(0) & ~sigmask(s))
        #define sigset(s, d) signal(s, d)

and replace calls to

        sigpause(SIGFOO)

with

        sigpause(sigblock(0) & ~sigmask(SIGFOO))

You can save some system calls by changing code such as

        sighold(SIGCHLD);
        <stuff>
        sigrelse(SIGCHLD);

to

        int omask = sigblock(sigmask(SIGCHLD));
        <stuff>
        (void) sigsetmask(omask);

Under other operating systems, you may be stuck with no way to
handle signals reliably.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)


 
 
 

Wanted: info about signal handling routines

Post by r.. » Mon, 02 Apr 1990 16:15:00


Quote:>    #define sigrelse(s) (void) sigsetmask(sigblock(0) & ~sigmask(s))

More reliable (in a few rare corner cases):

        #define sigrelse(s) (void) sigsetmask(sigblock(~0) & ~sigmask(s))
or
        #define sigrelse(s) (void) sigsetmask(sigsetmask(~0) & ~sigmask(s))

                Bob Lenk (hpfcla!rml)

 
 
 

1. Testers Wanted: vixie-cron Posix signal handling patch.

I'm looking for people to test a patch which adds posix signal
handling to vixie-cron-3.0.1.  I need testers on as many different
platforms as possible.

If you are having problems using the SIGHUP signal to close log
files, or if you find leftover CRON process and zombies if you
write cron jobs that kill the cron process, this patch may be of
use to you.

Note that this patch is not designed to fix a bug in vixie-cron.  
I don't know of any.  However, compiling the program to be Posix
compliant could help avoid platform dependant configuration errors
during compliation.  If your current copy of vixie-cron compiles
with POSIX defined, the patch will have some effect.

The patch can be found at:
ftp://ftp.meme.com/pub/software/vixie-cron-3.0.1/signal.patch

Please contact me with any problems, suggestions, or comments.



Karl O. Pinc           e-tattoo: Ride hard and die free.

2. xmus v2001.12.02

3. Info wanted: signal processing appl

4. Best file sharing tool?

5. Signal handling: signal() vs. sigaction()

6. Linux Based NC and Wine

7. S-Lang screen handling routines

8. [2.5] high irq count exceeds interrupt[] array (resend)

9. WANTED: INFO on kernel config info

10. List of routines safe to use in signals?

11. Signals and Asynchronous Serial Routines

12. Solaris 8 threads: If a routine is Async-Signal-Safe is it also thread Safe?

13. Signalling a process from a devices driver's interrupt routine.