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:
committed by
Adrien Destugues
parent
e04970ad6f
commit
a1999d3b8a
@@ -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
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user