* Don't check the open count of the other tty anymore when acquiring a

reference. The places where that is of relevance do that anyway, and
  tty_ioctl(), where it isn't, failed before, although that was not
  necessary. This prevented for instance ioctls() on the master tty
  before any slave had been opened.
* If the tty has no process group set, don't check for background reads.
  This was a problem with telnetd, respectively the executed login,
  which couldn't access the tty, since telnetd makes sure neither itself
  nor login has a controlling tty.
  telnet still doesn't work, exactly because it has no controlling tty
  and cannot set the tty process group. Not sure how that is supposed to
  work. Furthermore the tty doesn't have the usual flags set, which is
  apparrently the reason for the workaround (read_string()) in login.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25038 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-04-19 00:02:05 +00:00
parent 1642048478
commit eebd3f7d47
1 changed files with 5 additions and 3 deletions

View File

@ -147,7 +147,7 @@ class TTYReferenceLocking {
{ {
MutexLocker _(gTTYCookieLock); MutexLocker _(gTTYCookieLock);
if (cookie->closed || cookie->other_tty->open_count == 0) if (cookie->closed)
return false; return false;
cookie->thread_count++; cookie->thread_count++;
@ -626,7 +626,8 @@ WriterLocker::_CheckBackgroundWrite() const
} }
pid_t processGroup = getpgid(0); pid_t processGroup = getpgid(0);
if (processGroup != fSource->settings->pgrp_id) { if (fSource->settings->pgrp_id != 0
&& processGroup != fSource->settings->pgrp_id) {
if (team_get_controlling_tty() == fSource->index) if (team_get_controlling_tty() == fSource->index)
send_signal(-processGroup, SIGTTOU); send_signal(-processGroup, SIGTTOU);
return EIO; return EIO;
@ -730,7 +731,8 @@ ReaderLocker::_CheckBackgroundRead() const
return B_OK; return B_OK;
pid_t processGroup = getpgid(0); pid_t processGroup = getpgid(0);
if (processGroup != fTTY->settings->pgrp_id) { if (fTTY->settings->pgrp_id != 0
&& processGroup != fTTY->settings->pgrp_id) {
if (team_get_controlling_tty() == fTTY->index) if (team_get_controlling_tty() == fTTY->index)
send_signal(-processGroup, SIGTTIN); send_signal(-processGroup, SIGTTIN);
return EIO; return EIO;