You can also achieve this by doing the following:- Where ever you want to get the process name, just print thread->proc->tsk->comm Herr thread is the binder_thread structure associated with the current running thread. Regards, Rahil On Nov 7, 2012 9:43 PM, "andria" <[email protected]> wrote:
> > > Le mardi 6 novembre 2012 05:36:00 UTC+1, Manish Sharma a écrit : >> >> Hi, > > > Hi > > >> I want to find out the current process name. I tried current->comm but >> what I get is "Binder Thread #" with different thread numbers. For ex. I >> get "Binder Thread#' from comm for id.defcontainer. >> > > The reason you get this is because name of threads that are part of the > same process may be different. > > >> >> Any suggestions on other possible method to identify current process name? >> > > Solution 1 : get the ref of the task which id matches the tgid of the > current task. Calling find_task_by_vpid(current->tgid) should return the > task corresponding to the "process" in which the current task is running. > You can then get an access to its comm attribute > > Solution 2 : get cmdline value of your task. To do that you need to take a > look at how it is done in fs/proc/base.c > The main advantage of the second value is that you can get the complete > name of the process while the first solution is just a part of this name. > The size of current->comm > is limited. 15 characters if I'm not wrong > > > > > >> >> --Manish >> > -- > unsubscribe: [email protected] > website: http://groups.google.com/group/android-kernel -- unsubscribe: [email protected] website: http://groups.google.com/group/android-kernel
