All of lore.kernel.org
 help / color / mirror / Atom feed
* Change processname for dmix/dsnoop process
@ 2005-09-30 14:18 Gregor Jasny
  2005-09-30 14:41 ` Takashi Iwai
  0 siblings, 1 reply; 11+ messages in thread
From: Gregor Jasny @ 2005-09-30 14:18 UTC (permalink / raw)
  To: alsa-devel

Hi,

At the moment the dmix process inherits the processname from the first 
dmix enabled process. This can be very confusing.

It would be nice if dmix or dsnoop would change its name after forking.

Thanks,
Gregor


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

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

* Re: Change processname for dmix/dsnoop process
  2005-09-30 14:18 Change processname for dmix/dsnoop process Gregor Jasny
@ 2005-09-30 14:41 ` Takashi Iwai
  2005-10-01 23:13   ` Mike Hearn
  0 siblings, 1 reply; 11+ messages in thread
From: Takashi Iwai @ 2005-09-30 14:41 UTC (permalink / raw)
  To: Gregor Jasny; +Cc: alsa-devel

At Fri, 30 Sep 2005 16:18:02 +0200,
Gregor Jasny wrote:
> 
> Hi,
> 
> At the moment the dmix process inherits the processname from the first 
> dmix enabled process. This can be very confusing.
> 
> It would be nice if dmix or dsnoop would change its name after forking.

Well, changing the process name in run time is very tricky on Linux.
In other words: no proper way.


Takashi


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

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

* Re: Change processname for dmix/dsnoop process
  2005-09-30 14:41 ` Takashi Iwai
@ 2005-10-01 23:13   ` Mike Hearn
  2005-10-04 10:55     ` Takashi Iwai
  0 siblings, 1 reply; 11+ messages in thread
From: Mike Hearn @ 2005-10-01 23:13 UTC (permalink / raw)
  To: alsa-devel

On Fri, 30 Sep 2005 16:41:10 +0200, Takashi Iwai wrote:
> Well, changing the process name in run time is very tricky on Linux. In
> other words: no proper way.

Are you sure? I thought there was a syscall for it.



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

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

* Re: Re: Change processname for dmix/dsnoop process
  2005-10-01 23:13   ` Mike Hearn
@ 2005-10-04 10:55     ` Takashi Iwai
  2005-10-04 14:04       ` Mike Hearn
  2005-10-04 14:40       ` Mike Hearn
  0 siblings, 2 replies; 11+ messages in thread
From: Takashi Iwai @ 2005-10-04 10:55 UTC (permalink / raw)
  To: Mike Hearn; +Cc: alsa-devel

At Sun, 02 Oct 2005 00:13:56 +0100,
Mike Hearn wrote:
> 
> On Fri, 30 Sep 2005 16:41:10 +0200, Takashi Iwai wrote:
> > Well, changing the process name in run time is very tricky on Linux. In
> > other words: no proper way.
> 
> Are you sure? I thought there was a syscall for it.

Then I'd be happy to change the code.  Could you give a pointer?


Takashi


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

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

* Re: Re: Change processname for dmix/dsnoop process
  2005-10-04 10:55     ` Takashi Iwai
@ 2005-10-04 14:04       ` Mike Hearn
  2005-10-04 14:40       ` Mike Hearn
  1 sibling, 0 replies; 11+ messages in thread
From: Mike Hearn @ 2005-10-04 14:04 UTC (permalink / raw)
  To: crazney; +Cc: alsa-devel, Takashi Iwai

Hi David,

Long time no see! If you're ever in England again make sure to drop me a 
line.

Anyway, I remember you showed me a syscall to change the process name - 
do you have a function that could be included in ALSA so the forked dmix 
process can be more obvious?

thanks -mike

Takashi Iwai wrote:

>At Sun, 02 Oct 2005 00:13:56 +0100,
>Mike Hearn wrote:
>  
>
>>On Fri, 30 Sep 2005 16:41:10 +0200, Takashi Iwai wrote:
>>    
>>
>>>Well, changing the process name in run time is very tricky on Linux. In
>>>other words: no proper way.
>>>      
>>>
>>Are you sure? I thought there was a syscall for it.
>>    
>>
>
>Then I'd be happy to change the code.  Could you give a pointer?
>
>
>Takashi
>
>  
>



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

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

* Re: Re: Change processname for dmix/dsnoop process
  2005-10-04 10:55     ` Takashi Iwai
  2005-10-04 14:04       ` Mike Hearn
@ 2005-10-04 14:40       ` Mike Hearn
  2005-10-04 14:53         ` Takashi Iwai
  1 sibling, 1 reply; 11+ messages in thread
From: Mike Hearn @ 2005-10-04 14:40 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Actually, I found it - it's SYS_prctl with PR_SET_NAME (2.6 kernels only).

Something like this:

static inline int prctl(int option, unsigned long arg2, unsigned long arg3,
                        unsigned long arg4, unsigned long arg5)
{
    int ret;
    __asm__ __volatile__ ( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
                           : "=a" (ret) : "0" (SYS_prctl), "r" (option),
                           "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5) );
    return SYSCALL_RET(ret);
}

prctl(15 /* PR_SET_NAME */, (unsigned long)"dmix", 0, 0, 0);

thanks -mike

Takashi Iwai wrote:

>At Sun, 02 Oct 2005 00:13:56 +0100,
>Mike Hearn wrote:
>  
>
>>On Fri, 30 Sep 2005 16:41:10 +0200, Takashi Iwai wrote:
>>    
>>
>>>Well, changing the process name in run time is very tricky on Linux. In
>>>other words: no proper way.
>>>      
>>>
>>Are you sure? I thought there was a syscall for it.
>>    
>>
>
>Then I'd be happy to change the code.  Could you give a pointer?
>
>
>Takashi
>
>  
>





-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

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

* Re: Re: Change processname for dmix/dsnoop process
  2005-10-04 14:40       ` Mike Hearn
