@ page 313 line 10198-10210 section exit objection [gwc exit vs _exit]
Problem:
Defect code : 1. Error
The XSH page for exit() and _exit() says:
"The _Exit() [CX] and _exit() [/CX] functions shall not call
functions registered with atexit() nor any registered signal
handlers. Whether open streams are flushed or closed, or temporary
files are removed is implementation-defined."
The statement about stream flushing is a change from the requirements
for _exit() that were in POSIX.1-1996 and SUSv2, and appears to have
occurred during the addition of text relating to _Exit() from C99.
Hopefully it is unintentional, since a great many applications rely
on _exit() not flushing stream buffers and this difference between
exit() and _exit() is explained in pretty much every text book on
UNIX/POSIX programming.
Also, the statements on this page about removal of temporary files
conflict with the description of tmpfile() which states "The file
shall be automatically deleted when all references to the file are
closed." Thus the removal is not performed by the exit() function
itself, although removal may be performed by the system during a
call to the exit() function if there are any references to the
file still open. One solution would be to remove all mention of
temporary file removal from this page, thus leaving it to be
specified by the tmpfile() page, but differences from the C
Standard on the exit() page need to be CX shaded and how to you
CX shade a deletion? Instead, the parts relating to temporary
file removal should be modified to cover all methods by which the
last reference can be closed, such as closure of a dup'ed file
descriptor on process termination.
Action:
On line 10203 change:
"Whether open streams are flushed or closed, or temporary files
are removed is implementation-defined."
to:
"[CX] Open streams shall not be flushed. Whether open streams are
closed (without flushing) is implementation-defined. If closing
a stream results in the last reference to a file created by
tmpfile() being closed, then the file shall be automatically
deleted.[/CX]"
On line 10198 change:
"The exit() function shall then flush all open streams with
unwritten buffered data, close all open streams, and remove all
files created by tmpfile()."
to:
"The exit() function shall then flush all open streams with
unwritten buffered data and close all open streams. [CX] If
closing a stream results in the last reference to a file
created by tmpfile() being closed, then the file shall be
automatically deleted.[/CX]"
Append to line 10210:
"If closing a file descriptor results in the last reference to a
file created by tmpfile() being closed, then the file shall be
automatically deleted."
|