- if (funnel_type == -1) {
- funnel_t *f = thread_funnel_get();
- if(f == THR_FUNNEL_NULL)
- funnel_type = NO_FUNNEL;
- else if (f == (funnel_t *)network_flock)
- funnel_type = NETWORK_FUNNEL;
- else if (f == (funnel_t *)kernel_flock)
- funnel_type = KERNEL_FUNNEL;
- }
-
- switch (funnel_type) {
- case KERNEL_FUNNEL:
- /* Nothing more to do */
- break;
- case NETWORK_FUNNEL:
- thread_funnel_switch(NETWORK_FUNNEL, KERNEL_FUNNEL);
- break;
- case NO_FUNNEL:
- (void) thread_funnel_set(kernel_flock, TRUE);
- break;
- default:
- panic("Invalid funnel (%)", funnel_type);
- }
- auio.uio_iov = &aiov[0];
- auio.uio_offset = 0;
- auio.uio_segflg = UIO_SYSSPACE;
- auio.uio_rw = UIO_WRITE;
- aiov[0].iov_base = (caddr_t)kth;
- aiov[0].iov_len = sizeof(struct ktr_header);
- auio.uio_resid = sizeof(struct ktr_header);
- auio.uio_iovcnt = 1;
- auio.uio_procp = current_proc();
+ auio = uio_createwithbuffer(2, 0, UIO_SYSSPACE, UIO_WRITE,
+ &uio_buf[0], sizeof(uio_buf));
+ uio_addiov(auio, CAST_USER_ADDR_T(kth), sizeof(struct ktr_header));
+ context.vc_proc = p;
+ context.vc_ucred = kauth_cred_get();
+