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:received:received:cc:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=nKIrZO1P7tFlf7ytuCQX0rUQQPhjxkdC6p5AFgKngiQ=; b=t4ZCPqtqw2ds9Xx6WIt744+S6XV23Eaabp2WhrGdxDgYQOPq17uwSIOGRD28RnP8rM 5Z70VM1xH97qhfMp8BWPfTn9Ivym17OWfLhKyyeIDxAf15n2L/7IgAsBjd2DASReOOmG EwBHD/P9PVXZcCaIxCKCzBw+4jshTagV+4gDE= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=rN0frfeeDhzQNm/2N3bUYL1ZHhLvB3/yRGmC0lVpvufh95rkK0sqk/NQKb/2D6FUPv Q6Q7H4Z6PDVOqjtMsKhLSVdxAK06bfwYk8w8I3flXLSgPnVWcMtn9+utdO5BbxDq+Z6L LJeCVzjkwffHut1RJggDnmpuWyGMu0jk69cOU= On Jan 12, 2009, at 12:54 , Gary Fung wrote: task_t task = MACH_PORT_NULL; struct task_basic_info tinf; if(task_for_pid(mach_task_self(), pid, &task) == KERN_SUCCESS) { ... //not reached } Jason _______________________________________________ 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... Tried to retrieve task_info_t by using task_for_pid but the following code does not equate to true mach_task_self returns non null value so that should be ok. But task_for_pid does not return anything for &task. Any ideas? I've iterated through all the pids currently running, same result. Ran it on Leopard. task_for_pid() requires special privileges to execute. Instead of testing for KERN_SUCCESS in the future, I suggest using a variable to test, then you can see exactly what failed (in this case, you will not have privileges to execute it). The easiest way to deal with this (although, probably not the best way) is to execute the application as root. You can see the man page for taskgated(8) for more information on task_for_pid() and its security issues. This email sent to site_archiver@lists.apple.com