From 598f704d51ddfc7c1abd0afdbb99e4cbafbe8813 Mon Sep 17 00:00:00 2001 From: Brandon Potter Date: Mon, 11 Mar 2019 14:24:33 -0400 Subject: [PATCH] sim-se: add new getpgrp system call This changeset adds new (relatively simple) system call support. The getpgrp call returns a thread context's pgid. Change-Id: I361bdbfb9c01b761ddd5a4923d23f86971f8d614 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17111 Maintainer: Brandon Potter Tested-by: kokoro Reviewed-by: Ayaz Akram --- src/arch/x86/linux/process.cc | 2 +- src/sim/syscall_emul.cc | 7 +++++++ src/sim/syscall_emul.hh | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc index 9ffde7f90..8f669bfa5 100644 --- a/src/arch/x86/linux/process.cc +++ b/src/arch/x86/linux/process.cc @@ -373,7 +373,7 @@ static SyscallDesc syscallDescs64[] = { /* 108 */ SyscallDesc("getegid", getegidFunc), /* 109 */ SyscallDesc("setpgid", setpgidFunc), /* 110 */ SyscallDesc("getppid", getppidFunc), - /* 111 */ SyscallDesc("getpgrp", unimplementedFunc), + /* 111 */ SyscallDesc("getpgrp", getpgrpFunc), /* 112 */ SyscallDesc("setsid", unimplementedFunc), /* 113 */ SyscallDesc("setreuid", unimplementedFunc), /* 114 */ SyscallDesc("setregid", unimplementedFunc), diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc index 28e3e3ded..088dcbcce 100644 --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -982,6 +982,13 @@ pipe2Func(SyscallDesc *desc, int callnum, ThreadContext *tc) return pipeImpl(desc, callnum, tc, false, true); } +SyscallReturn +getpgrpFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) +{ + auto process = tc->getProcessPtr(); + return process->pgid(); +} + SyscallReturn setpgidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) { diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index 875f565cd..130791d20 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -226,6 +226,9 @@ SyscallReturn gettidFunc(SyscallDesc *desc, int num, ThreadContext *tc); /// Target chown() handler. SyscallReturn chownFunc(SyscallDesc *desc, int num, ThreadContext *tc); +/// Target getpgrpFunc() handler. +SyscallReturn getpgrpFunc(SyscallDesc *desc, int num, ThreadContext *tc); + /// Target setpgid() handler. SyscallReturn setpgidFunc(SyscallDesc *desc, int num, ThreadContext *tc); -- 2.30.2