diff --git a/dev/console.c b/dev/console.c index b4fd698..34a1724 100644 --- a/dev/console.c +++ b/dev/console.c @@ -138,3 +138,18 @@ void console_putchar(char c) } serial_write(c); } + +ssize_t console_write(const char *buf, size_t count) +{ + for (size_t i = 0; i < count; i++) + console_putchar(buf[i]); + return count; +} + +ssize_t console_read(char *buf, size_t count) +{ + if(console.l_line == 0) + return -EAGAIN; + + return 0; +} diff --git a/include/errno.h b/include/errno.h index e4ce924..69b44b9 100644 --- a/include/errno.h +++ b/include/errno.h @@ -12,6 +12,7 @@ #define EEXIST 8 #define ENOEXEC 9 #define EFAULT 10 +#define EAGAIN 11 const char *strerror(int errnum); diff --git a/include/kernel/common.h b/include/kernel/common.h index 6d8f4b5..ae0f52a 100644 --- a/include/kernel/common.h +++ b/include/kernel/common.h @@ -29,5 +29,6 @@ void panic(); typedef uintptr_t paddr_t; typedef uint32_t paddr32_t; +typedef int64_t ssize_t; #endif /* _COMMON_H_ */ diff --git a/lib/errno.c b/lib/errno.c index 8d4c136..d589476 100644 --- a/lib/errno.c +++ b/lib/errno.c @@ -14,6 +14,7 @@ static const char *errno_str[] = { [EEXIST] = "File exists", [ENOEXEC] = "Exec format error", [EFAULT] = "Bad address", + [EAGAIN] = "Try again", }; inline const char *strerror(int errnum)