sim-se: add syscalls related to polling

Fix poll so that it will use the syscall retry capability
instead of causing a blocking call.

Add the accept and wait4 system calls.

Add polling to read to remove deadlocks that occur in the
event queue that are caused by blocking system calls.

Modify the write system call to return an error number in
case of error.

Change-Id: I0b4091a2e41e4187ebf69d63e0088f988f37d5da
Reviewed-on: https://gem5-review.googlesource.com/c/12115
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com>
This commit is contained in:
Brandon Potter
2018-04-18 14:57:57 -04:00
committed by Anthony Gutierrez
parent c4e67f6837
commit bc74c58eaf
13 changed files with 521 additions and 88 deletions

View File

@@ -153,6 +153,15 @@ class Linux : public OperatingSystem
uint64_t iov_len;
};
// For select().
// linux-3.14-src/include/uapi/linux/posix_types.h
struct fd_set{
#ifndef LINUX__FD_SETSIZE
#define LINUX__FD_SETSIZE 1024
unsigned long fds_bits[LINUX__FD_SETSIZE / (8 * sizeof(long))];
#endif
};
//@{
/// ioctl() command codes.
static const unsigned TGT_TCGETS = 0x5401;
@@ -265,6 +274,14 @@ class Linux : public OperatingSystem
static const unsigned TGT_CLONE_NEWPID = 0x20000000;
static const unsigned TGT_CLONE_NEWNET = 0x40000000;
static const unsigned TGT_CLONE_IO = 0x80000000;
// linux-3.13-src/include/uapi/linux/wait.h
static const unsigned TGT_WNOHANG = 0x00000001;
static const unsigned TGT_WUNTRACED = 0x00000002;
static const unsigned TGT_WSTOPPED = TGT_WUNTRACED;
static const unsigned TGT_WEXITED = 0x00000004;
static const unsigned TGT_WCONTINUED = 0x00000008;
static const unsigned TGT_WNOWAIT = 0x01000000;
}; // class Linux
#endif // __LINUX_HH__