Date: Tue, 17 Nov 1998 19:17:09 +0000 (GMT) From: Terry Lambert <tlambert@primenet.com> To: bf20761@binghamton.edu (zhihuizhang) Cc: archie@whistle.com, julian@whistle.com, freebsd-hackers@FreeBSD.ORG Subject: Re: More questions on DEVFS Message-ID: <199811171917.MAA06638@usr09.primenet.com> In-Reply-To: <Pine.SOL.L3.93.981113162310.22911A-100000@bingsun2> from "zhihuizhang" at Nov 13, 98 04:37:47 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811171917.MAA06638>