From owner-freebsd-current@FreeBSD.ORG Wed Feb 4 15:47:16 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2747C11E for ; Wed, 4 Feb 2015 15:47:16 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC0B99BF for ; Wed, 4 Feb 2015 15:47:15 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-54-116-245.nwrknj.fios.verizon.net [173.54.116.245]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C8864B945; Wed, 4 Feb 2015 10:47:13 -0500 (EST) From: John Baldwin To: freebsd-current@freebsd.org Subject: Re: Filepaths in VM map for tmpfs files Date: Wed, 04 Feb 2015 10:15:04 -0500 Message-ID: <1601131.aIB9RoRbLs@ralph.baldwin.cx> User-Agent: KMail/4.14.2 (FreeBSD/10.1-STABLE; KDE/4.14.2; amd64; ; ) In-Reply-To: <20150203203336.GB42409@kib.kiev.ua> References: <54CCEFAB.9040406@badgerio.us> <54D0457E.90006@badgerio.us> <20150203203336.GB42409@kib.kiev.ua> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 04 Feb 2015 10:47:13 -0500 (EST) Cc: Konstantin Belousov , Eric Badger X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Feb 2015 15:47:16 -0000 On Tuesday, February 03, 2015 10:33:36 PM Konstantin Belousov wrote: > On Mon, Feb 02, 2015 at 09:50:22PM -0600, Eric Badger wrote: > > On 02/02/2015 03:30 AM, Konstantin Belousov wrote: > > > On Sun, Feb 01, 2015 at 08:38:29PM -0600, Eric Badger wrote: > > >> On 01/31/2015 09:36 AM, Konstantin Belousov wrote: > > >>> First, shouldn't the kve_type changed to KVME_TYPE_VNODE as well ? > > >> > > >> My thinking is no, because KVME_TYPE_SWAP is in fact the correct type; > > >> I'd opine that it is better to be transparent than make it look like > > >> there is an OBJT_VNODE object there. It may be that some programs would > > >> be confused by VNODE info returned on a SWAP type mapping, though I > > >> know > > >> that dtrace handles it OK. > > > > > > kve_vn_* and kve_path fields are defined only for KVME_TYPE_VNODE > > > kve_type. > > > So this is in fact a bug in whatever used the API to access kve_path > > > for KVE_TYPE_SWAP. > > > > Hmm, is that documented anywhere? I think it's fair to assume that > > kve_vn* applies only to the VNODE type, > > but I know there are several in-tree users that reference kve_path > > regardless of type (ostensibly relying > > on the default of an empty string). Maybe one could determine the > > validity of the kve_vn* fields by > > inspecting the kve_vn_type (not sure of all the consequences of that)? > > Or change it to KVME_TYPE_VNODE > > and deal with the below problem... > > There is no useful documentation for the kern.proc. sysctls. > My word (and statements from other involved developers) could be > considered as close to the truth as it can be. > Somebody taking the efforts to document the stuff would make very > valuable contribution. I think that kve_path should be valid for all types (e.g. shm_open() is not a vnode but has a pathname, and that should be fixed to display if possible). In the equivalent for files (kinfo_file), the pathname is type-independent and always valid. That said, I think tmpfs nodes should be exposed as files. It is an implementation detail of tmpfs that they are swap-backed, but from a user's perspective these are files, and if you want to expose other vnode-specific fields than just the path, KVME_TYPE_VNODE would be more correct. -- John Baldwin