Driver close system call

Roger Collins rogerc at ncrcae.Columbia.NCR.COM
Fri Mar 31 00:04:34 AEST 1989


In article <1193 at ncr-sd.SanDiego.NCR.COM> williamt at babel.SanDiego.NCR.COM (Wm. Tseng) writes:
> 
> If a process exits or terminates before it closes a driver, does kernel close
> the driver for that process ?

Yes.  All files (includes device nodes, regular files, pipes, etc.) are closed.

> In user process, several processes can open the 
> same driver. Are driver open and close routines executed as many time as process
> calls it ?

Yes and no.  Yes for opens, no for closes.  All opens get to the driver.
Only the last close gets to the driver.

> Does kernel control the close system call, so close is only executed
> once (when last process closes it)?

You got it, but not to confuse anyone else:  You meant to say,

"...so *the driver's* close is only executed once..."

The kernel does execute close logic for every close system call 
(decrement the reference counter for example), it just doesn't call the
driver's close routine until the reference counter is zero.

> When system crash, does kernel close all 
> the opened file and driver or just leave them open ?

No.  The kernel leaves everything basically as is (except for syncing
the drives).  This is probably vendor specific; I know only about
the NCR TOWER.

--
Roger Collins
NCR - E&M Columbia
rogerc at ncrcae.Columbia.NCR.COM



More information about the Comp.unix.questions mailing list