tty: add stubs for console_write and console_read
This commit is contained in:
parent
e2d9609bf7
commit
874e63e41c
4 changed files with 18 additions and 0 deletions
|
|
@ -138,3 +138,18 @@ void console_putchar(char c)
|
||||||
}
|
}
|
||||||
serial_write(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;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
#define EEXIST 8
|
#define EEXIST 8
|
||||||
#define ENOEXEC 9
|
#define ENOEXEC 9
|
||||||
#define EFAULT 10
|
#define EFAULT 10
|
||||||
|
#define EAGAIN 11
|
||||||
|
|
||||||
const char *strerror(int errnum);
|
const char *strerror(int errnum);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,5 +29,6 @@ void panic();
|
||||||
|
|
||||||
typedef uintptr_t paddr_t;
|
typedef uintptr_t paddr_t;
|
||||||
typedef uint32_t paddr32_t;
|
typedef uint32_t paddr32_t;
|
||||||
|
typedef int64_t ssize_t;
|
||||||
|
|
||||||
#endif /* _COMMON_H_ */
|
#endif /* _COMMON_H_ */
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ static const char *errno_str[] = {
|
||||||
[EEXIST] = "File exists",
|
[EEXIST] = "File exists",
|
||||||
[ENOEXEC] = "Exec format error",
|
[ENOEXEC] = "Exec format error",
|
||||||
[EFAULT] = "Bad address",
|
[EFAULT] = "Bad address",
|
||||||
|
[EAGAIN] = "Try again",
|
||||||
};
|
};
|
||||||
|
|
||||||
inline const char *strerror(int errnum)
|
inline const char *strerror(int errnum)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue