|
|
1.1 ! root 1: /* $Header: /newbits/kernel/USRSRC/coh/RCS/misc.c,v 1.4 91/07/24 07:51:19 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.4 91/07/24 07:51:19 bin ! 21: * update prov by hal ! 22: * ! 23: * ! 24: * Revision 1.1 88/03/24 16:14:01 src ! 25: * Initial revision ! 26: * ! 27: * 87/05/08 Allan Cornish /usr/src/sys/coh/misc.c ! 28: * System code and data segments no longer reported in panic messages. ! 29: * ! 30: * 87/02/17 Allan Cornish /usr/src/sys/coh/misc.c ! 31: * Panic message now includes system code and data segments. ! 32: */ ! 33: #include <sys/coherent.h> ! 34: #include <acct.h> ! 35: #include <errno.h> ! 36: #include <sys/ino.h> ! 37: #include <sys/stat.h> ! 38: #include <sys/uproc.h> ! 39: ! 40: /* ! 41: * Copy `n' bytes from `bp1' to `bp2'. ! 42: */ ! 43: kkcopy(bp1, bp2, n) ! 44: register char *bp1; ! 45: register char *bp2; ! 46: unsigned n; ! 47: { ! 48: register unsigned n1; ! 49: ! 50: n1 = n; ! 51: if (n1) { ! 52: do { ! 53: *bp2++ = *bp1++; ! 54: } while (--n1); ! 55: } ! 56: return (n); ! 57: } ! 58: ! 59: /* ! 60: * Clear the next `n' bytes starting at `bp'. ! 61: */ ! 62: kclear(bp, n) ! 63: register char *bp; ! 64: register unsigned n; ! 65: { ! 66: if (n) { ! 67: do { ! 68: *bp++ = 0; ! 69: } while (--n); ! 70: } ! 71: } ! 72: ! 73: /* ! 74: * Make sure we are the super user. ! 75: */ ! 76: super() ! 77: { ! 78: if (u.u_uid) { ! 79: u.u_error = EPERM; ! 80: return (0); ! 81: } ! 82: u.u_flag |= ASU; ! 83: return (1); ! 84: } ! 85: ! 86: /* ! 87: * Make sure we are the gived `uid' or the super user. ! 88: */ ! 89: owner(uid) ! 90: { ! 91: if (u.u_uid == uid) ! 92: return (1); ! 93: if (u.u_uid == 0) { ! 94: u.u_flag |= ASU; ! 95: return (1); ! 96: } ! 97: u.u_error = EPERM; ! 98: return (0); ! 99: } ! 100: ! 101: /* ! 102: * Panic. ! 103: */ ! 104: panic(a1) ! 105: char *a1; ! 106: { ! 107: static panflag; ! 108: ! 109: if (panflag++ == 0) { ! 110: printf("Panic: %r", &a1); ! 111: putchar('\n'); ! 112: usync(); ! 113: } ! 114: halt(); ! 115: --panflag; ! 116: } ! 117: ! 118: /* ! 119: * Print a message from a device driver. ! 120: */ ! 121: devmsg(dev, a1) ! 122: dev_t dev; ! 123: char *a1; ! 124: { ! 125: printf("(%d,%d): %r", major(dev), minor(dev), &a1); ! 126: printf("\n"); ! 127: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.