mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:27:35 +00:00
Virtual consoles kinda work!
We now make three VirtualConsoles at boot: tty0, tty1, and tty2. We launch an instance of /bin/sh in each one. You switch between them with Alt+1/2/3 How very very cool :^)
This commit is contained in:
parent
68739dc43e
commit
7a7956a595
24 changed files with 251 additions and 103 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "types.h"
|
||||
#include "string.h"
|
||||
#include "errno.h"
|
||||
#include "unistd.h"
|
||||
#include <Kernel/Syscall.h>
|
||||
#include <AK/printf.cpp>
|
||||
|
||||
|
@ -10,13 +11,14 @@ extern "C" {
|
|||
|
||||
int putchar(int ch)
|
||||
{
|
||||
Syscall::invoke(Syscall::PutCharacter, ch);
|
||||
write(0, &ch, 1);
|
||||
//Syscall::invoke(Syscall::PutCharacter, ch);
|
||||
return (byte)ch;
|
||||
}
|
||||
|
||||
static void sys_putch(char*, char ch)
|
||||
static void sys_putch(char*&, char ch)
|
||||
{
|
||||
Syscall::invoke(Syscall::PutCharacter, ch);
|
||||
putchar(ch);
|
||||
}
|
||||
|
||||
int printf(const char* fmt, ...)
|
||||
|
|
|
@ -32,6 +32,12 @@ ssize_t read(int fd, void* buf, size_t count)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
ssize_t write(int fd, const void* buf, size_t count)
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::PosixWrite, (dword)fd, (dword)buf, (dword)count);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int close(int fd)
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::PosixClose, fd);
|
||||
|
|
|
@ -9,6 +9,7 @@ gid_t getgid();
|
|||
pid_t getpid();
|
||||
int open(const char* path, int options);
|
||||
ssize_t read(int fd, void* buf, size_t count);
|
||||
ssize_t write(int fd, const void* buf, size_t count);
|
||||
int close(int fd);
|
||||
pid_t waitpid(pid_t, int* wstatus, int options);
|
||||
int chdir(const char* path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue