On Wed, Mar 15, 2006 at 09:47:33PM -0800, Dev Mazumdar wrote:
> If you've ever used ddi_get_pid() to return the process's PID, you'll find 
> the function below rather handy:
> 
> char *
> ddi_get_proc_name (void)     /* Return the command name of the current thread 
> */
> {
>   return ttoproc (curthread)->p_user.u_comm;
> }
> 
> This function will return the name of the process (or program) that 
> ddi_get_pid() will return.
> 
> If you've ever user mixertool while running an audio app, you can only
> see the PID of the process. Using our little kernel function, you can
> also get the name of the process that was currently playing.
>
> We use it in our Open Sound drivers to show what process (and it's
> PID) is currently accessing the particular OSS device.
>
> We'd like to request a formal inclusion of this function into Open
> Solaris.

Out of curiosity, why don't you do this in user-space?  I.E. have mixertool
read /proc/<pid>/psinfo into a psinfo_t, and print out the "pr_fname" or
"pr_psargs" field?

Cheers,
- jonathan

-- 
Jonathan Adams, Solaris Kernel Development
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to