• 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: Talking to the Dock
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Talking to the Dock


  • Subject: Re: Talking to the Dock
  • From: Sailor Quasar <email@hidden>
  • Date: Wed, 30 Jul 2003 18:29:01 -0400

On Wednesday, July 30, 2003, at 02:12 PM, Neil A. Van Note wrote:
sysctl is a fairly simple API, and in my tests, averages a 40:1
performance advantage against executing a focused ps via. popen. I didn't
bother benching against a piped NSTask (which is virtually the same thing)
after noting the above difference.

I never said the difference in speed wasn't significant :).

Also, The sysctl API for reading the process list does not seem to be
effected by the current users privileges, at least while tracking down the
Dock from a regular user account.

After some further testing, it would seem the sysctl API does bring back
a *full* process list irrespective of the executing current user account (at
least the ones I tested) without the calling application having to authorize
itself as root. This is while using a 3 element MIB (Management Information
Base) of CTL_KERN, KERN_PROC, KERN_PROC_ALL.

Hmm. It's possible the mileage varies on some other UNIX systems (I've not used sysctl() on OS X). 'ps' may need setuid to do kernel memory reads also. I personally think the NSTask method represents simpler code than sysctl(), but given the extreme speed advantage and un-need to auth as root, I am forced to agree that sysctl() is the better solution.

-- Sailor Quasar, just another player in The World
"Come with me in the twilight of the summer night for awhile"
Email: email@hidden
_______________________________________________
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: Talking to the Dock (From: "Neil A. Van Note" <email@hidden>)

  • Prev by Date: Re: Learning Cocoa
  • Next by Date: Re: While on the subject of: NSOutlineView
  • Previous by thread: Re: Talking to the Dock
  • Next by thread: Re: Talking to the Dock
  • Index(es):
    • Date
    • Thread