2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

files: Formalize fd restore priorities

There are places when we have to select which fd to ->open
and which to ->receive. To avoid deadlocks we sort them in
an ascending order on { pid, fd } pair.

Make this idea more formal by introducing an explicit function
doing this check and call it where appropriate (pipe.c master
selection is also simplified to fit new ... API).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2012-09-14 22:09:22 +04:00
parent a0560c4298
commit 8fc6dbfadd
4 changed files with 13 additions and 14 deletions

3
tty.c
View File

@@ -670,8 +670,7 @@ static void tty_setup_orphan_slavery(void)
* waiting for each other.
*/
b = file_master(&peer->d);
if (a->pid > b->pid ||
(a->pid == b->pid && a->fe->fd > b->fe->fd)) {
if (fdinfo_rst_prio(b, a)) {
a = b;
m = peer;
}