Commit f194d453 authored by Zebediah Figura's avatar Zebediah Figura Committed by Vitaly Lipatov

server: Create eventfd file descriptors for thread objects.

parent b39a2cde
......@@ -180,6 +180,7 @@ struct type_descr thread_type =
static void dump_thread( struct object *obj, int verbose );
static int thread_signaled( struct object *obj, struct wait_queue_entry *entry );
static int thread_get_esync_fd( struct object *obj, enum esync_type *type );
static unsigned int thread_map_access( struct object *obj, unsigned int access );
static void thread_poll_event( struct fd *fd, int event );
static struct list *thread_get_kernel_obj_list( struct object *obj );
......@@ -193,7 +194,7 @@ static const struct object_ops thread_ops =
add_queue, /* add_queue */
remove_queue, /* remove_queue */
thread_signaled, /* signaled */
NULL, /* get_esync_fd */
thread_get_esync_fd, /* get_esync_fd */
no_satisfied, /* satisfied */
no_signal, /* signal */
no_get_fd, /* get_fd */
......@@ -233,6 +234,7 @@ static inline void init_thread_structure( struct thread *thread )
thread->context = NULL;
thread->teb = 0;
thread->entry_point = 0;
thread->esync_fd = -1;
thread->system_regs = 0;
thread->queue = NULL;
thread->wait = NULL;
......@@ -381,6 +383,9 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
}
}
if (do_esync())
thread->esync_fd = esync_create_fd( 0, 0 );
set_fd_events( thread->request_fd, POLLIN ); /* start listening to events */
add_process_thread( thread->process, thread );
return thread;
......@@ -460,6 +465,9 @@ static void destroy_thread( struct object *obj )
if (thread->exit_poll) remove_timeout_user( thread->exit_poll );
if (thread->id) free_ptid( thread->id );
if (thread->token) release_object( thread->token );
if (do_esync())
close( thread->esync_fd );
}
/* dump a thread on stdout for debugging purposes */
......@@ -478,6 +486,13 @@ static int thread_signaled( struct object *obj, struct wait_queue_entry *entry )
return mythread->state == TERMINATED && !mythread->exit_poll;
}
static int thread_get_esync_fd( struct object *obj, enum esync_type *type )
{
struct thread *thread = (struct thread *)obj;
*type = ESYNC_MANUAL_SERVER;
return thread->esync_fd;
}
static unsigned int thread_map_access( struct object *obj, unsigned int access )
{
access = default_map_access( obj, access );
......
......@@ -54,6 +54,7 @@ struct thread
struct process *process;
thread_id_t id; /* thread id */
struct list mutex_list; /* list of currently owned mutexes */
int esync_fd; /* esync file descriptor (signalled on exit) */
unsigned int system_regs; /* which system regs have been set */
struct msg_queue *queue; /* message queue */
struct thread_wait *wait; /* current wait condition if sleeping */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment