diff --git a/headers/posix/termios.h b/headers/posix/termios.h index e8ec24428a..0be1e3cc1b 100644 --- a/headers/posix/termios.h +++ b/headers/posix/termios.h @@ -235,6 +235,7 @@ extern int tcdrain(int fd); extern int tcflow(int fd, int action); extern int tcflush(int fd, int queueSelector); extern pid_t tcgetsid(int fd); +extern int tcsetsid(int fd, pid_t pid); #ifdef __cplusplus } diff --git a/src/system/libroot/posix/termios.c b/src/system/libroot/posix/termios.c index 18b9c96c2f..5f559bedc9 100644 --- a/src/system/libroot/posix/termios.c +++ b/src/system/libroot/posix/termios.c @@ -180,3 +180,15 @@ tcgetsid(int fd) return -1; } + +int +tcsetsid(int fd, pid_t pid) +{ + if (pid != getsid(0)) { + errno = EINVAL; + return -1; + } + + return ioctl(fd, TIOCSCTTY, NULL); +} +