[CRIU] [PATCH 5/5] userns: restore gid and uid maps
Pavel Emelyanov
xemul at parallels.com
Tue Feb 11 10:30:54 PST 2014
On 02/11/2014 05:13 PM, Andrew Vagin wrote:
> On Tue, Feb 11, 2014 at 08:50:35AM +0400, Pavel Emelyanov wrote:
>>> +static int write_id_map(pid_t pid, UidGidExtent **extents, int n, char *id_map)
>>> +{
>>> + char buf[PAGE_SIZE];
>>> + int off = 0, i;
>>> + int fd;
>>> +
>>> + for (i = 0; i < n; i++)
>>> + off += snprintf(buf + off, sizeof(buf) - off,
>>> + "%d %d %d", extents[i]->first,
>>> + extents[i]->lower_first,
>>> + extents[i]->count);
>>
>> Maybe use fopen_proc for that? This would avoid allocating
>> one more buffer on the stack.
>
> * We don't have fopen_proc_rw
> * {u,g}id_map files can be written only once
>
> so we can't use stream here.
OK. Write it in the code comment then.
More information about the CRIU
mailing list