[libvirt] [PATCH 1/1] lxc: use our own hand-rolled code in place of unlockpt and grantpt

Eric Blake eblake at redhat.com
Mon Oct 17 14:32:45 UTC 2011


On 10/17/2011 07:26 AM, Serge E. Hallyn wrote:
> Quoting Eli Qiao (taget at linux.vnet.ibm.com):
>> hi Serge :
>
> Thanks for taking a look.
>
>>      I checked the code ,  only in lxc_controller.c call virFileOpenTtyAt().
>>      I didn't test the path, but my suggestion is that modify the
>> utility function in /src/util/util.c instead of adding a new
>> function.
>
> But virFileOpenTtyAt() is called by virFileOpenTty() in the same
> file.  So we really do want a new function using its own versions of
> grantpt+unlockpt, because I think that, when we can, we want to continue
> using the glibc versions.
>
> So the safe approach seemed to me to be: put the container-specific
> code into src/lxc/lxc_controller.c, then (in a separate patch) just fold
> virFileOpenTtyAt(), straight into virFileOpenTty().

Correct - my intent was that we have:

src/util/util.c: virFileOpenTty() - generally useful by any driver, uses 
glibc, and also should use posix_openpt rather than than 
open("/dev/ptmx") for portability (gnulib provides posix_openpt). 
Completely ditch virFileOpenTtyAt() by inlining it back to 
virFileOpenTty(), and since no one could use what virFileOpenTtyAt() 
claimed to provide except in the portable case where virFileOpenTty() 
was sufficient.

src/lxc/lxc_controller.c - LXC-specific function that uses ioctl() 
instead of glibc for opening a private tty.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list