Problems with /dev/tty

Problems with /dev/tty

Post by Ullrich von Bassewi » Fri, 01 Oct 1993 02:11:20

I have some problems when programs are using /dev/tty from a terminal.
(I'm using Linux 0.99pl12).

When working at the console, all is fine. On a terminal (actually a
second machine running a terminal program) some programs cannot access
/dev/tty. One of those programs is joe (V1.0.8), another is the kernel
config shell script. The error messages are like "Couldn't open tty".
The funny thing about joe is that the older version of joe (the one
which is in the SLS 1.03 distribution) had no problems with /dev/tty.

A command like 'echo "Hello world" > /dev/tty' works on the console
but fails when executed from the terminal. The displayed error message
is "no such device or address".

The device /dev/tty exists, has access rights 666 and is a char device
with major 5 and minor 0. To be shure, I deleted the device and
created it a second time - no change.

Has anyone seen such a behavior and can provide a few hints?

Thanks in advance


Ullrich von Bassewitz              Phone : +49 7071 440585

                                 Address : Zwehrenbuehlstrasse 33
                                           D-72070 Tuebingen (Germany)


1. problems with /dev/tty

I am having the following problem:

In a nutshell, I have three processes: parent, child, grandchild.
Parent spawns (fork/exec) the child and the child spawns the
grandchild. And the parent gets spawned by the shell.

The parent does an freopen( "/dev/null", "r", stdin ) before
he forks the child.  The grandchild, on the other hand,
needing to have lone rights to the controlling terminal,
does an freopen( "/dev/tty", "r", stdin ).  

When I run the program I type "parent" on the shell, and the
grandchild's freopen() call fails.  

However, if I put the freopen( "/dev/null", "r", stdin ) in the
child before it forks the grandchild, and leave the grandchild the
same, and exec "child" from the shell, freopen() succeeds.  But if
I start child from a script file freopen() fails when 'script'
is started like '$ script' and '$ sh script', but when 'script' is
started like '$ . script' freopen() succeeds.  

I know this sound kind of weird and confusing, but I am really stuck
with this.  This prevents me from forking the 'child' process, and
I can't live with that.

                                        - thanks, Tony

2. RedHat 4.2 Installation

3. Problems using /dev/tty

4. problem : using meta-characters in setting user password

5. Problems with /dev/tty (solved)

6. IP takeover?

7. Getting the real tty device name (/dev/tty not good enough)

8. Reading is much more interesting than TV (1240/1708)

9. /dev/ttyS? vs /dev/cua?

10. diff between /dev/tty and /dev/pts

11. /dev/cua /dev/ttyS and getty_ps

12. /dev//dev/tty: No such file or directory when requesting uptime