Commit 1be75af8 authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Andrei Vagin

compel_syscall(): make ret argument signed

I saw this line in the code

	unsigned long sret = -ENOSYS;

and ended up with this patch. Note syscall(2) man page says return value
is long -- who am I to disagree?

travis-ci: success for More polishing for compel cli
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 7d181cda
...@@ -83,7 +83,7 @@ err: ...@@ -83,7 +83,7 @@ err:
return ret; return ret;
} }
int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret, int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
unsigned long arg1, unsigned long arg1,
unsigned long arg2, unsigned long arg2,
unsigned long arg3, unsigned long arg3,
...@@ -114,7 +114,7 @@ void *remote_mmap(struct parasite_ctl *ctl, ...@@ -114,7 +114,7 @@ void *remote_mmap(struct parasite_ctl *ctl,
void *addr, size_t length, int prot, void *addr, size_t length, int prot,
int flags, int fd, off_t offset) int flags, int fd, off_t offset)
{ {
unsigned long map; long map;
int err; int err;
err = compel_syscall(ctl, __NR_mmap, &map, err = compel_syscall(ctl, __NR_mmap, &map,
......
...@@ -99,7 +99,7 @@ err: ...@@ -99,7 +99,7 @@ err:
return ret; return ret;
} }
int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret, int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
unsigned long arg1, unsigned long arg1,
unsigned long arg2, unsigned long arg2,
unsigned long arg3, unsigned long arg3,
...@@ -128,7 +128,7 @@ void *remote_mmap(struct parasite_ctl *ctl, ...@@ -128,7 +128,7 @@ void *remote_mmap(struct parasite_ctl *ctl,
void *addr, size_t length, int prot, void *addr, size_t length, int prot,
int flags, int fd, off_t offset) int flags, int fd, off_t offset)
{ {
unsigned long map; long map;
int err; int err;
if (offset & ~PAGE_MASK) if (offset & ~PAGE_MASK)
......
...@@ -381,7 +381,7 @@ int get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t save, void *ar ...@@ -381,7 +381,7 @@ int get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t save, void *ar
return save(arg, &regs, &fpregs); return save(arg, &regs, &fpregs);
} }
int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret, int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
unsigned long arg1, unsigned long arg1,
unsigned long arg2, unsigned long arg2,
unsigned long arg3, unsigned long arg3,
...@@ -410,7 +410,7 @@ void *remote_mmap(struct parasite_ctl *ctl, ...@@ -410,7 +410,7 @@ void *remote_mmap(struct parasite_ctl *ctl,
void *addr, size_t length, int prot, void *addr, size_t length, int prot,
int flags, int fd, off_t offset) int flags, int fd, off_t offset)
{ {
unsigned long map = 0; long map = 0;
int err; int err;
err = compel_syscall(ctl, __NR_mmap, &map, err = compel_syscall(ctl, __NR_mmap, &map,
......
...@@ -195,7 +195,7 @@ err: ...@@ -195,7 +195,7 @@ err:
return ret; return ret;
} }
int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret, int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
unsigned long arg1, unsigned long arg1,
unsigned long arg2, unsigned long arg2,
unsigned long arg3, unsigned long arg3,
...@@ -240,7 +240,7 @@ void *remote_mmap(struct parasite_ctl *ctl, ...@@ -240,7 +240,7 @@ void *remote_mmap(struct parasite_ctl *ctl,
void *addr, size_t length, int prot, void *addr, size_t length, int prot,
int flags, int fd, off_t offset) int flags, int fd, off_t offset)
{ {
unsigned long map; long map;
int err; int err;
bool compat_task = !user_regs_native(&ctl->orig.regs); bool compat_task = !user_regs_native(&ctl->orig.regs);
......
...@@ -55,7 +55,7 @@ int parasite_wait_ack(int sockfd, unsigned int cmd, struct ctl_msg *m); ...@@ -55,7 +55,7 @@ int parasite_wait_ack(int sockfd, unsigned int cmd, struct ctl_msg *m);
/* XXX -- remove with cr-exec.c */ /* XXX -- remove with cr-exec.c */
extern int compel_map_exchange(struct parasite_ctl *ctl, unsigned long size); extern int compel_map_exchange(struct parasite_ctl *ctl, unsigned long size);
extern int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret, extern int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
unsigned long arg1, unsigned long arg2, unsigned long arg1, unsigned long arg2,
unsigned long arg3, unsigned long arg4, unsigned long arg3, unsigned long arg4,
unsigned long arg5, unsigned long arg6); unsigned long arg5, unsigned long arg6);
......
...@@ -65,7 +65,7 @@ extern int compel_cure(struct parasite_ctl *ctl); ...@@ -65,7 +65,7 @@ extern int compel_cure(struct parasite_ctl *ctl);
extern void *compel_parasite_args_p(struct parasite_ctl *ctl); extern void *compel_parasite_args_p(struct parasite_ctl *ctl);
extern void *compel_parasite_args_s(struct parasite_ctl *ctl, int args_size); extern void *compel_parasite_args_s(struct parasite_ctl *ctl, int args_size);
extern int compel_syscall(struct parasite_ctl *ctl, int nr, unsigned long *ret, extern int compel_syscall(struct parasite_ctl *ctl, int nr, long *ret,
unsigned long arg1, unsigned long arg1,
unsigned long arg2, unsigned long arg2,
unsigned long arg3, unsigned long arg3,
......
...@@ -735,7 +735,7 @@ static int parasite_memfd_exchange(struct parasite_ctl *ctl, unsigned long size) ...@@ -735,7 +735,7 @@ static int parasite_memfd_exchange(struct parasite_ctl *ctl, unsigned long size)
void *where = (void *)ctl->ictx.syscall_ip + BUILTIN_SYSCALL_SIZE; void *where = (void *)ctl->ictx.syscall_ip + BUILTIN_SYSCALL_SIZE;
uint8_t orig_code[MEMFD_FNAME_SZ] = MEMFD_FNAME; uint8_t orig_code[MEMFD_FNAME_SZ] = MEMFD_FNAME;
pid_t pid = ctl->rpid; pid_t pid = ctl->rpid;
unsigned long sret = -ENOSYS; long sret = -ENOSYS;
int ret, fd, lfd; int ret, fd, lfd;
bool __maybe_unused compat_task = !compel_mode_native(ctl); bool __maybe_unused compat_task = !compel_mode_native(ctl);
...@@ -1303,7 +1303,7 @@ int compel_stop_daemon(struct parasite_ctl *ctl) ...@@ -1303,7 +1303,7 @@ int compel_stop_daemon(struct parasite_ctl *ctl)
int compel_cure_remote(struct parasite_ctl *ctl) int compel_cure_remote(struct parasite_ctl *ctl)
{ {
unsigned long ret; long ret;
if (compel_stop_daemon(ctl)) if (compel_stop_daemon(ctl))
return -1; return -1;
......
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