mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "shafa.hidee" <shafa.hidee@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Redirecting output
Date: Wed, 23 Mar 2005 03:36:31 -0800	[thread overview]
Message-ID: <20050323033631.0f7ad778.akpm@osdl.org> (raw)
In-Reply-To: <001e01c52f74$2f27daa0$6a88cb0a@hss.hns.com>

"shafa.hidee" <shafa.hidee@gmail.com> 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.


  parent reply	other threads:[~2005-03-23 11:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-23  6:42 shafa.hidee
2005-03-23  7:17 ` Jan Engelhardt
2005-03-23  7:27 ` Martin Waitz
2005-03-23 11:36 ` Andrew Morton [this message]
     [not found] <fa.hseagm2.1l76c0o@ifi.uio.no>
2005-03-23 14:21 ` Bodo Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050323033631.0f7ad778.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shafa.hidee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®