2005-03-23 06:44:01

by shafa.hidee

[permalink] [raw]
Subject: Redirecting output

Hi,
I have created a dummy module for learning device driver in linux. I
want to redirect the standard output of printk to my xterm. But by default
it is redirected to tty.

I have remote logged into the machine.

Please help.

Regards
Shafa.hidee


2005-03-23 07:18:13

by Jan Engelhardt

[permalink] [raw]
Subject: Re: Redirecting output

>Hi,
> I have created a dummy module for learning device driver in linux. I
>want to redirect the standard output of printk to my xterm. But by default
>it is redirected to tty.

What shall happen if you close the pts of the xterm?



Jan Engelhardt
--

2005-03-23 07:28:04

by Martin Waitz

[permalink] [raw]
Subject: Re: Redirecting output

hoi :)

On Wed, Mar 23, 2005 at 12:12:02PM +0530, shafa.hidee wrote:
> I have created a dummy module for learning device driver in linux. I
> want to redirect the standard output of printk to my xterm. But by default
> it is redirected to tty.

The kernel does not have 'standard output', so you can't redirect it.
Please consult the manual for dmesg and syslog.

And please have a look at a good Linux kernel book.
This will help you understand the kernel and will answer most
of your questions.

--
Martin Waitz


Attachments:
(No filename) (520.00 B)
signature.asc (189.00 B)
Digital signature
Download all attachments

2005-03-23 11:37:03

by Andrew Morton

[permalink] [raw]
Subject: Re: Redirecting output

"shafa.hidee" <[email protected]> wrote:
>
> I have created a dummy module for learning device driver in linux. I
> want to redirect the standard output of printk to my xterm. But by default
> it is redirected to tty.
>
> I have remote logged into the machine.

You can do this from within the module_init() handler only:

module_init_handler(...)
{
mm_segment_t old_fs;

....
old_fs = set_fs(KERNEL_DS);
sys_write(1, "foo\n", 4);
set_fs(old_fs);
...
}

The text comes out on modprobe's standard output.

Don't tell anyone I told you this.

2005-03-24 00:33:05

by Bodo Eggert

[permalink] [raw]
Subject: Re: Redirecting output

shafa.hidee <[email protected]> wrote:

> I have created a dummy module for learning device driver in linux. I
> want to redirect the standard output of printk to my xterm. But by default
> it is redirected to tty.

tail -f /var/log/syslog (or /var/log/messages)