|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1982, 1986 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution is only permitted until one year after the first shipment ! 6: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and ! 7: * binary forms are permitted provided that: (1) source distributions retain ! 8: * this entire copyright notice and comment, and (2) distributions including ! 9: * binaries display the following acknowledgement: This product includes ! 10: * software developed by the University of California, Berkeley and its ! 11: * contributors'' in the documentation or other materials provided with the ! 12: * distribution and in all advertising materials mentioning features or use ! 13: * of this software. Neither the name of the University nor the names of ! 14: * its contributors may be used to endorse or promote products derived from ! 15: * this software without specific prior written permission. ! 16: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 17: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 18: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 19: * ! 20: * @(#)sys_machdep.c 7.4 (Berkeley) 6/28/90 ! 21: */ ! 22: ! 23: #include "param.h" ! 24: #include "systm.h" ! 25: #include "ioctl.h" ! 26: #include "file.h" ! 27: #include "time.h" ! 28: #include "proc.h" ! 29: #include "uio.h" ! 30: #include "kernel.h" ! 31: #include "mtio.h" ! 32: #include "buf.h" ! 33: #include "trace.h" ! 34: ! 35: #include "pte.h" ! 36: ! 37: #ifdef TRACE ! 38: int nvualarm; ! 39: ! 40: vtrace(p, uap, retval) ! 41: struct proc *p; ! 42: register struct args { ! 43: int request; ! 44: int value; ! 45: } *uap; ! 46: int *retval; ! 47: { ! 48: int vdoualarm(); ! 49: ! 50: switch (uap->request) { ! 51: ! 52: case VTR_DISABLE: /* disable a trace point */ ! 53: case VTR_ENABLE: /* enable a trace point */ ! 54: if (uap->value < 0 || uap->value >= TR_NFLAGS) ! 55: return (EINVAL); ! 56: *retval = traceflags[uap->value]; ! 57: traceflags[uap->value] = uap->request; ! 58: break; ! 59: ! 60: case VTR_VALUE: /* return a trace point setting */ ! 61: if (uap->value < 0 || uap->value >= TR_NFLAGS) ! 62: return (EINVAL); ! 63: *retval = traceflags[uap->value]; ! 64: break; ! 65: ! 66: case VTR_UALARM: /* set a real-time ualarm, less than 1 min */ ! 67: if (uap->value <= 0 || uap->value > 60 * hz || nvualarm > 5) ! 68: return (EINVAL); ! 69: nvualarm++; ! 70: timeout(vdoualarm, (caddr_t)p->p_pid, uap->value); ! 71: break; ! 72: ! 73: case VTR_STAMP: ! 74: trace(TR_STAMP, uap->value, p->p_pid); ! 75: break; ! 76: } ! 77: return (0); ! 78: } ! 79: ! 80: vdoualarm(arg) ! 81: int arg; ! 82: { ! 83: register struct proc *p; ! 84: ! 85: p = pfind(arg); ! 86: if (p) ! 87: psignal(p, 16); ! 88: nvualarm--; ! 89: } ! 90: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.