Also publish /dev/tty. Opening it will open the controlling tty for the
current process. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24681 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
be8a6e43ff
commit
1ed6a33cc5
@ -27,8 +27,9 @@ static const int kMaxCachedSemaphores = 8;
|
||||
|
||||
int32 api_version = B_CUR_DRIVER_API_VERSION;
|
||||
|
||||
static char *sDeviceNames[kNumTTYs * 2 + 1];
|
||||
// reserve space for "pt/" and "tt/" entries and the terminating NULL
|
||||
static char *sDeviceNames[kNumTTYs * 2 + 2];
|
||||
// reserve space for "pt/" and "tt/" entries, "tty", and the terminating
|
||||
// NULL
|
||||
|
||||
struct mutex gGlobalTTYLock;
|
||||
struct mutex gTTYCookieLock;
|
||||
@ -100,6 +101,8 @@ init_driver(void)
|
||||
}
|
||||
}
|
||||
|
||||
sDeviceNames[2 * kNumTTYs] = "tty";
|
||||
|
||||
tty_add_debugger_commands();
|
||||
|
||||
return B_OK;
|
||||
|
@ -31,9 +31,18 @@ struct tty gSlaveTTYs[kNumTTYs];
|
||||
static status_t
|
||||
slave_open(const char *name, uint32 flags, void **_cookie)
|
||||
{
|
||||
// Get the tty index: Opening "/dev/tty" means opening the process'
|
||||
// controlling tty.
|
||||
int32 index = get_tty_index(name);
|
||||
if (index >= (int32)kNumTTYs)
|
||||
return B_ERROR;
|
||||
if (strcmp(name, "tty") == 0) {
|
||||
index = team_get_controlling_tty();
|
||||
if (index < 0)
|
||||
return B_NOT_ALLOWED;
|
||||
} else {
|
||||
index = get_tty_index(name);
|
||||
if (index >= (int32)kNumTTYs)
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
TRACE(("slave_open: TTY index = %ld (name = %s)\n", index, name));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user