Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: detecting process termination in kernel?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: detecting process termination in kernel?



On Mar 30, 2008, at 8:24 PM, Greg wrote:
Hi, given several process IDs, what are the different ways of finding out (being notified, etc), of when a specific PID terminates? I know that kqueues can be used in userland (with EVFILT PROC), can they be used as well from a KEXT?

If you are a KEXT, you typically export a device node and have the process open it. When the process terminates, the resource tracking close for the device node will be triggered as part of the process exit, which will notify you that it has gone away.


This is probably not useful for you, since wanting to know about processes other than processes with which you've already established a communications channel generally means you don't really want to solve the problem you are trying to solve by monitoring user space processes.

Also, proc_find() can return false positives, so you will not want to poll either; there are a finite number of PIDs available, and eventually they get recycled. If you are trying to do something by PID, then you are probably also not doing what you want to do , since having a PID is not necessarily the same as having a unique identifier for a process.

-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.