Alexandre Julliard : server: Convert thread creation/
exit times to the abs_time_t type.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Jul 26 09:00:46 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 3095a48d6f2010d224affb276c4749afe3014b05
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=3095a48d6f2010d224affb276c4749afe3014b05
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Jul 26 14:49:55 2006 +0200
server: Convert thread creation/exit times to the abs_time_t type.
---
dlls/ntdll/thread.c | 4 ++--
include/wine/server_protocol.h | 6 +++---
server/process.c | 1 +
server/protocol.def | 4 ++--
server/thread.c | 13 ++++++++-----
server/thread.h | 4 ++--
server/trace.c | 7 +++++--
7 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 91dbcd8..dbcc5a6 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -1077,8 +1077,8 @@ NTSTATUS WINAPI NtQueryInformationThread
status = wine_server_call( req );
if (status == STATUS_SUCCESS)
{
- RtlSecondsSince1970ToTime( reply->creation_time, &kusrt.CreateTime );
- RtlSecondsSince1970ToTime( reply->exit_time, &kusrt.ExitTime );
+ NTDLL_from_server_abstime( &kusrt.CreateTime, &reply->creation_time );
+ NTDLL_from_server_abstime( &kusrt.ExitTime, &reply->exit_time );
}
}
SERVER_END_REQ;
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index a51572c..1c128e2 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -386,8 +386,8 @@ struct get_thread_info_reply
int exit_code;
int priority;
int affinity;
- time_t creation_time;
- time_t exit_time;
+ abs_time_t creation_time;
+ abs_time_t exit_time;
};
@@ -4385,6 +4385,6 @@ union generic_reply
struct query_symlink_reply query_symlink_reply;
};
-#define SERVER_PROTOCOL_VERSION 241
+#define SERVER_PROTOCOL_VERSION 242
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/process.c b/server/process.c
index 853700f..3e5ef97 100644
--- a/server/process.c
+++ b/server/process.c
@@ -256,6 +256,7 @@ struct thread *create_process( int fd, s
list_init( &process->dlls );
gettimeofday( &process->start_time, NULL );
+ process->end_time.tv_sec = process->end_time.tv_usec = 0;
list_add_head( &process_list, &process->entry );
if (!(process->id = process->group_id = alloc_ptid( process )))
diff --git a/server/protocol.def b/server/protocol.def
index 7fd045a..6910ed4 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -345,8 +345,8 @@ #define SET_PROCESS_INFO_AFFINITY 0x02
int exit_code; /* thread exit code */
int priority; /* thread priority level */
int affinity; /* thread affinity mask */
- time_t creation_time; /* thread creation time */
- time_t exit_time; /* thread exit time */
+ abs_time_t creation_time; /* thread creation time */
+ abs_time_t exit_time; /* thread exit time */
@END
diff --git a/server/thread.c b/server/thread.c
index 36b7309..23508d3 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -144,11 +144,12 @@ inline static void init_thread_structure
thread->priority = THREAD_PRIORITY_NORMAL;
thread->affinity = 1;
thread->suspend = 0;
- thread->creation_time = time(NULL);
- thread->exit_time = 0;
thread->desktop_users = 0;
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->system_apc );
list_init( &thread->user_apc );
@@ -737,7 +738,7 @@ void kill_thread( struct thread *thread,
{
if (thread->state == TERMINATED) return; /* already killed */
thread->state = TERMINATED;
- thread->exit_time = time(NULL);
+ gettimeofday( &thread->exit_time, NULL );
if (current == thread) current = NULL;
if (debug_level)
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->priority = thread->priority;
reply->affinity = thread->affinity;
- reply->creation_time = thread->creation_time;
- reply->exit_time = thread->exit_time;
+ reply->creation_time.sec = thread->creation_time.tv_sec;
+ 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 );
}
diff --git a/server/thread.h b/server/thread.h
index fdc69d4..61911cd 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -84,8 +84,8 @@ struct thread
int suspend; /* suspend count */
obj_handle_t desktop; /* desktop handle */
int desktop_users; /* number of objects using the thread desktop */
- time_t creation_time; /* Thread creation time */
- time_t exit_time; /* Thread exit time */
+ struct timeval creation_time; /* Thread creation time */
+ struct timeval exit_time; /* Thread exit time */
struct token *token; /* security token associated with this thread */
};
diff --git a/server/trace.c b/server/trace.c
index 0fe3a67..ee3db8b 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -766,8 +766,11 @@ static void dump_get_thread_info_reply(
fprintf( stderr, " exit_code=%d,", req->exit_code );
fprintf( stderr, " priority=%d,", req->priority );
fprintf( stderr, " affinity=%d,", req->affinity );
- fprintf( stderr, " creation_time=%ld,", (long)req->creation_time );
- fprintf( stderr, " exit_time=%ld", (long)req->exit_time );
+ fprintf( stderr, " creation_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 )
More information about the wine-cvs
mailing list