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
68e850e6
Commit
68e850e6
authored
Aug 14, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Send a SIGKILL to processes that don't terminate properly.
parent
6c8259fb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
2 deletions
+54
-2
process.c
server/process.c
+49
-2
process.h
server/process.h
+2
-0
thread.c
server/thread.c
+3
-0
No files found.
server/process.c
View file @
68e850e6
...
...
@@ -217,6 +217,38 @@ static void set_process_startup_state( struct process *process, enum startup_sta
}
}
/* final cleanup once we are sure a process is really dead */
static
void
process_died
(
struct
process
*
process
)
{
if
(
debug_level
)
fprintf
(
stderr
,
"%04x: *process killed*
\n
"
,
process
->
id
);
release_object
(
process
);
if
(
!--
running_processes
)
close_master_socket
();
}
/* callback for process sigkill timeout */
static
void
process_sigkill
(
void
*
private
)
{
struct
process
*
process
=
private
;
process
->
sigkill_timeout
=
NULL
;
kill
(
process
->
unix_pid
,
SIGKILL
);
process_died
(
process
);
}
/* start the sigkill timer for a process upon exit */
static
void
start_sigkill_timer
(
struct
process
*
process
)
{
grab_object
(
process
);
if
(
process
->
unix_pid
!=
-
1
&&
process
->
msg_fd
)
{
struct
timeval
when
=
current_time
;
add_timeout
(
&
when
,
1000
);
process
->
sigkill_timeout
=
add_timeout_user
(
&
when
,
process_sigkill
,
process
);
}
else
process_died
(
process
);
}
/* create a new process and its main thread */
/* if the function fails the fd is closed */
struct
thread
*
create_process
(
int
fd
,
struct
thread
*
parent_thread
,
int
inherit_all
)
...
...
@@ -234,6 +266,8 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
process
->
debugger
=
NULL
;
process
->
handles
=
NULL
;
process
->
msg_fd
=
NULL
;
process
->
sigkill_timeout
=
NULL
;
process
->
unix_pid
=
-
1
;
process
->
exit_code
=
STILL_ACTIVE
;
process
->
running_threads
=
0
;
process
->
priority
=
PROCESS_PRIOCLASS_NORMAL
;
...
...
@@ -322,6 +356,8 @@ static void process_destroy( struct object *obj )
/* we can't have a thread remaining */
assert
(
list_empty
(
&
process
->
thread_list
));
assert
(
!
process
->
sigkill_timeout
);
/* timeout should hold a reference to the process */
set_process_startup_state
(
process
,
STARTUP_ABORTED
);
if
(
process
->
console
)
release_object
(
process
->
console
);
if
(
process
->
parent
)
release_object
(
process
->
parent
);
...
...
@@ -362,7 +398,18 @@ static void process_poll_event( struct fd *fd, int event )
struct
process
*
process
=
get_fd_user
(
fd
);
assert
(
process
->
obj
.
ops
==
&
process_ops
);
if
(
event
&
(
POLLERR
|
POLLHUP
))
set_fd_events
(
fd
,
-
1
);
if
(
event
&
(
POLLERR
|
POLLHUP
))
{
release_object
(
process
->
msg_fd
);
process
->
msg_fd
=
NULL
;
if
(
process
->
sigkill_timeout
)
/* already waiting for it to die */
{
remove_timeout_user
(
process
->
sigkill_timeout
);
process
->
sigkill_timeout
=
NULL
;
process_died
(
process
);
}
else
kill_process
(
process
,
NULL
,
0
);
}
else
if
(
event
&
POLLIN
)
receive_fd
(
process
);
}
...
...
@@ -528,8 +575,8 @@ static void process_killed( struct process *process )
destroy_process_classes
(
process
);
remove_process_locks
(
process
);
set_process_startup_state
(
process
,
STARTUP_ABORTED
);
start_sigkill_timer
(
process
);
wake_up
(
&
process
->
obj
,
0
);
if
(
!--
running_processes
)
close_master_socket
();
}
/* add a thread to a process running threads list */
...
...
server/process.h
View file @
68e850e6
...
...
@@ -57,6 +57,8 @@ struct process
struct
fd
*
msg_fd
;
/* fd for sendmsg/recvmsg */
process_id_t
id
;
/* id of the process */
process_id_t
group_id
;
/* group id of the process */
struct
timeout_user
*
sigkill_timeout
;
/* timeout for final SIGKILL */
int
unix_pid
;
/* Unix pid for final SIGKILL */
int
exit_code
;
/* process exit code */
int
running_threads
;
/* number of threads running in this process */
struct
timeval
start_time
;
/* absolute time at process start */
...
...
server/thread.c
View file @
68e850e6
...
...
@@ -872,12 +872,15 @@ DECL_HANDLER(init_thread)
if
(
!
process
->
peb
)
/* first thread, initialize the process too */
{
process
->
unix_pid
=
current
->
unix_pid
;
process
->
peb
=
req
->
peb
;
process
->
ldt_copy
=
req
->
ldt_copy
;
reply
->
info_size
=
init_process
(
current
);
}
else
{
if
(
process
->
unix_pid
!=
current
->
unix_pid
)
process
->
unix_pid
=
-
1
;
/* can happen with linuxthreads */
if
(
current
->
suspend
+
process
->
suspend
>
0
)
stop_thread
(
current
);
generate_debug_event
(
current
,
CREATE_THREAD_DEBUG_EVENT
,
req
->
entry
);
}
...
...
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