public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH] Cygwin: pinfo: Additional fix for CTTY behavior.
Date: Tue, 10 Jan 2023 18:52:57 +0900	[thread overview]
Message-ID: <20230110185257.8f316240e5d9f2d2fb78f21a@nifty.ne.jp> (raw)
In-Reply-To: <Y7vdjTREYWiLAJ9N@calimero.vinschen.de>

On Mon, 9 Jan 2023 10:25:33 +0100
Corinna Vinschen wrote:
> On Dec 28 17:35, Takashi Yano wrote:
> > The commit 25c4ad6ea52f did not fix the CTTY behavior enough. For
> > example, in the following test case, TTY will be associated as
> > a CTTY on the second open() call even though the TTY is already
> > CTTY of another session. This patch fixes the issue.
> 
> The patch is ok, thanks.
> 
> But while looking into this patch, I realized how confusing the old code
> is.  An unsuspecting reader will have a really hard time to figure out
> what ctty values of -1 or -2 actually mean.  The CVS log entry from 2012
> isn't enlightening either:
> 
>   On second thought, in the spirit of keeping things kludgy, set ctty to
>   -2 here as a special flag ...
> 
> Would you mind to introduce speaking symbolic values for them and add
> some comments to make them more transparent?

Ok. Do you mean, first push this CTTY patch, then,
add comment for ctty values -1 and -2 in another patch?

> Also, given this was a "kludge" from 10 years ago, is it really still
> needed?
> 
> As I said, it's confusing :}

Currently, the special values mean:
-1: CTTY is not initialized yet. Can associate with the TTY
    which is associated with the own session.
-2: CTTY has been released by setsid(). Can associate with
    a new TTY as CTTY, but cannot associate with the TTYs
    already associated with other sessions.

So, I think the two different values are necessary. 

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

  reply	other threads:[~2023-01-10  9:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-28  8:35 Takashi Yano
2023-01-09  9:25 ` Corinna Vinschen
2023-01-10  9:52   ` Takashi Yano [this message]
2023-01-10 10:35     ` Corinna Vinschen
2023-01-10 13:37   ` Takashi Yano
2023-01-10 14:35     ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230110185257.8f316240e5d9f2d2fb78f21a@nifty.ne.jp \
    --to=takashi.yano@nifty.ne.jp \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).