Just a re-send of my sparc rlimit/rusage patch.

diff -r 03c418c51f80 src/arch/sparc/linux/linux.hh
--- a/src/arch/sparc/linux/linux.hh     Tue Sep 22 00:04:20 2009 -0400
+++ b/src/arch/sparc/linux/linux.hh     Tue Sep 22 00:05:03 2009 -0400
@@ -93,6 +93,28 @@
         uint64_t mem_unit;  /* Memory unit size in bytes */
     } tgt_sysinfo;
 
+    //@{
+        /// For getrusage().
+        static const int TGT_RUSAGE_SELF     = 0;
+        static const int TGT_RUSAGE_CHILDREN = -1;
+        static const int TGT_RUSAGE_BOTH     = -2;
+    //@}
+
+        /// Resource enumeration for getrlimit().
+    enum rlimit_resources {
+        TGT_RLIMIT_CPU = 0,
+        TGT_RLIMIT_FSIZE = 1,
+        TGT_RLIMIT_DATA = 2,
+        TGT_RLIMIT_STACK = 3,
+        TGT_RLIMIT_CORE = 4,
+        TGT_RLIMIT_RSS = 5,
+        TGT_RLIMIT_NOFILE = 6,
+        TGT_RLIMIT_AS = 7,
+        TGT_RLIMIT_VMEM = 7,
+        TGT_RLIMIT_NPROC = 8,
+        TGT_RLIMIT_MEMLOCK = 9,
+        TGT_RLIMIT_LOCKS = 10
+    };
 };
 
 class Sparc32Linux : public SparcLinux
diff -r 03c418c51f80 src/arch/sparc/linux/syscalls.cc
--- a/src/arch/sparc/linux/syscalls.cc  Tue Sep 22 00:04:20 2009 -0400
+++ b/src/arch/sparc/linux/syscalls.cc  Tue Sep 22 00:05:03 2009 -0400
@@ -31,6 +31,9 @@
 #include "arch/sparc/linux/process.hh"
 #include "sim/syscall_emul.hh"
 
+using namespace std;
+using namespace SparcISA;
+
 class LiveProcess;
 class ThreadContext;
 
@@ -205,7 +208,7 @@
     /* 114 */ SyscallDesc("sendmsg", unimplementedFunc),
     /* 115 */ SyscallDesc("getgroups32", unimplementedFunc), //32 bit
     /* 116 */ SyscallDesc("gettimeofday", gettimeofdayFunc<Sparc32Linux>), 
//32 bit
-    /* 117 */ SyscallDesc("getrusage", unimplementedFunc), //32 bit
+    /* 117 */ SyscallDesc("getrusage", getrusageFunc<Sparc32Linux>), //32 bit
     /* 118 */ SyscallDesc("getsockopt", unimplementedFunc),
     /* 119 */ SyscallDesc("getcwd", getcwdFunc),
     /* 120 */ SyscallDesc("readv", unimplementedFunc),
@@ -232,8 +235,8 @@
     /* 141 */ SyscallDesc("getpeername", unimplementedFunc),
     /* 142 */ SyscallDesc("futex", unimplementedFunc), //32 bit
     /* 143 */ SyscallDesc("gettid", unimplementedFunc),
-    /* 144 */ SyscallDesc("getrlimit", unimplementedFunc),
-    /* 145 */ SyscallDesc("setrlimit", unimplementedFunc),
+    /* 144 */ SyscallDesc("getrlimit", getrlimitFunc<Sparc32Linux>),
+    /* 145 */ SyscallDesc("setrlimit", ignoreFunc),
     /* 146 */ SyscallDesc("pivot_root", unimplementedFunc),
     /* 147 */ SyscallDesc("prctl", unimplementedFunc), //32 bit
     /* 148 */ SyscallDesc("pciconfig_read", unimplementedFunc),
@@ -511,7 +514,7 @@
     /* 114 */ SyscallDesc("sendmsg", unimplementedFunc),
     /* 115 */ SyscallDesc("getgroups32", unimplementedFunc),
     /* 116 */ SyscallDesc("gettimeofday", gettimeofdayFunc<SparcLinux>),
-    /* 117 */ SyscallDesc("getrusage", unimplementedFunc),
+    /* 117 */ SyscallDesc("getrusage", getrusageFunc<SparcLinux>),
     /* 118 */ SyscallDesc("getsockopt", unimplementedFunc),
     /* 119 */ SyscallDesc("getcwd", unimplementedFunc),
     /* 120 */ SyscallDesc("readv", unimplementedFunc),
@@ -538,8 +541,8 @@
     /* 141 */ SyscallDesc("getpeername", unimplementedFunc),
     /* 142 */ SyscallDesc("futex", unimplementedFunc),
     /* 143 */ SyscallDesc("gettid", unimplementedFunc),
-    /* 144 */ SyscallDesc("getrlimit", unimplementedFunc),
-    /* 145 */ SyscallDesc("setrlimit", unimplementedFunc),
+    /* 144 */ SyscallDesc("getrlimit", getrlimitFunc<SparcLinux>),
+    /* 145 */ SyscallDesc("setrlimit", ignoreFunc),
     /* 146 */ SyscallDesc("pivot_root", unimplementedFunc),
     /* 147 */ SyscallDesc("prctl", unimplementedFunc),
     /* 148 */ SyscallDesc("pciconfig_read", unimplementedFunc),
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to