sim-se: correct statfs inclusion on !linux host
authorAndrea Mondelli <Andrea.Mondelli@ucf.edu>
Sat, 4 May 2019 13:43:24 +0000 (09:43 -0400)
committerBrandon Potter <Brandon.Potter@amd.com>
Mon, 6 May 2019 18:20:44 +0000 (18:20 +0000)
- Added missing header
- Fixed typo on __linux__ macro conditional
- s/ifdef/if defined/g for consistency

Change-Id: I83b69856e5ec8b23b707642c0e14216cf62db31e
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18668
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Brandon Potter <Brandon.Potter@amd.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/sim/syscall_emul.cc
src/sim/syscall_emul.hh

index 98fbe96a0aab91938ba0dffcac5966e228e0da51..ba84250de6ccc980a360c49d600fd68488e11678 100644 (file)
@@ -1039,7 +1039,7 @@ getegidFunc(SyscallDesc *desc, int callnum, Process *process,
 SyscallReturn
 fallocateFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc)
 {
-#if __linux__
+#if defined(__linux__)
     int index = 0;
     int tgt_fd = p->getSyscallArg(tc, index);
     int mode = p->getSyscallArg(tc, index);
index 91db9ae49a91b0f055cf2309f60bb808f2447cf7..caa4d2cf394f12da8c4e4e75ce074566ee3adb24 100644 (file)
 /// This file defines objects used to emulate syscalls from the target
 /// application on the host machine.
 
-#ifdef __linux__
+#if defined(__linux__)
 #include <sys/eventfd.h>
 #include <sys/statfs.h>
 
+#else
+#include <sys/mount.h>
+
 #endif
 
 #ifdef __CYGWIN32__
@@ -778,12 +781,12 @@ ioctlFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc)
             return status;
           }
           case SIOCGIFFLAGS:
-#ifdef __linux__
+#if defined(__linux__)
           case SIOCGIFINDEX:
 #endif
           case SIOCGIFNETMASK:
           case SIOCGIFADDR:
-#ifdef __linux__
+#if defined(__linux__)
           case SIOCGIFHWADDR:
 #endif
           case SIOCGIFMTU: {
@@ -1515,7 +1518,7 @@ SyscallReturn
 statfsFunc(SyscallDesc *desc, int callnum, Process *process,
            ThreadContext *tc)
 {
-#ifdef __linux__
+#if defined(__linux__)
     std::string path;
 
     int index = 0;
@@ -2851,7 +2854,7 @@ template <class OS>
 SyscallReturn
 eventfdFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
 {
-#ifdef __linux__
+#if defined(__linux__)
     int index = 0;
     unsigned initval = p->getSyscallArg(tc, index);
     int in_flags = p->getSyscallArg(tc, index);