linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to name the pthread or Renaming?
@ 2008-03-10 10:50 ziaudeen
       [not found] ` <36ca99e90803100723q142411e0r8e0462be8eac5d6d@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: ziaudeen @ 2008-03-10 10:50 UTC (permalink / raw)
  To: linux-c-programming

Hi,

While creating a pthread using the pthread_create function, Is there any 
ways to change/give the name of the thread to our custom names?

Please help me, I am a new bee to linux programming

Regards
Ziaudeen


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to name the pthread or Renaming?
       [not found]   ` <47D54A87.6010608@sun.com>
@ 2008-03-10 16:41     ` Bert Wesarg
       [not found]       ` <47D61F00.1090507@sun.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Bert Wesarg @ 2008-03-10 16:41 UTC (permalink / raw)
  To: Ziaudeen.Abdulrazak; +Cc: linux-c-programming

Sorry, forgot the ML as CC. I put the ML back on the CC.

On Mon, Mar 10, 2008 at 3:49 PM, ziaudeen <Ziaudeen.Abdulrazak@sun.com> wrote:
>
>  Hi Bert,
>
>  It is the name which I set using the prctl function prctl(PR_SET_NAME,<null
> terminated string.,0,0,0).  It is successfully setting the name for the
> thread. But I don't know how to see the changed thread name using the
> command
>   like ps -eLf or ps H.
as the named suggest, prctl(2) is to control a process's attributes.
The name is a attribute to the whole process, and can not be set
individual per thread.

>
>  Do you suggest something for me to try to see the changed name of each
> thread?
No, because I think you can not set the name for each thread, at most
for the process.

Anyway, I'm a little confused, in your first mail, you asked how to
set the name for a thread created with pthread_create(3), and now you
ask how you can see the changed name of a thread!

Bert

>
>  Regards
>  Ziaudeen
>
>
>
>
>  Bert Wesarg wrote:
>  Hi,
>
> On Mon, Mar 10, 2008 at 11:50 AM, ziaudeen <Ziaudeen.Abdulrazak@sun.com>
> wrote:
>
>
>  Hi,
>
>  While creating a pthread using the pthread_create function, Is there any
>  ways to change/give the name of the thread to our custom names?
>
>  About what name do you talking, the name of the binary, which is shown
> in ps/top/...?
>
> If its some internal name, posix threads have no such thing.
>
> Bert
>
>
>
>  Please help me, I am a new bee to linux programming
>
>  Regards
>  Ziaudeen
>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to name the pthread or Renaming?
       [not found]       ` <47D61F00.1090507@sun.com>
@ 2008-03-11 13:05         ` Bert Wesarg
       [not found]           ` <47D78410.1020906@sun.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Bert Wesarg @ 2008-03-11 13:05 UTC (permalink / raw)
  To: Ziaudeen.Abdulrazak; +Cc: linux-c-programming

On Tue, Mar 11, 2008 at 6:56 AM, ziaudeen <Ziaudeen.Abdulrazak@sun.com> wrote:
>
>  Hi Bert,
>  As the pthread_create or any other pthread functionality API is not
> available to set a name to the thread, so I have tried with the prctl() with
> PR_SET_NAME. I am able to set the name for the thread.successfully, since it
> is considered as LWP(light weight process), it is individually setting the
> name for the thread. I have checked this by using prctl() -PR_GET_NAME
> getting the name back from each thread and print it, I will be able to see
> the individual thread name, what I have change it. So now the problem is I
> am unable to see the LWP process name through PS command, even though the
> name is present for each thread. So I would like to know whether any other
> command present to see the pthread names.
Ok, I was wrong, the name you can set with prctl is indeed a
per-thread attribute. you can see this either in the stat file from
the /proc filesystem (inside parentheses) or with ps and the comm
format, not the args format, and the same with top, where you switch
this with 'c'.

Bert
>
>
>
>  Regards
>  Ziaudeen
>
>  Bert Wesarg wrote:
>  Sorry, forgot the ML as CC. I put the ML back on the CC.
>
> On Mon, Mar 10, 2008 at 3:49 PM, ziaudeen <Ziaudeen.Abdulrazak@sun.com>
> wrote:
>
>
>  Hi Bert,
>
>  It is the name which I set using the prctl function prctl(PR_SET_NAME,<null
> terminated string.,0,0,0). It is successfully setting the name for the
> thread. But I don't know how to see the changed thread name using the
> command
>  like ps -eLf or ps H.
>
>  as the named suggest, prctl(2) is to control a process's attributes.
> The name is a attribute to the whole process, and can not be set
> individual per thread.
>
>
>
>
>
>  Do you suggest something for me to try to see the changed name of each
> thread?
>
>
>
>  No, because I think you can not set the name for each thread, at most
> for the process.
>
> Anyway, I'm a little confused, in your first mail, you asked how to
> set the name for a thread created with pthread_create(3), and now you
> ask how you can see the changed name of a thread!
>
> Bert
>
>
>
>  Regards
>  Ziaudeen
>
>
>
>
>  Bert Wesarg wrote:
>  Hi,
>
> On Mon, Mar 10, 2008 at 11:50 AM, ziaudeen <Ziaudeen.Abdulrazak@sun.com>
> wrote:
>
>
>  Hi,
>
>  While creating a pthread using the pthread_create function, Is there any
>  ways to change/give the name of the thread to our custom names?
>
>  About what name do you talking, the name of the binary, which is shown
> in ps/top/...?
>
> If its some internal name, posix threads have no such thing.
>
> Bert
>
>
>
>  Please help me, I am a new bee to linux programming
>
>  Regards
>  Ziaudeen
>
>
>
>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to name the pthread or Renaming?
       [not found]           ` <47D78410.1020906@sun.com>
@ 2008-03-12  8:12             ` Bert Wesarg
  0 siblings, 0 replies; 4+ messages in thread
From: Bert Wesarg @ 2008-03-12  8:12 UTC (permalink / raw)
  To: Ziaudeen.Abdulrazak; +Cc: linux-c-programming

On Wed, Mar 12, 2008 at 8:19 AM, ziaudeen <Ziaudeen.Abdulrazak@sun.com> wrote:
>
>  Bert Wesarg wrote:
>  Ok, I was wrong, the name you can set with prctl is indeed a
> per-thread attribute. you can see this either in the stat file from
> the /proc filesystem (inside parentheses) or with ps and the comm
> format, not the args format, and the same with top, where you switch
> this with 'c'.
>
>  Could you please tell me exactly what is the command " ps -c" Is it ? I
> don't understand the comm mode means..
I wrote 'comm format' and not 'mode'. if you mean with the '-c' the
misc option 'true command name', than why do you put a '-' in front of
it? the help message shows only a single 'c' => "ps c"

Bert

>
>  - Ziaudeen

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-03-12  8:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-10 10:50 How to name the pthread or Renaming? ziaudeen
     [not found] ` <36ca99e90803100723q142411e0r8e0462be8eac5d6d@mail.gmail.com>
     [not found]   ` <47D54A87.6010608@sun.com>
2008-03-10 16:41     ` Bert Wesarg
     [not found]       ` <47D61F00.1090507@sun.com>
2008-03-11 13:05         ` Bert Wesarg
     [not found]           ` <47D78410.1020906@sun.com>
2008-03-12  8:12             ` Bert Wesarg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).