On Fri, Aug 19, 2005 at 17:35:18 +0200, canon wrote: > Thomas Petazzoni wrote: > > >Hi, > > > >canon wrote: > > > >>It's the first time I try to go use a kernel routine and I don't know > >>how to compile my application. > >>Actually, I want to realize a program which limit the cpu load of > >>another program. For this I need the user time of the application and > >>I find this in the /proc/<pid>/stat file. But, my program must be > >>accurate and need to read this file every ms (the operation cost > >>10ms). So, I tryed to get this information with the tast_struct > >>structure but I have a problem at compilation time. > >>When I include linux/sched.h, I have a lot of error message. I think > >>I should add some flag to my gcc command but I don't whose. > > > > > >You can't use kernel functions in user-space applications. That's it. > > > Even if I am root, I cannot make my program entering the kernel space ? Of course NOT. There is no crossing the barrier between user and kernel mode. > I was thinking to write a special scheduler that can be configured to > reduce the load of the process, but I have neither the skills nor the > time. I suppose that I will keep the current solution if there is no > other way. Special scheduler has to be implemented in kernel. Depending on how it should control the scheduler, it may or may not be possible to do this in a module. If you'd just want to walk around the run queues and fiddle priorities, you may be able to do it in a module, but for more you need to hack the core kernel. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@xxxxxx>
Attachment:
signature.asc
Description: Digital signature