From owner-freebsd-hackers Fri Aug 28 12:34:59 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA06632 for freebsd-hackers-outgoing; Fri, 28 Aug 1998 12:34:59 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from rucus.ru.ac.za (rucus.ru.ac.za [146.231.29.2]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id MAA06580 for ; Fri, 28 Aug 1998 12:34:26 -0700 (PDT) (envelope-from nbm@rucus.ru.ac.za) Received: (qmail 20773 invoked by uid 1003); 28 Aug 1998 19:14:04 -0000 Message-ID: <19980828211404.A18096@rucus.ru.ac.za> Date: Fri, 28 Aug 1998 21:14:04 +0200 From: Neil Blakey-Milner To: Luigi Rizzo , Craig Anderson Cc: freebsd-hackers@FreeBSD.ORG, brhall@timing.com Subject: Re: Help with passing fd on FreeBSD References: <199808281722.LAA10931@count.timing.com> <199808281628.SAA05374@labinfo.iet.unipi.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2i In-Reply-To: <199808281628.SAA05374@labinfo.iet.unipi.it>; from Luigi Rizzo on Fri, Aug 28, 1998 at 06:28:36PM +0200 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri 1998-08-28 (18:28), Luigi Rizzo wrote: > > > Can someone give me pointers on passing open file descriptors on FreeBSD? > > still, this looks to me one of the most obscure interfaces in the OS. > Does any real application use that ? In the Stevens book, he says: "1. A process forks a child process and the child then execs another process to open a particular file. The execed process does whatever it has to do to open the file and then passes the open file descriptor back to the original process, since the execed process is a child process of the orifinal process, there s no way for it to pass an open file back to the parent, other than passing an open file as we describe in this section." "2. A connection server can be incoked to handle all network connections. Instead of using fork and exec as described above, this secario requires any client process to connect with a well-known server. The client writes its request to the server using this connection (a Unix domain stream socket, for example), and the server responds with an open file descriptor or an error indication." I think this could be used to point children towards files to read for further input, or something like that. I'm not terribly sure, but the children may then need not be run as root to read files not owned by their process id (one assumes the child uses set[gu]id). Of course, I'm sure there are better ways of doing these things. I'm not sure how apache logs to files owned by other users (apache set[gu]id's its children), this may be the way. Neil -- Neil Blakey-Milner nbm@rucus.ru.ac.za To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message