From owner-freebsd-arch Fri May 3 20:33:53 2002 Delivered-To: freebsd-arch@freebsd.org Received: from rwcrmhc53.attbi.com (rwcrmhc53.attbi.com [204.127.198.39]) by hub.freebsd.org (Postfix) with ESMTP id 0437B37B416 for ; Fri, 3 May 2002 20:33:41 -0700 (PDT) Received: from blossom.cjclark.org ([12.234.91.48]) by rwcrmhc53.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020504033340.FLZE5896.rwcrmhc53.attbi.com@blossom.cjclark.org> for ; Sat, 4 May 2002 03:33:40 +0000 Received: (from cjc@localhost) by blossom.cjclark.org (8.11.6/8.11.6) id g443Xed74362 for arch@freebsd.org; Fri, 3 May 2002 20:33:40 -0700 (PDT) (envelope-from cjc) Date: Fri, 3 May 2002 20:33:40 -0700 From: "Crist J. Clark" To: arch@freebsd.org Subject: df(1) Broken in jail(8) Message-ID: <20020503203340.A74245@blossom.cjclark.org> Reply-To: cjclark@alum.mit.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i X-URL: http://people.freebsd.org/~cjc/ Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG The df(1) utility is broken in jail(8) environments. I could understand if it was totally broken, there are things you can't and shouldn't be able to do in a jail(8). However, df(1) behavior is inconsistent. The getmntinfo(3) function (via the getfsstat(2) call) works in a jail(8). When the output is generated from its output, df(1) works (but the info isn't offset to the jail(8)'s root). However, when one specifies individual filesystems or uses the '-t' option, the information on the mount point is gathered using a statfs(2) call. Since this takes a path, which will be offset to the jail(8) root when processed, as an argument, the results are basically broken. There are several ways to fix this, and I've come here for opinions. 1) One can not use statfs(2) for '-t,' but stick with getmntinfo(3)'s info only. But it makes some sense to stick with statfs(2) for file aguments provided to df(1). This is fairly easy to implement. 2) One can remove the ability to use df(1) at all in a jail(8). It could be argued that there is no real reason to be able to use things like getfsstat(2) or statfs(2) in a jail(8) (but what else might this break?). This is easy to do. 3) One can fix getfstat(2) and statfs(2) so they are "jail(8)-aware." That is, getfstat(2) knows only to return info on filesystems mounted at or above the jail(8)'s root. Both calls learn how to offset their mountpoint names to the jail root. This is harder. And is anyone already working on this? -- Crist J. Clark | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message