This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add wrappers for ExitProcess, TerminateProcess


On Oct  6 10:40, Charles Wilson wrote:
> 2009-10-05  Charles Wilson  <...>
> 
> 	Add cygwin wrapper for ExitProcess and TerminateProcess.
> 	* include/sys/cygwin.h: Declare new cygwin_getinfo_type
> 	CW_EXIT_PROCESS.
> 	* external.cc (exit_process): New function.
> 	(cygwin_internal): Handle CW_EXIT_PROCESS.
> 	* pinfo.h (pinfo::set_exit_code): New method.
> 	* pinfo.cc (pinfo::set_exit_code): New, refactored from...
> 	(pinfo::maybe_set_exit_code_from_windows): here. Call it.
> 	* exceptions.cc: Move global variable sigExeced...
> 	* globals.cc: here.
> 
> OK?

Looks good to me.  Let's wait for Chris, though.  I have just one question.

> +static void
> +exit_process (UINT status, BOOL useTerminateProcess)
> +{
> +  pid_t pid = getpid ();
> +  external_pinfo * ep = fillout_pinfo (pid, 1);
> +  DWORD dwpid = ep ? ep->dwProcessId : pid;
> +  pinfo p (pid, PID_MAP_RW);
> +  if ((dwpid == GetCurrentProcessId()) && (p->pid == ep->pid))
> +    p.set_exit_code ((DWORD)status);
> +  if (useTerminateProcess)
> +    TerminateProcess (GetCurrentProcess(), status);
> +  /* avoid 'else' clause to silence warning */
> +  ExitProcess (status);
> +}

Shouldn't exit_process be marked with attribute(noreturn) or is the
optimizing effect negligible?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]