diff --git a/cr-show.c b/cr-show.c index 9a1982bcb..6736ae6ce 100644 --- a/cr-show.c +++ b/cr-show.c @@ -25,6 +25,7 @@ #include "ipc_ns.h" #include "pstree.h" #include "cr-show.h" +#include "crtools.h" #include "protobuf.h" #include "protobuf/pstree.pb-c.h" diff --git a/eventfd.c b/eventfd.c index 2f7f124eb..d4e7bf826 100644 --- a/eventfd.c +++ b/eventfd.c @@ -17,7 +17,6 @@ #include "fdset.h" #include "eventfd.h" #include "proc_parse.h" -#include "crtools.h" #include "image.h" #include "util.h" #include "log.h" diff --git a/eventpoll.c b/eventpoll.c index fa5003aa5..d82c19eff 100644 --- a/eventpoll.c +++ b/eventpoll.c @@ -18,7 +18,6 @@ #include "rst_info.h" #include "eventpoll.h" #include "proc_parse.h" -#include "crtools.h" #include "image.h" #include "util.h" #include "log.h" diff --git a/fifo.c b/fifo.c index f3c29de81..67d7f569d 100644 --- a/fifo.c +++ b/fifo.c @@ -4,7 +4,6 @@ #include #include -#include "crtools.h" #include "fdset.h" #include "image.h" #include "files.h" diff --git a/files.c b/files.c index 0dd1b9f55..3960ee99c 100644 --- a/files.c +++ b/files.c @@ -13,8 +13,6 @@ #include #include -#include "crtools.h" - #include "files.h" #include "file-ids.h" #include "files-reg.h" diff --git a/fsnotify.c b/fsnotify.c index 793446e76..d0da4fd1b 100644 --- a/fsnotify.c +++ b/fsnotify.c @@ -27,7 +27,6 @@ #include "fsnotify.h" #include "proc_parse.h" #include "syscall.h" -#include "crtools.h" #include "mount.h" #include "image.h" #include "util.h" diff --git a/image.c b/image.c index b244cf3f5..c4547672f 100644 --- a/image.c +++ b/image.c @@ -1,5 +1,6 @@ #include #include +#include "crtools.h" #include "cr_options.h" #include "fdset.h" #include "image.h" diff --git a/include/crtools.h b/include/crtools.h index bd8fac384..de35738d5 100644 --- a/include/crtools.h +++ b/include/crtools.h @@ -23,16 +23,6 @@ int convert_to_elf(char *elf_path, int fd_core); int cr_check(void); 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); struct proc_status_creds; bool may_dump(struct proc_status_creds *); diff --git a/include/files.h b/include/files.h index 5b65bd7bf..4728ff14c 100644 --- a/include/files.h +++ b/include/files.h @@ -6,7 +6,7 @@ #include "lock.h" #include "list.h" #include "image.h" -#include "crtools.h" +#include "pid.h" #include "protobuf/fdinfo.pb-c.h" #include "protobuf/fown.pb-c.h" diff --git a/include/image.h b/include/image.h index f38a51b0a..00d2e4512 100644 --- a/include/image.h +++ b/include/image.h @@ -4,6 +4,7 @@ #include #include "compiler.h" +#include "servicefd.h" #include "image-desc.h" #include "magic.h" diff --git a/include/pid.h b/include/pid.h index 42a2b7e52..18a6dfa28 100644 --- a/include/pid.h +++ b/include/pid.h @@ -1,6 +1,8 @@ #ifndef __CR_PID_H__ #define __CR_PID_H__ +#include "stdbool.h" + struct pid { /* * The @real pid is used to fetch tasks during dumping stage, @@ -17,4 +19,14 @@ struct pid { 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 diff --git a/include/servicefd.h b/include/servicefd.h index 699d26ebf..85526b091 100644 --- a/include/servicefd.h +++ b/include/servicefd.h @@ -1,6 +1,8 @@ #ifndef __CR_SERVICE_FD_H__ #define __CR_SERVICE_FD_H__ +#include + enum sfd_type { SERVICE_FD_MIN, diff --git a/pipes.c b/pipes.c index 019ca8fda..ef260aa3f 100644 --- a/pipes.c +++ b/pipes.c @@ -5,7 +5,6 @@ #include #include -#include "crtools.h" #include "fdset.h" #include "image.h" #include "files.h" diff --git a/proc_parse.c b/proc_parse.c index a33371623..fee4bf916 100644 --- a/proc_parse.c +++ b/proc_parse.c @@ -12,7 +12,6 @@ #include "asm/types.h" #include "list.h" #include "util.h" -#include "crtools.h" #include "mount.h" #include "cpu.h" #include "file-lock.h" diff --git a/ptrace.c b/ptrace.c index f3d205648..b3b82416c 100644 --- a/ptrace.c +++ b/ptrace.c @@ -13,7 +13,6 @@ #include #include -#include "crtools.h" #include "compiler.h" #include "asm/types.h" #include "util.h" diff --git a/shmem.c b/shmem.c index e37581bad..18e25c09d 100644 --- a/shmem.c +++ b/shmem.c @@ -2,9 +2,9 @@ #include #include +#include "pid.h" #include "shmem.h" #include "image.h" -#include "crtools.h" #include "page-pipe.h" #include "page-xfer.h" #include "rst-malloc.h" diff --git a/signalfd.c b/signalfd.c index daceda82e..48816ede6 100644 --- a/signalfd.c +++ b/signalfd.c @@ -6,7 +6,6 @@ #include "asm/types.h" #include "signalfd.h" #include "proc_parse.h" -#include "crtools.h" #include "fdset.h" #include "image.h" #include "util.h" diff --git a/sk-netlink.c b/sk-netlink.c index ac662e90b..83a209054 100644 --- a/sk-netlink.c +++ b/sk-netlink.c @@ -3,7 +3,6 @@ #include #include -#include "crtools.h" #include "fdset.h" #include "files.h" #include "sockets.h" diff --git a/sk-queue.c b/sk-queue.c index d1e865668..9180e095f 100644 --- a/sk-queue.c +++ b/sk-queue.c @@ -15,7 +15,6 @@ #include "fdset.h" #include "image.h" #include "servicefd.h" -#include "crtools.h" #include "cr_options.h" #include "util.h" #include "util-pie.h" diff --git a/sockets.c b/sockets.c index c25ca690c..3869efc58 100644 --- a/sockets.c +++ b/sockets.c @@ -18,7 +18,6 @@ #include "util-pie.h" #include "sk-packet.h" #include "namespaces.h" -#include "crtools.h" #include "net.h" #ifndef NETLINK_SOCK_DIAG diff --git a/stats.c b/stats.c index cd5b82974..fb6a24a62 100644 --- a/stats.c +++ b/stats.c @@ -3,7 +3,6 @@ #include "asm/atomic.h" #include "protobuf.h" #include "stats.h" -#include "crtools.h" #include "image.h" #include "protobuf/stats.pb-c.h" diff --git a/uts_ns.c b/uts_ns.c index 777b3af12..b495bbbde 100644 --- a/uts_ns.c +++ b/uts_ns.c @@ -4,7 +4,6 @@ #include #include "util.h" -#include "crtools.h" #include "syscall.h" #include "namespaces.h" #include "sysctl.h"