|
|
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
1.1.1.3 ! root 58: ipc_mqueue_init(ipc_mqueue_t);
1.1 root 59:
60: extern void
1.1.1.3 ! root 61: ipc_mqueue_move(ipc_mqueue_t, ipc_mqueue_t, ipc_port_t);
1.1 root 62:
63: extern void
1.1.1.3 ! root 64: ipc_mqueue_changed(ipc_mqueue_t, mach_msg_return_t);
1.1 root 65:
66: extern mach_msg_return_t
1.1.1.3 ! root 67: ipc_mqueue_send(ipc_kmsg_t, mach_msg_option_t, mach_msg_timeout_t);
! 68:
! 69: extern mach_msg_return_t
! 70: ipc_mqueue_copyin(ipc_space_t, mach_port_t, ipc_mqueue_t *, ipc_object_t *);
1.1 root 71:
72: #define IMQ_NULL_CONTINUE ((void (*)()) 0)
73:
74: extern mach_msg_return_t
1.1.1.3 ! root 75: ipc_mqueue_receive(ipc_mqueue_t, mach_msg_option_t,
! 76: mach_msg_size_t, mach_msg_timeout_t,
! 77: boolean_t, void (*)(),
! 78: ipc_kmsg_t *, mach_port_seqno_t *);
1.1 root 79:
80: /*
81: * extern void
82: * ipc_mqueue_send_always(ipc_kmsg_t);
83: *
84: * Unfortunately, to avoid warnings/lint about unused variables
85: * when assertions are turned off, we need two versions of this.
86: */
87:
88: #include <kern/assert.h>
89:
90: #if MACH_ASSERT
91:
92: #define ipc_mqueue_send_always(kmsg) \
93: MACRO_BEGIN \
94: mach_msg_return_t mr; \
95: \
96: mr = ipc_mqueue_send((kmsg), MACH_SEND_ALWAYS, \
97: MACH_MSG_TIMEOUT_NONE); \
98: assert(mr == MACH_MSG_SUCCESS); \
99: MACRO_END
100:
1.1.1.2 root 101: #else /* MACH_ASSERT */
1.1 root 102:
103: #define ipc_mqueue_send_always(kmsg) \
104: MACRO_BEGIN \
105: (void) ipc_mqueue_send((kmsg), MACH_SEND_ALWAYS, \
106: MACH_MSG_TIMEOUT_NONE); \
107: MACRO_END
108:
109: #endif /* MACH_ASSERT */
110:
111: #endif /* _IPC_IPC_MQUEUE_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.