mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
Add sys$ttyname_r and ttyname_r() + ttyname().
And print a greeting when sh starts up so we know which TTY we're on.
This commit is contained in:
parent
7a85384e47
commit
00c21d1590
12 changed files with 78 additions and 3 deletions
|
@ -38,6 +38,20 @@ ssize_t write(int fd, const void* buf, size_t count)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int ttyname_r(int fd, char* buffer, size_t size)
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::PosixTtynameR, (dword)fd, (dword)buffer, (dword)size);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
static char ttyname_buf[32];
|
||||
char* ttyname(int fd)
|
||||
{
|
||||
if (ttyname_r(fd, ttyname_buf, sizeof(ttyname_buf)) < 0)
|
||||
return nullptr;
|
||||
return ttyname_buf;
|
||||
}
|
||||
|
||||
int close(int fd)
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::PosixClose, fd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue