xref: /original-bsd/sys/tahoe/tahoe/sys_machdep.c (revision c7f94de1)
1 /*
2  * Copyright (c) 1988 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)sys_machdep.c	7.7 (Berkeley) 07/12/92
7  */
8 
9 #include "sys/param.h"
10 #include "sys/systm.h"
11 #include "sys/user.h"
12 #include "sys/ioctl.h"
13 #include "sys/file.h"
14 #include "sys/proc.h"
15 #include "sys/kernel.h"
16 #include "sys/mtio.h"
17 #include "sys/buf.h"
18 
19 #include "../include/pte.h"
20 
21 #ifdef TRACE
22 int	nvualarm;
23 
24 struct vtrace_args {
25 	int	request;
26 	int	value;
27 };
28 /* ARGSUSED */
vtrace(p,uap,retval)29 vtrace(p, uap, retval)
30 	register struct proc *p;
31 	register struct vtrace_args *uap;
32 	int *retval;
33 {
34 	int vdoualarm();
35 
36 	switch (uap->request) {
37 
38 	case VTR_DISABLE:		/* disable a trace point */
39 	case VTR_ENABLE:		/* enable a trace point */
40 		if (uap->value < 0 || uap->value >= TR_NFLAGS)
41 			return (EINVAL);
42 		*retval = traceflags[uap->value];
43 		traceflags[uap->value] = uap->request;
44 		break;
45 
46 	case VTR_VALUE:		/* return a trace point setting */
47 		if (uap->value < 0 || uap->value >= TR_NFLAGS)
48 			return (EINVAL);
49 		*retval = traceflags[uap->value];
50 		break;
51 
52 	case VTR_UALARM:	/* set a real-time ualarm, less than 1 min */
53 		if (uap->value <= 0 || uap->value > 60 * hz || nvualarm > 5)
54 			return (EINVAL);
55 		nvualarm++;
56 		timeout(vdoualarm, (caddr_t)p->p_pid, uap->value);
57 		break;
58 
59 	case VTR_STAMP:
60 		trace(TR_STAMP, uap->value, p->p_pid);
61 		break;
62 	}
63 	return (0);
64 }
65 
vdoualarm(arg)66 vdoualarm(arg)
67 	int arg;
68 {
69 	register struct proc *p;
70 
71 	p = pfind(arg);
72 	if (p)
73 		psignal(p, 16);
74 	nvualarm--;
75 }
76 #endif
77