From owner-freebsd-current@FreeBSD.ORG Thu Nov 19 14:40:04 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DEE41065694; Thu, 19 Nov 2009 14:40:04 +0000 (UTC) (envelope-from rwatson@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 241808FC22; Thu, 19 Nov 2009 14:40:04 +0000 (UTC) Received: from lemongrass.sec.cl.cam.ac.uk (lemongrass.sec.cl.cam.ac.uk [128.232.18.47]) by cyrus.watson.org (Postfix) with ESMTPSA id 4C11C46B06; Thu, 19 Nov 2009 09:40:03 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii From: "Robert N. M. Watson" In-Reply-To: <3bbf2fe10911190545l264c0e2s615034999f46bc0a@mail.gmail.com> Date: Thu, 19 Nov 2009 14:40:01 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <645CAAD7-A3BE-44B3-97D5-F4E4786943A4@freebsd.org> References: <3bbf2fe10911160718j7784b311g2980aa02c79bc9ec@mail.gmail.com> <20091117141713.GA51251@sandvine.com> <9C740225-CB30-4D26-8E4B-F9D5DC51B899@FreeBSD.org> <3bbf2fe10911181733j598083feiddf3d4b34d0007d6@mail.gmail.com> <3bbf2fe10911190545l264c0e2s615034999f46bc0a@mail.gmail.com> To: Attilio Rao X-Mailer: Apple Mail (2.1077) Cc: freebsd-current@freebsd.org, Ed Maste Subject: Re: [PATCH] Let gcore use ptrace interface rather than the procfs X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 19 Nov 2009 14:40:04 -0000 On 19 Nov 2009, at 13:45, Attilio Rao wrote: >> If you add the missing include of sys/wait.h, elfcore.c generates an = error >> instead of a warning on this non-traditional use of wait(2): >>=20 >> + wait(); >>=20 >> Something like this may be preferred: >>=20 >> if (waitpid(pid, NULL, 0) < 0) >> err(1, "waitpid"); >=20 > I didn't get a warning neither an error but yes, the waitpid() is > preferred and should be used. This warning was on i386 9.x, FYI, and was a property of failing to call = wait(2) with an argument. >> I think that kills the last of the procfs dependencies, in which case >> perhaps we can remove the procfs.h include from elfcore.c, which = requires >> defining a local version of a summary data structure borrowed from = procfs. >> It's worth trying with procfs unmounted, however, to make sure = they're >> really all gone (which is how I ran into the above problem). >=20 > I don't like the idea to replicate the structures because of code > maintence. IMHO is ok to have procfs header. I'm not sure I agree; looking at the elfcore code, it looks like it goes = to some amount of inconvenience to stuff things into the structure in = the first place, primarily because that was how procfs exported it. With = your excellent change, there's no need for gcore(1) to depend on = procfs-specific data structures that may change, or more ideally, be = removed in the future. Robert=