1 |
/* Internal representation of a message. |
/* Internal representation of a message. |
2 |
Copyright 1999, 2000, 2001 Johan Rydberg, jrydberg@opencores.org. |
Copyright 1999, 2000, 2001, 2002 Johan Rydberg, jrydberg@opencores.org. |
3 |
|
|
4 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
5 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
111 |
if (! RTMK_MSG_TYPE_PORT_ANY_SEND (remote_type)) |
if (! RTMK_MSG_TYPE_PORT_ANY_SEND (remote_type)) |
112 |
return KERN_INVALID_RIGHT; |
return KERN_INVALID_RIGHT; |
113 |
|
|
114 |
if ((local_type == 0 && local_name != RTMK_PORT_NULL) |
if (((local_type == 0 && local_name) |
115 |
|
|| (local_type && local_name == 0)) |
116 |
|| !RTMK_MSG_TYPE_PORT_ANY_SEND (local_type)) |
|| !RTMK_MSG_TYPE_PORT_ANY_SEND (local_type)) |
117 |
return KERN_INVALID_RIGHT; |
return KERN_INVALID_RIGHT; |
118 |
|
|
|
|
|
119 |
/* Fetch remote port from IPC object. */ |
/* Fetch remote port from IPC object. */ |
120 |
|
|
121 |
kr = ipc_object_lookup (task->ipc_object, remote_name, &entry); |
kr = ipc_object_lookup (task->ipc_object, remote_name, &entry); |
134 |
msgh->msgh_remote_port = (rtmk_port_t) entry->ie_port; |
msgh->msgh_remote_port = (rtmk_port_t) entry->ie_port; |
135 |
|
|
136 |
/* Fetch local port from IPC object. */ |
/* Fetch local port from IPC object. */ |
137 |
|
if (local_name) |
138 |
kr = ipc_object_lookup (task->ipc_object, local_name, &entry); |
{ |
139 |
if (kr) |
kr = ipc_object_lookup (task->ipc_object, local_name, &entry); |
140 |
return kr; |
if (kr) |
141 |
|
return kr; |
142 |
if (! (IE_BITS_STATUS (entry->ie_bits) & IE_BITS_VALID)) |
|
143 |
return KERN_INVALID_RIGHT; |
if (! (IE_BITS_STATUS (entry->ie_bits) & IE_BITS_VALID)) |
144 |
|
return KERN_INVALID_RIGHT; |
145 |
if (! (IE_BITS_RIGHTS (entry->ie_bits) & RTMK_PORT_TYPE_RECEIVE)) |
|
146 |
return KERN_INVALID_RIGHT; |
if (! (IE_BITS_RIGHTS (entry->ie_bits) & RTMK_PORT_TYPE_RECEIVE)) |
147 |
|
return KERN_INVALID_RIGHT; |
148 |
/* ??? handle send-one right here? */ |
|
149 |
|
/* ??? handle send-one right here? */ |
150 |
kmsg->local_port = entry->ie_port; |
|
151 |
msgh->msgh_local_port = (rtmk_port_t) entry->ie_port; |
kmsg->local_port = entry->ie_port; |
152 |
|
msgh->msgh_local_port = (rtmk_port_t) entry->ie_port; |
153 |
|
} |
154 |
|
|
155 |
return KERN_SUCCESS; |
return KERN_SUCCESS; |
156 |
} |
} |