Re: Which function returns LWP in Linux.

From: Jaswinder Singh Rajput
Date: Mon May 17 2010 - 03:33:19 EST


Hello KOSAKI-san,

On Mon, May 17, 2010 at 12:33 PM, KOSAKI Motohiro
<kosaki.motohiro@xxxxxxxxxxxxxx> wrote:
>> Hi,
>>
>> For a process, we have different PIDs. For threads under a single
>> processes, we have different LWP id, but same PID in Linux.
>> ex.
>>
>> root@pc:/home/srinivas# ps -eLf
>> UID        PID  PPID     LWP  C STIME       TIME     CMD
>> root       100     1     100  0 May13       00:00:02 ./a.out
>> root       100     1     102  0 May13       00:00:00 ./a.out
>>
>> getpid() function returns PID of a process.
>> Which function retuns LWP id for thread?
>
> gettid()
>

gettid() is linux specific and not supported in glibc. Normally
application do not use gettid(), even procps is not using it, that why
I suggested Srinivas to check procps source to find the best solution
for it.

Thanks,
--
Jaswinder Singh.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/