Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Mar 2013 20:09:16 +0200
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        John Baldwin <jhb@freebsd.org>
Cc:        Stanislav Sedov <stas@freebsd.org>, Kostik Belousov <kib@freebsd.org>, "Robert N. M. Watson" <rwatson@freebsd.org>, Attilio Rao <attilio@freebsd.org>, freebsd-hackers@freebsd.org
Subject:   Re: libprocstat(3): retrieve process command line args and environment
Message-ID:  <20130316180915.GA91146@gmail.com>
In-Reply-To: <20130220195801.GA8679@gmail.com>
References:  <20130119151253.GB88025@gmail.com> <201301251531.43540.jhb@freebsd.org> <20130212215054.GA9839@gmail.com> <201302200904.15324.jhb@freebsd.org> <20130220195801.GA8679@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 20, 2013 at 09:58:02PM +0200, Mikolaj Golub wrote:
> 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...

Here is an updated patch:

http://people.freebsd.org/~trociny/procstat_core.2.patch

- The coredump routines are modified to be able to write notes
directly to a core file, via sbuf interface, without preliminary
preparing them all in a memory buffer.

- To write NT_PROCSTAT_* notes, the corresponding sysctl routines are
changed to provide kern_proc_filedesc_out(), kern_proc_kstack_out(),
kern_proc_out(), and kern_proc_vmmap_out() functions.

- libprocstat(3) is extended to extract procstat notes from a process
core file. Also new functions (procstat_getvmmap, procstat_kstack) are
added.

- procstat(1) is changed to use libprocstat(3) where it is possible
and to treat non-numeric command line arguments as core files.

-- 
Mikolaj Golub



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130316180915.GA91146>