mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 13:58:34 +00:00
criu: make sure to use pr_perror to show errno
In cases where we need to print errno, it is better to use pr_perror. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
10c619adb9
commit
7ea20e8f5a
@ -110,7 +110,7 @@ static void mmap_bug_test(void)
|
||||
}
|
||||
|
||||
if (munmap(map1, PAGE_SIZE)) {
|
||||
pr_err("Failed to unmap() 32-bit mapping: %m\n");
|
||||
pr_perror("Failed to unmap() 32-bit mapping");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ static int read_cgroup_prop(struct cgroup_prop *property, const char *fullpath)
|
||||
|
||||
ret = read(fd, buf, sizeof(buf) - 1);
|
||||
if (ret == -1) {
|
||||
pr_err("Failed scanning %s\n", fullpath);
|
||||
pr_perror("Failed scanning %s", fullpath);
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ static int check_prctl_cat1(void)
|
||||
|
||||
ret = prctl(PR_GET_TID_ADDRESS, (unsigned long)&tid_addr, 0, 0, 0);
|
||||
if (ret < 0) {
|
||||
pr_msg("prctl: PR_GET_TID_ADDRESS is not supported: %m");
|
||||
pr_perror("prctl: PR_GET_TID_ADDRESS is not supported");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -206,19 +206,19 @@ static int check_prctl_cat1(void)
|
||||
if (errno == EPERM)
|
||||
pr_msg("prctl: One needs CAP_SYS_RESOURCE capability to perform testing\n");
|
||||
else
|
||||
pr_msg("prctl: PR_SET_MM_BRK is not supported: %m\n");
|
||||
pr_perror("prctl: PR_SET_MM_BRK is not supported");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = prctl(PR_SET_MM, PR_SET_MM_EXE_FILE, -1, 0, 0);
|
||||
if (ret < 0 && errno != EBADF) {
|
||||
pr_msg("prctl: PR_SET_MM_EXE_FILE is not supported: %m\n");
|
||||
pr_perror("prctl: PR_SET_MM_EXE_FILE is not supported");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = prctl(PR_SET_MM, PR_SET_MM_AUXV, (long)&user_auxv, sizeof(user_auxv), 0);
|
||||
if (ret < 0) {
|
||||
pr_msg("prctl: PR_SET_MM_AUXV is not supported: %m\n");
|
||||
pr_perror("prctl: PR_SET_MM_AUXV is not supported");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -908,7 +908,7 @@ static int check_aio_remap(void)
|
||||
int r;
|
||||
|
||||
if (syscall(SYS_io_setup, 16, &ctx) < 0) {
|
||||
pr_err("No AIO syscall: %m\n");
|
||||
pr_perror("No AIO syscall");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -930,7 +930,7 @@ static int check_aio_remap(void)
|
||||
ctx = (aio_context_t)naddr;
|
||||
r = syscall(SYS_io_getevents, ctx, 0, 1, NULL, NULL);
|
||||
if (r < 0) {
|
||||
pr_err("AIO remap doesn't work properly: %m\n");
|
||||
pr_perror("AIO remap doesn't work properly");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -3614,7 +3614,7 @@ static int sigreturn_restore(pid_t pid, struct task_restore_args *task_args, uns
|
||||
/* VMA we need for stacks and sigframes for threads */
|
||||
if (mmap(mem, memzone_size, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, 0, 0) != mem) {
|
||||
pr_err("Can't mmap section for restore code\n");
|
||||
pr_perror("Can't mmap section for restore code");
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -417,7 +417,7 @@ static bool kerndat_has_memfd_create(void)
|
||||
else if (ret == -1 && errno == EFAULT)
|
||||
kdat.has_memfd = true;
|
||||
else {
|
||||
pr_err("Unexpected error from memfd_create(NULL, 0): %m\n");
|
||||
pr_perror("Unexpected error from memfd_create(NULL, 0)");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -591,7 +591,7 @@ static int open_shmem(int pid, struct vma_area *vma)
|
||||
*/
|
||||
addr = mmap(NULL, si->size, PROT_WRITE | PROT_READ, flags, f, 0);
|
||||
if (addr == MAP_FAILED) {
|
||||
pr_err("Can't mmap shmid=0x%"PRIx64" size=%ld\n",
|
||||
pr_perror("Can't mmap shmid=0x%"PRIx64" size=%ld",
|
||||
vi->shmid, si->size);
|
||||
goto err;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user