void handle_syscall(syscall_req_t* req, syscall_rsp_t* rsp) { switch (req->header.id) { case OPEN_ID: handle_open(req, rsp); break; case CLOSE_ID: handle_close(req, rsp); break; case READ_ID: handle_read(req, rsp); break; case WRITE_ID: handle_write(req, rsp); break; case LINK_ID: handle_link(req, rsp); break; case UNLINK_ID: handle_unlink(req, rsp); break; case LSEEK_ID: handle_lseek(req, rsp); break; case FSTAT_ID: handle_fstat(req, rsp); break; case ISATTY_ID: handle_isatty(req, rsp); break; case STAT_ID: handle_stat(req, rsp); break; default: error(-1, "Illegal syscall, should never be here..."); } rsp->header.return_errno = errno; }
int handle_vFile (char *own_buf, int packet_len, int *new_packet_len) { if (startswith (own_buf, "vFile:open:")) handle_open (own_buf); else if (startswith (own_buf, "vFile:pread:")) handle_pread (own_buf, new_packet_len); else if (startswith (own_buf, "vFile:pwrite:")) handle_pwrite (own_buf, packet_len); else if (startswith (own_buf, "vFile:fstat:")) handle_fstat (own_buf, new_packet_len); else if (startswith (own_buf, "vFile:close:")) handle_close (own_buf); else if (startswith (own_buf, "vFile:unlink:")) handle_unlink (own_buf); else if (startswith (own_buf, "vFile:readlink:")) handle_readlink (own_buf, new_packet_len); else return 0; return 1; }