From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 20 19:58:08 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 986832B6; Wed, 20 Feb 2013 19:58:08 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-we0-x22e.google.com (mail-we0-x22e.google.com [IPv6:2a00:1450:400c:c03::22e]) by mx1.freebsd.org (Postfix) with ESMTP id 2DDB9AE; Wed, 20 Feb 2013 19:58:07 +0000 (UTC) Received: by mail-we0-f174.google.com with SMTP id r6so6973396wey.5 for ; Wed, 20 Feb 2013 11:58:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=/9pYxqQ0ObQHe7L3/gTadKg22yepKNR25ZiUNP/IWH8=; b=NBK1GqcNV4y28gIveIMK9snpx7CWALXGasttg74136U1NFDsjOu5t64CrboQpVR3cY mrAyutEvThhVpJerigKJiOW82pyCvHTu06C0S0sxvzcmH+fAsut4MJQ/QamFX/vRxRuR GQv0YrJrBNVaSRKs8TsjOMg8edHcLg3MLjZ/KC7VJVoRF9vyWF6vtzz1t0UBUFHzyRR7 wlK2+W8j9clH/z372IDDvmH9v3o0WE7tSlUDnWDKqASajiiKcSemNOQjE43hTelsyM9q vKhe/VXdtpVBNdnFVMG27adN3NyCeb5FBoBPnKkJ6Re/jw0GW/B1+vDegO8LS6h8FnQj B/ww== X-Received: by 10.194.19.97 with SMTP id d1mr36281752wje.52.1361390286278; Wed, 20 Feb 2013 11:58:06 -0800 (PST) Received: from localhost ([178.150.115.244]) by mx.google.com with ESMTPS id bj9sm33176224wib.4.2013.02.20.11.58.04 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 20 Feb 2013 11:58:05 -0800 (PST) Sender: Mikolaj Golub Date: Wed, 20 Feb 2013 21:58:02 +0200 From: Mikolaj Golub To: John Baldwin Subject: Re: libprocstat(3): retrieve process command line args and environment Message-ID: <20130220195801.GA8679@gmail.com> References: <20130119151253.GB88025@gmail.com> <201301251531.43540.jhb@freebsd.org> <20130212215054.GA9839@gmail.com> <201302200904.15324.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201302200904.15324.jhb@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Stanislav Sedov , Kostik Belousov , "Robert N. M. Watson" , Attilio Rao , freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2013 19:58:08 -0000 On Wed, Feb 20, 2013 at 09:04:14AM -0500, John Baldwin wrote: > The process should be stopped by the time we dump a core, so running it > multiple times should be ok in that the sizes should not change. I would > say that you should try to implement a "determine sizes" pass that doesn't > allocate anything, but others should comment on that. I had a little talk with kib about this recently. Kib's main concern looked to be that a process with many threads/open files might require considerable amount of kernel memory if the procstat notes are prepared in memory before writing. So currently I am working on another approach, when on the first pass the sizes are found, and on the second pass procstat notes are written to coredump without preliminarily storing all notes in memory buffer. Hope, the code won't look very ugly... > One other thing to consider is if gcore needs to be updated to output these > records as well. It could use the sysctls to fetch the data and then write > out appropriate notes I think, so perhaps it wouldn't be too difficult to add > this as a followup commit once the kernel version has settled and the file > format is set? Looks like very interesting idea! Thank you for all your comments and suggestions. -- Mikolaj Golub