On 05/11/2011 07:09 AM, Daniel P. Berrange wrote:
On Thu, May 05, 2011 at 04:33:06PM -0600, Eric Blake wrote:
> On 05/05/2011 11:26 AM, Daniel P. Berrange wrote:
>> Introduce a new API in libvirt-qemu.so
>>
>> virDomainPtr virDomainQemuAttach(virConnectPtr domain,
>> int pid,
>> unsigned int flags);
>
> Do we want pid_t instead of pid? Or are we guaranteed that this only
> works on platforms with /proc/nnn, and that all such platforms already
> have sizeof(pid_t)<=sizeof(int)?
I didn't want to use pid_t, since that doesn't exist on Windows
and we can't assume app developers are using gnulib for portability.
Ah, I see - while pid_t is fine internally to libvirt, it is not a good
idea to expose it in a public header since we can't expose gnulib's
substitute types.
We may want to add a verify(sizeof(pid_t) <= sizeof(int)) somewhere in
our source code, to ensure we get a compile error if our assumption is
ever violated.
Does anything think is it remotely likely that any common
platform will use a 64-bit PID ? I'm sceptical,
As am I.
Using 'int' should be fine, then.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org