Ejemplo n.º 1
0
 def _handle_read(self, e, a, pre):
     print 'read', pre, a.a0
     if not pre and a.a0 in self.fds:
         print a.a0, a.a1, a.a2
         buf = self.fds[a.a0].read(a.a2)
         Child.from_event(e).write(a.a1, buf)
         a.return_code = len(buf)
         Child.from_event(e).modify_regs(a.syscall, a)
Ejemplo n.º 2
0
 def _handle_read(self, e, a, pre):
     print 'read', pre, a.a0
     if not pre and a.a0 in self.fds:
         print a.a0, a.a1, a.a2
         buf = self.fds[a.a0].read(a.a2)
         Child.from_event(e).write(a.a1, buf)
         a.return_code = len(buf)
         Child.from_event(e).modify_regs(a.syscall, a)
Ejemplo n.º 3
0
 def _handle_open(self, e, a, pre):
     if pre:
         fname = Child.from_event(e).read_string(a.a0)
         if fname in self.files:
             fd = self.get_fd()
             self.fds[fd] = self.files[fname]
             self.event_to_fds[Child.from_event(e)] = fd
     elif Child.from_event(e) in self.event_to_fds:
         fd = self.event_to_fds.pop(Child.from_event(e))
         a.return_code = fd
         Child.from_event(e).modify_regs(a.syscall, a)
Ejemplo n.º 4
0
 def _handle_open(self, e, a, pre):
     if pre:
         fname = Child.from_event(e).read_string(a.a0)
         if fname in self.files:
             fd = self.get_fd()
             self.fds[fd] = self.files[fname]
             self.event_to_fds[Child.from_event(e)] = fd
     elif Child.from_event(e) in self.event_to_fds:
         fd = self.event_to_fds.pop(Child.from_event(e))
         a.return_code = fd
         Child.from_event(e).modify_regs(a.syscall, a)
Ejemplo n.º 5
0
 def _handle_write(self, e, a, pre):
     c = Child.from_event(e)
     if pre and a.a0 in (1, 2):
         buf = c.read(a.a1, a.a2)
         if buf:
             c.write(a.a1, buf[::-1])