summaryrefslogtreecommitdiff
path: root/src/init/main.c
diff options
context:
space:
mode:
authordzwdz2021-10-10 16:02:10 +0000
committerdzwdz2021-10-10 16:02:10 +0000
commit26911b7c45d362c7760d002e4395e33524c4744a (patch)
treec0495f6470ee9956442da3fe7ab2e138f6907cc4 /src/init/main.c
parentf731536d64ce57ef6297f861bbc785020b132e9b (diff)
init: move __tty_fd to the stdlib, add the underscores to its name
Diffstat (limited to 'src/init/main.c')
-rw-r--r--src/init/main.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/init/main.c b/src/init/main.c
index 35d22a1..f726f31 100644
--- a/src/init/main.c
+++ b/src/init/main.c
@@ -11,8 +11,6 @@ extern char _bss_start; // provided by the linker
extern char _bss_end;
extern char _initrd;
-int tty_fd;
-
void read_file(const char *path, size_t len);
void fs_test(void);
void test_await(void);
@@ -22,8 +20,8 @@ int main(void) {
// allocate bss
_syscall_memflag(&_bss_start, &_bss_end - &_bss_start, MEMFLAG_PRESENT);
- tty_fd = _syscall_open("/tty", sizeof("/tty") - 1);
- if (tty_fd < 0)
+ __tty_fd = _syscall_open("/tty", sizeof("/tty") - 1);
+ if (__tty_fd < 0)
_syscall_exit(1);
fs_test();
@@ -38,7 +36,7 @@ void read_file(const char *path, size_t len) {
static char buf[64];
int buf_len = 64;
- _syscall_write(tty_fd, path, len, 0);
+ _syscall_write(__tty_fd, path, len, 0);
printf(": ");
if (fd < 0) {
printf("couldn't open.\n");
@@ -46,7 +44,7 @@ void read_file(const char *path, size_t len) {
}
buf_len = _syscall_read(fd, buf, buf_len, 0);
- _syscall_write(tty_fd, buf, buf_len, 0);
+ _syscall_write(__tty_fd, buf, buf_len, 0);
_syscall_close(fd);
}