From owner-svn-src-projects@FreeBSD.ORG Wed Jun 24 22:43:53 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A41201065677 for ; Wed, 24 Jun 2009 22:43:53 +0000 (UTC) (envelope-from ulf.lilleengen@gmail.com) Received: from mail-ew0-f213.google.com (mail-ew0-f213.google.com [209.85.219.213]) by mx1.freebsd.org (Postfix) with ESMTP id 2AB168FC16 for ; Wed, 24 Jun 2009 22:43:52 +0000 (UTC) (envelope-from ulf.lilleengen@gmail.com) Received: by ewy9 with SMTP id 9so378220ewy.43 for ; Wed, 24 Jun 2009 15:43:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :user-agent:cc:references:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:message-id; bh=853NJMIeXeQmWePoRofODI22zt5MmKA6SkgHEl5cVUU=; b=hKzBE4gPHQu/vN1lt4Bp7QBez9POrU58K7jnHfVpaL0Q8duuDTU4LVCrTdtI4hgnBU UO86OEue22E7eb1VpyfwpOc9/GCY6fyEYcoFGoGztEtDYEcW4C2dUDd31pmOIzG0CPsF Qejmly7sfO+tBTUzG01TJHUYUeiWHN8M+PbXo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:message-id; b=F1BGOyHVlgtZNo6CkxmBnBYmI9DTf23G6kYKErUbqH7gfN4VoO9AN4FQj6paeMTWCG YBk9QdQDR/RWRBm3eqO1Zg/5VETJZ4ZbBzJRbeg//LMwsbALr0uVeMyxfJQABu2oYWr8 +oGfvDURWYXxVSEys+j3ImD6+O7q11japsF+A= Received: by 10.210.65.16 with SMTP id n16mr1174951eba.23.1245882095418; Wed, 24 Jun 2009 15:21:35 -0700 (PDT) Received: from carrot.geeknest.org (z032069.its-s.tudelft.nl [145.94.32.69]) by mx.google.com with ESMTPS id 7sm348442eyb.25.2009.06.24.15.21.34 (version=SSLv3 cipher=RC4-MD5); Wed, 24 Jun 2009 15:21:34 -0700 (PDT) From: Ulf Lilleengen To: Bruce Evans Date: Thu, 25 Jun 2009 00:21:45 +0200 User-Agent: KMail/1.11.4 (FreeBSD/8.0-CURRENT; KDE/4.2.4; i386; ; ) References: <200906241544.n5OFi43Q019124@svn.freebsd.org> <200906241204.51117.jhb@freebsd.org> <20090625052324.I33482@delplex.bde.org> In-Reply-To: <20090625052324.I33482@delplex.bde.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906250021.46249.lulf@freebsd.org> Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194847 - projects/libprocstat/sys/sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 22:43:54 -0000 On Wednesday 24 June 2009 21:45:43 Bruce Evans wrote: > On Wed, 24 Jun 2009, John Baldwin wrote: > > On Wednesday 24 June 2009 11:44:04 am Ulf Lilleengen wrote: > > ========================================================================= > >===== > > > >> --- projects/libprocstat/sys/sys/user.h Wed Jun 24 15:41:21 > >> 2009 (r194846) +++ projects/libprocstat/sys/sys/user.h Wed Jun 24 > >> 15:44:04 2009 (r194847) @@ -312,6 +312,7 @@ struct kinfo_ofile { > >> > >> struct kinfo_file { > >> int kf_structsize; /* Variable size of record. */ > >> + uint16_t kf_status; /* Status flags. */ > >> int kf_type; /* Descriptor type. */ > >> int kf_fd; /* Array index. */ > >> int kf_ref_count; /* Reference count. */ *** SNIP *** > > >> int _kf_ispare[9]; /* Space for more stuff. */ > > Back to normal indentation. The indentation was fixed in the next commit, as i wanted to handle that in a separate commit. > > >> /* Truncated before copyout in sysctl */ > >> char kf_path[PATH_MAX]; /* Path to file, if any. */ > > > > You probably don't want to add kf_status where you did as it disturbs the > > ABI of all the fields after it. New fields should be added in the spare > > region. Given that mode_t is 16-bits I would just stick it next to > > kf_file_mode. > > Also, almost everything is disordered on size (really alignment). This > seems to break any possibility of the structs having the same size for > amd64 and i386 like the size macro still says they have: > - padding might be needed on amd64 only after "dev_t kf_file_fsid;", > depending on whether this field ends at a 32-bit or 64-bit boundary. > - "uint64_t kf_file_fileid;" gives maximal alignment on both amd64 and > i386, so the padding for the next few fields is clear: > - "mode_t kf_file_mode;" has size 16 bits and "off_t kf_file_size;" has > size 64 bits and maximal alignment requirements, so between these fields > there is 48 bits of padding on amd64 and 16 bits of padding on i386. > - "off_t kf_file_size;" has size 64 and gives maximal alignment again > - "dev_t kf_file_rdev;" has size 32 bits > - "mode_t kf_file_mode;" has size 16 bits and "int _kf_ispare[9];" has > alignment 32 bits, so between these fields there is 16 bits of padding > on both amd64 and i386. Unlike the previous padding, this is > sufficiently MD, but it is still wasteful. The mode_t's should be packed > together. > How about packing them like this: dev_t kf_file_fsid; /* Vnode filesystem id. */ dev_t kf_file_rdev; /* File device. */ 64 uint64_t kf_file_fileid; /* Global file id. */ 64 off_t kf_file_size; /* File size. */ 64 mode_t kf_file_mode; /* File mode. */ uint16_t kf_status; /* Status flags. */ 32 spare[9] Seems good? -- Ulf Lilleengen