Re: serial console _after_ boot ? - was: Redirect kernel console

From: devzero
Date: Thu Jan 03 2008 - 11:03:16 EST


> 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 doesn`t seem to make any difference if i do that ioctl on /dev/console or /dev/tty0 , because i`m getting EBUSY there, too


>
>
> On Jan 3 2008 15:39, devzero@xxxxxx wrote:
> >fantastic, thanks!
> >
> >unfortunately......
> >
> >opensuse103:/home/roland/serialcons # ./mytioccons
> >ioctl: Device or resource busy
> >
> >but i`m not deep enough into programming to understand this.
> >
>
> >int main(void)
> >{
> >int fd = open("/dev/ttyS0", O_RDWR);
> >int errno;
>
> This errno is so out of place.
>
> >
> >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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/