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 _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"