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

1.1       root        1: /* $Header: /kernel/kersrc/coh.286/RCS/misc.c,v 1.1 92/07/17 15:18:09 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/07/17  15:18:09  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: 
                     38: /*
                     39:  * Copy `n' bytes from `bp1' to `bp2'.
                     40:  */
                     41: kkcopy(bp1, bp2, n)
                     42: register char *bp1;
                     43: register char *bp2;
                     44: unsigned n;
                     45: {
                     46:        register unsigned n1;
                     47: 
                     48:        n1 = n;
                     49:        if (n1) {
                     50:                do {
                     51:                        *bp2++ = *bp1++;
                     52:                } while (--n1);
                     53:        }
                     54:        return (n);
                     55: }
                     56: 
                     57: /*
                     58:  * Clear the next `n' bytes starting at `bp'.
                     59:  */
                     60: kclear(bp, n)
                     61: register char *bp;
                     62: register unsigned n;
                     63: {
                     64:        if (n) {
                     65:                do {
                     66:                        *bp++ = 0;
                     67:                } while (--n);
                     68:        }
                     69: }
                     70: 
                     71: /*
                     72:  * Make sure we are the super user.
                     73:  */
                     74: super()
                     75: {
                     76:        if (u.u_uid) {
                     77:                u.u_error = EPERM;
                     78:                return (0);
                     79:        }
                     80:        u.u_flag |= ASU;
                     81:        return (1);
                     82: }
                     83: 
                     84: /*
                     85:  * Make sure we are the gived `uid' or the super user.
                     86:  */
                     87: owner(uid)
                     88: {
                     89:        if (u.u_uid == uid)
                     90:                return (1);
                     91:        if (u.u_uid == 0) {
                     92:                u.u_flag |= ASU;
                     93:                return (1);
                     94:        }
                     95:        u.u_error = EPERM;
                     96:        return (0);
                     97: }
                     98: 
                     99: /*
                    100:  * Panic.
                    101:  */
                    102: panic(a1)
                    103: char *a1;
                    104: {
                    105:        static panflag;
                    106: 
                    107:        if (panflag++ == 0) {
                    108:                printf("Panic: %r", &a1);
                    109:                putchar('\n');
                    110:                usync();
                    111:        }
                    112:        halt();
                    113:        --panflag;
                    114: }
                    115: 
                    116: /*
                    117:  * Print a message from a device driver.
                    118:  */
                    119: devmsg(dev, a1)
                    120: dev_t dev;
                    121: char *a1;
                    122: {
                    123:        printf("(%d,%d): %r", major(dev), minor(dev), &a1);
                    124:        printf("\n");
                    125: }

unix.superglobalmegacorp.com

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