Annotation of 43BSD/contrib/enet/vax/sys_machdep.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1982 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       6.4 (Berkeley) 6/8/85
        !             7:  */
        !             8: 
        !             9: #include "param.h"
        !            10: #include "systm.h"
        !            11: #include "dir.h"
        !            12: #include "user.h"
        !            13: #include "ioctl.h"
        !            14: #include "file.h"
        !            15: #include "proc.h"
        !            16: #include "uio.h"
        !            17: #include "kernel.h"
        !            18: #include "mtio.h"
        !            19: #include "buf.h"
        !            20: #include "trace.h"
        !            21: 
        !            22: #include "dkio.h"
        !            23: #include "pte.h"
        !            24: #include "../vaxuba/ubareg.h"
        !            25: #include "../vaxuba/ubavar.h"
        !            26: 
        !            27: resuba()
        !            28: {
        !            29: 
        !            30:        if (suser())
        !            31:        if (u.u_arg[0] < numuba)
        !            32:                ubareset(u.u_arg[0]);
        !            33: }
        !            34: 
        !            35: #ifdef TRACE
        !            36: int    nvualarm;
        !            37: 
        !            38: vtrace()
        !            39: {
        !            40:        register struct a {
        !            41:                int     request;
        !            42:                int     value;
        !            43:        } *uap;
        !            44:        int vdoualarm();
        !            45: 
        !            46:        uap = (struct a *)u.u_ap;
        !            47:        switch (uap->request) {
        !            48: 
        !            49:        case VTR_DISABLE:               /* disable a trace point */
        !            50:        case VTR_ENABLE:                /* enable a trace point */
        !            51:                if (uap->value < 0 || uap->value >= TR_NFLAGS)
        !            52:                        u.u_error = EINVAL;
        !            53:                else {
        !            54:                        u.u_r.r_val1 = traceflags[uap->value];
        !            55:                        traceflags[uap->value] = uap->request;
        !            56:                }
        !            57:                break;
        !            58: 
        !            59:        case VTR_VALUE:         /* return a trace point setting */
        !            60:                if (uap->value < 0 || uap->value >= TR_NFLAGS)
        !            61:                        u.u_error = EINVAL;
        !            62:                else
        !            63:                        u.u_r.r_val1 = 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 ||
        !            68:                    nvualarm > 5)
        !            69:                        u.u_error = EINVAL;
        !            70:                else {
        !            71:                        nvualarm++;
        !            72:                        timeout(vdoualarm, (caddr_t)u.u_procp->p_pid,
        !            73:                            uap->value);
        !            74:                }
        !            75:                break;
        !            76: 
        !            77:        case VTR_STAMP:
        !            78:                trace(TR_STAMP, uap->value, u.u_procp->p_pid);
        !            79:                break;
        !            80:        }
        !            81: }
        !            82: 
        !            83: vdoualarm(arg)
        !            84:        int arg;
        !            85: {
        !            86:        register struct proc *p;
        !            87: 
        !            88:        p = pfind(arg);
        !            89:        if (p)
        !            90:                psignal(p, 16);
        !            91:        nvualarm--;
        !            92: }
        !            93: #endif
        !            94: 
        !            95: #ifdef COMPAT
        !            96: /*
        !            97:  * Note: these tables are sorted by
        !            98:  * ioctl "code" (in ascending order).
        !            99:  */
        !           100: int dctls[] = { DKIOCHDR, 0 };
        !           101: int fctls[] = { FIOCLEX, FIONCLEX, FIOASYNC, FIONBIO, FIONREAD, 0 };
        !           102: int mctls[] = { MTIOCTOP, MTIOCGET, 0 };
        !           103: int tctls[] = {
        !           104:        TIOCGETD, TIOCSETD, TIOCHPCL, TIOCMODG, TIOCMODS,
        !           105:        TIOCGETP, TIOCSETP, TIOCSETN, TIOCEXCL, TIOCNXCL,
        !           106:        TIOCFLUSH,TIOCSETC, TIOCGETC, TIOCREMOTE,TIOCMGET,
        !           107:        TIOCMBIC, TIOCMBIS, TIOCMSET, TIOCSTART,TIOCSTOP,
        !           108:        TIOCPKT,  TIOCNOTTY,TIOCSTI,  TIOCOUTQ, TIOCGLTC,
        !           109:        TIOCSLTC, TIOCSPGRP,TIOCGPGRP,TIOCCDTR, TIOCSDTR,
        !           110:        TIOCCBRK, TIOCSBRK, TIOCLGET, TIOCLSET, TIOCLBIC,
        !           111:        TIOCLBIS, 0
        !           112: };
        !           113: #include "enetfilter.h"
        !           114: #if    NENETFILTER > 0
        !           115: #include "../vaxif/enet.h"
        !           116: int Ectls[] = {                /* CMU enet driver compatibility */
        !           117:        EIOCSETP, EIOCGETP, EIOCSETF, EIOCENBS, EIOCINHS,
        !           118:        EIOCSETW, EIOCFLUSH, EIOCALLOCP, EIOCDEALLOCP, EIOCMBIS,
        !           119:        EIOCMBIC, 0
        !           120: };
        !           121: #endif NENETFILTER
        !           122: 
        !           123: /*
        !           124:  * Map an old style ioctl command to new.
        !           125:  */
        !           126: mapioctl(cmd)
        !           127:        int cmd;
        !           128: {
        !           129:        register int *map, c;
        !           130: 
        !           131:        switch ((cmd >> 8) & 0xff) {
        !           132: 
        !           133:        case 'd':
        !           134:                map = dctls;
        !           135:                break;
        !           136: 
        !           137:        case 'f':
        !           138:                map = fctls;
        !           139:                break;
        !           140: 
        !           141:        case 'm':
        !           142:                map = mctls;
        !           143:                break;
        !           144: 
        !           145:        case 't':
        !           146:                map = tctls;
        !           147:                break;
        !           148: 
        !           149: #if    NENETFILTER > 0
        !           150:        case 'E':
        !           151:                map = Ectls;
        !           152:                break;
        !           153: #endif NENETFILTER
        !           154: 
        !           155:        default:
        !           156:                return (0);
        !           157:        }
        !           158:        while ((c = *map) && (c&0xff) < (cmd&0xff))
        !           159:                map++;
        !           160:        if (c && (c&0xff) == (cmd&0xff))
        !           161:                return (c);
        !           162:        return (0);
        !           163: }
        !           164: #endif

unix.superglobalmegacorp.com

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