LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   #include <linux/sched.h> (https://www.linuxquestions.org/questions/programming-9/include-linux-sched-h-819609/)

shankar_ceg 07-13-2010 10:48 AM

#include <linux/sched.h>
 
Hello People,
I am trying to include #include <linux/sched.h> and access a function in my program.But I end up having an error.

This is the following code...

#include<stdio.h>
#include<sys/stat.h>
#include<stdlib.h>
#include <linux/sched.h>
#include <unistd.h>
void execname() {
struct task_struct *my;
my = find_task_by_vpid(getpid());
printf("%s",my->comm);
}
int main()
{
execname();
}


this is the error:Test.c:8: error: ‘find_task_by_vpid’ was not declared in this scope

kalleanka 07-13-2010 10:57 AM

try find_pid_ns (thread_pid, 0)

shankar_ceg 07-13-2010 12:08 PM

Hello Sir,
That didn't help as well.This is what I wanted to do..
"Create a system call called quad that takes a process ID, retrieves its task_struct, and quadruples its current timeslice. Return the new timeslice on success, and a negative number on failure."

Thank You.

jf.argentino 07-13-2010 12:32 PM

I think this function is for the kernel space _ONLY_. See function "sched_setscheduler" and friends.

shankar_ceg 07-21-2010 04:55 AM

I am new to linux programming,can you explain what is kernel space _ONLY_ and how may i use it?
Thanks a lot...

JohnGraham 07-21-2010 05:13 AM

Quote:

Originally Posted by shankar_ceg (Post 4032035)
This is what I wanted to do..
"Create a system call called quad that takes a process ID, retrieves its task_struct, and quadruples its current timeslice. Return the new timeslice on success, and a negative number on failure."

Ah, if only you'd said that in the first place...

The major work there is in implementing a system call. Have a look at this.


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