OSDN Git Service

2001-10-26 Vladimir Makarov <vmakarov@redhat.com>
authorvmakarov <vmakarov>
Wed, 31 Oct 2001 23:27:52 +0000 (23:27 +0000)
committervmakarov <vmakarov>
Wed, 31 Oct 2001 23:27:52 +0000 (23:27 +0000)
* gloss.h (gloss32::do_sys_unlink): New function.

* gloss.cxx (gloss32::syscall_trap): Add processing SYS_unlink.
(gloss32::do_sys_unlink): New function.
(gloss32::do_sys_exit): Add breaks after each case.
(gloss32::do_sys_lseek): Set up correct results.

sid/component/gloss/ChangeLog
sid/component/gloss/gloss.cxx
sid/component/gloss/gloss.h

index 27eb1b3..0c26b73 100644 (file)
@@ -1,3 +1,12 @@
+2001-10-26  Vladimir Makarov  <vmakarov@redhat.com>
+
+       * gloss.h (gloss32::do_sys_unlink): New function.
+
+       * gloss.cxx (gloss32::syscall_trap): Add processing SYS_unlink.
+       (gloss32::do_sys_unlink): New function.
+       (gloss32::do_sys_exit): Add breaks after each case.
+       (gloss32::do_sys_lseek): Set up correct results.
+
 2001-10-10  Frank Ch. Eigler  <fche@redhat.com>
 
        On advice of Keith Rautenbach <Keith.Rautenbach@insignia.com>:
index f3cfdd7..a0df97c 100644 (file)
@@ -680,6 +680,9 @@ gloss32::syscall_trap()
     case libgloss::SYS_times:
       do_sys_times();
       break;
+    case libgloss::SYS_unlink:
+      do_sys_unlink();
+      break;
     default:
       do_nonstandard_target_syscalls (syscall);
       break;
@@ -765,6 +768,25 @@ gloss32::do_sys_times()
 }
 
 void
+gloss32::do_sys_unlink()
+{
+  string filename;
+  int32 str_ptr;
+  int errcode;
+
+  get_int_argument(1, str_ptr);
+  get_string(str_ptr, filename, 100);
+
+  if (! this->remove (filename, errcode))
+    {
+      set_host_error_result (errcode);
+      set_int_result (-1);
+    }
+  else
+    set_int_result (0);
+}
+
+void
 gloss32::do_sys_exit()
 {
   int32 value;
@@ -792,11 +814,14 @@ gloss32::do_sys_lseek()
     {
     case 1:
       whence = hostops::seek_cur;
+      break;
     case 2:
       whence = hostops::seek_end;
+      break;
     default:
     case 0:
       whence = hostops::seek_set;
+      break;
     }
 
   size32 new_pos;
@@ -805,10 +830,10 @@ gloss32::do_sys_lseek()
   if (! this->lseek(handle, offset, whence, new_pos, errcode))
     {
       set_host_error_result(errcode);
-      set_int_result(1);
+      set_int_result(-1);
       return;
     }
-  set_int_result(0);
+  set_int_result(new_pos);
 }
 
 void
index 5621cff..8992ef3 100644 (file)
@@ -148,6 +148,7 @@ protected:
   void do_sys_time();
   void do_sys_gettimeofday();
   void do_sys_times();
+  void do_sys_unlink();
   virtual void do_nonstandard_target_syscalls(int32 syscall);
   virtual bool target_to_host_open_flags (int open_flags, int& flags);
   virtual int32 target_to_host_syscall (int32 syscall);