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

Re: task_for_pid return dsChkErr


  • Subject: Re: task_for_pid return dsChkErr
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Thu, 5 Jun 2008 09:30:05 +0200



I don't think this functions returns an OSStatus, isn't it ?

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.


Le 5 juin 08 à 08:41, abandon a écrit :

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

_______________________________________________ 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: abandon <email@hidden>
References: 
 >task_for_pid return dsChkErr (From: abandon <email@hidden>)

  • Prev by Date: Re: Compiling msdosfs...
  • Next by Date: Re: Compiling msdosfs...
  • Previous by thread: task_for_pid return dsChkErr
  • Next by thread: Re: task_for_pid return dsChkErr
  • Index(es):
    • Date
    • Thread