162 |
break; |
break; |
163 |
} |
} |
164 |
|
|
165 |
default: |
/* Task is sending an async request. */ |
166 |
{ |
case RTMK_MSGH_BITS (RTMK_MSG_TYPE_COPY_SEND, 0): |
167 |
remote_type = RTMK_MSGH_BITS_REMOTE (msgh->msgh_bits); |
{ |
168 |
local_type = RTMK_MSGH_BITS_LOCAL (msgh->msgh_bits); |
/* Fetch remote port from IPC object. */ |
169 |
|
kr = ipc_object_copyin (task->ipc_object, remote_name, |
170 |
/* First of all check so that we got a valid header. */ |
RTMK_MSGH_BITS_REMOTE (msgh->msgh_bits), |
171 |
if (! RTMK_MSG_TYPE_PORT_ANY_SEND (remote_type)) |
& kmsg->destination_port); |
172 |
return KERN_INVALID_RIGHT; |
if (kr) |
173 |
|
panic ("kr = %d", kr); |
174 |
/* Fetch remote port from IPC object. */ |
msgh->msgh_local_port = (rtmk_port_t) kmsg->destination_port; |
175 |
kr = ipc_object_lookup (task->ipc_object, remote_name, &entry); |
msgh->msgh_remote_port = 0; |
176 |
if (kr) |
|
177 |
panic ("kr = %d", kr); |
kmsg->reply_port = 0; |
178 |
|
msgh->msgh_remote_port = 0; |
179 |
|
|
180 |
|
break; |
181 |
|
} |
182 |
|
|
183 |
|
default: |
184 |
if (! (IE_BITS_STATUS (entry->ie_bits) & IE_BITS_VALID)) |
{ |
185 |
return KERN_INVALID_RIGHT; |
remote_type = RTMK_MSGH_BITS_REMOTE (msgh->msgh_bits); |
186 |
|
local_type = RTMK_MSGH_BITS_LOCAL (msgh->msgh_bits); |
187 |
if (! (IE_BITS_RIGHTS (entry->ie_bits) & RTMK_PORT_TYPE_SEND_RIGHTS)) |
|
188 |
return KERN_INVALID_RIGHT; |
/* First of all check so that we got a valid header. */ |
189 |
|
if (! RTMK_MSG_TYPE_PORT_ANY_SEND (remote_type)) |
190 |
|
return KERN_INVALID_RIGHT; |
191 |
/* Fetch local port from IPC object. */ |
|
192 |
if (local_type) |
/* Fetch remote port from IPC object. */ |
193 |
{ |
kr = ipc_object_lookup (task->ipc_object, remote_name, &entry); |
194 |
if (! RTMK_MSG_TYPE_PORT_ANY_SEND (local_type)) |
if (kr) |
195 |
return KERN_INVALID_RIGHT; |
panic ("kr = %d", kr); |
196 |
|
|
197 |
|
|
198 |
|
if (! (IE_BITS_STATUS (entry->ie_bits) & IE_BITS_VALID)) |
199 |
|
return KERN_INVALID_RIGHT; |
200 |
|
|
201 |
|
if (! (IE_BITS_RIGHTS (entry->ie_bits) & RTMK_PORT_TYPE_SEND_RIGHTS)) |
202 |
|
return KERN_INVALID_RIGHT; |
203 |
|
|
204 |
|
|
205 |
|
/* Fetch local port from IPC object. */ |
206 |
|
if (local_type) |
207 |
|
{ |
208 |
|
if (! RTMK_MSG_TYPE_PORT_ANY_SEND (local_type)) |
209 |
|
return KERN_INVALID_RIGHT; |
210 |
|
|
211 |
kr = ipc_object_lookup (task->ipc_object, local_name, &entry); |
kr = ipc_object_lookup (task->ipc_object, local_name, &entry); |
212 |
if (kr) |
if (kr) |
213 |
panic ("kr = %d", kr); |
panic ("kr = %d", kr); |
214 |
|
|
215 |
if (! (IE_BITS_STATUS (entry->ie_bits) & IE_BITS_VALID)) |
if (! (IE_BITS_STATUS (entry->ie_bits) & IE_BITS_VALID)) |
216 |
return KERN_INVALID_RIGHT; |
return KERN_INVALID_RIGHT; |
217 |
|
|
218 |
if (! (IE_BITS_RIGHTS (entry->ie_bits) & RTMK_PORT_TYPE_RECEIVE)) |
if (! (IE_BITS_RIGHTS (entry->ie_bits) & RTMK_PORT_TYPE_RECEIVE)) |
219 |
return KERN_INVALID_RIGHT; |
return KERN_INVALID_RIGHT; |
220 |
|
|
221 |
/* ??? handle send-one right here? */ |
/* ??? handle send-one right here? */ |
222 |
|
|
223 |
kmsg->reply_port = entry->ie_port; |
kmsg->reply_port = entry->ie_port; |
224 |
msgh->msgh_remote_port = (rtmk_port_t) entry->ie_port; |
msgh->msgh_remote_port = (rtmk_port_t) entry->ie_port; |
225 |
} |
} |
226 |
else |
else |
227 |
{ |
{ |
228 |
kmsg->reply_port = 0; |
kmsg->reply_port = 0; |
229 |
msgh->msgh_remote_port = 0; |
msgh->msgh_remote_port = 0; |
230 |
} |
} |
231 |
break; |
break; |
232 |
} |
} |
233 |
} |
} |
234 |
return KERN_SUCCESS; |
return KERN_SUCCESS; |
235 |
} |
} |