Skip to content

Commit

Permalink
Change how headers are laid out
Browse files Browse the repository at this point in the history
  • Loading branch information
asdfugil committed Jan 20, 2024
1 parent 9e6da79 commit 9e99fba
Show file tree
Hide file tree
Showing 29 changed files with 47 additions and 34 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
ROOT := $(shell pwd)
MACOSX_SYSROOT = $(shell xcrun -sdk macosx --show-sdk-path)
TARGET_SYSROOT = $(shell xcrun -sdk iphoneos --show-sdk-path)
CC = xcrun -sdk iphoneos clang
CC = $(shell xcrun --find clang)
CFLAGS += -isystem $(ROOT)/apple-include -I$(ROOT)/include -isysroot $(TARGET_SYSROOT)
OBJC = $(CC)

export ROOT CC OBJC
export ROOT CC OBJC CFLAGS

all: apple-include
$(MAKE) -C $(ROOT)/src

apple-include:
apple-include: apple-include-private/**
mkdir -p apple-include/{bsm,objc,os/internal,sys,firehose,CoreFoundation,FSEvents,IOSurface,IOKit/kext,libkern,kern,arm,{mach/,}machine,CommonCrypto,Security,CoreSymbolication,Kernel/{kern,IOKit,libkern},rpc,rpcsvc,xpc/private,ktrace,mach-o,dispatch}
cp -af $(MACOSX_SYSROOT)/usr/include/{arpa,bsm,hfs,net,xpc,netinet,servers,timeconv.h,launch.h} apple-include
cp -af $(MACOSX_SYSROOT)/usr/include/objc/objc-runtime.h apple-include/objc
Expand Down Expand Up @@ -38,6 +39,7 @@ apple-include:
gsed -E /'__API_UNAVAILABLE'/d < $(TARGET_SYSROOT)/usr/include/pthread.h > apple-include/pthread.h
@if [ -f $(TARGET_SYSROOT)/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h ]; then gsed -E 's/API_UNAVAILABLE\(ios, watchos, tvos\)//g' < $(TARGET_SYSROOT)/System/Library/Frameworks/CoreFoundation.framework/Headers/CFUserNotification.h > apple-include/CoreFoundation/CFUserNotification.h; fi
gsed -i -E s/'__API_UNAVAILABLE\(.*\)'// apple-include/IOKit/IOKitLib.h
cp -a apple-include-private/. apple-include

clean:
$(MAKE) -C $(ROOT)/src clean
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 7 additions & 26 deletions include/xpc/private.h → apple-include-private/xpc/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#ifndef __XPC_PRIVATE_H__
#define __XPC_PRIVATE_H__

#ifndef __BLOCKS__
#error "XPC private APIs require Blocks support."
#endif // __BLOCKS__

#include <dispatch/dispatch.h>
#include <uuid/uuid.h>
#include <os/object.h>
Expand Down Expand Up @@ -180,30 +184,6 @@ XPC_EXPORT
xpc_object_t
xpc_create_reply_with_format(xpc_object_t original, const char * format, ...);

// Should move to <xpc/xpc_transaction_deprecate.h>

#ifndef __XPC_TRANSACTION_DEPRECATE_H__
#define __XPC_TRANSACTION_DEPRECATE_H__

#pragma mark Transactions

__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0)
XPC_TRANSACTION_DEPRECATED
void
xpc_transaction_exit_clean(void);

__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0)
XPC_TRANSACTION_DEPRECATED
void
xpc_transaction_interrupt_clean_exit(void);

__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0)
XPC_TRANSACTION_DEPRECATED
void
xpc_transactions_enable(void);

#endif

#pragma mark Tracks

XPC_EXPORT
Expand Down Expand Up @@ -307,13 +287,14 @@ xpc_pipe_invalidate(xpc_pipe_t pipe);
__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0)
XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2
kern_return_t
xpc_pipe_routine(xpc_pipe_t pipe, xpc_object_t request, xpc_object_t *reply);
xpc_pipe_routine(xpc_pipe_t pipe, xpc_object_t request, xpc_object_t XPC_GIVES_REFERENCE *reply);

API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0))
XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 XPC_NONNULL3 XPC_NONNULL4
int
_xpc_pipe_interface_routine(xpc_pipe_t pipe, uint64_t routine,
xpc_object_t message, xpc_object_t XPC_GIVES_REFERENCE *reply,
uint64_t flags) __API_AVAILABLE(ios(15.0));
uint64_t flags);

__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0)
XPC_EXPORT XPC_NONNULL_ALL
Expand Down
32 changes: 32 additions & 0 deletions apple-include-private/xpc/xpc_transcation_deprecate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef __XPC_TRANSACTION_DEPRECATE_H__
#define __XPC_TRANSACTION_DEPRECATE_H__

#include <Availability.h>
#include <sys/cdefs.h>

#ifndef __XPC_INDIRECT__
#error "Please #include <xpc/xpc.h> instead of this file directly."
#endif // __XPC_INDIRECT__

#ifndef XPC_TRANSACTION_DEPRECATED
#define XPC_TRANSACTION_DEPRECATED
#endif

#pragma mark Transactions

__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0)
XPC_TRANSACTION_DEPRECATED
void
xpc_transaction_exit_clean(void);

__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0)
XPC_TRANSACTION_DEPRECATED
void
xpc_transaction_interrupt_clean_exit(void);

__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0)
XPC_TRANSACTION_DEPRECATED
void
xpc_transactions_enable(void);

#endif
1 change: 0 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
SUBDIRS = fakedyld rootlesshooks payload_dylib payload systemhook ellekit rootfulhooks mount_cores
CFLAGS += -arch arm64 -I$(ROOT)/include -Wno-deprecated-declarations -Os -g
CC = xcrun -sdk iphoneos clang
STRIP = STRIP
DSYMUTIL = dsymutil
LDID = ldid
Expand Down
1 change: 0 additions & 1 deletion src/libjailbreak/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CFLAGS += -miphoneos-version-min=12.0 -std=gnu17
CFLAGS += -isystem $(ROOT)/apple-include -I$(ROOT)/include
LDFLAGS += -Wl,-dead_strip -Wno-unused-command-line-argument
OBJDIR = obj
C_SRC = $(wildcard *.c)
Expand Down
2 changes: 1 addition & 1 deletion src/payload/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SUBDIRS = loader p1ctl jailbreakd
CFLAGS += -miphoneos-version-min=12.0 -std=gnu17
CFLAGS += -isystem $(ROOT)/apple-include -I$(ROOT)/include -Wno-nullability-completeness
CFLAGS += -Wno-nullability-completeness
LDFLAGS += -Wl,-dead_strip -Wno-unused-command-line-argument
OBJDIR = obj
C_SRC = $(wildcard *.c)
Expand Down
1 change: 1 addition & 0 deletions src/payload/jailbreakd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ void reload_launchd_env(void) {
xpc_dictionary_set_uint64(launchd_dict, "cmd", LAUNCHD_CMD_RELOAD_JB_ENV);
int ret = jailbreak_send_launchd_message(launchd_dict, &launchd_reply);
xpc_release(launchd_dict);
xpc_release(launchd_reply);
}

void NSLog(CFStringRef, ...);
Expand Down
1 change: 1 addition & 0 deletions src/payload/p1ctl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ int reload_main(int argc, char* argv[]) {
fprintf(stderr, "failed to send launchd message: %d (%s)\n", ret, strerror(ret));
}
xpc_release(xdict);
xpc_release(xreply);
return ret;
}

Expand Down
1 change: 0 additions & 1 deletion src/payload_dylib/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CFLAGS += -miphoneos-version-min=12.0 -std=gnu17
CFLAGS += -isystem $(ROOT)/apple-include -I$(ROOT)/include
LDFLAGS += -Wl,-dead_strip -Wno-unused-command-line-argument
LDFLAGS += -install_name /cores/payload.dylib
OBJDIR = obj
Expand Down
1 change: 0 additions & 1 deletion src/systemhook/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
CFLAGS += -miphoneos-version-min=12.0 -std=gnu17
CFLAGS += -isystem $(ROOT)/apple-include -I$(ROOT)/include
LDFLAGS += -Wl,-dead_strip -Wno-unused-command-line-argument
LDFLAGS += -install_name /cores/binpack/usr/lib/systemhook.dylib
OBJDIR = obj
Expand Down

0 comments on commit 9e99fba

Please sign in to comment.