Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!ncrlnk!ncrcae!rogerc From: rogerc@ncrcae.Columbia.NCR.COM (Roger Collins) Newsgroups: comp.unix.questions Subject: Re: Driver close system call Message-ID: <4337@ncrcae.Columbia.NCR.COM> Date: 30 Mar 89 14:04:34 GMT References: <1193@ncr-sd.SanDiego.NCR.COM> Reply-To: rogerc@ncrcae.Columbia.NCR.COM (Roger Collins) Distribution: usa Organization: NCR - E & M Columbia Lines: 36 In article <1193@ncr-sd.SanDiego.NCR.COM> williamt@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@ncrcae.Columbia.NCR.COM