Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Mar 2013 00:56:52 +0200
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Stanislav Sedov <stas@freebsd.org>, Attilio Rao <attilio@freebsd.org>, "Robert N. M. Watson" <rwatson@freebsd.org>, freebsd-hackers@freebsd.org
Subject:   Re: libprocstat(3): retrieve process command line args and environment
Message-ID:  <20130316225651.GB3534@gmail.com>
In-Reply-To: <20130316223339.GA3534@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> <20130316180915.GA91146@gmail.com> <20130316191605.GJ3794@kib.kiev.ua> <20130316223339.GA3534@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Mar 17, 2013 at 12:35:20AM +0200, Mikolaj Golub wrote:

> Ah, this is a thing I wanted to discuss but forgot! As I understand
> the idea of the 'ABI hack' is: if the output buffer is less than the
> size of data we have, truncate our data to the last successfully
> written kinfo_file structure and return without error.
> 
> In my code I do reset ENOMEM to 0 (see sysctl_kern_proc_filedesc), but
> I don't see a way how using sbuf interface I can truncate req->oldidx
> to the last successfully written file: sbuf_bcat() (to internal
> buffer) may be successful and the error might appear only later, when
> draining. I suspect it will break things if I return with a partial
> kinfo_file, but haven't come with a solution yet...

A solution I am going to try is to provide maxlen argument to
kern_proc_filedesc_out(), and if it is not 0, output files that do not
exceed the limit, so sysctl_kern_proc_filedesc would call:

  kern_proc_filedesc_out(p, &sb, req->oldlen);

-- 
Mikolaj Golub



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