server: Convert thread creation/exit times to the abs_time_t type.

oldstable
Alexandre Julliard 2006-07-26 14:49:55 +02:00
parent 3ca608b1b3
commit 3095a48d6f
7 changed files with 23 additions and 16 deletions

View File

@ -1077,8 +1077,8 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
status = wine_server_call( req ); status = wine_server_call( req );
if (status == STATUS_SUCCESS) if (status == STATUS_SUCCESS)
{ {
RtlSecondsSince1970ToTime( reply->creation_time, &kusrt.CreateTime ); NTDLL_from_server_abstime( &kusrt.CreateTime, &reply->creation_time );
RtlSecondsSince1970ToTime( reply->exit_time, &kusrt.ExitTime ); NTDLL_from_server_abstime( &kusrt.ExitTime, &reply->exit_time );
} }
} }
SERVER_END_REQ; SERVER_END_REQ;

View File

@ -386,8 +386,8 @@ struct get_thread_info_reply
int exit_code; int exit_code;
int priority; int priority;
int affinity; int affinity;
time_t creation_time; abs_time_t creation_time;
time_t exit_time; abs_time_t exit_time;
}; };
@ -4385,6 +4385,6 @@ union generic_reply
struct query_symlink_reply query_symlink_reply; struct query_symlink_reply query_symlink_reply;
}; };
#define SERVER_PROTOCOL_VERSION 241 #define SERVER_PROTOCOL_VERSION 242
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */ #endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -256,6 +256,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
list_init( &process->dlls ); list_init( &process->dlls );
gettimeofday( &process->start_time, NULL ); gettimeofday( &process->start_time, NULL );
process->end_time.tv_sec = process->end_time.tv_usec = 0;
list_add_head( &process_list, &process->entry ); list_add_head( &process_list, &process->entry );
if (!(process->id = process->group_id = alloc_ptid( process ))) if (!(process->id = process->group_id = alloc_ptid( process )))

View File

@ -345,8 +345,8 @@ struct token_groups
int exit_code; /* thread exit code */ int exit_code; /* thread exit code */
int priority; /* thread priority level */ int priority; /* thread priority level */
int affinity; /* thread affinity mask */ int affinity; /* thread affinity mask */
time_t creation_time; /* thread creation time */ abs_time_t creation_time; /* thread creation time */
time_t exit_time; /* thread exit time */ abs_time_t exit_time; /* thread exit time */
@END @END

View File

@ -144,11 +144,12 @@ inline static void init_thread_structure( struct thread *thread )
thread->priority = THREAD_PRIORITY_NORMAL; thread->priority = THREAD_PRIORITY_NORMAL;
thread->affinity = 1; thread->affinity = 1;
thread->suspend = 0; thread->suspend = 0;
thread->creation_time = time(NULL);
thread->exit_time = 0;
thread->desktop_users = 0; thread->desktop_users = 0;
thread->token = NULL; thread->token = NULL;
gettimeofday( &thread->creation_time, NULL );
thread->exit_time.tv_sec = thread->exit_time.tv_usec = 0;
list_init( &thread->mutex_list ); list_init( &thread->mutex_list );
list_init( &thread->system_apc ); list_init( &thread->system_apc );
list_init( &thread->user_apc ); list_init( &thread->user_apc );
@ -737,7 +738,7 @@ void kill_thread( struct thread *thread, int violent_death )
{ {
if (thread->state == TERMINATED) return; /* already killed */ if (thread->state == TERMINATED) return; /* already killed */
thread->state = TERMINATED; thread->state = TERMINATED;
thread->exit_time = time(NULL); gettimeofday( &thread->exit_time, NULL );
if (current == thread) current = NULL; if (current == thread) current = NULL;
if (debug_level) if (debug_level)
fprintf( stderr,"%04x: *killed* exit_code=%d\n", fprintf( stderr,"%04x: *killed* exit_code=%d\n",
@ -946,8 +947,10 @@ DECL_HANDLER(get_thread_info)
reply->exit_code = (thread->state == TERMINATED) ? thread->exit_code : STILL_ACTIVE; reply->exit_code = (thread->state == TERMINATED) ? thread->exit_code : STILL_ACTIVE;
reply->priority = thread->priority; reply->priority = thread->priority;
reply->affinity = thread->affinity; reply->affinity = thread->affinity;
reply->creation_time = thread->creation_time; reply->creation_time.sec = thread->creation_time.tv_sec;
reply->exit_time = thread->exit_time; reply->creation_time.usec = thread->creation_time.tv_usec;
reply->exit_time.sec = thread->exit_time.tv_sec;
reply->exit_time.usec = thread->exit_time.tv_usec;
release_object( thread ); release_object( thread );
} }

View File

@ -84,8 +84,8 @@ struct thread
int suspend; /* suspend count */ int suspend; /* suspend count */
obj_handle_t desktop; /* desktop handle */ obj_handle_t desktop; /* desktop handle */
int desktop_users; /* number of objects using the thread desktop */ int desktop_users; /* number of objects using the thread desktop */
time_t creation_time; /* Thread creation time */ struct timeval creation_time; /* Thread creation time */
time_t exit_time; /* Thread exit time */ struct timeval exit_time; /* Thread exit time */
struct token *token; /* security token associated with this thread */ struct token *token; /* security token associated with this thread */
}; };

View File

@ -766,8 +766,11 @@ static void dump_get_thread_info_reply( const struct get_thread_info_reply *req
fprintf( stderr, " exit_code=%d,", req->exit_code ); fprintf( stderr, " exit_code=%d,", req->exit_code );
fprintf( stderr, " priority=%d,", req->priority ); fprintf( stderr, " priority=%d,", req->priority );
fprintf( stderr, " affinity=%d,", req->affinity ); fprintf( stderr, " affinity=%d,", req->affinity );
fprintf( stderr, " creation_time=%ld,", (long)req->creation_time ); fprintf( stderr, " creation_time=" );
fprintf( stderr, " exit_time=%ld", (long)req->exit_time ); dump_abs_time( &req->creation_time );
fprintf( stderr, "," );
fprintf( stderr, " exit_time=" );
dump_abs_time( &req->exit_time );
} }
static void dump_set_thread_info_request( const struct set_thread_info_request *req ) static void dump_set_thread_info_request( const struct set_thread_info_request *req )