From owner-freebsd-hackers Tue Nov 17 18:11:15 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id SAA02749 for freebsd-hackers-outgoing; Tue, 17 Nov 1998 18:11:15 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from smtp01.primenet.com (smtp01.primenet.com [206.165.6.131]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id SAA02744 for ; Tue, 17 Nov 1998 18:11:14 -0800 (PST) (envelope-from tlambert@usr09.primenet.com) Received: (from daemon@localhost) by smtp01.primenet.com (8.8.8/8.8.8) id MAA05901; Tue, 17 Nov 1998 12:17:22 -0700 (MST) Received: from usr09.primenet.com(206.165.6.209) via SMTP by smtp01.primenet.com, id smtpd005878; Tue Nov 17 12:17:16 1998 Received: (from tlambert@localhost) by usr09.primenet.com (8.8.5/8.8.5) id MAA06638; Tue, 17 Nov 1998 12:17:09 -0700 (MST) From: Terry Lambert Message-Id: <199811171917.MAA06638@usr09.primenet.com> Subject: Re: More questions on DEVFS To: bf20761@binghamton.edu (zhihuizhang) Date: Tue, 17 Nov 1998 19:17:09 +0000 (GMT) Cc: archie@whistle.com, julian@whistle.com, freebsd-hackers@FreeBSD.ORG In-Reply-To: from "zhihuizhang" at Nov 13, 98 04:37:47 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > After thinking for quite a while, I still have two confusions: > > (1) I read the source code of chroot() in file vfs_syscalls.c. It takes a > path and change the fd_rdir (root directory) of the calling process. How > can the superuser process change the root directory of any other process? By modifying the value of the current processes file descriptor table's idea of fd_rdir: struct filedesc *fdp; fdp = cnp->cn_proc->p_fd; /* * Get starting point for the translation. */ if ((ndp->ni_rootdir = fdp->fd_rdir) == NULL) ndp->ni_rootdir = rootvnode; ...in other words, the current processes idea of the root directory. > (2) By saying "put devices in there..", I guess it means that the > superuser mount the special device at some directory under the new root. > If we set up root directories for several processes, then we may need to > mount a certain device used by these processes several times. DEVFS can > be mounted multiple times to achieve this. However, multiple mounts of > a normal file system are NOT allowed. Am I right? You could union the FS's into the new space, with a number of minor modifications to the VFS code. But in general, the new space is on an already mounted FS, so you wouldn't really want to do this anyway. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message