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.thisproc (NULL);
|
||||||
myself->pgid = myself->sid = myself->pid;
|
myself->pgid = myself->sid = myself->pid;
|
||||||
myself->ctty = -1;
|
myself->ctty = -1; /* -1 means not initialized yet. */
|
||||||
myself->uid = ILLEGAL_UID;
|
myself->uid = ILLEGAL_UID;
|
||||||
myself->gid = ILLEGAL_GID;
|
myself->gid = ILLEGAL_GID;
|
||||||
environ_init (NULL, 0); /* call after myself has been set up */
|
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 (fh && (ctty <= 0 || ctty == tc.ntty) && !(flags & O_NOCTTY))
|
||||||
{
|
{
|
||||||
if (tc.getsid () && tc.getsid () != sid && ctty == -2)
|
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. */
|
; /* Do nothing if another session is associated with the TTY. */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1176,7 +1176,9 @@ setsid (void)
|
||||||
syscall_printf ("hmm. pgid %d pid %d", myself->pgid, myself->pid);
|
syscall_printf ("hmm. pgid %d pid %d", myself->pgid, myself->pid);
|
||||||
else
|
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->sid = myself->pid;
|
||||||
myself->pgid = myself->pid;
|
myself->pgid = myself->pid;
|
||||||
if (cygheap->ctty)
|
if (cygheap->ctty)
|
||||||
|
|
Loading…
Reference in New Issue