From owner-freebsd-current Sat Feb 1 04:31:01 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id EAA18368 for current-outgoing; Sat, 1 Feb 1997 04:31:01 -0800 (PST) Received: from tfs.com (tfs.com [140.145.250.1]) by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id EAA18320 for ; Sat, 1 Feb 1997 04:30:57 -0800 (PST) Received: from schizo.dk.tfs.com by tfs.com (smail3.1.28.1) with SMTP id m0vqeaP-0003xJC; Sat, 1 Feb 97 04:30 PST Received: from critter.dk.tfs.com (critter-home [193.162.32.19]) by schizo.dk.tfs.com (8.8.2/8.7.3) with ESMTP id NAA28141 for ; Sat, 1 Feb 1997 13:30:22 +0100 (MET) Received: from critter.dk.tfs.com (localhost [127.0.0.1]) by critter.dk.tfs.com (8.8.2/8.8.2) with ESMTP id NAA03052 for ; Sat, 1 Feb 1997 13:31:40 +0100 (MET) To: current@freebsd.org Subject: device driver open semantics... Reply-to: phk@freebsd.org Date: Sat, 01 Feb 1997 13:31:40 +0100 Message-ID: <3050.854800300@critter.dk.tfs.com> From: Poul-Henning Kamp Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk The way things work now, this scenario exists: Proc A Proc B Device foo ------------------------------------------ open(foo,RD) \__________________ \ ->open(foo, RD,A) open(foo,WR) \__ \ ->open(foo, WR,B) close(foo) >>nothing<< close(foo) \____________________ \ ->close(foo,A) I'm dissatisfied with the >>nothing<< step. At this time there is nobody who has the device open for writing but we fail to communicate this to the driver. Many drivers don't really care who opened them, and it would generally be sufficient to be informed of the current agregate open mode: Proc A Proc B Device foo ------------------------------------------ open(foo,RD) \__________________ \ ->isopen(foo, RD) open(foo,WR) \__ \ ->isopen(foo, RD|WR) close(foo) \____ \ ->isopen(foo, RD) close(foo) \____________________ \ ->isopen(foo,0) (we would still have to pass a proc * argument in case we need to sleep, but it does not necessarily correspond to the process that effected the change in status) Comments ? I realize that changing this behaviour in general would probably surprise most if not all of our device-drivers, So we're probably talking about a per-driver flag or possibly a different open/close entry point in the [cb]devsw structure. Preferences ? Objections ? -- Poul-Henning Kamp | phk@FreeBSD.ORG FreeBSD Core-team. http://www.freebsd.org/~phk | phk@login.dknet.dk Private mailbox. whois: [PHK] | phk@tfs.com TRW Financial Systems, Inc. Future will arrive by its own means, progress not so.