  | |  | task_struct pid in for current task does not tally .. | task_struct pid in for current task does not tally .. 2004-01-30 - By Basith Salman
Back Hi All,
The current- >pid of the task_struct does not tall with the getpid()
for pthread_create() call.
For ex. below the getpid() in myfunc() does not tally with the
pid in the current task_struct for linux redhat 9.
It is one more that the in thread func.
ex. if getpid() below return 100 than the current- >pid of the
task_struct (sched.) has a value of 101.
If this is the case than how do I get the actual thread
pid from the task_struc in ther kernel.
TIA
basithsalman@(protected)
main()
{
...
pthread_create(tid, myfunc, ..);
}
myfunc()
{
getpid();
} <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN " >
<HTML > <HEAD >
<META http-equiv=Content-Type content= "text/html; charset=iso-8859-1 " >
<META content= "MSHTML 6.00.2800.1276 " name=GENERATOR >
<STYLE > </STYLE >
</HEAD >
<BODY bgColor=#ffffff >
<DIV > <FONT face=Arial size=2 >Hi All, </FONT > </DIV >
<DIV > <FONT face=Arial size=2 > </FONT > </DIV >
<DIV > <FONT face=Arial size=2 >The current->pid of the task_struct does not
tall with the getpid() </FONT > </DIV >
<DIV > <FONT face=Arial size=2 >for pthread_create() call. </FONT > </DIV >
<DIV > <FONT face=Arial size=2 > </FONT > </DIV >
<DIV > <FONT face=Arial size=2 >For ex. below the getpid() in myfunc() does not
tally with the </FONT > </DIV >
<DIV > <FONT face=Arial size=2 >pid in the current task_struct for linux redhat
9. </FONT > </DIV >
<DIV > <FONT face=Arial size=2 >It is one more that the in thread
func. </FONT > </DIV >
<DIV > <FONT face=Arial size=2 >ex. if getpid() below return 100 than the
current->pid of the </FONT > </DIV >
<DIV > <FONT face=Arial size=2 >task_struct (sched.) has a value of
101. </FONT > </DIV >
<DIV > <FONT face=Arial size=2 >If this is the case than how do I get the actual
thread </FONT > </DIV >
<DIV > <FONT face=Arial size=2 >pid from the task_struc in ther
kernel. </FONT > </DIV >
<DIV > <FONT face=Arial size=2 > </FONT > </DIV >
<DIV > <FONT face=Arial size=2 >TIA </FONT > </DIV >
<DIV > <FONT face=Arial size=2 > <A
href= "mailto:basithsalman@(protected) " >basithsalman@(protected) </A > </FONT > </DIV >
<DIV > <FONT face=Arial size=2 >main() </FONT > </DIV >
<DIV > <FONT face=Arial size=2 >{ </FONT > </DIV >
<DIV > <FONT face=Arial size=2 > ... </FONT > </DIV >
<DIV > <FONT face=Arial size=2 > pthread_create(tid, myfunc,
..); <BR >} </FONT > </DIV >
<DIV > <FONT face=Arial size=2 > </FONT > </DIV >
<DIV > <FONT face=Arial size=2 >myfunc() </FONT > </DIV >
<DIV > <FONT face=Arial size=2 >{ </FONT > </DIV >
<DIV > <FONT face=Arial size=2 > getpid(); </FONT > </DIV >
<DIV > <FONT face=Arial size=2 >} </FONT > </DIV > </BODY > </HTML >
|
|
 |