Date: Mon, 26 Apr 1999 11:25:41 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Alain Magloire cc: djgpp-workers AT delorie DOT com Subject: Re: A workaround for Unix-style temporary files In-Reply-To: <199904260237.WAA18935@mccoy2.ECE.McGill.CA> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sun, 25 Apr 1999, Alain Magloire wrote: > - SIGSEGV is not the only sig that can terminate a process/program if not > catch, SIGHUP, SIGPIPE, SIGABRT etc ... will terminate the process also. DJGPP supports similar facilities, but in a slightly different way. SIGINT that is generated by Ctrl-C calls `exit', so all atexit functions are run as usual. Ctrl-C generated by Ctrl-BREAK, and all the other signals, including SIGSEGV, SIGQUIT and SIGABRT, bypass `exit', and the only cleanup they do is the necessary unhooking of hardware interrupts and exceptions (without which the system will promptly die). > - Is the file still in the namespace after unlink() ? I'm not sure what are you asking here. > - On DOS, when the program terminates, is close() call on the file > descriptors ? Yes, DOS closes all open files on behalf of an exiting program. > Maybe the unlink() or the _opentmp() emulation should register something > with atexit() to make sure that close() is call. That's what `tmpfile' does. But, as mentioned here, this will only work if atexit functions get to run, and they are bypassed when the program crashes. We could, of course, push the code that closes temporary files into the part that always gets run (atexit functions cannot be pushed there, since ANSI says they are only run ``on normal program termination''), but I'm not sure this is such a good idea that it requires a whole new machinery to be invented. And some really hard crashes, like stack overflow, won't even get to that code.