[comp.unix.wizards] What to do when close

chip@ateng.UUCP (Chip Salzenberg) (02/05/88)

A question for those of you with UNIX kernel source code:

     If you call open() on a device file, and you then call close() on
     the open file descriptor, but the driver for that device reports an
     error on the close, is the file descriptor closed or not?

We are running SCO Xenix System V, but we're interested in the results
for all types of machines.

Please E-mail and I'll post a summary.
-- 
Chip Salzenberg                 UUCP: "{codas,uunet}!ateng!chip"
A T Engineering                 My employer's opinions are a trade secret.
       "Anything that works is better than anything that doesn't."

jh@pcsbst (02/12/88)

Freeing the file descriptor is the first job done
by the UNIX SVR3 close() system call. Thus, you may reuse
it. Whatever happens else is the responsibility of the kernel.

Since I have seem some code in which u.u_error was tested in the kernel
[ after some operations like bread() ] I would strictly advise
against a driver close function to return an error code!
If the error condition is severe I would recommend a console
message from inside the kernel.

Note, that the close() code is protected from signals.

	Johannes Heuft
	unido!pcsbst!jh