feat: add is_terminal_attached syscall
This commit is contained in:
@@ -626,6 +626,8 @@ namespace montauk::abi {
|
||||
|
||||
return 0;
|
||||
}
|
||||
case SYS_TERMINAL_ATTACHED:
|
||||
return Sys_TerminalAttached();
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
@@ -652,7 +654,8 @@ namespace montauk::abi {
|
||||
Hal::WriteMSR(Hal::IA32_FMASK, 0x200);
|
||||
|
||||
Kt::KernelLogStream(Kt::OK, "Syscall") << "SYSCALL/SYSRET initialized (LSTAR="
|
||||
<< kcp::hex << (uint64_t)SyscallEntry << kcp::dec << ", 171 syscall slots)";
|
||||
<< kcp::hex << (uint64_t)SyscallEntry << kcp::dec << ", "
|
||||
<< (SYS_TERMINAL_ATTACHED + 1) << " syscall slots)";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -160,6 +160,9 @@ namespace montauk::abi {
|
||||
/* Userspace log */
|
||||
static constexpr uint64_t SYS_LOG_WRITE = 176;
|
||||
|
||||
/* Process terminal attachment */
|
||||
static constexpr uint64_t SYS_TERMINAL_ATTACHED = 177;
|
||||
|
||||
// Audio control commands (for SYS_AUDIOCTL).
|
||||
//
|
||||
// Commands 0..3 act on the stream named by the handle argument.
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
|
||||
namespace montauk::abi {
|
||||
|
||||
static int Sys_TerminalAttached() {
|
||||
auto* proc = Sched::GetCurrentProcessPtr();
|
||||
return proc != nullptr && proc->redirected && proc->ioOutHandle >= 0;
|
||||
}
|
||||
|
||||
static void Sys_Print(const char* text) {
|
||||
auto* proc = Sched::GetCurrentProcessPtr();
|
||||
if (proc && proc->redirected) {
|
||||
|
||||
Reference in New Issue
Block a user