Skip to contentSkip to conversation

serial console _after_ boot ? - was: Redirect kernel console

DISCUSSION [email protected] 1 participant 1 message Jan 3, 2008

lore
Share & tools
lore
#0 lore raw
Quoted 1 line

This errno is so out of place.

yes, that was stupid.

anyway:

# strace ./mytiocons
--snipp--
open("/dev/ttyS0", O_RDWR)              = 3
ioctl(0, TIOCCONS)                      = -1 EBUSY (Device or resource busy)
ioctl(3, TIOCCONS)                      = -1 EBUSY (Device or resource busy)
--snipp--

man tty_ioctl is telling:

Redirecting console output

TIOCCONS void
Redirect output that would have gone to
/dev/console or /dev/tty0 to the given tty. If that was a pty master, send it to the slave. Anybody can do this as long as the output was not redirected yet. If it was redirected already EBUSY is returned, but root may stop redirection by using this ioctl with fd pointing at /dev/console or /dev/tty0.

but it doesnt seem to make any difference if i do that ioctl on /dev/console or /dev/tty0 , because im getting EBUSY there, too

Quoted 13 lines · On Jan 3 2008 15:39, [email protected] wrote:
Quoted 9 lines

fantastic, thanks!

unfortunately......

opensuse103:/home/roland/serialcons # ./mytioccons
ioctl: Device or resource busy

but i`m not deep enough into programming to understand this.

Quoted 14 lines
Quoted 4 lines

int main(void)
{
int fd = open("/dev/ttyS0", O_RDWR);
int errno;

This errno is so out of place.

Quoted 6 lines

ioctl(0, TIOCCONS, NULL);

if (ioctl(fd, TIOCCONS, NULL) < 0)

       printf("ioctl: %s\n", strerror(errno));
}

_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066