Annotation of coherent/d/286_KERNEL/USRSRC/coh/misc.c, revision 1.1.1.1

1.1       root        1: /* $Header: /newbits/286_KERNEL/USRSRC/coh/RCS/misc.c,v 1.1 92/01/09 13:28:55 bin Exp Locker: bin $ */
                      2: /* (lgl-
                      3:  *     The information contained herein is a trade secret of Mark Williams
                      4:  *     Company, and  is confidential information.  It is provided  under a
                      5:  *     license agreement,  and may be  copied or disclosed  only under the
                      6:  *     terms of  that agreement.  Any  reproduction or disclosure  of this
                      7:  *     material without the express written authorization of Mark Williams
                      8:  *     Company or persuant to the license agreement is unlawful.
                      9:  *
                     10:  *     COHERENT Version 2.3.37
                     11:  *     Copyright (c) 1982, 1983, 1984.
                     12:  *     An unpublished work by Mark Williams Company, Chicago.
                     13:  *     All rights reserved.
                     14:  -lgl) */
                     15: /*
                     16:  * Coherent.
                     17:  * Miscellaneous routines.
                     18:  *
                     19:  * $Log:       misc.c,v $
                     20:  * Revision 1.1  92/01/09  13:28:55  bin
                     21:  * Initial revision
                     22:  * 
                     23:  * Revision 1.1        88/03/24  16:14:01      src
                     24:  * Initial revision
                     25:  * 
                     26:  * 87/05/08    Allan Cornish           /usr/src/sys/coh/misc.c
                     27:  * System code and data segments no longer reported in panic messages.
                     28:  *
                     29:  * 87/02/17    Allan Cornish           /usr/src/sys/coh/misc.c
                     30:  * Panic message now includes system code and data segments.
                     31:  */
                     32: #include <sys/coherent.h>
                     33: #include <acct.h>
                     34: #include <errno.h>
                     35: #include <sys/ino.h>
                     36: #include <sys/stat.h>
                     37: #include <sys/uproc.h>
                     38: 
                     39: /*
                     40:  * Copy `n' bytes from `bp1' to `bp2'.
                     41:  */
                     42: kkcopy(bp1, bp2, n)
                     43: register char *bp1;
                     44: register char *bp2;
                     45: unsigned n;
                     46: {
                     47:        register unsigned n1;
                     48: 
                     49:        n1 = n;
                     50:        if (n1) {
                     51:                do {
                     52:                        *bp2++ = *bp1++;
                     53:                } while (--n1);
                     54:        }
                     55:        return (n);
                     56: }
                     57: 
                     58: /*
                     59:  * Clear the next `n' bytes starting at `bp'.
                     60:  */
                     61: kclear(bp, n)
                     62: register char *bp;
                     63: register unsigned n;
                     64: {
                     65:        if (n) {
                     66:                do {
                     67:                        *bp++ = 0;
                     68:                } while (--n);
                     69:        }
                     70: }
                     71: 
                     72: /*
                     73:  * Make sure we are the super user.
                     74:  */
                     75: super()
                     76: {
                     77:        if (u.u_uid) {
                     78:                u.u_error = EPERM;
                     79:                return (0);
                     80:        }
                     81:        u.u_flag |= ASU;
                     82:        return (1);
                     83: }
                     84: 
                     85: /*
                     86:  * Make sure we are the gived `uid' or the super user.
                     87:  */
                     88: owner(uid)
                     89: {
                     90:        if (u.u_uid == uid)
                     91:                return (1);
                     92:        if (u.u_uid == 0) {
                     93:                u.u_flag |= ASU;
                     94:                return (1);
                     95:        }
                     96:        u.u_error = EPERM;
                     97:        return (0);
                     98: }
                     99: 
                    100: /*
                    101:  * Panic.
                    102:  */
                    103: panic(a1)
                    104: char *a1;
                    105: {
                    106:        static panflag;
                    107: 
                    108:        if (panflag++ == 0) {
                    109:                printf("Panic: %r", &a1);
                    110:                putchar('\n');
                    111:                usync();
                    112:        }
                    113:        halt();
                    114:        --panflag;
                    115: }
                    116: 
                    117: /*
                    118:  * Print a message from a device driver.
                    119:  */
                    120: devmsg(dev, a1)
                    121: dev_t dev;
                    122: char *a1;
                    123: {
                    124:        printf("(%d,%d): %r", major(dev), minor(dev), &a1);
                    125:        printf("\n");
                    126: }

unix.superglobalmegacorp.com

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