X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=docs%2Fctty.htm;h=8f466cdde6677c2fff3113d2aed8b06293a01fa4;hb=d4b719878f5a08986d0a3dc493aad90d4466752e;hp=26d2c79569f450092b6343035e4354245cd43554;hpb=d0bbbdcd6eefd249637f153f9d29b37c7f545e33;p=oweals%2Fbusybox.git diff --git a/docs/ctty.htm b/docs/ctty.htm index 26d2c7956..8f466cdde 100644 --- a/docs/ctty.htm +++ b/docs/ctty.htm @@ -145,7 +145,7 @@ PID (process ID), PGID (process group ID) and SID (session ID) of processes. With a shell that does not know about job control, like ash, each of its children will be in the same session and have the same process group as the shell. With a shell that knows -about job control, like bash, the processes of one pipeline. like +about job control, like bash, the processes of one pipeline, like

% cat paper | ideal | pic | tbl | eqn | ditroff > out
 
@@ -227,7 +227,7 @@ controlling tty. If there is none, this returns a random value larger than 1 that is not a process group ID.

A process can set the foreground process group in its session using tcsetpgrp(fd,pgrp), where fd refers to its -controlling tty, and pgrp is a process group in the +controlling tty, and pgrp is a process group in its session, and this session still is associated to the controlling tty of the calling process.

How does one get fd? By definition, /dev/tty @@ -365,7 +365,7 @@ this is a great mystery. becomes its controlling tty.

The BSD approach is that one has to explicitly call

-
ioctl(fd, TIOCSCTTY, ...);
+
ioctl(fd, TIOCSCTTY, 0/1);
 
@@ -378,6 +378,8 @@ and (ii) it does not yet have a controlling tty, and (iii) maybe the tty should not already control some other session; if it does it is an error if we aren't root, or we steal the tty if we are all-powerful. +[vda: correction: third parameter controls this: if 1, we steal tty from +any such session, if 0, we don't steal]

Opening some terminal will give us a controlling tty, provided that (i) the current process is a session leader, and (ii) it does not yet have a controlling tty, and