mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oliver Neukum <oliver@neukum.org>
To: linux-kernel@vger.kernel.org
Subject: question on tty open and close
Date: Wed, 28 Mar 2007 13:38:29 +0200	[thread overview]
Message-ID: <200703281338.29250.oliver@neukum.org> (raw)

Hi,

in tty_io.c::tty_open():

	if (!retval) {
		if (tty->driver->open)
			retval = tty->driver->open(tty, filp);
		else
			retval = -ENODEV;
	}
	filp->f_flags = saved_flags;

	if (!retval && test_bit(TTY_EXCLUSIVE, &tty->flags) && !capable(CAP_SYS_ADMIN))
		retval = -EBUSY;

	if (retval) {
#ifdef TTY_DEBUG_HANGUP
		printk(KERN_DEBUG "error %d in opening %s...", retval,
		       tty->name);
#endif
		release_dev(filp);

We find that a failure in open() leads to release_dev() being called.
release_dev() calls close():

	if (tty->driver->close)
		tty->driver->close(tty, filp);

So we have a file that's closed although open() never succeeded?
What's the reason for that?

	Regards
		Oliver

             reply	other threads:[~2007-03-28 11:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-28 11:38 Oliver Neukum [this message]
2007-03-28 13:10 ` Stuart MacDonald
2007-03-28 13:16   ` Oliver Neukum
2007-03-28 13:22     ` Stuart MacDonald
2007-03-28 14:44       ` Alan Cox
2007-03-28 15:26         ` Paul Fulghum
2007-03-28 15:31           ` Alan Cox
2007-03-28 14:54             ` Marcel Holtmann
2007-03-28 15:32             ` Paul Fulghum
2007-03-28 14:37 Kilau, Scott

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=200703281338.29250.oliver@neukum.org \
    --to=oliver@neukum.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®