diff options
author | 2021-05-21 09:21:42 -0400 | |
---|---|---|
committer | 2021-05-21 09:21:42 -0400 | |
commit | f06784df5a44c2aeb450ff88346a96f0bc9eb732 (patch) | |
tree | 49e9923a65f7cf572a6f0833737b72848299b1c8 /adv_cmds/ps | |
parent | 0e3bb24ea8cde1573760b88ad56c1cc00be15cc8 (diff) | |
parent | 8d788054a62508f8d1b93067be16fb73f987ca8e (diff) | |
download | apple_cmds-f06784df5a44c2aeb450ff88346a96f0bc9eb732.tar.gz apple_cmds-f06784df5a44c2aeb450ff88346a96f0bc9eb732.tar.zst apple_cmds-f06784df5a44c2aeb450ff88346a96f0bc9eb732.zip |
Merge branch 'apple'
Diffstat (limited to 'adv_cmds/ps')
-rw-r--r-- | adv_cmds/ps/entitlements.plist | 4 | ||||
-rw-r--r-- | adv_cmds/ps/tasks.c | 16 |
2 files changed, 12 insertions, 8 deletions
diff --git a/adv_cmds/ps/entitlements.plist b/adv_cmds/ps/entitlements.plist index eaaf1de..cdf0e9e 100644 --- a/adv_cmds/ps/entitlements.plist +++ b/adv_cmds/ps/entitlements.plist @@ -2,9 +2,7 @@ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> - <key>com.apple.system-task-ports</key> - <true/> - <key>task_for_pid-allow</key> + <key>com.apple.system-task-ports.read</key> <true/> </dict> </plist> diff --git a/adv_cmds/ps/tasks.c b/adv_cmds/ps/tasks.c index 4548b56..d2fcb07 100644 --- a/adv_cmds/ps/tasks.c +++ b/adv_cmds/ps/tasks.c @@ -1,3 +1,4 @@ +#include <System/sys/proc.h> #include <sys/param.h> #include <sys/user.h> #include <sys/time.h> @@ -22,8 +23,9 @@ #include "ps.h" #include <mach/shared_memory_server.h> +#include <mach/mach_vm.h> -extern kern_return_t task_for_pid(task_port_t task, pid_t pid, task_port_t *target); +extern kern_return_t task_read_for_pid(task_port_t task, pid_t pid, task_port_t *target); #define STATE_MAX 7 @@ -96,7 +98,11 @@ int get_task_info (KINFO *ki) ki->state = STATE_MAX; pid = KI_PROC(ki)->p_pid; - if (task_for_pid(mach_task_self(), pid, &ki->task) != KERN_SUCCESS) { + error = task_read_for_pid(mach_task_self(), pid, &ki->task); + if (error != KERN_SUCCESS) { +#ifdef DEBUG + mach_error("Error calling task_read_for_pid()", error); +#endif return(1); } info_count = TASK_BASIC_INFO_COUNT; @@ -110,8 +116,8 @@ int get_task_info (KINFO *ki) } { vm_region_basic_info_data_64_t b_info; - vm_address_t address = GLOBAL_SHARED_TEXT_SEGMENT; - vm_size_t size; + mach_vm_address_t address = GLOBAL_SHARED_TEXT_SEGMENT; + mach_vm_size_t size; mach_port_t object_name; /* @@ -120,7 +126,7 @@ int get_task_info (KINFO *ki) * the 2 segments that are used for split libraries */ info_count = VM_REGION_BASIC_INFO_COUNT_64; - error = vm_region_64(ki->task, &address, &size, VM_REGION_BASIC_INFO, + error = mach_vm_region(ki->task, &address, &size, VM_REGION_BASIC_INFO, (vm_region_info_t)&b_info, &info_count, &object_name); if (error == KERN_SUCCESS) { if (b_info.reserved && size == (SHARED_TEXT_REGION_SIZE) && |