On Saturday, January 19, 2013 10:12:54 am Mikolaj Golub wrote: > Hi, > > Some time ago Stanislav Sedov suggested to me extending libprocstat(3) > with functions to retrieve process command line arguments and > environment variables. > > In the first approach I tried, the newly added functions > procstat_getargv/getenvv allocated a buffer of necessary size, stored > the values and returned to the caller: > > http://people.freebsd.org/~trociny/libprocstat.1.patch > > The problem with this approach was that when I updated procstat(1) to > use this interface, I observed noticeable performance degradation > (about 30% on systems with MALLOC_PRODUCTION off), due to memory > allocation overhead: the original procstat(1) reuses the buffer for > all its retrievals. > > So my second approach was to add internal buffers to struct procstat, > which are used by procstat_getargv/getenvv to store values and reused > on the subsequent call: > > http://people.freebsd.org/~trociny/libprocstat.2.patch > > The drawback of this approach is that a user has to take care and > remember that a subsequent call rewrites argument vector obtained from > the previous call. On the other hand this is ok for typical use cases > while does not add allocation overhead, so I like this approach more. > > I would like to commit this second patch, if there are no objections > or suggestions how to improve the things.
How is this different from kvm_getargv()? It seems to be a direct copy. -- John Baldwin _______________________________________________ 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"