This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Re: Add wrappers for ExitProcess, TerminateProcess
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin-patches at cygwin dot com
- Date: Mon, 5 Oct 2009 22:27:22 +0200
- Subject: Re: Add wrappers for ExitProcess, TerminateProcess
- References: <4ACA4323.5080103@cwilson.fastmail.fm>
- Reply-to: cygwin-patches at cygwin dot com
On Oct 5 15:04, Charles Wilson wrote:
> Normally, posix programs should call abort(), exit(), _exit(), kill() --
> or various pthread functions -- to terminate operation (either their
> own, or that of some other processes/thread). However, there are two
> cases where the win32 ExitProcess and TerminateProcess functions might
> justifiably be called:
> 1) inside cygwin's own process startup/shutdown implementation
> 2) "Native" programs that use the w32api throughout, but are compiled
> using the cygwin compiler (e.g. without -mno-cygwin). [*]
>
> However, the ExitProcess and TerminateProcess functions, when called
> directly, do not allow for the 'exit status' maintained by cygwin to be
> set. This can be a problem when such cygwin applications are exec'ed by
> other cygwin apps: cygwin's code for exec'ing children doesn't ever
> check the value of GetExitCodeProcess as set by these win32 functions,
> if the child application is also a cygwin app.
>
> The attached patch address this problem, by providing two wrappers:
> cygwin_terminate_process <--> TerminateProcess
> cygwin_exit_process <--> ExitProcess
I have some doubts that we really need such a functionality externally
available, outside of the limited scenario of something like
pseudo-reloc. An API for those knowing what this is about is very
likely sufficient. What about
cygwin_internal (CW_TERMINATE_PROCESS);
cygwin_internal (CW_EXIT_PROCESS);
No new entry point, no need to document it.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat