1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:17:36 +00:00

Stub out a bunch more functions to get closer to that sweet bash build.

This commit is contained in:
Andreas Kling 2018-11-11 10:38:33 +01:00
parent e48182d91b
commit f394e3486a
14 changed files with 114 additions and 1 deletions

View file

@ -1042,6 +1042,16 @@ int Process::sys$access(const char* pathname, int mode)
ASSERT_NOT_REACHED();
}
int Process::sys$fcntl(int fd, int cmd, dword extra_arg)
{
(void) cmd;
(void) extra_arg;
auto* descriptor = file_descriptor(fd);
if (!descriptor)
return -EBADF;
ASSERT_NOT_REACHED();
}
int Process::sys$fstat(int fd, Unix::stat* statbuf)
{
VALIDATE_USER_WRITE(statbuf, sizeof(Unix::stat));
@ -1453,6 +1463,29 @@ int Process::sys$setpgid(pid_t specified_pid, pid_t specified_pgid)
return 0;
}
int Process::sys$tcgetattr(int fd, Unix::termios* tp)
{
VALIDATE_USER_WRITE(tp, sizeof(Unix::termios));
auto* descriptor = file_descriptor(fd);
if (!descriptor)
return -EBADF;
if (!descriptor->isTTY())
return -ENOTTY;
ASSERT_NOT_REACHED();
}
int Process::sys$tcsetattr(int fd, int optional_actions, const Unix::termios* tp)
{
(void) optional_actions;
VALIDATE_USER_READ(tp, sizeof(Unix::termios));
auto* descriptor = file_descriptor(fd);
if (!descriptor)
return -EBADF;
if (!descriptor->isTTY())
return -ENOTTY;
ASSERT_NOT_REACHED();
}
pid_t Process::sys$tcgetpgrp(int fd)
{
auto* descriptor = file_descriptor(fd);

View file

@ -170,6 +170,9 @@ public:
int sys$setuid(uid_t);
unsigned sys$alarm(unsigned seconds);
int sys$access(const char* pathname, int mode);
int sys$fcntl(int fd, int cmd, dword extra_arg);
int sys$tcgetattr(int fd, Unix::termios*);
int sys$tcsetattr(int fd, int optional_actions, const Unix::termios*);
static void initialize();

View file

@ -173,6 +173,12 @@ static DWORD handle(RegisterDump& regs, DWORD function, DWORD arg1, DWORD arg2,
return current->sys$alarm((unsigned)arg1);
case Syscall::SC_access:
return current->sys$access((const char*)arg1, (int)arg2);
case Syscall::SC_fcntl:
return current->sys$fcntl((int)arg1, (int)arg2, (dword)arg3);
case Syscall::SC_tcgetattr:
return current->sys$tcgetattr((int)arg1, (Unix::termios*)arg2);
case Syscall::SC_tcsetattr:
return current->sys$tcsetattr((int)arg1, (int)arg2, (const Unix::termios*)arg3);
default:
kprintf("<%u> int0x80: Unknown function %x requested {%x, %x, %x}\n", current->pid(), function, arg1, arg2, arg3);
break;

View file

@ -63,6 +63,9 @@
__ENUMERATE_SYSCALL(alarm) \
__ENUMERATE_SYSCALL(fstat) \
__ENUMERATE_SYSCALL(access) \
__ENUMERATE_SYSCALL(fcntl) \
__ENUMERATE_SYSCALL(tcsetattr) \
__ENUMERATE_SYSCALL(tcgetattr) \
#define DO_SYSCALL_A0(function) Syscall::invoke((dword)(function))