Annotation of researchv10no/lbin/Mail/4.2sys.c, revision 1.1.1.1

1.1       root        1: #ifndef        BSD4_2
                      2: #ifndef lint
                      3: static char *sccsid = "@(#)4.2sys.c    1.0 3/9/84";
                      4: #endif
                      5: 
                      6: #include "rcv.h"
                      7: 
                      8: /*
                      9:  * Mail -- a mail program
                     10:  *
                     11:  * Simulates some 4.2BSD system calls
                     12:  */
                     13: 
                     14: int oldbmask = 0;              /* previously blocked signals */
                     15: int beenhere = 0;              /* have we initialized signals? */
                     16: int heldsigs[NSIG];            /* list of held signals */
                     17: 
                     18: /*
                     19:  * Add signals to list of those to be blocked
                     20:  */
                     21: 
                     22: sigblock(smask)
                     23: int smask;
                     24: {
                     25:        int retmask;
                     26: 
                     27:        retmask = oldbmask;
                     28:        oldbmask |= smask;
                     29:        blocksig(oldbmask);
                     30:        return(retmask);
                     31: }
                     32: 
                     33: /*
                     34:  * Set signals to be blocked
                     35:  */
                     36: 
                     37: sigsetmask(smask)
                     38: int smask;
                     39: {
                     40:        int retmask;
                     41: 
                     42:        retmask = oldbmask;
                     43:        oldbmask = smask;
                     44:        blocksig(oldbmask);
                     45:        return(retmask);
                     46: }
                     47: 
                     48: /*
                     49:  * Block signals in smask
                     50:  */
                     51: 
                     52: blocksig(smask)
                     53: int smask;
                     54: {
                     55:        int i;
                     56: 
                     57:        for (i = 0; i < NSIG; i++) {
                     58:                if (!beenhere) {
                     59:                        sigset(i, sigset(i, SIG_DFL));
                     60:                        heldsigs[i] = 0;
                     61:                }
                     62:                if (i != SIGKILL && i != SIGSTOP && i != SIGCONT &&
                     63:                    (smask & mask(i)) && !heldsigs[i]) {
                     64:                        sighold(i);
                     65:                        heldsigs[i] = 1;
                     66:                }
                     67:                else if (i != SIGKILL && i != SIGSTOP && i != SIGCONT &&
                     68:                    !(smask & mask(i)) && heldsigs[i]) {
                     69:                        sigrelse(i);
                     70:                        heldsigs[i] = 0;
                     71:                }
                     72:        }
                     73:        beenhere = 1;
                     74: }
                     75: 
                     76: #endif /* BSD4_2 */

unix.superglobalmegacorp.com

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