mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-05 08:45:49 +00:00
I've mentioned the problem that after c/r each inotify receives one or more unexpected events. This happens because our algorithm mixes setting up an inotify watch on the file with opening and closing it. We mix inotify creation and watched file open/close because we need to create the inotify watch on the file from another mntns (generally). And we do a trick opening the file so that it can be referenced in current mntns by /proc/<pid>/fd/<id> path. Moreover if we have several inotifies on the same file, than queue gets even more events than just one which happens in a simple case. note: For now we don't have a way to c/r events in queue but we need to at least leave the queue clean from events generated by our own. These, still, looks harder to rewrite wd creation without this proc-fd trick than to remove unexpected events from queues. So just cleanup these events for each fdt-restorer process, for each of its inotify fds _after_ restore stage (at CR_STATE_RESTORE_SIGCHLD). These is a closest place where for an _alive_ process we know that all prepare_fds() are done by all processes. These means we need to do the cleanup in PIE code, so need to add sys_ppoll definitions for PIE and divide process in two phases: first collect and transfer fds, second do real cleanup. note: We still do prepare_fds() for zombies. But zombies have no fds in /proc/pid/fd so we will collect no in collect_fds() and therefore we have no in prepare_fds(), thus there is no need to cleanup inotifies for zombies. v2: adopt to multiple unexpected events v3: do not cleanup from fdt-receivers, done from fdt-restorer v4: do without additional fds restore stage v5: replace sys_poll with sys_ppoll and fix minor nits Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> use ppoll always and remove poll
115 lines
7.1 KiB
Modula-2
115 lines
7.1 KiB
Modula-2
#
|
|
# System calls table, please make sure the table consists of only the syscalls
|
|
# really used somewhere in the project.
|
|
#
|
|
# The template is (name and arguments are optional if you need only __NR_x
|
|
# defined, but no real entry point in syscalls lib).
|
|
#
|
|
# name/alias code64 code32 arguments
|
|
# -----------------------------------------------------------------------
|
|
#
|
|
read 63 3 (int fd, void *buf, unsigned long count)
|
|
write 64 4 (int fd, const void *buf, unsigned long count)
|
|
open ! 5 (const char *filename, unsigned long flags, unsigned long mode)
|
|
close 57 6 (int fd)
|
|
lseek 62 19 (int fd, unsigned long offset, unsigned long origin)
|
|
mmap 222 ! (void *addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long offset)
|
|
mprotect 226 125 (const void *addr, unsigned long len, unsigned long prot)
|
|
munmap 215 91 (void *addr, unsigned long len)
|
|
brk 214 45 (void *addr)
|
|
rt_sigaction sigaction 134 174 (int signum, const rt_sigaction_t *act, rt_sigaction_t *oldact, size_t sigsetsize)
|
|
rt_sigprocmask sigprocmask 135 175 (int how, k_rtsigset_t *set, k_rtsigset_t *old, size_t sigsetsize)
|
|
rt_sigreturn 139 173 (void)
|
|
ioctl 29 54 (unsigned int fd, unsigned int cmd, unsigned long arg)
|
|
pread64 67 180 (unsigned int fd, char *buf, size_t count, loff_t pos)
|
|
ptrace 117 26 (long request, pid_t pid, void *addr, void *data)
|
|
mremap 216 163 (unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flag, unsigned long new_addr)
|
|
mincore 232 219 (void *addr, unsigned long size, unsigned char *vec)
|
|
madvise 233 220 (unsigned long start, size_t len, int behavior)
|
|
shmat 196 305 (int shmid, void *shmaddr, int shmflag)
|
|
pause 1061 29 (void)
|
|
nanosleep 101 162 (struct timespec *req, struct timespec *rem)
|
|
getitimer 102 105 (int which, const struct itimerval *val)
|
|
setitimer 103 104 (int which, const struct itimerval *val, struct itimerval *old)
|
|
getpid 172 20 (void)
|
|
socket 198 281 (int domain, int type, int protocol)
|
|
connect 203 283 (int sockfd, struct sockaddr *addr, int addrlen)
|
|
sendto 206 290 (int sockfd, void *buff, size_t len, unsigned int flags, struct sockaddr *addr, int addr_len)
|
|
recvfrom 207 292 (int sockfd, void *ubuf, size_t size, unsigned int flags, struct sockaddr *addr, int *addr_len)
|
|
sendmsg 211 296 (int sockfd, const struct msghdr *msg, int flags)
|
|
recvmsg 212 297 (int sockfd, struct msghdr *msg, int flags)
|
|
shutdown 210 293 (int sockfd, int how)
|
|
bind 235 282 (int sockfd, const struct sockaddr *addr, int addrlen)
|
|
setsockopt 208 294 (int sockfd, int level, int optname, const void *optval, socklen_t optlen)
|
|
getsockopt 209 295 (int sockfd, int level, int optname, const void *optval, socklen_t *optlen)
|
|
clone 220 120 (unsigned long flags, void *child_stack, void *parent_tid, unsigned long newtls, void *child_tid)
|
|
exit 93 1 (unsigned long error_code)
|
|
wait4 260 114 (int pid, int *status, int options, struct rusage *ru)
|
|
waitid 95 280 (int which, pid_t pid, struct siginfo *infop, int options, struct rusage *ru)
|
|
kill 129 37 (long pid, int sig)
|
|
fcntl 25 55 (int fd, int type, long arg)
|
|
flock 32 143 (int fd, unsigned long cmd)
|
|
mkdir ! 39 (const char *name, int mode)
|
|
rmdir ! 40 (const char *name)
|
|
unlink ! 10 (char *pathname)
|
|
readlinkat 78 332 (int fd, const char *path, char *buf, int bufsize)
|
|
umask 166 60 (int mask)
|
|
getgroups 158 205 (int gsize, unsigned int *groups)
|
|
setgroups 159 206 (int gsize, unsigned int *groups)
|
|
setresuid 147 164 (int uid, int euid, int suid)
|
|
getresuid 148 165 (int *uid, int *euid, int *suid)
|
|
setresgid 149 170 (int gid, int egid, int sgid)
|
|
getresgid 150 171 (int *gid, int *egid, int *sgid)
|
|
getpgid 155 132 (pid_t pid)
|
|
setfsuid 151 138 (int fsuid)
|
|
setfsgid 152 139 (int fsgid)
|
|
getsid 156 147 (void)
|
|
capget 90 184 (struct cap_header *h, struct cap_data *d)
|
|
capset 91 185 (struct cap_header *h, struct cap_data *d)
|
|
rt_sigqueueinfo 138 178 (pid_t pid, int sig, siginfo_t *info)
|
|
setpriority 140 97 (int which, int who, int nice)
|
|
sched_setscheduler 119 156 (int pid, int policy, struct sched_param *p)
|
|
sigaltstack 132 186 (const void *uss, void *uoss)
|
|
personality 92 136 (unsigned int personality)
|
|
prctl 167 172 (int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5)
|
|
arch_prctl ! 17 (int option, unsigned long addr)
|
|
setrlimit 164 75 (int resource, struct krlimit *rlim)
|
|
mount 40 21 (char *dev_nmae, char *dir_name, char *type, unsigned long flags, void *data)
|
|
umount2 39 52 (char *name, int flags)
|
|
gettid 178 224 (void)
|
|
futex 98 240 (uint32_t *uaddr, int op, uint32_t val, struct timespec *utime, uint32_t *uaddr2, uint32_t val3)
|
|
set_tid_address 96 256 (int *tid_addr)
|
|
restart_syscall 128 0 (void)
|
|
timer_create 107 257 (clockid_t which_clock, struct sigevent *timer_event_spec, kernel_timer_t *created_timer_id)
|
|
timer_settime 110 258 (kernel_timer_t timer_id, int flags, const struct itimerspec *new_setting, struct itimerspec *old_setting)
|
|
timer_gettime 108 259 (int timer_id, const struct itimerspec *setting)
|
|
timer_getoverrun 109 260 (int timer_id)
|
|
timer_delete 111 261 (kernel_timer_t timer_id)
|
|
clock_gettime 113 263 (const clockid_t which_clock, const struct timespec *tp)
|
|
exit_group 94 248 (int error_code)
|
|
set_robust_list 99 338 (struct robust_list_head *head, size_t len)
|
|
get_robust_list 100 339 (int pid, struct robust_list_head **head_ptr, size_t *len_ptr)
|
|
signalfd4 74 355 (int fd, k_rtsigset_t *mask, size_t sizemask, int flags)
|
|
rt_tgsigqueueinfo 240 363 (pid_t tgid, pid_t pid, int sig, siginfo_t *info)
|
|
vmsplice 75 343 (int fd, const struct iovec *iov, unsigned long nr_segs, unsigned int flags)
|
|
timerfd_settime 86 353 (int ufd, int flags, const struct itimerspec *utmr, struct itimerspec *otmr)
|
|
fanotify_init 262 367 (unsigned int flags, unsigned int event_f_flags)
|
|
fanotify_mark 263 368 (int fanotify_fd, unsigned int flags, uint64_t mask, int dfd, const char *pathname)
|
|
open_by_handle_at 265 371 (int mountdirfd, struct file_handle *handle, int flags)
|
|
setns 268 375 (int fd, int nstype)
|
|
kcmp 272 378 (pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2)
|
|
openat 56 322 (int dirfd, const char *pathname, int flags, mode_t mode)
|
|
mkdirat 34 323 (int dirfd, const char *pathname, mode_t mode)
|
|
unlinkat 35 328 (int dirfd, const char *pathname, int flags)
|
|
memfd_create 279 385 (const char *name, unsigned int flags)
|
|
io_setup 0 243 (unsigned nr_events, aio_context_t *ctx)
|
|
io_submit 2 246 (aio_context_t ctx_id, long nr, struct iocb **iocbpp)
|
|
io_getevents 4 245 (aio_context_t ctx, long min_nr, long nr, struct io_event *evs, struct timespec *tmo)
|
|
seccomp 277 383 (unsigned int op, unsigned int flags, const char *uargs)
|
|
gettimeofday 169 78 (struct timeval *tv, struct timezone *tz)
|
|
preadv_raw 69 361 (int fd, struct iovec *iov, unsigned long nr, unsigned long pos_l, unsigned long pos_h)
|
|
userfaultfd 282 388 (int flags)
|
|
fallocate 47 352 (int fd, int mode, loff_t offset, loff_t len)
|
|
cacheflush ! 983042 (void *start, void *end, int flags)
|
|
ppoll 73 336 (struct pollfd *fds, unsigned int nfds, const struct timespec *tmo, const sigset_t *sigmask, size_t sigsetsize)
|