public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Wright <chris@wirex.com>
To: Wanghong Yuan <wyuan1@ews.uiuc.edu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: How to enable printk
Date: Sun, 28 Apr 2002 23:52:14 -0700	[thread overview]
Message-ID: <20020428235214.B8654@figure1.int.wirex.com> (raw)
In-Reply-To: LINKIFYAbeGBfEIaAADaEaIfCEdAEIbHeEDCDaHeEBcDceGLINKIFYAFADeDdcHBebaaCIAfHaJcEdCfFIcdbeCFfeFDBf <20020428.204911.63038910.davem@redhat.com> <001001c1ef3d$890a6d50$e6f7ae80@ad.uiuc.edu>

* Wanghong Yuan (wyuan1@ews.uiuc.edu) wrote:
> Hi,
> 
> It may be a simple question. But I cannot see the result of printk in
> console like the following. Do i need to enable it somewhere? Thanks

Take a look a man 8 dmesg.  Also Documentation/sysctl/kernel.txt.

> /*-O2 -Wall -DMODULE -D__KERNEL__ -DLINUX -c testsys.c */
> 
> #include <linux/sys.h>
> #include <linux/mm.h>
> #include <linux/module.h>
> #include <linux/kernel.h>
> #include <linux/sched.h>
> #include <sys/syscall.h>
> #include <asm/uaccess.h>
> 
> 
> /* The system call number we attempt to install ourselves as. */
> static int syscall_num = 165;

I hope you know this can't be done safely (race free).

> asmlinkage int sys_test(int pid, int period, int cycles, int* ptr)
> 
> {
> 
>  put_user(current->pid, ptr);
>  return pid-10000;
> 
> }
> 
> extern int sys_call_table[];
> 
> #ifdef MODULE
> int init_module(void)
> {
>   printk("yes\n");
>   sys_call_table[syscall_num] = (int)sys_test;
>   return 0;
> }
> 
> void cleanup_module(void)
> {
>   sys_call_table[syscall_num] = 0;

this could cause a problem.  you should save the original entry when you
insmod and restore it here ;-)

> }
> 
> #endif /* MODULE */

btw, take a look at how the module_init() and module_exit() macros are used
in the kernel.

hope that helps,
-chris

  parent reply	other threads:[~2002-04-29  6:52 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-24 15:09 VLAN and Network Drivers 2.4.x jd
2002-04-24 13:04 ` David S. Miller
2002-04-24 16:23   ` AW: " jd
2002-04-24 16:35     ` David S. Miller
2002-04-24 17:03       ` AW: " jd
2002-04-24 16:59         ` David S. Miller
2002-04-24 17:31           ` Ben Greear
2002-04-24 17:25             ` David S. Miller
2002-04-24 17:58               ` Ben Greear
2002-04-24 17:56                 ` David S. Miller
2002-04-24 19:43                   ` Ben Greear
2002-04-24 22:23                 ` AW: " jd
2002-04-24 17:49             ` Jeff Garzik
2002-04-24 18:04               ` Ben Greear
2002-04-24 18:10                 ` Jeff Garzik
2002-04-24 18:07               ` Matti Aarnio
2002-04-24 18:13                 ` Jeff Garzik
2002-04-24 17:42           ` AW: " jd
2002-04-24 17:40             ` David S. Miller
2002-04-24 22:28               ` AW: " jd
2002-04-24 22:21                 ` David S. Miller
2002-04-25  4:26                   ` AW: Re: AW: Re: AW: Re: AW: Re: AW: Re: AW: Re: AW: [was: VLAN and Network Drivers 2.4.x] Dax Kelson
     [not found]                     ` <200204242141.02957.bodnar42@phalynx.dhs.org>
2002-04-25  4:43                       ` Ryan Cumming
2002-04-25 10:19                     ` Matthias Andree
2002-04-25 13:45                   ` AW: Re: AW: Re: AW: Re: AW: Re: AW: Re: VLAN and Network Drivers 2.4.x jd
2002-04-26  0:46                     ` David S. Miller
2002-04-27 20:34                       ` jd
2002-04-28  2:43                         ` David S. Miller
2002-04-28 20:28                           ` jd
2002-04-29  3:49                             ` David S. Miller
2002-04-29  5:20                               ` How to enable printk Wanghong Yuan
2002-04-28  6:33                                 ` Uilton Dutra
2002-04-29  6:33                                 ` Itai Nahshon
2002-04-29  6:52                                 ` Chris Wright [this message]
2002-04-29 11:37                                 ` David Woodhouse
2002-04-30 17:12                                   ` Denis Vlasenko
2002-04-30 12:55                                     ` David Woodhouse
2002-04-30 18:03                                       ` Denis Vlasenko
2002-04-30 13:14                                         ` David Woodhouse
2002-04-29 22:15                                 ` Accurately measure CPU cycles used by a program? thanks Wanghong Yuan
2002-04-29 22:22                                   ` J.A. Magallon
2002-04-30 16:30                                     ` Zach Brown
2002-05-10 23:49                                     ` Corey Minyard
2002-04-30 22:15                                   ` what replaces tq_scheduler in 2.4 Wanghong Yuan
2002-04-30 22:31                                     ` Andrew Morton
2002-05-02 15:44                                       ` Ingo Oeser
2002-05-03  0:13                                         ` Wanghong Yuan
2002-05-03 18:04                                         ` Andrew Morton
2002-05-01  6:41                                     ` suspend a thread in LKM Wanghong Yuan
2002-04-29  9:06                               ` VLAN and Network Drivers 2.4.x jd
2002-04-25 10:20           ` Matthias Andree
2002-04-24 16:39     ` AW: " Pasi Kärkkäinen
2002-04-24 16:18 ` Ben Greear
2002-04-24 16:46   ` AW: " jd

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=20020428235214.B8654@figure1.int.wirex.com \
    --to=chris@wirex.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wyuan1@ews.uiuc.edu \
    /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