|
|
1.1 root 1: /* $Header: /kernel/kersrc/io.286/semcon.c,v 1.1 92/07/17 15:24:46 bin Exp Locker: bin $
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: semcon.c,v $
26: * Revision 1.1 92/07/17 15:24:46 bin
27: * Initial revision
28: *
29: * Revision 2.1 88/09/03 13:11:55 src
30: * *** empty log message ***
31: *
32: * Revision 1.1 88/03/24 17:06:26 src
33: * Initial revision
34: *
35: * 87/03/02 Allan Cornish /usr/src/sys/i8086/drv/semcon.c
36: * Semioctl() now supports long key [was short] on SEMGET operations.
37: * This allows compatability with System V.
38: *
39: * 85/08/06 Allan Cornish
40: * Sem.c split into configuration (semcon.c) and implementation (sem.c).
41: * Semload() renamed to seminit().
42: *
43: * 85/07/03 Allan Cornish
44: * Eliminated semopen() and semclose() functions.
45: *
46: * 84/09/30 Allan Cornish
47: * Initial Revision.
48: */
49:
50: #include <coherent.h>
51: #include <types.h>
52: #include <errno.h>
53: #include <con.h>
54: #include <sem.h>
55:
56: /*
57: * Functions.
58: */
59:
60: int seminit();
61: int semioctl();
62: int nulldev();
63: int nonedev();
64:
65: /*
66: * Device Configuration.
67: */
68:
69: CON semcon = {
70: DFCHR, /* Flags */
71: 23, /* Major Index */
72: nulldev, /* Open */
73: nulldev, /* Close */
74: nonedev, /* Block */
75: nonedev, /* Read */
76: nonedev, /* Write */
77: semioctl, /* Ioctl */
78: nulldev, /* Power fail */
79: nulldev, /* Timeout */
80: seminit, /* Load */
81: nulldev /* Unload */
82: };
83:
84: /*
85: * Semaphore Device Ioctl.
86: */
87:
88: static
89: semioctl( dev, com, vec )
90:
91: dev_t dev;
92: int com;
93: register int *vec;
94:
95: {
96: switch ( com ) {
97:
98: case SEMCTL:
99: putuwd( vec+0,
100: usemctl(getuwd( vec+1 ),
101: getuwd( vec+2 ),
102: getuwd( vec+3 ),
103: getuwd( vec+4 ) ));
104: return;
105:
106: case SEMGET:
107: putuwd( vec+0,
108: usemget(getuwd( vec+1 ),
109: getuwd( vec+2 ),
110: getuwd( vec+3 ),
111: getuwd( vec+4 ) ));
112: return;
113:
114: case SEMOP:
115: putuwd( vec+0,
116: usemop( getuwd( vec+1 ),
117: getuwd( vec+2 ),
118: getuwd( vec+3 ) ));
119: return;
120:
121: default:
122: u.u_error = EINVAL;
123: return;
124: }
125: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.