]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/sandbox/cpu/os.c
sandbox: Improve sandbox serial port keyboard interface
[karo-tx-uboot.git] / arch / sandbox / cpu / os.c
index 36637af6ce4c578a19e4133025822afe82ec6001..3e37c930b06d6c690a9c7054562982dd313d8ac3 100644 (file)
@@ -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);