Brandon Potter has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/17111

Change subject: sim-se: add new getpgrp system call
......................................................................

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
---
M src/arch/x86/linux/process.cc
M src/sim/syscall_emul.cc
M src/sim/syscall_emul.hh
3 files changed, 11 insertions(+), 1 deletion(-)



diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc
index f92575f..ab57b78 100644
--- a/src/arch/x86/linux/process.cc
+++ b/src/arch/x86/linux/process.cc
@@ -344,7 +344,7 @@
     /* 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 17ce9b7..b3f675c 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -971,6 +971,13 @@
 }

 SyscallReturn
+getpgrpFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
+{
+    auto process = tc->getProcessPtr();
+    return process->pgid();
+}
+
+SyscallReturn
 setpgidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
 {
     int index = 0;
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 0abd814..8dd049d 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -245,6 +245,9 @@
 /// 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);


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/17111
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I361bdbfb9c01b761ddd5a4923d23f86971f8d614
Gerrit-Change-Number: 17111
Gerrit-PatchSet: 1
Gerrit-Owner: Brandon Potter <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to