Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Mon, 29 Apr 2002 02:52:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Mon, 29 Apr 2002 02:52:37 -0400 Received: from cerebus.wirex.com ([65.102.14.138]:25085 "EHLO figure1.int.wirex.com") by vger.kernel.org with ESMTP id ; Mon, 29 Apr 2002 02:52:36 -0400 Date: Sun, 28 Apr 2002 23:52:14 -0700 From: Chris Wright To: Wanghong Yuan Cc: linux-kernel@vger.kernel.org Subject: Re: How to enable printk Message-ID: <20020428235214.B8654@figure1.int.wirex.com> Mail-Followup-To: Wanghong Yuan , linux-kernel@vger.kernel.org In-Reply-To: <20020427.194302.02285733.davem@redhat.com><467685860.avixxmail@nexxnet.epcnet.de> <20020428.204911.63038910.davem@redhat.com> <001001c1ef3d$890a6d50$e6f7ae80@ad.uiuc.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org * 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 > #include > #include > #include > #include > #include > #include > > > /* 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 - 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/