Console driver behaviour?
Hello.
How can I determine that the program is run via ssh or on a headless box?
The problem is with Linux Console Tools. It tries opening /dev/tty, /dev/tty0 and /dev/console respectively upon the start, and it fails on ssh'ed or headless boxes. Is there any way to catch the situation? I've thought that open should return ENODEV in these cases, but it doesn't..
Signature · 2 lines
Regards, Wartan. "Computers are not intelligent. They only think they are."
Quoted 4 lines · Mark Hahn
Quoted 2 lines
any way to catch the situation? I've thought that open should return ENODEV in these cases, but it doesn't..
screen, perhaps? this is most definitely not a linux-kernel question.
This is most probably a console driver question, which is kernel-specific ;)
I wonder what should console driver say when it doesn't have a real physical console behind it. IMO, this should be a ENODEV case, or some other way to determine programmatically that this situation takes place. So, I am trying to find someone familar with console driver on linux-kernel (since this driver doesn't have a specific maintainer).
If I am wrong, and linux-kernel is not relevant, sorry..
Signature · 3 lines
Regards, Wartan. echo "Your stdio isn't very std." -- Larry Wall in Configure from the perl distribution
Quoted 11 lines
Quoted 5 lines
Quoted 3 lines
any way to catch the situation? I've thought that open should return ENODEV in these cases, but it doesn't..
screen, perhaps? this is most definitely not a linux-kernel question.
This is most probably a console driver question, which is kernel-specific ;)
I wonder what should console driver say when it doesn't have a real physical console behind it. IMO, this should be a ENODEV case, or some other way to determine programmatically that this situation takes place.
That should not happen. Especially since int init/main.c we have:
if (open("/dev/console", O_RDWR, 0) < 0)
printk("Warning: unable to open an initial console.\n");(void) dup(0);
(void) dup(0);
which causes alot of problems.
Quoted 2 lines
So, I am trying to find someone familar with console driver on linux-kernel (since this driver doesn't have a specific maintainer).
That would be me :-/
Quoted 3 lines
How can I determine that the program is run via ssh or on a headless box?
Hm. I never seen a clean way to do this :-(
Quoted 5 lines
The problem is with Linux Console Tools. It tries opening
/dev/tty,/dev/tty0and/dev/consolerespectively upon the start, and it fails on ssh'ed or headless boxes. Is there any way to catch the situation? I've thought that open should return ENODEV in these cases, but it doesn't..
/dev/console -> System console. printk messages are sent to these devices.
It is always there.
/dev/tty -> The TTY device associated with the current process
/dev/tty0 -> Only related to VTs. This is the foreground virtual
termial (made from a graphics card and a regular keyboard)