Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
cc933f58
Commit
cc933f58
authored
Feb 20, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Moved exit_thread and abort_thread functions to thread.c.
parent
36334a1b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
71 additions
and
74 deletions
+71
-74
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+1
-2
server.c
dlls/ntdll/server.c
+6
-59
signal_i386.c
dlls/ntdll/signal_i386.c
+4
-4
signal_powerpc.c
dlls/ntdll/signal_powerpc.c
+1
-1
signal_sparc.c
dlls/ntdll/signal_sparc.c
+1
-1
signal_x86_64.c
dlls/ntdll/signal_x86_64.c
+1
-1
sync.c
dlls/ntdll/sync.c
+1
-1
thread.c
dlls/ntdll/thread.c
+56
-5
No files found.
dlls/ntdll/ntdll_misc.h
View file @
cc933f58
...
@@ -73,8 +73,7 @@ extern NTSTATUS server_init_process_done(void);
...
@@ -73,8 +73,7 @@ extern NTSTATUS server_init_process_done(void);
extern
size_t
server_init_thread
(
void
*
entry_point
);
extern
size_t
server_init_thread
(
void
*
entry_point
);
extern
void
DECLSPEC_NORETURN
server_protocol_error
(
const
char
*
err
,
...
);
extern
void
DECLSPEC_NORETURN
server_protocol_error
(
const
char
*
err
,
...
);
extern
void
DECLSPEC_NORETURN
server_protocol_perror
(
const
char
*
err
);
extern
void
DECLSPEC_NORETURN
server_protocol_perror
(
const
char
*
err
);
extern
void
DECLSPEC_NORETURN
server_exit_thread
(
int
status
);
extern
void
DECLSPEC_NORETURN
abort_thread
(
int
status
);
extern
void
DECLSPEC_NORETURN
server_abort_thread
(
int
status
);
extern
sigset_t
server_block_set
;
extern
sigset_t
server_block_set
;
extern
void
server_enter_uninterrupted_section
(
RTL_CRITICAL_SECTION
*
cs
,
sigset_t
*
sigset
);
extern
void
server_enter_uninterrupted_section
(
RTL_CRITICAL_SECTION
*
cs
,
sigset_t
*
sigset
);
extern
void
server_leave_uninterrupted_section
(
RTL_CRITICAL_SECTION
*
cs
,
sigset_t
*
sigset
);
extern
void
server_leave_uninterrupted_section
(
RTL_CRITICAL_SECTION
*
cs
,
sigset_t
*
sigset
);
...
...
dlls/ntdll/server.c
View file @
cc933f58
...
@@ -62,7 +62,6 @@
...
@@ -62,7 +62,6 @@
#include "ntstatus.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define WIN32_NO_STATUS
#include "wine/library.h"
#include "wine/library.h"
#include "wine/pthread.h"
#include "wine/server.h"
#include "wine/server.h"
#include "wine/debug.h"
#include "wine/debug.h"
#include "ntdll_misc.h"
#include "ntdll_misc.h"
...
@@ -93,8 +92,6 @@ struct cmsg_fd
...
@@ -93,8 +92,6 @@ struct cmsg_fd
timeout_t
server_start_time
=
0
;
/* time of server startup */
timeout_t
server_start_time
=
0
;
/* time of server startup */
extern
struct
wine_pthread_functions
pthread_functions
;
sigset_t
server_block_set
;
/* signals to block during server calls */
sigset_t
server_block_set
;
/* signals to block during server calls */
static
int
fd_socket
=
-
1
;
/* socket to exchange file descriptors with the server */
static
int
fd_socket
=
-
1
;
/* socket to exchange file descriptors with the server */
...
@@ -141,56 +138,6 @@ static void fatal_perror( const char *err, ... )
...
@@ -141,56 +138,6 @@ static void fatal_perror( const char *err, ... )
/***********************************************************************
/***********************************************************************
* server_exit_thread
*/
void
server_exit_thread
(
int
status
)
{
struct
wine_pthread_thread_info
info
;
int
fds
[
4
];
RtlAcquirePebLock
();
RemoveEntryList
(
&
NtCurrentTeb
()
->
TlsLinks
);
RtlReleasePebLock
();
RtlFreeHeap
(
GetProcessHeap
(),
0
,
NtCurrentTeb
()
->
FlsSlots
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
NtCurrentTeb
()
->
TlsExpansionSlots
);
info
.
stack_base
=
NtCurrentTeb
()
->
DeallocationStack
;
info
.
teb_base
=
NtCurrentTeb
();
info
.
teb_sel
=
wine_get_fs
();
info
.
exit_status
=
status
;
fds
[
0
]
=
ntdll_get_thread_data
()
->
wait_fd
[
0
];
fds
[
1
]
=
ntdll_get_thread_data
()
->
wait_fd
[
1
];
fds
[
2
]
=
ntdll_get_thread_data
()
->
reply_fd
;
fds
[
3
]
=
ntdll_get_thread_data
()
->
request_fd
;
pthread_sigmask
(
SIG_BLOCK
,
&
server_block_set
,
NULL
);
info
.
stack_size
=
virtual_free_system_view
(
&
info
.
stack_base
);
info
.
teb_size
=
virtual_free_system_view
(
&
info
.
teb_base
);
close
(
fds
[
0
]
);
close
(
fds
[
1
]
);
close
(
fds
[
2
]
);
close
(
fds
[
3
]
);
pthread_functions
.
exit_thread
(
&
info
);
}
/***********************************************************************
* server_abort_thread
*/
void
server_abort_thread
(
int
status
)
{
pthread_sigmask
(
SIG_BLOCK
,
&
server_block_set
,
NULL
);
close
(
ntdll_get_thread_data
()
->
wait_fd
[
0
]
);
close
(
ntdll_get_thread_data
()
->
wait_fd
[
1
]
);
close
(
ntdll_get_thread_data
()
->
reply_fd
);
close
(
ntdll_get_thread_data
()
->
request_fd
);
pthread_functions
.
abort_thread
(
status
);
}
/***********************************************************************
* server_protocol_error
* server_protocol_error
*/
*/
void
server_protocol_error
(
const
char
*
err
,
...
)
void
server_protocol_error
(
const
char
*
err
,
...
)
...
@@ -201,7 +148,7 @@ void server_protocol_error( const char *err, ... )
...
@@ -201,7 +148,7 @@ void server_protocol_error( const char *err, ... )
fprintf
(
stderr
,
"wine client error:%x: "
,
GetCurrentThreadId
()
);
fprintf
(
stderr
,
"wine client error:%x: "
,
GetCurrentThreadId
()
);
vfprintf
(
stderr
,
err
,
args
);
vfprintf
(
stderr
,
err
,
args
);
va_end
(
args
);
va_end
(
args
);
server_
abort_thread
(
1
);
abort_thread
(
1
);
}
}
...
@@ -212,7 +159,7 @@ void server_protocol_perror( const char *err )
...
@@ -212,7 +159,7 @@ void server_protocol_perror( const char *err )
{
{
fprintf
(
stderr
,
"wine client error:%x: "
,
GetCurrentThreadId
()
);
fprintf
(
stderr
,
"wine client error:%x: "
,
GetCurrentThreadId
()
);
perror
(
err
);
perror
(
err
);
server_
abort_thread
(
1
);
abort_thread
(
1
);
}
}
...
@@ -248,7 +195,7 @@ static unsigned int send_request( const struct __server_request_info *req )
...
@@ -248,7 +195,7 @@ static unsigned int send_request( const struct __server_request_info *req )
}
}
if
(
ret
>=
0
)
server_protocol_error
(
"partial write %d
\n
"
,
ret
);
if
(
ret
>=
0
)
server_protocol_error
(
"partial write %d
\n
"
,
ret
);
if
(
errno
==
EPIPE
)
server_
abort_thread
(
0
);
if
(
errno
==
EPIPE
)
abort_thread
(
0
);
if
(
errno
==
EFAULT
)
return
STATUS_ACCESS_VIOLATION
;
if
(
errno
==
EFAULT
)
return
STATUS_ACCESS_VIOLATION
;
server_protocol_perror
(
"write"
);
server_protocol_perror
(
"write"
);
}
}
...
@@ -277,7 +224,7 @@ static void read_reply_data( void *buffer, size_t size )
...
@@ -277,7 +224,7 @@ static void read_reply_data( void *buffer, size_t size )
server_protocol_perror
(
"read"
);
server_protocol_perror
(
"read"
);
}
}
/* the server closed the connection; time to die... */
/* the server closed the connection; time to die... */
server_
abort_thread
(
0
);
abort_thread
(
0
);
}
}
...
@@ -401,7 +348,7 @@ void CDECL wine_server_send_fd( int fd )
...
@@ -401,7 +348,7 @@ void CDECL wine_server_send_fd( int fd )
if
((
ret
=
sendmsg
(
fd_socket
,
&
msghdr
,
0
))
==
sizeof
(
data
))
return
;
if
((
ret
=
sendmsg
(
fd_socket
,
&
msghdr
,
0
))
==
sizeof
(
data
))
return
;
if
(
ret
>=
0
)
server_protocol_error
(
"partial write %d
\n
"
,
ret
);
if
(
ret
>=
0
)
server_protocol_error
(
"partial write %d
\n
"
,
ret
);
if
(
errno
==
EINTR
)
continue
;
if
(
errno
==
EINTR
)
continue
;
if
(
errno
==
EPIPE
)
server_
abort_thread
(
0
);
if
(
errno
==
EPIPE
)
abort_thread
(
0
);
server_protocol_perror
(
"sendmsg"
);
server_protocol_perror
(
"sendmsg"
);
}
}
}
}
...
@@ -459,7 +406,7 @@ static int receive_fd( obj_handle_t *handle )
...
@@ -459,7 +406,7 @@ static int receive_fd( obj_handle_t *handle )
server_protocol_perror
(
"recvmsg"
);
server_protocol_perror
(
"recvmsg"
);
}
}
/* the server closed the connection; time to die... */
/* the server closed the connection; time to die... */
server_
abort_thread
(
0
);
abort_thread
(
0
);
}
}
...
...
dlls/ntdll/signal_i386.c
View file @
cc933f58
...
@@ -1109,7 +1109,7 @@ static EXCEPTION_RECORD *setup_exception_record( SIGCONTEXT *sigcontext, void *s
...
@@ -1109,7 +1109,7 @@ static EXCEPTION_RECORD *setup_exception_record( SIGCONTEXT *sigcontext, void *s
GetCurrentThreadId
(),
(
unsigned
int
)
EIP_sig
(
sigcontext
),
GetCurrentThreadId
(),
(
unsigned
int
)
EIP_sig
(
sigcontext
),
(
unsigned
int
)
ESP_sig
(
sigcontext
),
NtCurrentTeb
()
->
Tib
.
StackLimit
,
(
unsigned
int
)
ESP_sig
(
sigcontext
),
NtCurrentTeb
()
->
Tib
.
StackLimit
,
NtCurrentTeb
()
->
Tib
.
StackBase
);
NtCurrentTeb
()
->
Tib
.
StackBase
);
server_
abort_thread
(
1
);
abort_thread
(
1
);
}
}
if
(
stack
-
1
>
stack
||
/* check for overflow in subtraction */
if
(
stack
-
1
>
stack
||
/* check for overflow in subtraction */
...
@@ -1129,7 +1129,7 @@ static EXCEPTION_RECORD *setup_exception_record( SIGCONTEXT *sigcontext, void *s
...
@@ -1129,7 +1129,7 @@ static EXCEPTION_RECORD *setup_exception_record( SIGCONTEXT *sigcontext, void *s
diff
,
GetCurrentThreadId
(),
(
unsigned
int
)
EIP_sig
(
sigcontext
),
diff
,
GetCurrentThreadId
(),
(
unsigned
int
)
EIP_sig
(
sigcontext
),
(
unsigned
int
)
ESP_sig
(
sigcontext
),
NtCurrentTeb
()
->
DeallocationStack
,
(
unsigned
int
)
ESP_sig
(
sigcontext
),
NtCurrentTeb
()
->
DeallocationStack
,
NtCurrentTeb
()
->
Tib
.
StackLimit
,
NtCurrentTeb
()
->
Tib
.
StackBase
);
NtCurrentTeb
()
->
Tib
.
StackLimit
,
NtCurrentTeb
()
->
Tib
.
StackBase
);
server_
abort_thread
(
1
);
abort_thread
(
1
);
}
}
else
if
((
char
*
)(
stack
-
1
)
<
(
char
*
)
NtCurrentTeb
()
->
Tib
.
StackLimit
)
else
if
((
char
*
)(
stack
-
1
)
<
(
char
*
)
NtCurrentTeb
()
->
Tib
.
StackLimit
)
{
{
...
@@ -1142,7 +1142,7 @@ static EXCEPTION_RECORD *setup_exception_record( SIGCONTEXT *sigcontext, void *s
...
@@ -1142,7 +1142,7 @@ static EXCEPTION_RECORD *setup_exception_record( SIGCONTEXT *sigcontext, void *s
diff
,
GetCurrentThreadId
(),
(
unsigned
int
)
EIP_sig
(
sigcontext
),
diff
,
GetCurrentThreadId
(),
(
unsigned
int
)
EIP_sig
(
sigcontext
),
(
unsigned
int
)
ESP_sig
(
sigcontext
),
NtCurrentTeb
()
->
DeallocationStack
,
(
unsigned
int
)
ESP_sig
(
sigcontext
),
NtCurrentTeb
()
->
DeallocationStack
,
NtCurrentTeb
()
->
Tib
.
StackLimit
,
NtCurrentTeb
()
->
Tib
.
StackBase
);
NtCurrentTeb
()
->
Tib
.
StackLimit
,
NtCurrentTeb
()
->
Tib
.
StackBase
);
server_
abort_thread
(
1
);
abort_thread
(
1
);
}
}
}
}
...
@@ -1550,7 +1550,7 @@ static void quit_handler( int signal, siginfo_t *siginfo, void *sigcontext )
...
@@ -1550,7 +1550,7 @@ static void quit_handler( int signal, siginfo_t *siginfo, void *sigcontext )
{
{
WORD
fs
,
gs
;
WORD
fs
,
gs
;
init_handler
(
sigcontext
,
&
fs
,
&
gs
);
init_handler
(
sigcontext
,
&
fs
,
&
gs
);
server_
abort_thread
(
0
);
abort_thread
(
0
);
}
}
...
...
dlls/ntdll/signal_powerpc.c
View file @
cc933f58
...
@@ -584,7 +584,7 @@ static HANDLER_DEF(abrt_handler)
...
@@ -584,7 +584,7 @@ static HANDLER_DEF(abrt_handler)
*/
*/
static
HANDLER_DEF
(
quit_handler
)
static
HANDLER_DEF
(
quit_handler
)
{
{
server_
abort_thread
(
0
);
abort_thread
(
0
);
}
}
...
...
dlls/ntdll/signal_sparc.c
View file @
cc933f58
...
@@ -397,7 +397,7 @@ static HANDLER_DEF(abrt_handler)
...
@@ -397,7 +397,7 @@ static HANDLER_DEF(abrt_handler)
*/
*/
static
HANDLER_DEF
(
quit_handler
)
static
HANDLER_DEF
(
quit_handler
)
{
{
server_
abort_thread
(
0
);
abort_thread
(
0
);
}
}
...
...
dlls/ntdll/signal_x86_64.c
View file @
cc933f58
...
@@ -472,7 +472,7 @@ static HANDLER_DEF(abrt_handler)
...
@@ -472,7 +472,7 @@ static HANDLER_DEF(abrt_handler)
*/
*/
static
HANDLER_DEF
(
quit_handler
)
static
HANDLER_DEF
(
quit_handler
)
{
{
server_
abort_thread
(
0
);
abort_thread
(
0
);
}
}
...
...
dlls/ntdll/sync.c
View file @
cc933f58
...
@@ -831,7 +831,7 @@ static int wait_reply( void *cookie )
...
@@ -831,7 +831,7 @@ static int wait_reply( void *cookie )
server_protocol_perror
(
"wakeup read"
);
server_protocol_perror
(
"wakeup read"
);
}
}
/* the server closed the connection; time to die... */
/* the server closed the connection; time to die... */
server_
abort_thread
(
0
);
abort_thread
(
0
);
}
}
...
...
dlls/ntdll/thread.c
View file @
cc933f58
...
@@ -68,7 +68,7 @@ static LIST_ENTRY tls_links;
...
@@ -68,7 +68,7 @@ static LIST_ENTRY tls_links;
static
size_t
sigstack_total_size
;
static
size_t
sigstack_total_size
;
static
ULONG
sigstack_zero_bits
;
static
ULONG
sigstack_zero_bits
;
st
ruct
wine_pthread_functions
pthread_functions
=
{
NULL
}
;
st
atic
struct
wine_pthread_functions
pthread_functions
;
static
RTL_CRITICAL_SECTION
ldt_section
;
static
RTL_CRITICAL_SECTION
ldt_section
;
...
@@ -346,6 +346,57 @@ HANDLE thread_init(void)
...
@@ -346,6 +346,57 @@ HANDLE thread_init(void)
return
exe_file
;
return
exe_file
;
}
}
/***********************************************************************
* abort_thread
*/
void
abort_thread
(
int
status
)
{
pthread_sigmask
(
SIG_BLOCK
,
&
server_block_set
,
NULL
);
close
(
ntdll_get_thread_data
()
->
wait_fd
[
0
]
);
close
(
ntdll_get_thread_data
()
->
wait_fd
[
1
]
);
close
(
ntdll_get_thread_data
()
->
reply_fd
);
close
(
ntdll_get_thread_data
()
->
request_fd
);
pthread_functions
.
abort_thread
(
status
);
}
/***********************************************************************
* exit_thread
*/
static
void
DECLSPEC_NORETURN
exit_thread
(
int
status
)
{
struct
wine_pthread_thread_info
info
;
int
fds
[
4
];
RtlAcquirePebLock
();
RemoveEntryList
(
&
NtCurrentTeb
()
->
TlsLinks
);
RtlReleasePebLock
();
RtlFreeHeap
(
GetProcessHeap
(),
0
,
NtCurrentTeb
()
->
FlsSlots
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
NtCurrentTeb
()
->
TlsExpansionSlots
);
info
.
stack_base
=
NtCurrentTeb
()
->
DeallocationStack
;
info
.
teb_base
=
NtCurrentTeb
();
info
.
teb_sel
=
wine_get_fs
();
info
.
exit_status
=
status
;
fds
[
0
]
=
ntdll_get_thread_data
()
->
wait_fd
[
0
];
fds
[
1
]
=
ntdll_get_thread_data
()
->
wait_fd
[
1
];
fds
[
2
]
=
ntdll_get_thread_data
()
->
reply_fd
;
fds
[
3
]
=
ntdll_get_thread_data
()
->
request_fd
;
pthread_sigmask
(
SIG_BLOCK
,
&
server_block_set
,
NULL
);
info
.
stack_size
=
virtual_free_system_view
(
&
info
.
stack_base
);
info
.
teb_size
=
virtual_free_system_view
(
&
info
.
teb_base
);
close
(
fds
[
0
]
);
close
(
fds
[
1
]
);
close
(
fds
[
2
]
);
close
(
fds
[
3
]
);
pthread_functions
.
exit_thread
(
&
info
);
}
#ifdef __i386__
#ifdef __i386__
/* wrapper for apps that don't declare the thread function correctly */
/* wrapper for apps that don't declare the thread function correctly */
extern
DWORD
call_thread_entry_point
(
PRTL_THREAD_START_ROUTINE
entry
,
void
*
arg
);
extern
DWORD
call_thread_entry_point
(
PRTL_THREAD_START_ROUTINE
entry
,
void
*
arg
);
...
@@ -401,7 +452,7 @@ static void DECLSPEC_NORETURN call_thread_func( PRTL_THREAD_START_ROUTINE rtl_fu
...
@@ -401,7 +452,7 @@ static void DECLSPEC_NORETURN call_thread_func( PRTL_THREAD_START_ROUTINE rtl_fu
else
else
{
{
LdrShutdownThread
();
LdrShutdownThread
();
server_
exit_thread
(
exit_code
);
exit_thread
(
exit_code
);
}
}
}
}
...
@@ -624,7 +675,7 @@ void WINAPI RtlExitUserThread( ULONG status )
...
@@ -624,7 +675,7 @@ void WINAPI RtlExitUserThread( ULONG status )
else
else
{
{
LdrShutdownThread
();
LdrShutdownThread
();
server_
exit_thread
(
status
);
exit_thread
(
status
);
}
}
}
}
...
@@ -730,8 +781,8 @@ NTSTATUS WINAPI NtTerminateThread( HANDLE handle, LONG exit_code )
...
@@ -730,8 +781,8 @@ NTSTATUS WINAPI NtTerminateThread( HANDLE handle, LONG exit_code )
if
(
self
)
if
(
self
)
{
{
if
(
last
)
exit
(
exit_code
);
if
(
last
)
_
exit
(
exit_code
);
else
server_
abort_thread
(
exit_code
);
else
abort_thread
(
exit_code
);
}
}
return
ret
;
return
ret
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment