On 05/02/2013 06:07 AM, Daniel P. Berrange wrote:
On Thu, May 02, 2013 at 01:03:41PM +0100, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange(a)redhat.com>
>
> Since PIDs can be reused, polkit prefers to be given
> a (PID,start time) pair. If given a PID on its own,
> it will attempt to lookup the start time in /proc/pid/stat,
> though this is subject to races.
>
> It is safer if the client app resolves the PID start
> time itself, because as long as the app has the client
> socket open, the client PID won't be reused.
>
> Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
> +#elif defined(__FreeBSD__)
> +int virProcessGetStartTime(pid_t pid,
> + unsigned long long *timestamp)
Note this BSD specific code block has not even been compile tested.
It is just copied from the polkit codebase with minimal conversion
to libvirt standards.
I've compile-tested it on FreeBSD (well, I had to do some conflict
resolution in virstring to get this patch to apply, so I hope that when
you rebase, that you end up doing the same resolution - but the
conflicts didn't affect the BSD section of virprocess.c). It didn't
quite work:
util/virprocess.c: In function 'virProcessGetStartTime':
util/virprocess.c:850: error: incompatible type for argument 3 of 'sysctl'
I think you want to pass &p, not p, as the third argument (at least,
doing that cleared up compilation for me, although I don't know how to
test that the compiled result actually worked).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org