Automated merge with ssh://hg@repo.m5sim.org/m5
[gem5.git] / src / kern / linux / linux.hh
index a41fac9a7db1a25162b7a1ea392f52a2e095e9cb..7fe107139bdf7fda1baa51f0660e0d62565ae544 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004-2005 The Regents of The University of Michigan
+ * Copyright (c) 2004-2009 The Regents of The University of Michigan
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -30,6 +30,8 @@
 
 #ifndef __LINUX_HH__
 #define __LINUX_HH__
+
+#include "base/types.hh"
 #include "config/full_system.hh"
 
 #if FULL_SYSTEM
@@ -38,10 +40,13 @@ class Linux {};
 
 #else //!FULL_SYSTEM
 
-#include <inttypes.h>
+#include <string>
 
 #include "kern/operatingsystem.hh"
 
+class ThreadContext;
+class LiveProcess;
+
 ///
 /// This class encapsulates the types, structures, constants,
 /// functions, and syscall-number mappings specific to the Alpha Linux
@@ -57,6 +62,7 @@ class Linux : public OperatingSystem
     typedef uint64_t size_t;
     typedef uint64_t off_t;
     typedef int64_t time_t;
+    typedef int64_t clock_t;
     typedef uint32_t uid_t;
     typedef uint32_t gid_t;
     //@}
@@ -131,6 +137,17 @@ class Linux : public OperatingSystem
         int64_t tv_usec;        //!< microseconds
     };
 
+    /// Clock ticks per second, for times().
+    static const int M5_SC_CLK_TCK = 100;
+
+    /// For times().
+    struct tms {
+        int64_t tms_utime;      //!< user time
+        int64_t tms_stime;      //!< system time
+        int64_t tms_cutime;     //!< user time of children
+        int64_t tms_cstime;     //!< system time of children
+    };
+
     // For writev/readv
     struct tgt_iovec {
         uint64_t iov_base; // void *
@@ -158,6 +175,9 @@ class Linux : public OperatingSystem
         int64_t ru_nivcsw;              //!< involuntary "
     };
 
+    static int openSpecialFile(std::string path, LiveProcess *process, ThreadContext *tc);
+    static std::string procMeminfo(LiveProcess *process, ThreadContext *tc);
+
 };  // class Linux