From d2f505f52c3760ae2d5a1ec52870ece9c10015cb Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Thu, 13 Oct 2011 17:31:52 +0400 Subject: [PATCH] restore: Add some more comments Add comments on real_pid member and pipe users counters. Reported-by: Pavel Emelyanov Signed-off-by: Cyrill Gorcunov --- cr-restore.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cr-restore.c b/cr-restore.c index e1caf6896..9284498ba 100644 --- a/cr-restore.c +++ b/cr-restore.c @@ -36,6 +36,14 @@ struct fmap_fd { int fd; }; +/* + * Some shared memory entries and pipe entries are created + * only in one process and got shared by others. Because of + * this the real_pid member is used. It serves like a synchronization + * point -- the process which creates a particular entity does set + * real_pid member and all other users do wait until this member is set. + */ + struct shmem_info { unsigned long start; unsigned long end; @@ -914,7 +922,11 @@ static int create_pipe(int pid, struct pipe_entry *e, struct pipe_info *pi, int pi->write_fd = pfd[1]; pi->real_pid = getpid(); - /* The process used both pipe ends */ + /* + * FIXME: xemul@ reported that this actually + * would not work if a task keeps pipe many times + * not just two. Need to review and fix propery. + */ if (pipe_is_rw(pi)) minusers = 2;