Re: kqueue EVFILT_PROC and child process pid
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type; bh=AC5mRItjr9iZEB7aXvYUo0awNLFEsvm141AQnRzXdRg=; b=XNovN1tHSXNV5ZpsvDuOV1Jth+7A0GgDlv0RhERbrFixtejaYDIlmOGxZOl6tVLGyu hEmzXY8JEF2HvuJu8c2AptpLEtCxwDoORfbUp/ZffTYyEwEQO5GL598Q9eqWYQKwP3BV Enivdet8MIBf5bdu8f7ccxcAP1hVhF/ZfIF+s= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; b=tQuNR8ZKBiHRqAu0sTbDp/Il54oA3Te2A87U3WfHmwqFnRxcpdEuBhdx0P0PQhed8G DawPPrRxG5FGGtteEvL6yISxMI3CU5g99Gff/ZrNyFJW89rh+frFfUpxKOcwWtAWjj3t nY8AUYIo2DXfaXI12+QJ83XEVv99saZnCJisM=
You cannot watch for all processes, only processes you created. After you fork, you can add a kqueue to watch for the new process' death, in lieu of waitpid() or a SIGCHLD signal. You cannot however sit there, watching for any random process' death. Mac OS X has no such mechanism, AFAIK.
kevents are perfectly capable of monitoring another, unrelated process. It's become quite a hobby of mine, actually. :) As far as getting the the new child's PID, I don't think it's possible using the kevent APIs from userland. (sys/event.h mentions "lower bits contain the PID of the child", but I think this is kernel-only.) Of course you could always iterate over the process list checking each process' parent PID... there's probably a better way, though. _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Dave Keck