LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-21-2010, 02:02 PM   #1
sAir
LQ Newbie
 
Registered: Dec 2009
Posts: 2

Rep: Reputation: 0
How to get and modify thread_info for a given pid?


How do I get thread_info for a given pid? Is there a way to modify PC of thread A in thread B so once thread A is scheduled, it will jump to the new instruction?

Any help is appreciated! Thanks in advance!

sAir
 
Old 01-21-2010, 02:35 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Yes, there are plenty of ways to get OS-level info about a thread or process. Reading "/proc" or learning "gdb" are two particularly good choices:

http://www.linuxjournal.com/article/8381
http://www.linux.com/archive/feature/126718

And yes, there are plenty of ways to control the behavior of a thread or process; either within the process, or from other processes on the system (or, of course, even from remote hosts).

But you want to go for the *highest* level of abstraction (e.g. set a shared variable, or create a new class instance). You *don't* want to muck around with low-level constructs like Program Counters or stack frames.

IMHO .. PSM
 
Old 01-21-2010, 03:01 PM   #3
sAir
LQ Newbie
 
Registered: Dec 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks paulsm4,

I see we can get the thread_info or task_struct for current thread, but I did not find how to get these for a given pid. Could you point me the api that I can use?

Thanks again.

sAir
 
  


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
What is the more easier way to check the pid and kill the pid cmx08 Linux - General 5 09-09-2008 10:57 PM
reading pid from pid file in C language shifter Programming 1 05-14-2008 10:49 AM
usb bluetooth modify vid & pid scan73 Linux - Newbie 1 02-11-2008 10:35 PM
kill pid.... won't work with 'pid' variable given.. sachitha Programming 6 03-06-2006 07:48 PM
/var/run/[XXX].pid - Tcl pid code liguorir Linux - Software 1 05-20-2004 10:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06: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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration