JohnTitor / mach2

Apache License 2.0
31 stars 13 forks source link

is `task_for_pid` obsolete ? #26

Open CeNiEi opened 1 year ago

CeNiEi commented 1 year ago

It seems that the function task_for_pid is obsolete. After looking at some source files, I found this in mach_traps.h:

/*
 *  Obsolete interfaces.
 */

extern kern_return_t task_for_pid(
    mach_port_name_t target_tport,
    int pid,
    mach_port_name_t *t);

extern kern_return_t task_name_for_pid(
    mach_port_name_t target_tport,
    int pid,
    mach_port_name_t *tn);

extern kern_return_t pid_for_task(
    mach_port_name_t t,
    int *x);

extern kern_return_t debug_control_port_for_pid(
    mach_port_name_t target_tport,
    int pid,
    mach_port_name_t *t);

Event though i have found a lot resources related to debugging on mac, which mention this function call as the gateway to rest of the functionality like manipulating registers, I could not find this function on apple's mach documentation. https://developer.apple.com/search/?q=task_for_pid&type=Documentation

So is this function now deprecated, and if it is what should be used in its place?

JohnTitor commented 9 months ago

If upstream says so, yeah, it's obsolete. But providing it doesn't harm and users can choose what they use (note that this crate just exposes the items what mach does). If upstream removes it, I'm happy to say good-bye to it on this crate :)