LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-14-2005, 01:33 AM   #1
cranium2004
Member
 
Registered: Feb 2004
Distribution: FC4,RHEL4
Posts: 223

Rep: Reputation: 30
problem in kernel module


hello,
Why am i getting oops in following kernel module on RH9 linux with 2.4.20-8 kernel? want to print time in kernel

#define __KERNEL__
#define MODULE
#include <linux/module.h>
#include <linux/config.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/time.h>


static int __init tt_init(void)
{
struct timeval *mytime=NULL;

do_gettimeofday(mytime);
printk(KERN_DEBUG "sec is = %ld\n",mytime->tv_sec);
return 0;
}

static void __exit tt_exit(void)
{

printk(KERN_DEBUG "LEaving Module\n");
}


module_init(tt_init);
module_exit(tt_exit);
MODULE_LICENSE("GPL");
 
Old 04-14-2005, 03:10 AM   #2
freegianghu
Member
 
Registered: Oct 2004
Location: somewhere in the street
Distribution: Window$
Posts: 192

Rep: Reputation: 30
Re: problem in kernel module

I think:
Quote:
static int __init tt_init(void)
{
struct timeval *mytime=NULL;

do_gettimeofday(mytime);
printk(KERN_DEBUG "sec is = %ld\n",mytime->tv_sec);
return 0;
}
shold be:
Code:
static int __init tt_init(void)
{
  struct timeval mytime;
  do_gettimeofday(&mytime);
  printk(KERN_DEBUG "sec is = %ld\n",mytime.tv_sec);
  return 0;
}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem installing module in Fedora Core 2 (2.6 kernel vs 2.4 problem?) Arodef Linux - Kernel 3 11-30-2007 02:55 PM
[Error] Kernel Module : No kernel module build environment saman007uk Debian 7 09-09-2006 06:34 PM
Kernel 2.6.13 and module problem jeffpr Fedora 3 10-07-2005 05:22 PM
Kernel 2.4.23 module problem powadha Linux - Software 2 12-09-2003 06:28 AM
kernel module ignorant newbie looking for any one with kernel module knowledge cpoet Slackware 4 11-24-2003 09:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration