lkml.org 
[lkml]   [2005]   [Jul]   [1]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateFri, 1 Jul 2005 06:02:11 +0100 (BST)
FromKV Pavuram <>
SubjectRe: Pthreadid, pid
Thank you Andrew. It worked.

Pav. 


--- Andrew Burgess <aab@cichlid.com> wrote:
> >When i run a multi-threaded program from gdb, gdb
> >shows "New Thread XXXXXXXX (LWP LLLL)" for each new
> >thread created by the application.
> 
> >However, when I run ps -aelfm, the output shows
> each
> >thread of this application but with a different
> PID.
> 
> >And, getpid () in each thread inside the
> application
> >always retreives the same PID.
> 
> >What is the relation between LWP is given by GDB,
> PID
> >shown by ps call and the PID returned by getpid ().
> 
> >Is there any system call to obtain one from the
> >other??
> 
> see gettid(2)
> 
> you need to include the macro call
> _syscall0(pid_t,gettid)
> in your program as gettid isn't in glibc
> 
> 




_______________________________________________________
Too much spam in your inbox? Yahoo! Mail gives you the best spam protection for FREE! http://in.mail.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-07-01 05:05    [W:0.107 / U:0.050 seconds]
©2003-2008 Jasper Spaans