On Wed, Feb 25, 2009 at 8:20 AM, Pei Lin <[email protected]> wrote:

> "sys_clock_gettime " is System call which is provided to usr space as
> a interface for kernel.As you write a module you should use function
> in kernel system map that is export to use for your drive.
>
> if you want get time in your module,you can check recent
> include/linux/time.h like current_kernel_time()
> or
> CURRENT_TIME()
> do_gettimeofday etc.
>
> Maybe this can give u some help.
>

  Yes, generally its 'do_gettimeofday' so use this in your kernel module.

>
> Lin
>
> 2009/2/25 Ole Loots <[email protected]>:
> > But I wan't to call a function that is not part of my module... i want to
> > call sys_clock_gettime - which is a function of the kernel.
> >
> >
> > ----- Original Message ----- From: "Guo Hongruan" <[email protected]>
> > To: "Ole Loots" <[email protected]>
> > Sent: Wednesday, February 25, 2009 12:47 PM
> > Subject: Re: Getting kernel symbols in kernel module (dynamically)
> >
> >
> >> If you want to call a symbol in kernel module, you need to make sure it
> is
> >> exported. Through the macro EXPORT_SYMBOL, you can export the kernel
> >> function or variables, so that you can call them in kernel module.
> >>
> >> The following is an example:
> >>
> >> EXPORT_SYMBOL(acpi_bus_get_device);
> >>
> >> 在 Wed, 25 Feb 2009 18:45:05 +0800,Ole Loots <[email protected]> 写道:
> >>
> >>>
> >>> Hello Guo,
> >>>
> >>> I'm talking about kernel space. I want to get kernel space symbols when
> >>> running a kernel module... Or maybe the linker can link agains the
> kernel
> >>> (so the addresses of the symbols are statically inserted into my
> module,
> >>> also), but that wouldn't be as good as getting the symbols dynamically.
> >>>
> >>> On Wed, 25 Feb 2009 18:20:21 +0800, "Guo Hongruan" <[email protected]
> >
> >>> wrote:
> >>>>
> >>>> Too dangrous!!
> >>>>
> >>>> In kernel space or userspace? If in userspace, you can only call
> >>>> clock_gettime.
> >>>>
> >>>> 在 Wed, 25 Feb 2009 18:08:55 +0800,Ole Loots <[email protected]>
> >>>
> >>> 写道:
> >>>>
> >>>>> Hello,
> >>>>>
> >>>>> I want to call the kernel function sys_clock_gettime, but when I just
> >>>>> try to call it, the linker complains about the unknown
> symbol/function
> >>>>> sys_clock_gettime, so i have hard coded a function pointer in my
> >>>>> module...:
> >>>>>
> >>>>> long (*p_sys_clock_gettime)(clockid_t, struct timespec *tp) =
> >>>
> >>> 0xc004373c;
> >>>>>
> >>>>> That works fine for my system, but I know thats not the way to do it.
> >>>>> How is it done properly?
> >>>>>
> >>>>> Regards,
> >>>>> Ole
> >>>>>
> >>>>>
> >>>>> --
> >>>>> To unsubscribe from this list: send an email with
> >>>>> "unsubscribe kernelnewbies" to [email protected]
> >>>>> Please read the FAQ at http://kernelnewbies.org/FAQ
> >>>>>
> >>
> >>
> >>
> >> --
> >> Guo Hongruan, Embedded Linux Consultant
> >> Mobile: +86-0-13484056007
> >> Skype: camelguo
> >> http://www.gulessoft.com
> >>
> >
> >
> > --
> > To unsubscribe from this list: send an email with
> > "unsubscribe kernelnewbies" to [email protected]
> > Please read the FAQ at http://kernelnewbies.org/FAQ
> >
> >
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to [email protected]
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>


-- 
Thanks
Rizavan

Reply via email to