• 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: Get parent process (Carbon question)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get parent process (Carbon question)


  • Subject: Re: Get parent process (Carbon question)
  • From: Chris Giordano <email@hidden>
  • Date: Fri, 6 Sep 2002 17:50:57 -0400

Renaud,

I had occasion to come across a similar topic recently. It should help with getting the name of the parent process. The following message discussed killing a process by name, but you could use this to instead find the process with the same pid and get the name. It basically looped through all of the processes and printed the process id and name. You could instead check each process for a match to the pid you get back from getppid() and if you get a match, return the name. (There might be a much better way, but I don't yet know of one.)

The message is at <http://cocoa.mamasam.com/COCOADEV/2002/02/1/24657.php>. You'd have to contend with the deprecation of the cString method if you choose to follow the code exactly as it is, but I'll leave you to peruse the archives for a solution to that one if you do go that route.

chris

On Friday, September 6, 2002, at 05:16 PM, Renaud Boisjoly wrote:

Hi again

Well, I've mastered getppid() and now know all about using unix functions in Cocoa... but the problem persists.

What I'm trying to do is figure out if my app was launched from the Finder or from my System Preference Pane...

So I started with Carbon, which will do what I need, but I cannot figure out. I was looking for a way to get the process id and then figure out the name of the process... but I nopw realise I do not knowhow to do this, apart from executing a ps command and parsing it out.

I thought I coul duse part of the Carbon stuff once I had the pid, but Carbon relies on a ProcessSerialNumber, which is different from the pid...

So I'm back to where I was, apart from doing an NSTask-type of thing, for something which seems simple in concept...

On Friday, September 6, 2002, at 10:59 AM, Ondra Cada wrote:


If anyone has a few minutes, I'm a complete Carbon neophyte and I'm trying to do something using Carbon

That's not a good idea ;)

which Cocoa does not seem to be able to do.

Well, Cocoa was designed to use BSD layer whenever necessary. Just try "man getppid".
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Get parent process (Carbon question) (From: Renaud Boisjoly <email@hidden>)

  • Prev by Date: Re: Get parent process (Carbon question)
  • Next by Date: Generating Decent GIF With Transparency from NSBitmapImageRep
  • Previous by thread: Re: Get parent process (Carbon question)
  • Next by thread: Re: Get parent process (Carbon question)
  • Index(es):
    • Date
    • Thread