|
|
1.1 ! root 1: /* $Header: /usr/src/sys/i8086/drv/RCS/semcon.c,v 2.1 88/09/03 13:11:55 src Exp $ ! 2: * ! 3: * The information contained herein is a trade secret of INETCO ! 4: * Systems, and is confidential information. It is provided under ! 5: * a license agreement, and may be copied or disclosed only under ! 6: * the terms of that agreement. Any reproduction or disclosure of ! 7: * this material without the express written authorization of ! 8: * INETCO Systems or persuant to the license agreement is unlawful. ! 9: * ! 10: * Copyright (c) 1987, 1985, 1984. ! 11: * An unpublished work by INETCO Systems, Ltd. ! 12: * All rights reserved. ! 13: */ ! 14: ! 15: /* ! 16: * System V Compatible Semaphore Device Driver ! 17: * ! 18: * This device driver provides System V compatible semaphore operations. ! 19: * Operations are performed through the semaphore device (/dev/sem). ! 20: * and are implemented as ioctl calls from semctl, semget, semop ! 21: * utilities. ! 22: * ! 23: * Author: Allan Cornish, INETCO Systems Ltd., Sep 1984 ! 24: * ! 25: * $Log: /usr/src/sys/i8086/drv/RCS/semcon.c,v $ ! 26: * Revision 2.1 88/09/03 13:11:55 src ! 27: * *** empty log message *** ! 28: * ! 29: * Revision 1.1 88/03/24 17:06:26 src ! 30: * Initial revision ! 31: * ! 32: * 87/03/02 Allan Cornish /usr/src/sys/i8086/drv/semcon.c ! 33: * Semioctl() now supports long key [was short] on SEMGET operations. ! 34: * This allows compatability with System V. ! 35: * ! 36: * 85/08/06 Allan Cornish ! 37: * Sem.c split into configuration (semcon.c) and implementation (sem.c). ! 38: * Semload() renamed to seminit(). ! 39: * ! 40: * 85/07/03 Allan Cornish ! 41: * Eliminated semopen() and semclose() functions. ! 42: * ! 43: * 84/09/30 Allan Cornish ! 44: * Initial Revision. ! 45: */ ! 46: ! 47: #include <coherent.h> ! 48: #include <types.h> ! 49: #include <uproc.h> ! 50: #include <errno.h> ! 51: #include <con.h> ! 52: #include <sem.h> ! 53: ! 54: /* ! 55: * Functions. ! 56: */ ! 57: ! 58: int seminit(); ! 59: int semioctl(); ! 60: int nulldev(); ! 61: int nonedev(); ! 62: ! 63: /* ! 64: * Device Configuration. ! 65: */ ! 66: ! 67: CON semcon = { ! 68: DFCHR, /* Flags */ ! 69: 23, /* Major Index */ ! 70: nulldev, /* Open */ ! 71: nulldev, /* Close */ ! 72: nonedev, /* Block */ ! 73: nonedev, /* Read */ ! 74: nonedev, /* Write */ ! 75: semioctl, /* Ioctl */ ! 76: nulldev, /* Power fail */ ! 77: nulldev, /* Timeout */ ! 78: seminit, /* Load */ ! 79: nulldev /* Unload */ ! 80: }; ! 81: ! 82: /* ! 83: * Semaphore Device Ioctl. ! 84: */ ! 85: ! 86: static ! 87: semioctl( dev, com, vec ) ! 88: ! 89: dev_t dev; ! 90: int com; ! 91: register int *vec; ! 92: ! 93: { ! 94: switch ( com ) { ! 95: ! 96: case SEMCTL: ! 97: putuwd( vec+0, ! 98: usemctl(getuwd( vec+1 ), ! 99: getuwd( vec+2 ), ! 100: getuwd( vec+3 ), ! 101: getuwd( vec+4 ) )); ! 102: return; ! 103: ! 104: case SEMGET: ! 105: putuwd( vec+0, ! 106: usemget(getuwd( vec+1 ), ! 107: getuwd( vec+2 ), ! 108: getuwd( vec+3 ), ! 109: getuwd( vec+4 ) )); ! 110: return; ! 111: ! 112: case SEMOP: ! 113: putuwd( vec+0, ! 114: usemop( getuwd( vec+1 ), ! 115: getuwd( vec+2 ), ! 116: getuwd( vec+3 ) )); ! 117: return; ! 118: ! 119: default: ! 120: u.u_error = EINVAL; ! 121: return; ! 122: } ! 123: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.