This is the mail archive of the sid@sources.redhat.com mailing list for the SID project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch for gloss unlink and lseek.



  Hello, I've committed the following patch.  The patch implements
unlink and fixes several bugs in lseek.

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.


Index: gloss.cxx
===================================================================
RCS file: /cvs/src/src/sid/component/gloss/gloss.cxx,v
retrieving revision 1.12
diff -c -p -r1.12 gloss.cxx
*** gloss.cxx	2001/09/26 03:56:05	1.12
--- gloss.cxx	2001/10/31 23:24:59
*************** gloss32::syscall_trap()
*** 680,685 ****
--- 680,688 ----
      case libgloss::SYS_times:
        do_sys_times();
        break;
+     case libgloss::SYS_unlink:
+       do_sys_unlink();
+       break;
      default:
        do_nonstandard_target_syscalls (syscall);
        break;
*************** gloss32::do_sys_times()
*** 765,770 ****
--- 768,792 ----
  }
  
  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;
*************** gloss32::do_sys_lseek()
*** 792,802 ****
--- 814,827 ----
      {
      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;
*************** gloss32::do_sys_lseek()
*** 805,814 ****
    if (! this->lseek(handle, offset, whence, new_pos, errcode))
      {
        set_host_error_result(errcode);
!       set_int_result(1);
        return;
      }
!   set_int_result(0);
  }
  
  void
--- 830,839 ----
    if (! this->lseek(handle, offset, whence, new_pos, errcode))
      {
        set_host_error_result(errcode);
!       set_int_result(-1);
        return;
      }
!   set_int_result(new_pos);
  }
  
  void
Index: gloss.h
===================================================================
RCS file: /cvs/src/src/sid/component/gloss/gloss.h,v
retrieving revision 1.5
diff -c -p -r1.5 gloss.h
*** gloss.h	2001/09/26 03:56:05	1.5
--- gloss.h	2001/10/31 23:24:59
*************** protected:
*** 148,153 ****
--- 148,154 ----
    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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]