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 solution is that you will get the complete name of the process. If you choose the first solution there is a chance that you only get a part of the name if it is too long. The siez of current->comm is limited to 15 characters if I'm not wrong > > --Manish > -- unsubscribe: android-kernel+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-kernel