Can I change a flow of system call to device driver which is made by my self ?

From: forman (forman76_at_yahoo.co.kr)
Date: 07/31/03


Date: 31 Jul 2003 03:58:37 -0700

kernel have a sys_gettimeofday system call that use a time of CPU. but I have

a RTC( rtc4513 ) in my board. so, I want to chage it like that system call use

my rtc device driver.

at first, I just try .. sys_gettimeofday function call do_gettimeofday.

so, I modified source of do_gettimeofday in /linux/arch/arm/kernel/time.c

[code]

void do_gettimeofday(struct timeval *tv)
{
   int fd;
   unsigned long flags;
   unsigned long usec, sec;
    
/* getrid of below original part */
/*
   read_lock_irqsave(&xtime_lock, flags);
   usec = gettimeoffset();
   {
      unsigned long lost = jiffies - wall_jiffies;

      if (lost)
         usec += lost * USECS_PER_JIFFY;
   }
   sec = xtime.tv_sec;
   usec += xtime.tv_usec;
   read_unlock_irqrestore(&xtime_lock, flags);
*/
   /* usec may have gone up a lot: be safe */
/*
   while (usec >= 1000000) {
      usec -= 1000000;
      sec++;
   }

   tv->tv_sec = sec;
   tv->tv_usec = usec;
*/
/* new code */
   fd = sys_open ( "/dev/rtc", O_RDWR, 0 ); <-- to call rtc device driver.
   sys_ioctl ( fd, 0x1, tv );
}

I did test after recompiling kernel then kernel write this error message
"unable to handle kernel null pointer ~~"

please, check my code.
Is my thinking is rignt ?? ( kernel system call connect to device drive )



Relevant Pages

  • Re: [linux-pm] sleepy linux self-test
    ... there was indeed a "RTC Alarm: ... Bootlog and kernel config attached. ... # AX.25 network device drivers ...
    (Linux-Kernel)
  • Re: Solid freezes with 2.6.25
    ... the RTC until the lockup happens with something like ... # CPUFreq processor drivers ... # DCCP Kernel Hacking ... # SCSI support type ...
    (Linux-Kernel)
  • Re: ntp and hwclock
    ... I have set up clock in my Ericsson mobile phone more than 3 years ... Maybe the new RTC class lets one change ... |kernel will write the time back to the CMOS clock every 11 minutes. ...
    (Debian-User)
  • Re: Q: Disabling "11 minute mode"
    ... If you have the PPSkit: ... Otherwise you have to patch time.c in the kernel. ... The main purpose of an RTC is to initialise the system time at powerup, ... the true time, and later ntpd has to step this to UTC. ...
    (comp.protocols.time.ntp)
  • Re: Something Wicked (with my hdwr clock) This Way Comes
    ... F7_x86_64 and using the 2.6.23.8-34.fc7 kernel ... Upon shutting down, bringing up the BIOS, I saw that the RTC was ... cmos time system-cmos error_ppm tick freq tick freq ... deviating relative to the system clock. ...
    (Fedora)