From owner-freebsd-arch Wed Dec 13 15:54: 4 2000 From owner-freebsd-arch@FreeBSD.ORG Wed Dec 13 15:54:00 2000 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from Awfulhak.org (awfulhak.demon.co.uk [194.222.196.252]) by hub.freebsd.org (Postfix) with ESMTP id 0762F37B404; Wed, 13 Dec 2000 15:53:59 -0800 (PST) Received: from hak.lan.Awfulhak.org (root@hak.lan.awfulhak.org [172.16.0.12]) by Awfulhak.org (8.11.1/8.11.1) with ESMTP id eBDNplZ04667; Wed, 13 Dec 2000 23:51:47 GMT (envelope-from brian@lan.awfulhak.org) Received: from hak.lan.Awfulhak.org (brian@localhost [127.0.0.1]) by hak.lan.Awfulhak.org (8.11.1/8.11.1) with ESMTP id eBDNtJU70418; Wed, 13 Dec 2000 23:55:19 GMT (envelope-from brian@hak.lan.Awfulhak.org) Message-Id: <200012132355.eBDNtJU70418@hak.lan.Awfulhak.org> X-Mailer: exmh version 2.2 06/23/2000 with nmh-1.0.4 To: Tony Finch Cc: Brian Somers , Alfred Perlstein , arch@FreeBSD.ORG, net@FreeBSD.ORG, brian@Awfulhak.org Subject: Re: patch to cleanup inflight desciptor handling. In-Reply-To: Message from Tony Finch of "Wed, 13 Dec 2000 22:57:53 GMT." <20001213225753.B30050@hand.dotat.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 13 Dec 2000 23:55:19 +0000 From: Brian Somers Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Brian Somers wrote: > > > >Hmm, the last time i looked at this, I believe the whole thing was > >dealt with by not increasing the file descriptor reference count > >when it was put in the message header. If process A closed the > >descriptor before process B actually recvmsg()d it, it would be > >EBADF. The recvmsg() actually incremented the reference count. > > But it has always been documented behaviour that the receiving process > gets a valid descriptor even if the sender closes it directly after > sendmsging it. If this was not the case then descriptor handoff would > require an "ok" reply from the receiving process before the sender > could close it, which is a pain. > > Hmm, the only references for this I can think of are Stevens and the > red & black daemon books, but I'm sure I've read a good discussion of > it somewhere else. I've just looked back through my archives... the problem I'm thinking of was a different problem - where the descriptor passed was the only descriptor open for a tty whose pgrp was that of process A. A passed the descriptor to B and then exited at which point the tty (correctly) revoked all it's remaining descriptors (the one en-route or in process B). There's no way to avoid this - except by having A fork(), the child close the descriptor and continue where it left off and the parent pause() waiting for a signal from B to tell it that it's finished with that tty. This is why I implemented ``enable keep-session'' :-) > Tony. > -- > f.a.n.finch fanf@covalent.net dot@dotat.at > "And remember my friend, future events such > as these will affect you in the future." Cheers. -- Brian Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message