site_archiver@lists.apple.com Delivered-To: Darwin-dev@lists.apple.com I don't think this functions returns an OSStatus, isn't it ? Le 5 juin 08 à 08:41, abandon a écrit : Hi, all, #include <sys/sysctl.h> #include <mach-o/dyld.h> #include <mach/mach_traps.h> #include <mach/mach_init.h> #include <mach/message.h> #include <mach/vm_map.h> #include <mach/vm_region.h> #include <mach/mach_port.h> #include <mach-o/fat.h> #include <mach-o/nlist.h> #include <Carbon/Carbon.h> _______________________________________________ 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/devlists%40shadowlab.org _______________________________________________ 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... Using GetMacOSStatusErrorString() will not returns anything usefull, but mach_error_string() will. Since Mac OS 10.4 Tiger Intel, this function need special rights to be used (for obvious security reasons). See man taskgated, this is a good starting point to find information about those restrictions. Is task_for_pid still supported on Leopard 10.5.3(9D34)? I found when I call this function it will always return dsChkErr( code 5). Following my simple test program, use gcc test.c -o test -framework carbon to compile and ./test pid to run. int main(int argc, char* argv[]) { mach_port_name_t task; int pid = atoi(argv[1]); int error = task_for_pid((mach_port_name_t)task_self_trap(), pid, (mach_port_name_t *) &task); if (error) { printf("task_for_pid return error %d : %s\n", error, GetMacOSStatusErrorString(error)); } else { printf("Get the process %d's task port : %x\n", pid, task); } return 0; } This email sent to devlists@shadowlab.org This email sent to site_archiver@lists.apple.com
participants (1)
-
Jean-Daniel Dupas