DWORD WINAPI hook_thread_proc(LPVOID arg) { #else void *hook_thread_proc(void *arg) { #endif // Set the hook status. int status = hook_run(); if (status != UIOHOOK_SUCCESS) { #ifdef _WIN32 *(DWORD *) arg = status; #else *(int *) arg = status; #endif } // Make sure we signal that we have passed any exception throwing code for // the waiting hook_enable(). #ifdef _WIN32 SetEvent(hook_control_cond); return status; #else // Make sure we signal that we have passed any exception throwing code for // the waiting hook_enable(). pthread_cond_signal(&hook_control_cond); pthread_mutex_unlock(&hook_control_mutex); return arg; #endif }
/* * taskq function for nic events. */ void ip_ne_queue_func(void *arg) { hook_event_token_t hr; hook_nic_event_int_t *info = (hook_nic_event_int_t *)arg; ip_stack_t *ipst; netstack_t *ns; ns = netstack_find_by_stackid(info->hnei_stackid); if (ns == NULL) goto done; ipst = ns->netstack_ip; if (ipst == NULL) goto done; hr = (info->hnei_event.hne_protocol == ipst->ips_ipv6_net_data) ? ipst->ips_ipv6nicevents : ipst->ips_ipv4nicevents; (void) hook_run(info->hnei_event.hne_protocol->netd_hooks, hr, (hook_data_t)&info->hnei_event); done: if (ns != NULL) netstack_rele(ns); kmem_free(info->hnei_event.hne_data, info->hnei_event.hne_datalen); kmem_free(arg, sizeof (hook_nic_event_int_t)); }