Commit d2f505f5 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

restore: Add some more comments

Add comments on real_pid member and pipe users counters.
Reported-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
parent 8b122598
...@@ -36,6 +36,14 @@ struct fmap_fd { ...@@ -36,6 +36,14 @@ struct fmap_fd {
int 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 { struct shmem_info {
unsigned long start; unsigned long start;
unsigned long end; unsigned long end;
...@@ -914,7 +922,11 @@ static int create_pipe(int pid, struct pipe_entry *e, struct pipe_info *pi, int ...@@ -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->write_fd = pfd[1];
pi->real_pid = getpid(); 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)) if (pipe_is_rw(pi))
minusers = 2; minusers = 2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment