* syscall.c (cb_syscall) <case CB_SYS_truncate>
authorHans-Peter Nilsson <hp@axis.com>
Wed, 15 Dec 2004 01:26:40 +0000 (01:26 +0000)
committerHans-Peter Nilsson <hp@axis.com>
Wed, 15 Dec 2004 01:26:40 +0000 (01:26 +0000)
<case CB_SYS_ftruncate>: New cases.

sim/common/ChangeLog
sim/common/syscall.c

index d7440be77262162c86768e1d0f1de90e7290c6c4..78be8dca45e3fc28618ba5180b63200737028101 100644 (file)
@@ -1,3 +1,8 @@
+2004-12-15  Hans-Peter Nilsson  <hp@axis.com>
+
+       * syscall.c (cb_syscall) <case CB_SYS_truncate>
+       <case CB_SYS_ftruncate>: New cases.
+
 2004-12-13  Hans-Peter Nilsson  <hp@axis.com>
 
        * syscall.c (cb_syscall) <case CB_SYS_lstat>: New case.
index 789aa3ac79af3e52fb9be167fc39ccfb56f3c65f..fcfb4176809a040edaec63d19d03da00bfe79c96 100644 (file)
@@ -400,6 +400,36 @@ cb_syscall (cb, sc)
       }
       break;
 
+    case CB_SYS_truncate :
+      {
+       char *path;
+       long len = sc->arg2;
+
+       errcode = get_path (cb, sc, sc->arg1, &path);
+       if (errcode != 0)
+         {
+           result = -1;
+           errcode = EFAULT;
+           goto FinishSyscall;
+         }
+       result = (*cb->truncate) (cb, path, len);
+       free (path);
+       if (result < 0)
+         goto ErrorFinish;
+      }
+      break;
+
+    case CB_SYS_ftruncate :
+      {
+       int fd = sc->arg1;
+       long len = sc->arg2;
+
+       result = (*cb->ftruncate) (cb, fd, len);
+       if (result < 0)
+         goto ErrorFinish;
+      }
+      break;
+
     case CB_SYS_rename :
       {
        char *path1, *path2;