LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-13-2010, 10:48 AM   #1
shankar_ceg
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Rep: Reputation: 0
#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
 
Old 07-13-2010, 10:57 AM   #2
kalleanka
Member
 
Registered: Aug 2003
Location: Mallorca, Spain
Distribution: xubuntu
Posts: 551

Rep: Reputation: 38
try find_pid_ns (thread_pid, 0)
 
Old 07-13-2010, 12:08 PM   #3
shankar_ceg
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Original Poster
Rep: Reputation: 0
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.
 
Old 07-13-2010, 12:32 PM   #4
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
I think this function is for the kernel space _ONLY_. See function "sched_setscheduler" and friends.
 
1 members found this post helpful.
Old 07-21-2010, 04:55 AM   #5
shankar_ceg
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Original Poster
Rep: Reputation: 0
I am new to linux programming,can you explain what is kernel space _ONLY_ and how may i use it?
Thanks a lot...
 
Old 07-21-2010, 05:13 AM   #6
JohnGraham
Member
 
Registered: Oct 2009
Posts: 467

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by shankar_ceg View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
init and sched lipun4u Linux - Newbie 2 09-18-2008 03:21 AM
Differences between /usr/include/* and linux/include/* simopal6 Linux - General 2 08-26-2007 03:41 AM
problem in including linux/sched.h sudeepghiya Linux - General 1 11-02-2006 10:35 AM
include/linux/types.h and include/linux/posix_types.h kpachopoulos Programming 2 11-26-2005 05:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration