Commit a434e7f0 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

crtools: move pid_rst_prio to pid.h

crtools.h is too heavy to be included in many sources
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 72727bb3
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "ipc_ns.h" #include "ipc_ns.h"
#include "pstree.h" #include "pstree.h"
#include "cr-show.h" #include "cr-show.h"
#include "crtools.h"
#include "protobuf.h" #include "protobuf.h"
#include "protobuf/pstree.pb-c.h" #include "protobuf/pstree.pb-c.h"
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "fdset.h" #include "fdset.h"
#include "eventfd.h" #include "eventfd.h"
#include "proc_parse.h" #include "proc_parse.h"
#include "crtools.h"
#include "image.h" #include "image.h"
#include "util.h" #include "util.h"
#include "log.h" #include "log.h"
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "rst_info.h" #include "rst_info.h"
#include "eventpoll.h" #include "eventpoll.h"
#include "proc_parse.h" #include "proc_parse.h"
#include "crtools.h"
#include "image.h" #include "image.h"
#include "util.h" #include "util.h"
#include "log.h" #include "log.h"
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
#include "crtools.h"
#include "fdset.h" #include "fdset.h"
#include "image.h" #include "image.h"
#include "files.h" #include "files.h"
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include <sys/un.h> #include <sys/un.h>
#include <stdlib.h> #include <stdlib.h>
#include "crtools.h"
#include "files.h" #include "files.h"
#include "file-ids.h" #include "file-ids.h"
#include "files-reg.h" #include "files-reg.h"
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "fsnotify.h" #include "fsnotify.h"
#include "proc_parse.h" #include "proc_parse.h"
#include "syscall.h" #include "syscall.h"
#include "crtools.h"
#include "mount.h" #include "mount.h"
#include "image.h" #include "image.h"
#include "util.h" #include "util.h"
......
#include <unistd.h> #include <unistd.h>
#include <stdarg.h> #include <stdarg.h>
#include "crtools.h"
#include "cr_options.h" #include "cr_options.h"
#include "fdset.h" #include "fdset.h"
#include "image.h" #include "image.h"
......
...@@ -23,16 +23,6 @@ int convert_to_elf(char *elf_path, int fd_core); ...@@ -23,16 +23,6 @@ int convert_to_elf(char *elf_path, int fd_core);
int cr_check(void); int cr_check(void);
int cr_exec(int pid, char **opts); int cr_exec(int pid, char **opts);
/*
* When we have to restore a shared resource, we mush select which
* task should do it, and make other(s) wait for it. In order to
* avoid deadlocks, always make task with lower pid be the restorer.
*/
static inline bool pid_rst_prio(unsigned pid_a, unsigned pid_b)
{
return pid_a < pid_b;
}
void restrict_uid(unsigned int uid, unsigned int gid); void restrict_uid(unsigned int uid, unsigned int gid);
struct proc_status_creds; struct proc_status_creds;
bool may_dump(struct proc_status_creds *); bool may_dump(struct proc_status_creds *);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "lock.h" #include "lock.h"
#include "list.h" #include "list.h"
#include "image.h" #include "image.h"
#include "crtools.h" #include "pid.h"
#include "protobuf/fdinfo.pb-c.h" #include "protobuf/fdinfo.pb-c.h"
#include "protobuf/fown.pb-c.h" #include "protobuf/fown.pb-c.h"
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "compiler.h" #include "compiler.h"
#include "servicefd.h"
#include "image-desc.h" #include "image-desc.h"
#include "magic.h" #include "magic.h"
......
#ifndef __CR_PID_H__ #ifndef __CR_PID_H__
#define __CR_PID_H__ #define __CR_PID_H__
#include "stdbool.h"
struct pid { struct pid {
/* /*
* The @real pid is used to fetch tasks during dumping stage, * The @real pid is used to fetch tasks during dumping stage,
...@@ -17,4 +19,14 @@ struct pid { ...@@ -17,4 +19,14 @@ struct pid {
pid_t virt; pid_t virt;
}; };
/*
* When we have to restore a shared resource, we mush select which
* task should do it, and make other(s) wait for it. In order to
* avoid deadlocks, always make task with lower pid be the restorer.
*/
static inline bool pid_rst_prio(unsigned pid_a, unsigned pid_b)
{
return pid_a < pid_b;
}
#endif #endif
#ifndef __CR_SERVICE_FD_H__ #ifndef __CR_SERVICE_FD_H__
#define __CR_SERVICE_FD_H__ #define __CR_SERVICE_FD_H__
#include <stdbool.h>
enum sfd_type { enum sfd_type {
SERVICE_FD_MIN, SERVICE_FD_MIN,
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/mman.h> #include <sys/mman.h>
#include "crtools.h"
#include "fdset.h" #include "fdset.h"
#include "image.h" #include "image.h"
#include "files.h" #include "files.h"
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "asm/types.h" #include "asm/types.h"
#include "list.h" #include "list.h"
#include "util.h" #include "util.h"
#include "crtools.h"
#include "mount.h" #include "mount.h"
#include "cpu.h" #include "cpu.h"
#include "file-lock.h" #include "file-lock.h"
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include <sys/resource.h> #include <sys/resource.h>
#include <sys/wait.h> #include <sys/wait.h>
#include "crtools.h"
#include "compiler.h" #include "compiler.h"
#include "asm/types.h" #include "asm/types.h"
#include "util.h" #include "util.h"
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <stdlib.h> #include <stdlib.h>
#include "pid.h"
#include "shmem.h" #include "shmem.h"
#include "image.h" #include "image.h"
#include "crtools.h"
#include "page-pipe.h" #include "page-pipe.h"
#include "page-xfer.h" #include "page-xfer.h"
#include "rst-malloc.h" #include "rst-malloc.h"
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "asm/types.h" #include "asm/types.h"
#include "signalfd.h" #include "signalfd.h"
#include "proc_parse.h" #include "proc_parse.h"
#include "crtools.h"
#include "fdset.h" #include "fdset.h"
#include "image.h" #include "image.h"
#include "util.h" #include "util.h"
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <poll.h> #include <poll.h>
#include "crtools.h"
#include "fdset.h" #include "fdset.h"
#include "files.h" #include "files.h"
#include "sockets.h" #include "sockets.h"
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "fdset.h" #include "fdset.h"
#include "image.h" #include "image.h"
#include "servicefd.h" #include "servicefd.h"
#include "crtools.h"
#include "cr_options.h" #include "cr_options.h"
#include "util.h" #include "util.h"
#include "util-pie.h" #include "util-pie.h"
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "util-pie.h" #include "util-pie.h"
#include "sk-packet.h" #include "sk-packet.h"
#include "namespaces.h" #include "namespaces.h"
#include "crtools.h"
#include "net.h" #include "net.h"
#ifndef NETLINK_SOCK_DIAG #ifndef NETLINK_SOCK_DIAG
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#include "asm/atomic.h" #include "asm/atomic.h"
#include "protobuf.h" #include "protobuf.h"
#include "stats.h" #include "stats.h"
#include "crtools.h"
#include "image.h" #include "image.h"
#include "protobuf/stats.pb-c.h" #include "protobuf/stats.pb-c.h"
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include <string.h> #include <string.h>
#include "util.h" #include "util.h"
#include "crtools.h"
#include "syscall.h" #include "syscall.h"
#include "namespaces.h" #include "namespaces.h"
#include "sysctl.h" #include "sysctl.h"
......
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