Re: Redirecting output

From: Andrew Morton (akpm_at_osdl.org)
Date: 03/23/05

  • Next message: Esben Nielsen: "Re: Real-Time Preemption and RCU"
    Date:	Wed, 23 Mar 2005 03:36:31 -0800
    To: "shafa.hidee" <shafa.hidee@gmail.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.

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


  • Next message: Esben Nielsen: "Re: Real-Time Preemption and RCU"

    Relevant Pages

    • Redirecting output
      ... want to redirect the standard output of printk to my xterm. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Redirecting output
      ... >want to redirect the standard output of printk to my xterm. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: printk output to file
      ... > I want to redirect the output of printk from my ... > kernel module to a file. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Cant redirect output to file
      ... Why can't I successfully redirect the output? ... directs both standard output and standard error to the file dirlist, ...
      (uk.comp.os.linux)
    • redirection of standard output of a Python command to a Python variable
      ... I try to find a quick way to redirect the standard output of a Python ... foobar = fsock.read ...
      (comp.lang.python)