POSIX: add tcsetsid()

Change-Id: Ia8f41e417379dcaf4f976933cf91bb2de157bc72
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3376
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Jérôme Duval
2020-11-17 07:53:28 +00:00
committed by Adrien Destugues
parent e04970ad6f
commit a1999d3b8a
2 changed files with 13 additions and 0 deletions
+1
View File
@@ -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
}
+12
View File
@@ -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);
}