[libvirt] [PATCHv2 10/27] lxc: reject unknown flags

Eric Blake eblake at redhat.com
Wed Jul 13 20:43:11 UTC 2011


On 07/13/2011 06:21 AM, Matthias Bolte wrote:
> 2011/7/8 Eric Blake <eblake at redhat.com>:
>> * src/lxc/lxc_driver.c (lxcOpen, lxcDomainSetMemoryParameters)
>> (lxcDomainGetMemoryParameters): Reject unknown flags.
>> * src/lxc/lxc_container.c (lxcContainerStart): Use unsigned flags.
>> @@ -889,7 +889,7 @@ int lxcContainerStart(virDomainDefPtr def,
>>                       char *ttyPath)
>>  {
>>     pid_t pid;
>> -    int flags;
>> +    unsigned int flags;
> 
> flags is passed to clone that takes int, so rename this to cflags (in
> line with oflags and fflags) and keep it as int.
> 
> ACK, with the clone flags as int.

Good idea.  I squashed this in, then pushed 9 and 10 (8 will be saved
for my round 3 posting, since you had more comments on the esx migration
flag handling).

Slowly making my way through this series...

diff --git i/src/lxc/lxc_container.c w/src/lxc/lxc_container.c
index ffa2f34..8e1860b 100644
--- i/src/lxc/lxc_container.c
+++ w/src/lxc/lxc_container.c
@@ -889,7 +889,7 @@ int lxcContainerStart(virDomainDefPtr def,
                       char *ttyPath)
 {
     pid_t pid;
-    unsigned int flags;
+    int cflags;
     int stacksize = getpagesize() * 4;
     char *stack, *stacktop;
     lxc_child_argv_t args = { def, nveths, veths, control, ttyPath,
@@ -902,19 +902,19 @@ int lxcContainerStart(virDomainDefPtr def,
     }
     stacktop = stack + stacksize;

-    flags = CLONE_NEWPID|CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|SIGCHLD;
+    cflags = CLONE_NEWPID|CLONE_NEWNS|CLONE_NEWUTS|CLONE_NEWIPC|SIGCHLD;

     if (userns_supported()) {
         VIR_DEBUG("Enable user namespaces");
-        flags |= CLONE_NEWUSER;
+        cflags |= CLONE_NEWUSER;
     }

     if (def->nets != NULL) {
         VIR_DEBUG("Enable network namespaces");
-        flags |= CLONE_NEWNET;
+        cflags |= CLONE_NEWNET;
     }

-    pid = clone(lxcContainerChild, stacktop, flags, &args);
+    pid = clone(lxcContainerChild, stacktop, cflags, &args);
     VIR_FREE(stack);
     VIR_DEBUG("clone() completed, new container PID is %d", pid);



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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110713/aeae12ee/attachment-0001.sig>


More information about the libvir-list mailing list