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
81977b77
Commit
81977b77
authored
Sep 21, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Kill the process without SIGTERM when the fd socket is closed.
parent
e3bd111b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
19 deletions
+35
-19
process.c
server/process.c
+28
-12
process.h
server/process.h
+1
-1
request.c
server/request.c
+6
-6
No files found.
server/process.c
View file @
81977b77
...
...
@@ -408,7 +408,7 @@ static void process_poll_event( struct fd *fd, int event )
process
->
sigkill_timeout
=
NULL
;
process_died
(
process
);
}
else
kill_process
(
process
,
NULL
,
0
);
else
kill_process
(
process
,
0
);
}
else
if
(
event
&
POLLIN
)
receive_fd
(
process
);
}
...
...
@@ -512,6 +512,20 @@ static void process_unload_dll( struct process *process, void *base )
else
set_error
(
STATUS_INVALID_PARAMETER
);
}
/* terminate a process with the given exit code */
static
void
terminate_process
(
struct
process
*
process
,
struct
thread
*
skip
,
int
exit_code
)
{
struct
list
*
ptr
,
*
next
;
LIST_FOR_EACH_SAFE
(
ptr
,
next
,
&
process
->
thread_list
)
{
struct
thread
*
thread
=
LIST_ENTRY
(
ptr
,
struct
thread
,
proc_entry
);
if
(
exit_code
)
thread
->
exit_code
=
exit_code
;
if
(
thread
!=
skip
)
kill_thread
(
thread
,
1
);
}
}
/* kill all processes */
void
kill_all_processes
(
struct
process
*
skip
,
int
exit_code
)
{
...
...
@@ -525,7 +539,7 @@ void kill_all_processes( struct process *skip, int exit_code )
if
(
process
->
running_threads
)
break
;
}
if
(
&
process
->
entry
==
&
process_list
)
break
;
/* no process found */
kill
_process
(
process
,
NULL
,
exit_code
);
terminate
_process
(
process
,
NULL
,
exit_code
);
}
}
...
...
@@ -544,7 +558,7 @@ void kill_console_processes( struct thread *renderer, int exit_code )
if
(
process
->
console
&&
process
->
console
->
renderer
==
renderer
)
break
;
}
if
(
&
process
->
entry
==
&
process_list
)
break
;
/* no process found */
kill
_process
(
process
,
NULL
,
exit_code
);
terminate
_process
(
process
,
NULL
,
exit_code
);
}
}
...
...
@@ -638,16 +652,18 @@ void resume_process( struct process *process )
}
/* kill a process on the spot */
void
kill_process
(
struct
process
*
process
,
struct
thread
*
skip
,
int
exit_code
)
void
kill_process
(
struct
process
*
process
,
int
violent_death
)
{
struct
list
*
ptr
,
*
next
;
LIST_FOR_EACH_SAFE
(
ptr
,
next
,
&
process
->
thread_list
)
if
(
violent_death
)
terminate_process
(
process
,
NULL
,
1
);
else
{
struct
thread
*
thread
=
LIST_ENTRY
(
ptr
,
struct
thread
,
proc_entry
)
;
struct
list
*
ptr
,
*
next
;
if
(
exit_code
)
thread
->
exit_code
=
exit_code
;
if
(
thread
!=
skip
)
kill_thread
(
thread
,
1
);
LIST_FOR_EACH_SAFE
(
ptr
,
next
,
&
process
->
thread_list
)
{
struct
thread
*
thread
=
LIST_ENTRY
(
ptr
,
struct
thread
,
proc_entry
);
kill_thread
(
thread
,
0
);
}
}
}
...
...
@@ -666,7 +682,7 @@ void kill_debugged_processes( struct thread *debugger, int exit_code )
}
if
(
&
process
->
entry
==
&
process_list
)
break
;
/* no process found */
process
->
debugger
=
NULL
;
kill
_process
(
process
,
NULL
,
exit_code
);
terminate
_process
(
process
,
NULL
,
exit_code
);
}
}
...
...
@@ -960,7 +976,7 @@ DECL_HANDLER(terminate_process)
if
((
process
=
get_process_from_handle
(
req
->
handle
,
PROCESS_TERMINATE
)))
{
reply
->
self
=
(
current
->
process
==
process
);
kill
_process
(
process
,
current
,
req
->
exit_code
);
terminate
_process
(
process
,
current
,
req
->
exit_code
);
release_object
(
process
);
}
}
...
...
server/process.h
View file @
81977b77
...
...
@@ -120,7 +120,7 @@ extern void remove_process_thread( struct process *process,
extern
void
suspend_process
(
struct
process
*
process
);
extern
void
resume_process
(
struct
process
*
process
);
extern
void
kill_all_processes
(
struct
process
*
skip
,
int
exit_code
);
extern
void
kill_process
(
struct
process
*
process
,
struct
thread
*
skip
,
int
exit_code
);
extern
void
kill_process
(
struct
process
*
process
,
int
violent_death
);
extern
void
kill_console_processes
(
struct
thread
*
renderer
,
int
exit_code
);
extern
void
kill_debugged_processes
(
struct
thread
*
debugger
,
int
exit_code
);
extern
void
break_process
(
struct
process
*
process
);
...
...
server/request.c
View file @
81977b77
...
...
@@ -402,13 +402,13 @@ int receive_fd( struct process *process )
if
(
!
ret
)
{
kill_process
(
process
,
NULL
,
0
);
kill_process
(
process
,
0
);
}
else
if
(
ret
>
0
)
{
fprintf
(
stderr
,
"Protocol error: process %04x: partial recvmsg %d for fd
\n
"
,
process
->
id
,
ret
);
kill_process
(
process
,
NULL
,
1
);
kill_process
(
process
,
1
);
}
else
{
...
...
@@ -416,7 +416,7 @@ int receive_fd( struct process *process )
{
fprintf
(
stderr
,
"Protocol error: process %04x: "
,
process
->
id
);
perror
(
"recvmsg"
);
kill_process
(
process
,
NULL
,
1
);
kill_process
(
process
,
1
);
}
}
return
-
1
;
...
...
@@ -450,17 +450,17 @@ int send_client_fd( struct process *process, int fd, obj_handle_t handle )
if
(
ret
>=
0
)
{
fprintf
(
stderr
,
"Protocol error: process %04x: partial sendmsg %d
\n
"
,
process
->
id
,
ret
);
kill_process
(
process
,
NULL
,
1
);
kill_process
(
process
,
1
);
}
else
if
(
errno
==
EPIPE
)
{
kill_process
(
process
,
NULL
,
0
);
kill_process
(
process
,
0
);
}
else
{
fprintf
(
stderr
,
"Protocol error: process %04x: "
,
process
->
id
);
perror
(
"sendmsg"
);
kill_process
(
process
,
NULL
,
1
);
kill_process
(
process
,
1
);
}
return
-
1
;
}
...
...
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