[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 74/74] linux-user: Split out getpriority, setprio
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v7 74/74] linux-user: Split out getpriority, setpriority |
Date: |
Sun, 19 May 2019 13:37:26 -0700 |
Signed-off-by: Richard Henderson <address@hidden>
---
linux-user/syscall-defs.h | 2 ++
linux-user/syscall-proc.inc.c | 28 ++++++++++++++++++++++++++++
linux-user/syscall.c | 18 ------------------
linux-user/strace.list | 6 ------
4 files changed, 30 insertions(+), 24 deletions(-)
diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h
index 8b2d95d19e..3b45250977 100644
--- a/linux-user/syscall-defs.h
+++ b/linux-user/syscall-defs.h
@@ -80,6 +80,7 @@ SYSCALL_DEF(getpid);
#ifdef TARGET_NR_getppid
SYSCALL_DEF(getppid);
#endif
+SYSCALL_DEF(getpriority, ARG_DEC, ARG_DEC);
#ifdef TARGET_NR_getrlimit
SYSCALL_DEF(getrlimit, ARG_DEC, ARG_PTR);
#endif
@@ -238,6 +239,7 @@ SYSCALL_DEF(semget, ARG_DEC, ARG_DEC, ARG_HEX);
#endif
SYSCALL_DEF(sethostname, ARG_STR);
SYSCALL_DEF(setpgid, ARG_DEC, ARG_DEC);
+SYSCALL_DEF(setpriority, ARG_DEC, ARG_DEC, ARG_DEC);
#ifdef TARGET_NR_setrlimit
SYSCALL_DEF(setrlimit, ARG_DEC, ARG_PTR);
#endif
diff --git a/linux-user/syscall-proc.inc.c b/linux-user/syscall-proc.inc.c
index 408e96a834..e85151cc2e 100644
--- a/linux-user/syscall-proc.inc.c
+++ b/linux-user/syscall-proc.inc.c
@@ -479,6 +479,29 @@ SYSCALL_IMPL(getppid)
}
#endif
+SYSCALL_IMPL(getpriority)
+{
+ abi_long ret;
+
+ /*
+ * Note that negative values are valid for getpriority, so we must
+ * differentiate based on errno settings.
+ */
+ errno = 0;
+ ret = getpriority(arg1, arg2);
+ if (ret == -1 && errno != 0) {
+ return -host_to_target_errno(errno);
+ }
+#ifdef TARGET_ALPHA
+ /* Return value is the unbiased priority. Signal no error. */
+ ((CPUAlphaState *)cpu_env)->ir[IR_V0] = 0;
+#else
+ /* Return value is a biased priority to avoid negative numbers. */
+ ret = 20 - ret;
+#endif
+ return ret;
+}
+
#ifdef TARGET_NR_getrlimit
SYSCALL_IMPL(getrlimit)
{
@@ -568,6 +591,11 @@ SYSCALL_IMPL(setpgid)
return get_errno(setpgid(arg1, arg2));
}
+SYSCALL_IMPL(setpriority)
+{
+ return get_errno(setpriority(arg1, arg2, arg3));
+}
+
#ifdef TARGET_NR_setrlimit
SYSCALL_IMPL(setrlimit)
{
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1b1d44bf32..6e7cccbdd5 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4144,24 +4144,6 @@ static abi_long do_syscall1(void *cpu_env, int num,
abi_long arg1,
void *p;
switch(num) {
- case TARGET_NR_getpriority:
- /* Note that negative values are valid for getpriority, so we must
- differentiate based on errno settings. */
- errno = 0;
- ret = getpriority(arg1, arg2);
- if (ret == -1 && errno != 0) {
- return -host_to_target_errno(errno);
- }
-#ifdef TARGET_ALPHA
- /* Return value is the unbiased priority. Signal no error. */
- ((CPUAlphaState *)cpu_env)->ir[IR_V0] = 0;
-#else
- /* Return value is a biased priority to avoid negative numbers. */
- ret = 20 - ret;
-#endif
- return ret;
- case TARGET_NR_setpriority:
- return get_errno(setpriority(arg1, arg2, arg3));
#ifdef TARGET_NR_statfs
case TARGET_NR_statfs:
if (!(p = lock_user_string(arg1))) {
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 55b617239c..a0d2b3f9c5 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -256,9 +256,6 @@
#ifdef TARGET_NR_getpmsg
{ TARGET_NR_getpmsg, "getpmsg" , NULL, NULL, NULL },
#endif
-#ifdef TARGET_NR_getpriority
-{ TARGET_NR_getpriority, "getpriority", "%s(%#x,%#x)", NULL, NULL },
-#endif
#ifdef TARGET_NR_getrandom
{ TARGET_NR_getrandom, "getrandom", NULL, NULL, NULL },
#endif
@@ -1007,9 +1004,6 @@
#ifdef TARGET_NR_setpgrp
{ TARGET_NR_setpgrp, "setpgrp" , NULL, NULL, NULL },
#endif
-#ifdef TARGET_NR_setpriority
-{ TARGET_NR_setpriority, "setpriority" , NULL, NULL, NULL },
-#endif
#ifdef TARGET_NR_setregid
{ TARGET_NR_setregid, "setregid" , NULL, NULL, NULL },
#endif
--
2.17.1
- Re: [Qemu-devel] [PATCH v7 62/74] linux-user: Split out rt_sigqueueinfo, rt_tgsigqueueinfo, (continued)
- [Qemu-devel] [PATCH v7 63/74] linux-user: Split out sigreturn, rt_sigreturn, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 66/74] linux-user: Split out getrusage, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 67/74] linux-user: Split out gettimeofday, settimeofday, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 69/74] linux-user: Split out pselect6, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 68/74] linux-user: Split out select, _newselect, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 70/74] linux-user: Split out symlink, symlinkat, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 71/74] linux-user: Split out swapon, swapoff, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 72/74] linux-user: Split out reboot, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 73/74] linux-user: Split out truncate, truncate64, ftruncate, ftruncate64, Richard Henderson, 2019/05/19
- [Qemu-devel] [PATCH v7 74/74] linux-user: Split out getpriority, setpriority,
Richard Henderson <=
- Re: [Qemu-devel] [PATCH v7 00/74] linux-user: Split do_syscall, Laurent Vivier, 2019/05/20
- Re: [Qemu-devel] [PATCH v7 00/74] linux-user: Split do_syscall, Peter Maydell, 2019/05/20
- Re: [Qemu-devel] [PATCH v7 00/74] linux-user: Split do_syscall, Aleksandar Markovic, 2019/05/22