summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/sandbox/cpu/os.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index 36637af..3e37c93 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -44,6 +44,14 @@ ssize_t os_read(int fd, void *buf, size_t count)
return read(fd, buf, count);
}
+ssize_t os_read_no_block(int fd, void *buf, size_t count)
+{
+ const int flags = fcntl(fd, F_GETFL, 0);
+
+ fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+ return os_read(fd, buf, count);
+}
+
ssize_t os_write(int fd, const void *buf, size_t count)
{
return write(fd, buf, count);