1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:57:46 +00:00

Kernel: Don't assume paths of TTYs and pseudo terminals anymore

The obsolete ttyname and ptsname syscalls are removed.
LibC doesn't rely on these anymore, and it helps simplifying the Kernel
in many places, so it's an overall an improvement.

In addition to that, /proc/PID/tty node is removed too as it is not
needed anymore by userspace to get the attached TTY of a process, as
/dev/tty (which is already a character device) represents that as well.
This commit is contained in:
Liav A 2022-02-15 21:41:41 +02:00 committed by Andreas Kling
parent de7566c2c4
commit b5ef900ccd
19 changed files with 13 additions and 141 deletions

View file

@ -184,8 +184,6 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
return virt$profiling_disable(arg1);
case SC_profiling_enable:
return virt$profiling_enable(arg1);
case SC_ptsname:
return virt$ptsname(arg1, arg2, arg3);
case SC_purge:
return virt$purge(arg1);
case SC_read:
@ -249,8 +247,6 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
return 0;
case SC_sysconf:
return virt$sysconf(arg1);
case SC_ttyname:
return virt$ttyname(arg1, arg2, arg3);
case SC_umask:
return virt$umask(arg1);
case SC_uname:
@ -1454,19 +1450,6 @@ int Emulator::virt$setpgid(pid_t pid, pid_t pgid)
return syscall(SC_setpgid, pid, pgid);
}
int Emulator::virt$ttyname(int fd, FlatPtr buffer, size_t buffer_size)
{
auto buffer_result = ByteBuffer::create_zeroed(buffer_size);
if (buffer_result.is_error())
return -ENOMEM;
auto& host_buffer = buffer_result.value();
int rc = syscall(SC_ttyname, fd, host_buffer.data(), host_buffer.size());
if (rc < 0)
return rc;
mmu().copy_to_vm(buffer, host_buffer.data(), host_buffer.size());
return rc;
}
int Emulator::virt$getcwd(FlatPtr buffer, size_t buffer_size)
{
auto buffer_result = ByteBuffer::create_zeroed(buffer_size);
@ -1642,12 +1625,6 @@ u32 Emulator::virt$allocate_tls(FlatPtr initial_data, size_t size)
return tls_base;
}
int Emulator::virt$ptsname(int fd, FlatPtr buffer, size_t buffer_size)
{
auto pts = mmu().copy_buffer_from_vm(buffer, buffer_size);
return syscall(SC_ptsname, fd, pts.data(), pts.size());
}
int Emulator::virt$beep()
{
return syscall(SC_beep);