Lines Matching defs:kmsg
175 ipc_kmsg_t kmsg);
178 ipc_kmsg_t kmsg,
183 ipc_kmsg_t kmsg,
190 ipc_kmsg_t kmsg,
215 ipc_kmsg_t kmsg;
257 kmsg = cache->entries[--i];
259 ikm_check_init(kmsg, max_expanded_size);
261 kmsg->ikm_header = (mach_msg_header_t *)
262 ((vm_offset_t)(kmsg + 1) +
265 return (kmsg);
268 kmsg = (ipc_kmsg_t)zalloc(ipc_kmsg_zone);
270 kmsg = (ipc_kmsg_t)kalloc(ikm_plus_overhead(max_expanded_size));
273 if (kmsg != IKM_NULL) {
274 ikm_init(kmsg, max_expanded_size);
275 kmsg->ikm_header = (mach_msg_header_t *)
276 ((vm_offset_t)(kmsg + 1) +
281 return(kmsg);
298 ipc_kmsg_t kmsg)
300 mach_msg_size_t size = kmsg->ikm_size;
304 if (kmsg->ikm_sender != NULL) {
305 task_deallocate(kmsg->ikm_sender);
306 kmsg->ikm_sender = NULL;
315 port = ikm_prealloc_inuse_port(kmsg);
318 ikm_prealloc_clear_inuse(kmsg, port);
319 if (ip_active(port) && (port->ip_premsg == kmsg)) {
330 if (kmsg->ikm_size == IKM_SAVED_MSG_SIZE) {
337 cache->entries[i] = kmsg;
343 zfree(ipc_kmsg_zone, kmsg);
346 kfree(kmsg, ikm_plus_overhead(size));
353 * Enqueue a kmsg.
359 ipc_kmsg_t kmsg)
361 ipc_kmsg_enqueue_macro(queue, kmsg);
367 * Dequeue and return a kmsg.
387 * Pull a kmsg out of a queue.
393 ipc_kmsg_t kmsg)
399 next = kmsg->ikm_next;
400 prev = kmsg->ikm_prev;
402 if (next == kmsg) {
403 assert(prev == kmsg);
404 assert(queue->ikmq_base == kmsg);
408 if (queue->ikmq_base == kmsg)
415 assert((kmsg->ikm_next = IKM_BOGUS) == IKM_BOGUS);
416 assert((kmsg->ikm_prev = IKM_BOGUS) == IKM_BOGUS);
422 * Return the kmsg following the given kmsg.
429 ipc_kmsg_t kmsg)
435 next = kmsg->ikm_next;
454 ipc_kmsg_t kmsg)
467 ipc_kmsg_enqueue(queue, kmsg);
470 /* must leave kmsg in queue while cleaning it */
472 while ((kmsg = ipc_kmsg_queue_first(queue)) != IKM_NULL) {
473 ipc_kmsg_clean(kmsg);
474 ipc_kmsg_rmqueue(queue, kmsg);
475 ipc_kmsg_free(kmsg);
492 ipc_kmsg_t kmsg)
496 port = kmsg->ikm_header->msgh_remote_port;
499 kmsg->ikm_header->msgh_remote_port = MACH_PORT_NULL;
500 ipc_kmsg_destroy(kmsg);
515 __unused ipc_kmsg_t kmsg,
614 ipc_kmsg_t kmsg,
621 mach_msg_bits_t mbits = kmsg->ikm_header->msgh_bits;
623 object = (ipc_object_t) kmsg->ikm_header->msgh_remote_port;
627 object = (ipc_object_t) kmsg->ikm_header->msgh_local_port;
635 ipc_kmsg_clean_body(kmsg, number, desc);
649 ipc_kmsg_t kmsg)
654 mbits = kmsg->ikm_header->msgh_bits;
655 object = (ipc_object_t) kmsg->ikm_header->msgh_remote_port;
659 object = (ipc_object_t) kmsg->ikm_header->msgh_local_port;
666 body = (mach_msg_body_t *) (kmsg->ikm_header + 1);
667 ipc_kmsg_clean_body(kmsg, body->msgh_descriptor_count,
672 if (kmsg->ikm_sender != NULL) {
673 task_deallocate(kmsg->ikm_sender);
674 kmsg->ikm_sender = NULL;
682 * Assign a kmsg as a preallocated message buffer to a port.
689 ipc_kmsg_t kmsg,
692 assert(kmsg->ikm_prealloc == IP_NULL);
694 kmsg->ikm_prealloc = IP_NULL;
695 IP_SET_PREALLOC(port, kmsg);
707 ipc_kmsg_t kmsg,
710 assert(kmsg->ikm_prealloc == port);
712 kmsg->ikm_prealloc = IP_NULL;
713 IP_CLEAR_PREALLOC(port, kmsg);
740 ipc_kmsg_t kmsg;
751 kmsg = ipc_kmsg_alloc(msg_and_trailer_size);
753 if (kmsg == IKM_NULL)
756 if (copyinmsg(msg_addr, (char *) kmsg->ikm_header, size)) {
757 ipc_kmsg_free(kmsg);
761 kmsg->ikm_header->msgh_size = size;
769 trailer = (mach_msg_max_trailer_t *) ((vm_offset_t)kmsg->ikm_header + size);
776 if(trcWork.traceMask) dbgTrace(0x1100, (unsigned int)kmsg->ikm_header->msgh_id,
777 (unsigned int)kmsg->ikm_header->msgh_remote_port,
778 (unsigned int)kmsg->ikm_header->msgh_local_port, 0);
786 kmsg->ikm_sender = cur;
793 *kmsgp = kmsg;
819 ipc_kmsg_t kmsg;
833 * See if the port has a pre-allocated kmsg for kernel
844 kmsg = dest_port->ip_premsg;
845 if (msg_and_trailer_size > kmsg->ikm_size) {
849 if (ikm_prealloc_inuse(kmsg)) {
853 ikm_prealloc_set_inuse(kmsg, dest_port);
856 kmsg = ipc_kmsg_alloc(msg_and_trailer_size);
857 if (kmsg == IKM_NULL)
861 (void) memcpy((void *) kmsg->ikm_header, (const void *) msg, size);
863 kmsg->ikm_header->msgh_size = size;
872 ((vm_offset_t)kmsg->ikm_header + size);
881 kmsg->ikm_sender = NULL;
883 *kmsgp = kmsg;
906 ipc_kmsg_t kmsg,
912 port = (ipc_port_t) kmsg->ikm_header->msgh_remote_port;
937 kmsg = ipc_kobject_server(kmsg);
938 if (kmsg == IKM_NULL)
941 port = (ipc_port_t) kmsg->ikm_header->msgh_remote_port;
962 kmsg->ikm_header->msgh_remote_port = MACH_PORT_NULL;
963 ipc_kmsg_destroy(kmsg);
967 if (kmsg->ikm_header->msgh_bits & MACH_MSGH_BITS_CIRCULAR) {
972 ipc_kmsg_destroy(kmsg);
982 return (ipc_mqueue_send(&port->ip_messages, kmsg, option, send_timeout));
1002 ipc_kmsg_t kmsg,
1007 if (copyoutmsg((const char *) kmsg->ikm_header, msg_addr, size))
1012 ipc_kmsg_free(kmsg);
1029 ipc_kmsg_t kmsg,
1032 (void) memcpy((void *) msg, (const void *) kmsg->ikm_header, size);
1034 ipc_kmsg_free(kmsg);
1475 ipc_kmsg_t kmsg,
1497 dest = (ipc_object_t) kmsg->ikm_header->msgh_remote_port;
1498 body = (mach_msg_body_t *) (kmsg->ikm_header + 1);
1509 ipc_kmsg_clean_partial(kmsg, 0, NULL, 0, 0);
1542 ((vm_offset_t)kmsg->ikm_header + kmsg->ikm_header->msgh_size)) {
1543 ipc_kmsg_clean_partial(kmsg, 0, NULL, 0, 0);
1562 ipc_kmsg_clean_partial(kmsg, 0, NULL, 0, 0);
1581 ipc_kmsg_clean_partial(kmsg, 0, NULL, 0, 0);
1597 ipc_kmsg_clean_partial(kmsg, 0, NULL, 0, 0);
1642 kmsg->ikm_header->msgh_bits |= MACH_MSGH_BITS_CIRCULAR;
1850 kmsg->ikm_header->msgh_bits |= MACH_MSGH_BITS_CIRCULAR;
1868 ipc_kmsg_clean_partial(kmsg, dsc_count - i,
1881 kmsg->ikm_header->msgh_bits &= ~MACH_MSGH_BITS_COMPLEX;
1885 mach_msg_base_t *old_base = (mach_msg_base_t *)kmsg->ikm_header;
1890 kmsg->ikm_header = &new_base->header;
1928 ipc_kmsg_t kmsg,
1935 mr = ipc_kmsg_copyin_header(kmsg->ikm_header, space, notify);
1939 if ((kmsg->ikm_header->msgh_bits & MACH_MSGH_BITS_COMPLEX) == 0)
1942 return( ipc_kmsg_copyin_body( kmsg, space, map) );
1963 ipc_kmsg_t kmsg)
1965 mach_msg_bits_t bits = kmsg->ikm_header->msgh_bits;
1968 ipc_object_t remote = (ipc_object_t) kmsg->ikm_header->msgh_remote_port;
1969 ipc_object_t local = (ipc_object_t) kmsg->ikm_header->msgh_local_port;
1987 kmsg->ikm_header->msgh_bits = bits;
1993 kmsg->ikm_header->msgh_bits = bits;
2001 body = (mach_msg_body_t *) (kmsg->ikm_header + 1);
2036 kmsg->ikm_header->msgh_bits |=
2076 kmsg->ikm_header->msgh_bits |= MACH_MSGH_BITS_CIRCULAR;
2507 ipc_kmsg_t kmsg,
2521 body = (mach_msg_body_t *) (kmsg->ikm_header + 1);
2558 mach_msg_base_t *old_base = (mach_msg_base_t *)kmsg->ikm_header;
2563 kmsg->ikm_header = &new_base->header;
2564 kmsg->ikm_header->msgh_size += dsc_adjust;
2765 ipc_kmsg_clean_body(kmsg, 1, daddr);
2858 ipc_kmsg_t kmsg,
2863 send_size = kmsg->ikm_header->msgh_size;
2865 if ((kmsg->ikm_header->msgh_bits & MACH_MSGH_BITS_COMPLEX) &&
2871 body = (mach_msg_body_t *) (kmsg->ikm_header + 1);
2912 ipc_kmsg_t kmsg,
2920 mr = ipc_kmsg_copyout_header(kmsg->ikm_header, space, notify);
2926 if (kmsg->ikm_header->msgh_bits & MACH_MSGH_BITS_COMPLEX) {
2927 mr = ipc_kmsg_copyout_body(kmsg, space, map, slist);
2958 ipc_kmsg_t kmsg,
2963 mach_msg_bits_t mbits = kmsg->ikm_header->msgh_bits;
2964 ipc_object_t dest = (ipc_object_t) kmsg->ikm_header->msgh_remote_port;
2965 ipc_object_t reply = (ipc_object_t) kmsg->ikm_header->msgh_local_port;
2976 kmsg->ikm_header->msgh_bits = mbits &~ MACH_MSGH_BITS_CIRCULAR;
2977 kmsg->ikm_header->msgh_remote_port = (ipc_port_t)dest_name;
2978 kmsg->ikm_header->msgh_local_port = (ipc_port_t)reply_name;
2981 mr |= ipc_kmsg_copyout_body(kmsg, space, map, slist);
2998 ipc_kmsg_t kmsg,
3008 mbits = kmsg->ikm_header->msgh_bits;
3009 dest = (ipc_object_t) kmsg->ikm_header->msgh_remote_port;
3010 reply = (ipc_object_t) kmsg->ikm_header->msgh_local_port;
3032 kmsg->ikm_header->msgh_bits = (MACH_MSGH_BITS_OTHER(mbits) |
3034 kmsg->ikm_header->msgh_local_port = (ipc_port_t)dest_name;
3035 kmsg->ikm_header->msgh_remote_port = (ipc_port_t)reply_name;
3040 body = (mach_msg_body_t *) (kmsg->ikm_header + 1);
3041 ipc_kmsg_clean_body(kmsg, body->msgh_descriptor_count,
3051 * The gather (kmsg) is valid since it has been copied in.
3074 ipc_kmsg_t kmsg)
3101 body = (mach_msg_body_t *) (kmsg->ikm_header + 1);
3211 ipc_kmsg_t kmsg,
3220 dest = (ipc_object_t) kmsg->ikm_header->msgh_remote_port;
3221 reply = (ipc_object_t) kmsg->ikm_header->msgh_local_port;
3222 dest_type = MACH_MSGH_BITS_REMOTE(kmsg->ikm_header->msgh_bits);
3223 reply_type = MACH_MSGH_BITS_LOCAL(kmsg->ikm_header->msgh_bits);
3239 kmsg->ikm_header->msgh_bits =
3240 (MACH_MSGH_BITS_OTHER(kmsg->ikm_header->msgh_bits) |
3242 kmsg->ikm_header->msgh_local_port = (ipc_port_t)dest_name;
3243 kmsg->ikm_header->msgh_remote_port = (ipc_port_t)reply_name;
3336 ipc_kmsg_t kmsg)
3338 iprintf("kmsg=0x%x\n", kmsg);
3340 kmsg->ikm_next,
3341 kmsg->ikm_prev,
3342 kmsg->ikm_size);
3344 ipc_msg_print(kmsg->ikm_header);