|
|
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>
1.1.1.5 ! root 40: #include <kern/macros.h>
1.1.1.4 root 41: #include <ipc/ipc_kmsg_queue.h>
1.1 root 42: #include <ipc/ipc_kmsg.h>
43: #include <ipc/ipc_thread.h>
44:
45: typedef struct ipc_mqueue {
46: decl_simple_lock_data(, imq_lock_data)
47: struct ipc_kmsg_queue imq_messages;
48: struct ipc_thread_queue imq_threads;
49: } *ipc_mqueue_t;
50:
51: #define IMQ_NULL ((ipc_mqueue_t) 0)
52:
53: #define imq_lock_init(mq) simple_lock_init(&(mq)->imq_lock_data)
54: #define imq_lock(mq) simple_lock(&(mq)->imq_lock_data)
55: #define imq_lock_try(mq) simple_lock_try(&(mq)->imq_lock_data)
56: #define imq_unlock(mq) simple_unlock(&(mq)->imq_lock_data)
57:
58: extern void
1.1.1.3 root 59: ipc_mqueue_init(ipc_mqueue_t);
1.1 root 60:
61: extern void
1.1.1.3 root 62: ipc_mqueue_move(ipc_mqueue_t, ipc_mqueue_t, ipc_port_t);
1.1 root 63:
64: extern void
1.1.1.3 root 65: ipc_mqueue_changed(ipc_mqueue_t, mach_msg_return_t);
1.1 root 66:
67: extern mach_msg_return_t
1.1.1.3 root 68: ipc_mqueue_send(ipc_kmsg_t, mach_msg_option_t, mach_msg_timeout_t);
69:
70: extern mach_msg_return_t
71: ipc_mqueue_copyin(ipc_space_t, mach_port_t, ipc_mqueue_t *, ipc_object_t *);
1.1 root 72:
73: #define IMQ_NULL_CONTINUE ((void (*)()) 0)
74:
75: extern mach_msg_return_t
1.1.1.3 root 76: ipc_mqueue_receive(ipc_mqueue_t, mach_msg_option_t,
77: mach_msg_size_t, mach_msg_timeout_t,
78: boolean_t, void (*)(),
79: ipc_kmsg_t *, mach_port_seqno_t *);
1.1 root 80:
81: /*
82: * extern void
83: * ipc_mqueue_send_always(ipc_kmsg_t);
84: *
85: * Unfortunately, to avoid warnings/lint about unused variables
86: * when assertions are turned off, we need two versions of this.
87: */
88:
89: #include <kern/assert.h>
90:
91: #if MACH_ASSERT
92:
93: #define ipc_mqueue_send_always(kmsg) \
94: MACRO_BEGIN \
95: mach_msg_return_t mr; \
96: \
97: mr = ipc_mqueue_send((kmsg), MACH_SEND_ALWAYS, \
98: MACH_MSG_TIMEOUT_NONE); \
99: assert(mr == MACH_MSG_SUCCESS); \
100: MACRO_END
101:
1.1.1.2 root 102: #else /* MACH_ASSERT */
1.1 root 103:
104: #define ipc_mqueue_send_always(kmsg) \
105: MACRO_BEGIN \
106: (void) ipc_mqueue_send((kmsg), MACH_SEND_ALWAYS, \
107: MACH_MSG_TIMEOUT_NONE); \
108: MACRO_END
109:
110: #endif /* MACH_ASSERT */
111:
112: #endif /* _IPC_IPC_MQUEUE_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.