fix on 32bit boxes
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed, 15 Sep 2010 12:34:46 +0200
changeset 15 daf0d6f26acf
parent 12 2e11702ad4fa
child 16 3c08dd507a88
fix on 32bit boxes
model/dce-stat.cc
model/dce-stdio.cc
model/sys/dce-stat.h
--- a/model/dce-stat.cc	Wed Sep 15 12:04:18 2010 +0200
+++ b/model/dce-stat.cc	Wed Sep 15 12:34:46 2010 +0200
@@ -47,7 +47,18 @@
 }
 int dce_fxstat (int ver, int fd, struct stat *buf)
 {
-  return dce_fstat (fd, buf);
+  Thread *current = Current ();
+  NS_LOG_FUNCTION (current << UtilsGetNodeId () << fd);
+  NS_ASSERT (current != 0);
+  int index = UtilsSearchOpenFd (fd);
+  if (index == -1)
+    {
+      current->err = EBADF;
+      return -1;
+    }
+  UnixFd *unixFd = current->process->openFiles[index].second;
+  int retval = unixFd->Fxstat (ver, buf);
+  return retval;
 }
 int dce_fxstat64 (int ver, int fd, struct stat64 *buf)
 {
@@ -102,16 +113,9 @@
 }
 int dce_fstat (int fd, struct stat *buf)
 {
-  Thread *current = Current ();
-  NS_LOG_FUNCTION (current << UtilsGetNodeId () << fd);
-  NS_ASSERT (current != 0);
-  int index = UtilsSearchOpenFd (fd);
-  if (index == -1)
-    {
-      current->err = EBADF;
-      return -1;
-    }
-  UnixFd *unixFd = current->process->openFiles[index].second;
-  int retval = unixFd->Fxstat (0, buf);
-  return retval;
+  return dce_fxstat (_STAT_VER, fd, buf);
 }
+int dce_fstat64 (int fd, struct stat64 *buf)
+{
+  return dce_fxstat64 (_STAT_VER, fd, buf);
+}
--- a/model/dce-stdio.cc	Wed Sep 15 12:04:18 2010 +0200
+++ b/model/dce-stdio.cc	Wed Sep 15 12:34:46 2010 +0200
@@ -85,7 +85,7 @@
 }
 int my_stat (_IO_FILE *file, void *buf)
 {
-  int result = dce_fstat (file->_fileno, (struct stat *)buf);
+  int result = dce_fstat64 (file->_fileno, (struct stat64 *)buf);
   if (result == -1)
     {
       errno = Current ()->err;
--- a/model/sys/dce-stat.h	Wed Sep 15 12:04:18 2010 +0200
+++ b/model/sys/dce-stat.h	Wed Sep 15 12:34:46 2010 +0200
@@ -19,6 +19,7 @@
 int dce_lxstat64 (int ver, const char *pathname, struct stat64 *buf);
 
 int dce_fstat (int fd, struct stat *buf);
+int dce_fstat64 (int fd, struct stat64 *buf);
 
 int dce_mkdir(const char *pathname, mode_t mode);