Cygwin: ctty: Add comments for the special values: -1 and -2.
_pinfo::ctty has two special values other than the device id of the allocated ctty: -1: CTTY is not initialized yet. Can be associated with the TTY which is associated with the session leader. -2: CTTY has been released by setsid(). Can be associate only with new TTY which is not associated with any other session as CTTY, but cannot be associate with the TTYs already associated with other sessions. This patch adds the comments in some source files. Suggested-by: Corinna Vinschen <corinna@vinschen.de> Signedoff-by: Takashi Yano <takashi.yano@nifty.ne.jp>
This commit is contained in:
parent
8e77725f31
commit
3b7df69aaa
|
@ -97,7 +97,7 @@ pinfo_init (char **envp, int envc)
|
|||
|
||||
myself.thisproc (NULL);
|
||||
myself->pgid = myself->sid = myself->pid;
|
||||
myself->ctty = -1;
|
||||
myself->ctty = -1; /* -1 means not initialized yet. */
|
||||
myself->uid = ILLEGAL_UID;
|
||||
myself->gid = ILLEGAL_GID;
|
||||
environ_init (NULL, 0); /* call after myself has been set up */
|
||||
|
@ -531,6 +531,9 @@ _pinfo::set_ctty (fhandler_termios *fh, int flags)
|
|||
if (fh && (ctty <= 0 || ctty == tc.ntty) && !(flags & O_NOCTTY))
|
||||
{
|
||||
if (tc.getsid () && tc.getsid () != sid && ctty == -2)
|
||||
/* ctty == -2 means CTTY has been released by setsid().
|
||||
Can be associated only with a new TTY which is not
|
||||
associated with any other session. */
|
||||
; /* Do nothing if another session is associated with the TTY. */
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1176,7 +1176,9 @@ setsid (void)
|
|||
syscall_printf ("hmm. pgid %d pid %d", myself->pgid, myself->pid);
|
||||
else
|
||||
{
|
||||
myself->ctty = -2;
|
||||
myself->ctty = -2; /* -2 means CTTY has been released by setsid().
|
||||
Can be associated only with a new TTY which
|
||||
is not associated with any session. */
|
||||
myself->sid = myself->pid;
|
||||
myself->pgid = myself->pid;
|
||||
if (cygheap->ctty)
|
||||
|
|
Loading…
Reference in New Issue