This is the mail archive of the cygwin-patches@cygwin.com 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]

Re: close-on-exec handles are left open by exec parent


Hi!

Friday, 03 August, 2001 Christopher Faylor cgf@redhat.com wrote:

>>  here's the proposed patch. it also contains a fix FreeConsole ()
>>related bug -- when cygwin application frees its console,
>>"process_input" thread may be still running. When console is closed,
>>WaitForMultipleObjects () with console handle returns WAIT_FAILED, so
>>"process_input" thread starts cycling and eating CPU.

CF> Ack! I don't understand why you've introduced another synchronization
CF> event.  Why not just close all of the fds after the program has been
CF> successfully executed?  Once CreateProcess has executed, the handles will
CF> be opened by the new process.

they do, but we care not only about win32 handles. when /dev/tty0 is
closed, some new process (for example) which opens /dev/tty, allocates
new tty, an it will be /dev/tty0, won't it?

without synchronization i got all kinds of strange lockups and
crashes, which disappear when synchronization is added. i didn't
investigate those crashes, but they probably do need some closer
investigation. i'll try to look at them.

your point about non-cygwin apps is absolutely valid, though :( i have
to think it over a bit more. maybe we need to add some kind of
"pre-close" that closes win32 handles, but left cygwin-specific data,
such as tty slot, intact. or just utilize fixup_before_exec ()

Egor.            mailto:deo@logos-m.ru ICQ 5165414 FidoNet 2:5020/496.19


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