@ 2005-10-04 14:53         ` Takashi Iwai
  2005-10-04 17:40           ` Takashi Iwai
  0 siblings, 1 reply; 11+ messages in thread
From: Takashi Iwai @ 2005-10-04 14:53 UTC (permalink / raw)
  To: Mike Hearn; +Cc: alsa-devel

At Tue, 04 Oct 2005 15:40:04 +0100,
Mike Hearn wrote:
> 
> Actually, I found it - it's SYS_prctl with PR_SET_NAME (2.6 kernels only).
> 
> Something like this:
> 
> static inline int prctl(int option, unsigned long arg2, unsigned long arg3,
>                         unsigned long arg4, unsigned long arg5)
> {
>     int ret;
>     __asm__ __volatile__ ( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
>                            : "=a" (ret) : "0" (SYS_prctl), "r" (option),
>                            "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5) );
>     return SYSCALL_RET(ret);
> }
> 
> prctl(15 /* PR_SET_NAME */, (unsigned long)"dmix", 0, 0, 0);

Great, looks like we have it in sys/prctl.h.
Let's see whether it works...


Thanks,

Takashi


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

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

* Re: Re: Change processname for dmix/dsnoop process
  2005-10-04 14:53         ` Takashi Iwai
@ 2005-10-04 17:40           ` Takashi Iwai
  2005-10-04 18:38             ` Mike Hearn
  0 siblings, 1 reply; 11+ messages in thread
From: Takashi Iwai @ 2005-10-04 17:40 UTC (permalink / raw)
  To: Mike Hearn; +Cc: alsa-devel

At Tue, 04 Oct 2005 16:53:37 +0200,
I wrote:
> 
> At Tue, 04 Oct 2005 15:40:04 +0100,
> Mike Hearn wrote:
> > 
> > Actually, I found it - it's SYS_prctl with PR_SET_NAME (2.6 kernels only).
> > 
> > Something like this:
> > 
> > static inline int prctl(int option, unsigned long arg2, unsigned long arg3,
> >                         unsigned long arg4, unsigned long arg5)
> > {
> >     int ret;
> >     __asm__ __volatile__ ( "pushl %%ebx; movl %2,%%ebx; int $0x80; popl %%ebx"
> >                            : "=a" (ret) : "0" (SYS_prctl), "r" (option),
> >                            "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5) );
> >     return SYSCALL_RET(ret);
> > }
> > 
> > prctl(15 /* PR_SET_NAME */, (unsigned long)"dmix", 0, 0, 0);
> 
> Great, looks like we have it in sys/prctl.h.
> Let's see whether it works...

It seems not always working.  At least, ps shows the old content while
pstree shows the new name.  Possibly because /proc entry doesn't
change.


Takashi


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

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

* Re: Re: Change processname for dmix/dsnoop process
  2005-10-04 17:40           ` Takashi Iwai
@ 2005-10-04 18:38             ` Mike Hearn
  2005-10-05  9:54               ` Takashi Iwai
  0 siblings, 1 reply; 11+ messages in thread
From: Mike Hearn @ 2005-10-04 18:38 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel


>It seems not always working.  At least, ps shows the old content while
>pstree shows the new name.  Possibly because /proc entry doesn't
>change.
>

Try changing argv[0] before the exec() call - it's got something to do 
with that. I don't remember exactly.


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

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

* Re: Re: Change processname for dmix/dsnoop process
  2005-10-04 18:38             ` Mike Hearn
@ 2005-10-05  9:54               ` Takashi Iwai
  2005-10-05 15:50                 ` Mike Hearn
  0 siblings, 1 reply; 11+ messages in thread
From: Takashi Iwai @ 2005-10-05  9:54 UTC (permalink / raw)
  To: Mike Hearn; +Cc: alsa-devel

At Tue, 04 Oct 2005 19:38:05 +0100,
Mike Hearn wrote:
> 
> 
> >It seems not always working.  At least, ps shows the old content while
> >pstree shows the new name.  Possibly because /proc entry doesn't
> >change.
> >
> 
> Try changing argv[0] before the exec() call - it's got something to do 
> with that. I don't remember exactly.

dmix doesn't exec :)
We may overwrite argv[0] string, but its pointer isn't known in the
dmix function.


Takashi


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

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

* Re: Re: Change processname for dmix/dsnoop process
  2005-10-05  9:54               ` Takashi Iwai
@ 2005-10-05 15:50                 ` Mike Hearn
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Hearn @ 2005-10-05 15:50 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Takashi Iwai wrote:

>dmix doesn't exec :)
>We may overwrite argv[0] string, but its pointer isn't known in the
>dmix function.
>
>  
>
Hmm, IIRC you can get it from the auxiliary array and there is some way 
to get the address of that, but right now I don't remember what it is.


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

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

end of thread, other threads:[~2005-10-05 15:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-30 14:18 Change processname for dmix/dsnoop process Gregor Jasny
2005-09-30 14:41 ` Takashi Iwai
2005-10-01 23:13   ` Mike Hearn
2005-10-04 10:55     ` Takashi Iwai
2005-10-04 14:04       ` Mike Hearn
2005-10-04 14:40       ` Mike Hearn
2005-10-04 14:53         ` Takashi Iwai
2005-10-04 17:40           ` Takashi Iwai
2005-10-04 18:38             ` Mike Hearn
2005-10-05  9:54               ` Takashi Iwai
2005-10-05 15:50                 ` Mike Hearn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.