* gentls_offsets: Reinstate unlink of temp files.

* fhandler_console.cc (fhandler_console::close): Fix debugging output.
(fhandler_console::fixup_after_fork): Decrement open_fhs prior to call to
fhandler_console::open since this would cause incrementing too much
incrementing in child processes.  (Probably needs to be handled more elegantly
someday)
(fhandler_console::fixup_after_exec): Ditto.
This commit is contained in:
Christopher Faylor 2004-01-15 19:51:49 +00:00
parent 6a15098793
commit ac02533e08
3 changed files with 18 additions and 4 deletions

View File

@ -1,3 +1,16 @@
2004-01-15 Christopher Faylor <cgf@redhat.com>
* gentls_offsets: Reinstate unlink of temp files.
2004-01-14 Christopher Faylor <cgf@redhat.com>
* fhandler_console.cc (fhandler_console::close): Fix debugging output.
(fhandler_console::fixup_after_fork): Decrement open_fhs prior to call
to fhandler_console::open since this would cause incrementing too much
incrementing in child processes. (Probably needs to be handled more
elegantly someday)
(fhandler_console::fixup_after_exec): Ditto.
2004-01-14 Christopher Faylor <cgf@redhat.com> 2004-01-14 Christopher Faylor <cgf@redhat.com>
* cygtls.h (_threadinfo::call): Remove regparm declaration to work * cygtls.h (_threadinfo::call): Remove regparm declaration to work

View File

@ -680,8 +680,7 @@ fhandler_console::close (void)
if (!cygheap->fdtab.in_vfork_cleanup () && --(cygheap->open_fhs) <= 0 if (!cygheap->fdtab.in_vfork_cleanup () && --(cygheap->open_fhs) <= 0
&& myself->ctty != TTY_CONSOLE) && myself->ctty != TTY_CONSOLE)
{ {
syscall_printf ("open_fhs %d, freeing console %p", cygheap->open_fhs, syscall_printf ("open_fhs %d", cygheap->open_fhs);
myself->ctty);
FreeConsole (); FreeConsole ();
} }
debug_printf ("decremented open_fhs, now %d", cygheap->open_fhs); debug_printf ("decremented open_fhs, now %d", cygheap->open_fhs);
@ -1761,6 +1760,7 @@ fhandler_console::fixup_after_fork (HANDLE)
/* Windows does not allow duplication of console handles between processes /* Windows does not allow duplication of console handles between processes
so open the console explicitly. */ so open the console explicitly. */
cygheap->open_fhs--; /* The downside of storing this in cygheap. */
if (!open (O_NOCTTY | get_flags (), 0)) if (!open (O_NOCTTY | get_flags (), 0))
system_printf ("error opening console after fork, %E"); system_printf ("error opening console after fork, %E");
@ -1791,6 +1791,7 @@ fhandler_console::fixup_after_exec (HANDLE)
HANDLE h = get_handle (); HANDLE h = get_handle ();
HANDLE oh = get_output_handle (); HANDLE oh = get_output_handle ();
cygheap->open_fhs--; /* The downside of storing this in cygheap. */
if (!open (O_NOCTTY | get_flags (), 0)) if (!open (O_NOCTTY | get_flags (), 0))
{ {
int sawerr = 0; int sawerr = 0;

View File

@ -5,7 +5,7 @@ open(TLS, $tls) or die "$0: couldn't open tls file \"$tls\" - $!\n";
my $struct = ''; my $struct = '';
my @fields = (); my @fields = ();
my $def = ''; my $def = '';
my $tls = join('', <TLS>); $tls = join('', <TLS>);
$tls =~ s/\n[^\n]*gentls_offsets[^\n]*\n(.+)\Z/$1/os; $tls =~ s/\n[^\n]*gentls_offsets[^\n]*\n(.+)\Z/$1/os;
my $pre = $`; my $pre = $`;
substr($tls, 0, length($pre)) = ''; substr($tls, 0, length($pre)) = '';
@ -75,5 +75,5 @@ open(OFFS, "/tmp/$$.a.out|") or die "$0: couldn't run \"/tmp/$$.a.out\" - $!\n";
print TLS_OUT <OFFS>; print TLS_OUT <OFFS>;
close OFFS; close OFFS;
close TLS_OUT; close TLS_OUT;
# unlink "/tmp/$$.cc", "/tmp/$$.a.out"; unlink "/tmp/$$.cc", "/tmp/$$.a.out";
exit(0); exit(0);