Annotation of 43BSD/lib/libc/gen/signal.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1985 Regents of the University of California.
                      3:  * All rights reserved.  The Berkeley software License Agreement
                      4:  * specifies the terms and conditions for redistribution.
                      5:  */
                      6: 
                      7: #if defined(LIBC_SCCS) && !defined(lint)
                      8: static char sccsid[] = "@(#)signal.c   5.2 (Berkeley) 3/9/86";
                      9: #endif LIBC_SCCS and not lint
                     10: 
                     11: /*
                     12:  * Almost backwards compatible signal.
                     13:  */
                     14: #include <signal.h>
                     15: 
                     16: int (*
                     17: signal(s, a))()
                     18:        int s, (*a)();
                     19: {
                     20:        struct sigvec osv, sv;
                     21:        static int mask[NSIG];
                     22:        static int flags[NSIG];
                     23: 
                     24:        sv.sv_handler = a;
                     25:        sv.sv_mask = mask[s];
                     26:        sv.sv_flags = flags[s];
                     27:        if (sigvec(s, &sv, &osv) < 0)
                     28:                return (BADSIG);
                     29:        if (sv.sv_mask != osv.sv_mask || sv.sv_flags != osv.sv_flags) {
                     30:                mask[s] = sv.sv_mask = osv.sv_mask;
                     31:                flags[s] = sv.sv_flags = osv.sv_flags;
                     32:                if (sigvec(s, &sv, 0) < 0)
                     33:                        return (BADSIG);
                     34:        }
                     35:        return (osv.sv_handler);
                     36: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.