about summary refs log tree commit diff
path: root/src/termios/tcgetsid.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/termios/tcgetsid.c')
-rw-r--r--src/termios/tcgetsid.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/termios/tcgetsid.c b/src/termios/tcgetsid.c
new file mode 100644
index 00000000..1053fd64
--- /dev/null
+++ b/src/termios/tcgetsid.c
@@ -0,0 +1,10 @@
+#include <termios.h>
+#include <sys/ioctl.h>
+
+pid_t tcgetsid(int fd)
+{
+	int sid;
+	if (ioctl(fd, TIOCGSID, &sid) < 0)
+		return -1;
+	return sid;
+}