Re: current_proc() issue on leopard
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com The following code gives the current process name. struct proc *p = current_proc(); p->p_comm // contains current process name On Tiger, it is working fine, but on leopard, p_comm is empty. S+E -- Quinn "The Eskimo!" <http://www.apple.com/developer/> Apple Developer Relations, Developer Technical Support, Core OS/Hardware _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... At 14:38 +0530 20/3/08, Praveen Kumar wrote: Please let me know if there are alternate ways to get the current process name. (struct proc) is private, and has been since 10.4. You should /not/ be trying to access fields within it. In fact, I'm confused as to how this even compiles! Fortunately, there is a much better way to do this. Check out proc_name defined in <sys/proc.h> in the Kernel framework. Also, proc_self (from the same header) is a more modern way to get the current process. If you switch to that, please note that it gives you a reference to the current process that you then have to release using proc_rele. This email sent to site_archiver@lists.apple.com
participants (1)
-
Quinn