• 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
task_for_pid return dsChkErr
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

task_for_pid return dsChkErr


  • Subject: task_for_pid return dsChkErr
  • From: abandon <email@hidden>
  • Date: Thu, 5 Jun 2008 14:41:02 +0800

Hi, all,

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.

#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>

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;
}
 
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: task_for_pid return dsChkErr
      • From: Jean-Daniel Dupas <email@hidden>
  • Prev by Date: Re: Compiling msdosfs...
  • Next by Date: Re: Compiling msdosfs...
  • Previous by thread: Re: Control socket communication gets truncated...
  • Next by thread: Re: task_for_pid return dsChkErr
  • Index(es):
    • Date
    • Thread