Re: [osol-code] Executing a kernel thread periodically

2007-05-08 Thread Garrett D'Amore
Paul Durrant wrote: On 07/05/07, Thomas De Schampheleire <[EMAIL PROTECTED]> wrote: There some things I would like to make sure first: can I use all kernel functions from a module? In Linux, modules can only use those functions from the kernel which are exported by the EXPORT_SYMBOL macro. I

Re: [osol-code] Executing a kernel thread periodically

2007-05-08 Thread Paul Durrant
On 07/05/07, Thomas De Schampheleire <[EMAIL PROTECTED]> wrote: There some things I would like to make sure first: can I use all kernel functions from a module? In Linux, modules can only use those functions from the kernel which are exported by the EXPORT_SYMBOL macro. I suppose there is a sim

Re: [osol-code] Executing a kernel thread periodically

2007-05-07 Thread Thomas De Schampheleire
Hi, There some things I would like to make sure first: can I use all kernel functions from a module? In Linux, modules can only use those functions from the kernel which are exported by the EXPORT_SYMBOL macro. I suppose there is a similar mechanism for OpenSolaris, isn't there? In that case: how

Re: [osol-code] Executing a kernel thread periodically

2007-05-03 Thread Garrett D'Amore
Thomas De Schampheleire wrote: Hi all, I will try using the timeout() first, but I am wondering where I should start the first invocation of my function. Probably from attach(). -- Garrett The code I would like to run could be considered to be related to power management. Is there a ce

Re: [osol-code] Executing a kernel thread periodically

2007-05-03 Thread Thomas De Schampheleire
Well, it basically is a power management strategy that needs to be able to use the function cpu_offline() in common/os/cpu.c. I would like this 'module' to be able to load automatically, and work automatically, stand-alone. If this is possible from a module, that is fine by me. Is it correct that

Re: [osol-code] Executing a kernel thread periodically

2007-05-02 Thread James Carlson
Thomas De Schampheleire writes: > The code I am writing does not really handle a certain device, so I guess a > device driver is not what I am aiming at. > A loadable module sounds ok to me. > > How do I tell OpenSolaris that this module should be loaded? Is there any > documentation regarding dev

Re: [osol-code] Executing a kernel thread periodically

2007-05-02 Thread Dana H. Myers
Paul Durrant wrote: On 5/2/07, Dana H. Myers <[EMAIL PROTECTED]> wrote: For a non-driver loadable module, you may initiate the thread as part of the module attach() and shut the thread down as part of the module detach(). AFAIK only drivers have attach() and detach() entry points; did you mean

Re: [osol-code] Executing a kernel thread periodically

2007-05-02 Thread Dana H. Myers
Thomas De Schampheleire wrote: Well, I actually do not know. The code I am writing does not really handle a certain device, so I guess a device driver is not what I am aiming at. A loadable module sounds ok to me. That's pretty much the choice you have :-) (unless you're changing the base ke

Re: [osol-code] Executing a kernel thread periodically

2007-05-02 Thread Paul Durrant
On 5/2/07, Dana H. Myers <[EMAIL PROTECTED]> wrote: For a non-driver loadable module, you may initiate the thread as part of the module attach() and shut the thread down as part of the module detach(). AFAIK only drivers have attach() and detach() entry points; did you mean _init() and _fini()?

Re: [osol-code] Executing a kernel thread periodically

2007-05-02 Thread Thomas De Schampheleire
Well, I actually do not know. The code I am writing does not really handle a certain device, so I guess a device driver is not what I am aiming at. A loadable module sounds ok to me. How do I tell OpenSolaris that this module should be loaded? Is there any documentation regarding developing modu

Re: [osol-code] Executing a kernel thread periodically

2007-05-02 Thread Dana H. Myers
Thomas De Schampheleire wrote: Hi all, I will try using the timeout() first, but I am wondering where I should start the first invocation of my function. The code I would like to run could be considered to be related to power management. Is there a certain file or function from where I shou

