• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Finding process path from Cocoa?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding process path from Cocoa?


  • Subject: Re: Finding process path from Cocoa?
  • From: Alastair Houghton <email@hidden>
  • Date: Wed, 9 Dec 2009 10:06:55 +0000

On 9 Dec 2009, at 00:03, Laurent Daudelin wrote:

> Is there any way I can find what's the path of a given process running? A background process, which cannot be retrieved in [[NSWorkspace sharedWorkspace] launchedApplications]?

If we're talking about background processes, to get this kind of information you probably need to use sysctl() (or run "ps" in the background and parse its output), however I think you'll find that you can only get the contents of the argv[] array, which can be set to *anything* by your parent process.

Furthermore, there is no guarantee that the executable will not have moved to a different location on the drive, or been replaced by a new (and potentially different) executable.

You might be interested in this (which I found using Google just now)

  <http://www.nightproductions.net/dsprocessesinfo_m.html>

which is fine for displaying the information to the user, but I really wouldn't recommend using or relying on the pathname of your executable, or anyone else's for that matter.

Kind regards,

Alastair.

--
http://alastairs-place.net



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Finding process path from Cocoa? (From: Laurent Daudelin <email@hidden>)

  • Prev by Date: Re: Finding process path from Cocoa?
  • Next by Date: Re: Finding process path from Cocoa?
  • Previous by thread: Re: Finding process path from Cocoa?
  • Next by thread: Re: Finding process path from Cocoa?
  • Index(es):
    • Date
    • Thread