Eric Pouech pouech-eric@wanadoo.fr writes:
as reported by Igor Sysoev on WD, exit process code wasn't properly implemented on *BSD it appeared (thanks Igor for all the testings and traces) that after terminate_process request was issued, the client/server pipe got closed because the running thread was actually killed, erasing the exit_code that terminate_process had set. This patch actually fixes it.
I don't think we need a new thread state just for that; how about something like this?
Index: server/process.c =================================================================== RCS file: /home/winehq/opt/cvs-commit/wine/server/process.c,v retrieving revision 1.104 diff -u -p -r1.104 process.c --- server/process.c 18 Mar 2003 05:04:33 -0000 1.104 +++ server/process.c 13 Jun 2003 23:18:03 -0000 @@ -688,7 +688,7 @@ void kill_process( struct process *proce while (thread) { struct thread *next = thread->proc_next; - thread->exit_code = exit_code; + if (exit_code) thread->exit_code = exit_code; if (thread != skip) kill_thread( thread, 1 ); thread = next; } Index: server/request.c =================================================================== RCS file: /home/winehq/opt/cvs-commit/wine/server/request.c,v retrieving revision 1.79 diff -u -p -r1.79 request.c --- server/request.c 28 Mar 2003 00:36:12 -0000 1.79 +++ server/request.c 13 Jun 2003 23:18:04 -0000 @@ -382,7 +382,7 @@ int receive_fd( struct process *process if (ret > 0) fprintf( stderr, "Protocol error: process %p: partial recvmsg %d for fd\n", process, ret ); - kill_process( process, NULL, 1 ); + kill_process( process, NULL, (ret > 0) ); } else {
Alexandre Julliard wrote:
Eric Pouech pouech-eric@wanadoo.fr writes:
as reported by Igor Sysoev on WD, exit process code wasn't properly implemented on *BSD it appeared (thanks Igor for all the testings and traces) that after terminate_process request was issued, the client/server pipe got closed because the running thread was actually killed, erasing the exit_code that terminate_process had set. This patch actually fixes it.
I don't think we need a new thread state just for that; how about something like this?
I agree that it would better without a new thread state But it seems that in the case of a process termination with ExitProcess(0), your proposal will never set the exit code to 0 and always return an exit code of STILL_ACTIVE.
A+
Eric Pouech pouech-eric@wanadoo.fr writes:
I agree that it would better without a new thread state But it seems that in the case of a process termination with ExitProcess(0), your proposal will never set the exit code to 0 and always return an exit code of STILL_ACTIVE.
No, the exit code is already 0 by default, so there's no need to set it again for the ExitProcess(0) case.
On Fri, 13 Jun 2003, Alexandre Julliard wrote:
Eric Pouech pouech-eric@wanadoo.fr writes:
as reported by Igor Sysoev on WD, exit process code wasn't properly implemented on *BSD it appeared (thanks Igor for all the testings and traces) that after terminate_process request was issued, the client/server pipe got closed because the running thread was actually killed, erasing the exit_code that terminate_process had set. This patch actually fixes it.
I don't think we need a new thread state just for that; how about something like this?
I think that the new state makes the code clearer. Eric Pouech's patch sets a exit code only in RUNNING state and ignores it in other states.
It's not clear here ------ if (exit_code) thread->exit_code = exit_code; ------ why exit_code is set only if it's not zero and what's about a zero code.
Igor Sysoev http://sysoev.ru/en/