diff -r 21970e34aa6a -r 7a963b8b0b30 src/arch/x86/linux/linux.hh --- a/src/arch/x86/linux/linux.hh Thu Mar 17 15:59:27 2011 -0700 +++ b/src/arch/x86/linux/linux.hh Thu Mar 17 15:59:49 2011 -0700 @@ -109,6 +109,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, + }; + }; class X86Linux32 : public Linux @@ -177,6 +199,54 @@ } tgt_sysinfo; static bool mmapGrowsDown() { return true; } + + //@{ + /// For getrusage(). + static const int TGT_RUSAGE_SELF = 0; + static const int TGT_RUSAGE_CHILDREN = -1; + static const int TGT_RUSAGE_BOTH = -2; + //@} + + /// For gettimeofday(). + struct timeval { + int32_t tv_sec; //!< seconds + int32_t tv_usec; //!< microseconds + }; + + struct rusage { + struct timeval ru_utime; //!< user time used + struct timeval ru_stime; //!< system time used + int32_t ru_maxrss; //!< max rss + int32_t ru_ixrss; //!< integral shared memory size + int32_t ru_idrss; //!< integral unshared data " + int32_t ru_isrss; //!< integral unshared stack " + int32_t ru_minflt; //!< page reclaims - total vmfaults + int32_t ru_majflt; //!< page faults + int32_t ru_nswap; //!< swaps + int32_t ru_inblock; //!< block input operations + int32_t ru_oublock; //!< block output operations + int32_t ru_msgsnd; //!< messages sent + int32_t ru_msgrcv; //!< messages received + int32_t ru_nsignals; //!< signals received + int32_t ru_nvcsw; //!< voluntary context switches + int32_t ru_nivcsw; //!< involuntary " + }; + + /// 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, + }; + }; #endif diff -r 21970e34aa6a -r 7a963b8b0b30 src/arch/x86/linux/syscalls.cc --- a/src/arch/x86/linux/syscalls.cc Thu Mar 17 15:59:27 2011 -0700 +++ b/src/arch/x86/linux/syscalls.cc Thu Mar 17 15:59:49 2011 -0700 @@ -310,8 +310,8 @@ /* 94 */ SyscallDesc("lchown", unimplementedFunc), /* 95 */ SyscallDesc("umask", unimplementedFunc), /* 96 */ SyscallDesc("gettimeofday", unimplementedFunc), - /* 97 */ SyscallDesc("getrlimit", unimplementedFunc), - /* 98 */ SyscallDesc("getrusage", unimplementedFunc), + /* 97 */ SyscallDesc("getrlimit", getrlimitFunc), + /* 98 */ SyscallDesc("getrusage", getrusageFunc), /* 99 */ SyscallDesc("sysinfo", sysinfoFunc), /* 100 */ SyscallDesc("times", timesFunc), /* 101 */ SyscallDesc("ptrace", unimplementedFunc), @@ -568,8 +568,8 @@ /* 73 */ SyscallDesc("sigpending", unimplementedFunc), /* 74 */ SyscallDesc("sethostname", unimplementedFunc), /* 75 */ SyscallDesc("setrlimit", ignoreFunc), - /* 76 */ SyscallDesc("getrlimit", unimplementedFunc), - /* 77 */ SyscallDesc("getrusage", unimplementedFunc), + /* 76 */ SyscallDesc("getrlimit", getrlimitFunc), + /* 77 */ SyscallDesc("getrusage", getrusageFunc), /* 78 */ SyscallDesc("gettimeofday", unimplementedFunc), /* 79 */ SyscallDesc("settimeofday", unimplementedFunc), /* 80 */ SyscallDesc("getgroups", unimplementedFunc),