On 07/27/2010 02:05 PM, Dhaval Giani wrote:
> On Tue, Jul 27, 2010 at 2:02 PM, Jan Safranek<[email protected]>  wrote:
>>
>>>>> +int cgroup_init(void)
>>>>> +{
>>>>> +     int ret = 0;
>>>>> +     int i;
>>>>> +
>>>>> +     pthread_rwlock_wrlock(&cg_mount_table_lock);
>>>>> +
>>>>> +     ret = cgroup_init_context(&cgroup_context);
>>>>> +
>>>>> +     if (ret)
>>>>> +             goto out;
>>>>> +
>>>>> +     /* Move everything from state into the global table
>>>>> +      * Once the changes are complte, this code goes away.
>>>>> +      * This is only for the APIs not converted yet.
>>>>> +      */
>>>>> +     cgroup_initialized = 1;
>>>>
>>>> I am not sure I understand this correctly... If these 4 patches are
>>>> accepted, will applications using cgroup_init work? It looks like they
>>>> could. Will applications using cgroup_init_context work? I have bad
>>>> feeling about it - if the comment above is correct, they probably wont,
>>>> because global cg_mount_table is not filled.
>>>>
>>>
>>> the code below does just that ;-). Though you are right, I should move
>>> this to after it being filled up.
>>>
>>>>> +
>>>>> +     for (i = 0; i<      cgroup_context->size; i++) {
>>>>> +             strcpy(cg_mount_table[i].name,
>>>>> cgroup_context->mount[i].name);
>>>>> +             strcpy(cg_mount_table[i].path,
>>>>> cgroup_context->mount[i].path);
>>>>> +     }
>>>
>>> It is being filled here right now.
>>
>> No, it's not. If you follow my question, the application uses
>> cgroup_init_context, not cgroup_init, so it never reaches this code. So the
>> tables are not filled and who knows what happens.
>>
>
> If you are using cgroup_init_context, you have a context. You always
> use that context. You are not expected to use a non context mechanism
> then.

But then I can't some functions from the API... e.g.
cgroup_attach_task_pid accesses global cg_mount_table.

jan

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to