|
|
1.1 ! root 1: /* (-lgl ! 2: * COHERENT Version 3.0 ! 3: * Copyright (c) 1982, 1990 by Mark Williams Company. ! 4: * All rights reserved. May not be copied without permission. ! 5: -lgl) */ ! 6: #ifndef SEM_H ! 7: #define SEM_H ! 8: ! 9: /* ! 10: ** IPC Semaphore Facility ! 11: */ ! 12: ! 13: #include <sys/ipc.h> ! 14: #include <sys/types.h> ! 15: ! 16: /* ! 17: ** Permission Definitions. ! 18: */ ! 19: ! 20: #define SEM_A 0200 /* alter permission */ ! 21: #define SEM_R 0400 /* read permission */ ! 22: ! 23: /* ! 24: ** Semaphore Operation Flags. ! 25: */ ! 26: ! 27: /* #define SEM_UNDO 010000 */ /* set up adjust on exit entry */ ! 28: ! 29: /* ! 30: ** Semctl Command Definitions. ! 31: */ ! 32: ! 33: #define GETNCNT 3 /* get semncnt */ ! 34: #define GETPID 4 /* get sempid */ ! 35: #define GETVAL 5 /* get semval */ ! 36: #define GETALL 6 /* get all semval's */ ! 37: #define GETZCNT 7 /* get semzcnt */ ! 38: #define SETVAL 8 /* set semval */ ! 39: #define SETALL 9 /* set all semval's */ ! 40: ! 41: /* ! 42: ** Structure Definitions. ! 43: */ ! 44: ! 45: /* ! 46: ** There is one semaphore structure for each semaphore in the system. ! 47: */ ! 48: ! 49: struct sem { ! 50: ! 51: unsigned short semval; /* semaphore text map address */ ! 52: short sempid; /* pid of last operation */ ! 53: unsigned short semncnt; /* # awaiting semval > cval */ ! 54: unsigned short semzcnt; /* # awaiting semval = 0 */ ! 55: }; ! 56: ! 57: /* ! 58: ** There is one semaphore id data structure for each set of semaphores ! 59: ** in the system. ! 60: */ ! 61: ! 62: struct semid_ds { ! 63: ! 64: struct ipc_perm sem_perm; /* operation permission struct */ ! 65: struct sem *sem_base; /* pointer to first semaphore in set */ ! 66: unsigned short sem_nsems; /* # of semaphores in set */ ! 67: time_t sem_otime; /* last semop time */ ! 68: time_t sem_ctime; /* last change time */ ! 69: }; ! 70: ! 71: /* ! 72: ** There is one undo structure per process in the system. ! 73: */ ! 74: ! 75: struct sem_undo { ! 76: ! 77: struct sem_undo *un_np; /* ptr to next active undo structure */ ! 78: short un_cnt; /* # of active entries */ ! 79: struct undo { ! 80: short un_aoe; /* adjust on exit values */ ! 81: short un_num; /* semaphore # */ ! 82: int un_id; /* semid */ ! 83: } un_ent[1]; /* undo entries (one minimum) */ ! 84: }; ! 85: ! 86: /* ! 87: ** User semaphore template for semop system calls. ! 88: */ ! 89: ! 90: struct sembuf { ! 91: ! 92: unsigned short sem_num; /* semaphore # */ ! 93: short sem_op; /* semaphore operation */ ! 94: short sem_flg; /* operation flags */ ! 95: }; ! 96: ! 97: /* ! 98: ** Ioctl commands issued to Semaphore device driver (Coherent specific). ! 99: */ ! 100: ! 101: #define SEMIOC ('S'<<8) ! 102: #define SEMCTL (SEMIOC|0) ! 103: #define SEMGET (SEMIOC|1) ! 104: #define SEMOP (SEMIOC|2) ! 105: ! 106: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.