|
|
1.1.1.2 ! root 1: /* 1.1 root 2: * Mach Operating System 3: * Copyright (c) 1991,1990,1989 Carnegie Mellon University 4: * All Rights Reserved. 1.1.1.2 ! root 5: * 1.1 root 6: * Permission to use, copy, modify and distribute this software and its 7: * documentation is hereby granted, provided that both the copyright 8: * notice and this permission notice appear in all copies of the 9: * software, derivative works or modified versions, and any portions 10: * thereof, and that both notices appear in supporting documentation. 1.1.1.2 ! root 11: * 1.1 root 12: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 13: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 14: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 1.1.1.2 ! root 15: * 1.1 root 16: * Carnegie Mellon requests users of this software to return to 1.1.1.2 ! root 17: * 1.1 root 18: * Software Distribution Coordinator or [email protected] 19: * School of Computer Science 20: * Carnegie Mellon University 21: * Pittsburgh PA 15213-3890 1.1.1.2 ! root 22: * 1.1 root 23: * any improvements or extensions that they make and grant Carnegie Mellon 24: * the rights to redistribute these changes. 25: */ 26: /* 27: * File: ipc/ipc_mqueue.h 28: * Author: Rich Draves 29: * Date: 1989 30: * 31: * Definitions for message queues. 32: */ 33: 34: #ifndef _IPC_IPC_MQUEUE_H_ 35: #define _IPC_IPC_MQUEUE_H_ 36: 37: #include <mach/message.h> 38: #include <kern/assert.h> 39: #include <kern/lock.h> 40: #include <kern/macro_help.h> 41: #include <ipc/ipc_kmsg.h> 42: #include <ipc/ipc_thread.h> 43: 44: typedef struct ipc_mqueue { 45: decl_simple_lock_data(, imq_lock_data) 46: struct ipc_kmsg_queue imq_messages; 47: struct ipc_thread_queue imq_threads; 48: } *ipc_mqueue_t; 49: 50: #define IMQ_NULL ((ipc_mqueue_t) 0) 51: 52: #define imq_lock_init(mq) simple_lock_init(&(mq)->imq_lock_data) 53: #define imq_lock(mq) simple_lock(&(mq)->imq_lock_data) 54: #define imq_lock_try(mq) simple_lock_try(&(mq)->imq_lock_data) 55: #define imq_unlock(mq) simple_unlock(&(mq)->imq_lock_data) 56: 57: extern void 58: ipc_mqueue_init(/* ipc_mqueue_t */); 59: 60: extern void 61: ipc_mqueue_move(/* ipc_mqueue_t, ipc_mqueue_t, ipc_port_t */); 62: 63: extern void 64: ipc_mqueue_changed(/* ipc_mqueue_t, mach_msg_return_t */); 65: 66: extern mach_msg_return_t 67: ipc_mqueue_send(/* ipc_kmsg_t, mach_msg_option_t, mach_msg_timeout_t */); 68: 69: #define IMQ_NULL_CONTINUE ((void (*)()) 0) 70: 71: extern mach_msg_return_t 72: ipc_mqueue_receive(/* ipc_mqueue_t, mach_msg_option_t, 73: mach_msg_size_t, mach_msg_timeout_t, 74: boolean_t, void (*)(), 75: ipc_kmsg_t *, mach_port_seqno_t * */); 76: 77: /* 78: * extern void 79: * ipc_mqueue_send_always(ipc_kmsg_t); 80: * 81: * Unfortunately, to avoid warnings/lint about unused variables 82: * when assertions are turned off, we need two versions of this. 83: */ 84: 85: #include <kern/assert.h> 86: 87: #if MACH_ASSERT 88: 89: #define ipc_mqueue_send_always(kmsg) \ 90: MACRO_BEGIN \ 91: mach_msg_return_t mr; \ 92: \ 93: mr = ipc_mqueue_send((kmsg), MACH_SEND_ALWAYS, \ 94: MACH_MSG_TIMEOUT_NONE); \ 95: assert(mr == MACH_MSG_SUCCESS); \ 96: MACRO_END 97: 1.1.1.2 ! root 98: #else /* MACH_ASSERT */ 1.1 root 99: 100: #define ipc_mqueue_send_always(kmsg) \ 101: MACRO_BEGIN \ 102: (void) ipc_mqueue_send((kmsg), MACH_SEND_ALWAYS, \ 103: MACH_MSG_TIMEOUT_NONE); \ 104: MACRO_END 105: 106: #endif /* MACH_ASSERT */ 107: 108: #endif /* _IPC_IPC_MQUEUE_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.