⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sys_machdep.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
字号:
#ifndef lintstatic char *sccsid = "@(#)sys_machdep.c	4.1	ULTRIX	7/2/90";#endif	lint/************************************************************************ *									* *			Copyright (c) 1984, 1986 by			* *		Digital Equipment Corporation, Maynard, MA		* *			All rights reserved.				* *									* *   This software is furnished under a license and may be used and	* *   copied  only  in accordance with the terms of such license and	* *   with the  inclusion  of  the  above  copyright  notice.   This	* *   software  or  any	other copies thereof may not be provided or	* *   otherwise made available to any other person.  No title to and	* *   ownership of the software is hereby transferred.			* *									* *   This software is  derived	from  software	received  from	the	* *   University    of	California,   Berkeley,   and	from   Bell	* *   Laboratories.  Use, duplication, or disclosure is	subject  to	* *   restrictions  under  license  agreements  with  University  of	* *   California and with AT&T.						* *									* *   The information in this software is subject to change  without	* *   notice  and should not be construed as a commitment by Digital	* *   Equipment Corporation.						* *									* *   Digital assumes no responsibility for the use  or	reliability	* *   of its software on equipment which is not supplied by Digital.	* *									* ************************************************************************//* * sys_machdep.c   6.1	   07/29/83 * * Modification history * * 10-Oct-88 -- jaw *	replace switch_to_master with general routine switch_affinity * * 23-Aug-88 - miche *	Add support for ref'ing processing for vdoualarm * * Miscellaneous kernel machine dependent routines * * 01-Apr-86 - Ricky Palmer * *	Derived from 4.2BSD labeled: sys_machdep.c 6.1	83/07/29. *	Added copyright notice and changed "dkio.h" include. * */#include "../h/param.h"#include "../h/systm.h"#include "../h/dir.h"#include "../h/user.h"#include "../h/ioctl.h"#include "../h/file.h"#include "../h/proc.h"#include "../h/uio.h"#include "../h/kernel.h"#include "../h/mtio.h"#include "../h/buf.h"#include "../h/dkio.h"#include "../h/cpudata.h"#include "../machine/pte.h"#include "../io/uba/ubareg.h"#include "../io/uba/ubavar.h"resuba(){	int saveaffinity;/* UNIBUS is NOT mpsafe */	if (suser()) {		if (u.u_arg[0] < numuba) {			saveaffinity = switch_affinity(boot_cpu_mask);			ubareset(u.u_arg[0]);			(void) switch_affinity(saveaffinity);		}	}}#ifdef TRACEint	nvualarm;vtrace(){	register struct a {		int	request;		int	value;	} *uap;	int vdoualarm();	uap = (struct a *)u.u_ap;	switch (uap->request) {	case VTR_DISABLE:		/* disable a trace point */	case VTR_ENABLE:		/* enable a trace point */		if (uap->value < 0 || uap->value >= TR_NFLAGS)			u.u_error = EINVAL;		else {			u.u_r.r_val1 = traceflags[uap->value];			traceflags[uap->value] = uap->request;		}		break;	case VTR_VALUE: 	/* return a trace point setting */		if (uap->value < 0 || uap->value >= TR_NFLAGS)			u.u_error = EINVAL;		else			u.u_r.r_val1 = traceflags[uap->value];		break;	case VTR_UALARM:	/* set a real-time ualarm, less than 1 min */		if (uap->value <= 0 || uap->value > 60 * hz ||		    nvualarm > 5)			u.u_error = EINVAL;		else {			nvualarm++;			timeout(vdoualarm, (caddr_t)u.u_procp->p_pid,			    uap->value);		}		break;	case VTR_STAMP:		trace(TR_STAMP, uap->value, u.u_procp->p_pid);		break;	}}vdoualarm(arg)	int arg;{	register struct proc *p;	if (p = proc_get(arg)) {		psignal(p, 16);		proc_rele(p);	}	nvualarm--;}#endif#ifdef COMPAT/* * Note: these tables are sorted by * ioctl "code" (in ascending order). */int dctls[] = { DKIOCHDR, 0 };int fctls[] = { FIOCLEX, FIONCLEX, FIOASYNC, FIONBIO, FIONREAD, 0 };int mctls[] = { MTIOCTOP, MTIOCGET, 0 };int tctls[] = {	TIOCGETD, TIOCSETD, TIOCHPCL, TIOCMODG, TIOCMODS,	TIOCGETP, TIOCSETP, TIOCSETN, TIOCEXCL, TIOCNXCL,	TIOCFLUSH,TIOCSETC, TIOCGETC, TIOCREMOTE,TIOCMGET,	TIOCMBIC, TIOCMBIS, TIOCMSET, TIOCSTART,TIOCSTOP,	TIOCPKT,  TIOCNOTTY,TIOCSTI,  TIOCOUTQ, TIOCGLTC,	TIOCSLTC, TIOCSPGRP,TIOCGPGRP,TIOCCDTR, TIOCSDTR,	TIOCCBRK, TIOCSBRK, TIOCLGET, TIOCLSET, TIOCLBIC,	TIOCLBIS, 0};/* * Map an old style ioctl command to new. */mapioctl(cmd)	int cmd;{	register int *map, c;	switch ((cmd >> 8) & 0xff) {	case 'd':		map = dctls;		break;	case 'f':		map = fctls;		break;	case 'm':		map = mctls;		break;	case 't':		map = tctls;		break;	default:		return (0);	}	while ((c = *map) && (c&0xff) < (cmd&0xff))		map++;	if (c && (c&0xff) == (cmd&0xff))		return (c);	return (0);}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -