[CRIU] [PATCH] proc: read all data from /proc/pid/task/tid/children

Pavel Emelyanov xemul at parallels.com
Mon Oct 26 08:55:48 PDT 2015


On 10/26/2015 06:51 PM, Andrew Vagin wrote:
> On Mon, Oct 26, 2015 at 06:41:13PM +0300, Pavel Emelyanov wrote:
>> On 10/26/2015 04:49 PM, Andrey Vagin wrote:
>>> From: Andrew Vagin <avagin at openvz.org>
>>>
>>> Currently we read only 4096 bytes (the size of buf).
>>>
>>> Signed-off-by: Andrew Vagin <avagin at openvz.org>
>>> ---
>>>  proc_parse.c | 31 ++++++++++++++-----------------
>>>  1 file changed, 14 insertions(+), 17 deletions(-)
>>>
>>> diff --git a/proc_parse.c b/proc_parse.c
>>> index 75ca682..bd6f023 100644
>>> --- a/proc_parse.c
>>> +++ b/proc_parse.c
>>> @@ -2145,40 +2145,37 @@ int parse_children(pid_t pid, pid_t **_c, int *_n)
>>>  		return -1;
>>>  
>>>  	while ((de = readdir(dir))) {
>>> -		int fd, len;
>>> -		char *pos;
>>> +		FILE *f;
>>>  
>>>  		if (dir_dots(de))
>>>  			continue;
>>>  
>>> -		fd = open_proc(pid, "task/%s/children", de->d_name);
>>> -		if (fd < 0)
>>> +		f = fopen_proc(pid, "task/%s/children", de->d_name);
>>
>> Please, use bfd engine for this.
> 
> I use fscanf(), can I use it with bfd?

fscanf no, check proc_parse() how it's done using sscanf.

-- Pavel



More information about the CRIU mailing list