/* call a request handler */ static void call_req_handler( struct thread *thread ) { union generic_reply reply; enum request req = thread->req.request_header.req; current = thread; current->reply_size = 0; clear_error(); memset( &reply, 0, sizeof(reply) ); if (debug_level) trace_request(); if (req < REQ_NB_REQUESTS) req_handlers[req]( ¤t->req, &reply ); else set_error( STATUS_NOT_IMPLEMENTED ); if (current) { if (current->reply_fd) { reply.reply_header.error = current->error; reply.reply_header.reply_size = current->reply_size; if (debug_level) trace_reply( req, &reply ); send_reply( &reply ); } else { current->exit_code = 1; kill_thread( current, 1 ); /* no way to continue without reply fd */ } } current = NULL; }
void execute_child_process(const char *name) { trace_request(); if (execl(name, name, 0) == -1) { printf("Failed to replace process\n"); return; } }