Kernel/LibC: Add initial pseudo terminal support
This patch implements posix_openpt() and ptsname() grantpt() and unlockpt() are left in LibC as stubs, as posix_openpt currently does all of the needed work.
This commit is contained in:
@@ -88,6 +88,8 @@ __BEGIN_DECLS
|
||||
O(SYS_SIGPENDING, sigpending) \
|
||||
O(SYS_SIGPROCMASK, sigprocmask) \
|
||||
O(SYS_SETITIMER, setitimer) \
|
||||
O(SYS_POSIX_OPENPT, posix_openpt) \
|
||||
O(SYS_PTSNAME, ptsname) \
|
||||
|
||||
enum Syscall
|
||||
{
|
||||
|
||||
@@ -519,6 +519,31 @@ char* mktemp(char*)
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
int posix_openpt(int oflag)
|
||||
{
|
||||
return syscall(SYS_POSIX_OPENPT, oflag);
|
||||
}
|
||||
|
||||
int grantpt(int)
|
||||
{
|
||||
// currently posix_openpt() does this
|
||||
return 0;
|
||||
}
|
||||
|
||||
int unlockpt(int)
|
||||
{
|
||||
// currently posix_openpt() does this
|
||||
return 0;
|
||||
}
|
||||
|
||||
char* ptsname(int fildes)
|
||||
{
|
||||
static char buffer[PATH_MAX];
|
||||
if (syscall(SYS_PTSNAME, fildes, buffer, sizeof(buffer)) == -1)
|
||||
return nullptr;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
size_t mbstowcs(wchar_t* __restrict pwcs, const char* __restrict s, size_t n)
|
||||
{
|
||||
auto* us = reinterpret_cast<const unsigned char*>(s);
|
||||
|
||||
Reference in New Issue
Block a user