Re: [osol-code] Executing a kernel thread periodically

2007-05-02 Thread Thomas De Schampheleire
Hi all, I will try using the timeout() first, but I am wondering where I should start the first invocation of my function. The code I would like to run could be considered to be related to power management. Is there a certain file or function from where I should call my function? For this start,

Re: [osol-code] Executing a kernel thread periodically

2007-04-25 Thread Casper . Dik
>No. timeout() does not block until the background task is completed >(that would kind of defeat the point) so there's no unfinished >functions. Self re-scheduling timeouts are quite common. The tricky >part comes when you want to stop such a thing as you cannot hold a >lock over untimeout() which

Re: [osol-code] Executing a kernel thread periodically

2007-04-25 Thread Garrett D'Amore
Paul Durrant wrote: On 4/25/07, Thomas De Schampheleire <[EMAIL PROTECTED]> wrote: If I would use timeout only to start function A, and within function A do a new call to timeout in order to keep it running each period, that would the bad thing to do, right? Since then I would leave a trail

Re: [osol-code] Executing a kernel thread periodically

2007-04-25 Thread Paul Durrant
On 4/25/07, Thomas De Schampheleire <[EMAIL PROTECTED]> wrote: If I would use timeout only to start function A, and within function A do a new call to timeout in order to keep it running each period, that would the bad thing to do, right? Since then I would leave a trail of unfinished functions

Re: [osol-code] Executing a kernel thread periodically

2007-04-25 Thread Garrett D'Amore
What you described is basically correct. -- Garrett Thomas De Schampheleire wrote: Hi, Thanks for your replies. I checked the man pages for both timeout and taskq. If I would use timeout only to start function A, and within function A do a new call to timeout in order to keep it running

Re: [osol-code] Executing a kernel thread periodically

2007-04-25 Thread Thomas De Schampheleire
Hi, Thanks for your replies. I checked the man pages for both timeout and taskq. If I would use timeout only to start function A, and within function A do a new call to timeout in order to keep it running each period, that would the bad thing to do, right? Since then I would leave a trail of un

Re: [osol-code] Executing a kernel thread periodically

2007-04-23 Thread Garrett D'Amore
Paul Durrant wrote: On 4/23/07, Thomas De Schampheleire <[EMAIL PROTECTED]> wrote: - Have a thread run containing a while loop with a delay inside. This would have the disadvantage that the time between the thread's execution is run is not always fixed (it would depend on the load of the sys

Re: [osol-code] Executing a kernel thread periodically

2007-04-23 Thread Garrett D'Amore
Thomas De Schampheleire wrote: Hi, I need some kernel code to be executed periodically and I am wondering what the best way would be to achieve this. I can imagine the following possibilities: - Have a thread run containing a while loop with a delay inside. This would have the disadvantage t

Re: [osol-code] Executing a kernel thread periodically

2007-04-23 Thread James C. McPherson
Thomas De Schampheleire wrote: Hi, I need some kernel code to be executed periodically and I am wondering what the best way would be to achieve this. I can imagine the following possibilities: - Have a thread run containing a while loop with a delay inside. This would have the disadvantage t

Re: [osol-code] Executing a kernel thread periodically

2007-04-23 Thread Paul Durrant
On 4/23/07, Thomas De Schampheleire <[EMAIL PROTECTED]> wrote: - Have a thread run containing a while loop with a delay inside. This would have the disadvantage that the time between the thread's execution is run is not always fixed (it would depend on the load of the system, ...). To some ex

[osol-code] Executing a kernel thread periodically

2007-04-23 Thread Thomas De Schampheleire
Hi, I need some kernel code to be executed periodically and I am wondering what the best way would be to achieve this. I can imagine the following possibilities: - Have a thread run containing a while loop with a delay inside. This would have the disadvantage that the time between the thread's e