Re: Printing the messages through printk while using Xwindows.

From: Tigran Aivazian (tigran@veritas.com)
Date: Fri Jul 28 2000 - 14:09:17 EST


On Fri, 28 Jul 2000, Russell King wrote:

> Richard B. Johnson writes:
> > This is a wee bit better because it will compile and run ;)
> >
> > print_string(char *str)
> > {
> > struct tty_struct *tty = current->tty;
> >
> > (*tty->driver.write)(tty, 0, str, strlen(str));
> > (*tty->driver.write)(tty, 0, "\015\012", 2);
> > }
>
> And probably oops. Doesn't X disassociate itself from the tty,
> so current->tty could well be NULL. Also, Who's to say that
> "current" is the X server?

and who is saying that current is the X server? current is insmod if the
function is called from init_module() and is mount(8) if the function is
called from read_super() and is process XYZ if the function is called in
the context of the process XYZ. Nobody said anything about X server. The
current is the process in whose context the print_string() is called and
which has a controlling terminal.

Regards.
Tigran

>
> Note also that this will write in "text" mode onto a graphics
> mode framebuffer, which won't be very visible.
>
> Probably the best way of seeing the kernel messages is to either
> use a serial console, or failing that kill klogd and use
> cat /proc/kmsg to display them in an xterm.
> _____
> |_____| ------------------------------------------------- ---+---+-
> | | Russell King rmk@arm.linux.org.uk --- ---
> | | | | http://www.arm.linux.org.uk/~rmk/aboutme.html / / |
> | +-+-+ --- -+-
> / | THE developer of ARM Linux |+| /|\
> / | | | --- |
> +-+-+ ------------------------------------------------- /\\\ |
>

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



This archive was generated by hypermail 2b29 : Mon Jul 31 2000 - 21:00:28 EST