[CRIU] Re: [PATCH cr 03/12] pipe: all pipes are seved in one file
Andrew Vagin
avagin at parallels.com
Thu Apr 5 08:03:57 EDT 2012
On Thu, Apr 05, 2012 at 03:57:10PM +0400, Pavel Emelyanov wrote:
> On 04/05/2012 03:47 PM, Andrey Vagin wrote:
> >
> > Information about pipe's file structs saved in one global file and
> > fdinfo_entry is saved for each descriptor
> >
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> > cr-dump.c | 203 ++++++++++++++++++++++++++---------------------------
> > cr-show.c | 4 +-
> > include/crtools.h | 4 +-
> > include/image.h | 5 +-
> > 4 files changed, 108 insertions(+), 108 deletions(-)
> >
>
> > + if (!(p->flags & O_WRONLY) && i == nr_pipes) {
> > + pipes[nr_pipes] = p->id;
> > + nr_pipes++;
> > + if (nr_pipes > PIPES_SIZE) {
> > + pr_err("OOM storing pipe\n");
> > + return -1;
> > + }
> > + } else
>
> > + pipes = xmalloc(PIPES_SIZE);
> > + if (!pipes)
> > + goto err;
> >
>
> PIPES_SIZE is the number of bytes, but you check for overflow
> by comparing number of items with it.
Yes, it's my bug.
>
> > + for (i = 0; i < nr_pipes; i++)
> > + if (pipes[i] == p->id)
> > + break;
> > +
> > + if (!(p->flags & O_WRONLY) && i == nr_pipes) {
>
> O_o write ends of pipes do not happen to be in this array? What is it for?
It's for dumping data.
>
> > + pipes[nr_pipes] = p->id;
> > + nr_pipes++;
> > + if (nr_pipes > PIPES_SIZE) {
> > + pr_err("OOM storing pipe\n");
> > + return -1;
> > + }
> > + } else
> > + goto dump;
>
More information about the CRIU
mailing list