Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add procinfo and hostinfo #13

Merged
merged 4 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ jobs:
gh release download -R ProcursusTeam/ldid -p ldid_macosx_x86_64
install -m755 ldid_macosx_x86_64 ldid
echo "${PWD}" >> $GITHUB_PATH
mkdir -p ${HOME}/include
mkdir -p ${HOME}/include/sys
ln -s $(xcrun -sdk macosx --show-sdk-path)/usr/include/xpc ${HOME}/include/xpc
ln -s $(xcrun -sdk macosx --show-sdk-path)/usr/include/launch.h ${HOME}/include/launch.h
ln -s $(xcrun -sdk macosx --show-sdk-path)/usr/include/net ${HOME}/include/net
ln -s $(xcrun -sdk macosx --show-sdk-path)/usr/include/libproc.h ${HOME}/include/libproc.h
ln -s $(xcrun -sdk macosx --show-sdk-path)/usr/include/sys/proc_info.h ${HOME}/include/sys/proc_info.h
ln -s $(xcrun -sdk macosx --show-sdk-path)/usr/include/sys/kern_control.h ${HOME}/include/sys/kern_control.h
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ launchctl
a.out
*.dSYM

tools/*.txt
.vscode

compile_commands.json
include
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DESTDIR ?=
SRC := attach.c blame.c bootstrap.c enable.c env.c error.c examine.c kickstart.c
SRC += kill.c launchctl.c limit.c list.c load.c manager.c plist.c print.c reboot.c
SRC += remove.c runstats.c start_stop.c userswitch.c version.c xpc_helper.c
SRC += dumpjpcategory.c
SRC += dumpjpcategory.c procinfo.c

ifeq ($(DEBUG),1)
CFLAGS += -O0 -g -fsanitize=address,undefined -fno-omit-frame-pointer
Expand Down
4 changes: 2 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
1. [x] print-cache
1. [x] print-disabled
1. [x] plist
1. [ ] procinfo
1. [ ] hostinfo
1. [x] procinfo
1. [x] hostinfo
1. [ ] resolveport
1. [x] limit
1. [x] runstats
Expand Down
4 changes: 2 additions & 2 deletions launchctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ static const struct {
{ "print-cache", "Prints information about the service cache.", NULL, print_cache_cmd },
{ "print-disabled", "Prints which services are disabled.", NULL, print_disabled_cmd },
{ "plist", "Prints a property list embedded in a binary (targets the Info.plist by default).", "[segment,section] <path>", plist_cmd },
{ "procinfo", "Prints port information about a process.", "<pid>", todo_cmd },
{ "hostinfo", "Prints port information about the host.", NULL, todo_cmd },
{ "procinfo", "Prints port information about a process.", "<pid>", procinfo_cmd },
{ "hostinfo", "Prints port information about the host.", NULL, hostinfo_cmd },
{ "resolveport", "Resolves a port name from a process to an endpoint in launchd.", "<owner-pid> <port-name>", todo_cmd },
{ "limit", "Reads or modifies launchd's resource limits.", "[<limit-name> [<both-limits> | <soft-limit> <hard-limit>]", limit_cmd },
{ "runstats", "Prints performance statistics for a service.", "<service-target>", runstats_cmd },
Expand Down
4 changes: 4 additions & 0 deletions launchctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ cmd_main limit_cmd;
// dumpjpcategory.c
cmd_main dumpjpcategory_cmd;

// procinfo.c
cmd_main procinfo_cmd;
cmd_main hostinfo_cmd;

void launchctl_xpc_object_print(xpc_object_t, const char *name, int level);
int launchctl_send_xpc_to_launchd(uint64_t routine, xpc_object_t msg, xpc_object_t *reply);
void launchctl_setup_xpc_dict(xpc_object_t dict);
Expand Down
2 changes: 2 additions & 0 deletions launchctl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
<true/>
<key>com.apple.private.xpc.service-configure</key>
<true/>
<key>task_for_pid-allow</key>
<true/>
<key>platform-application</key>
<true/>
</dict>
Expand Down
Loading
Loading