From a42871173b94b0ca82c1db9b97c5da82fc3867cb Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 8 Nov 2015 20:50:30 -0800 Subject: [PATCH] Remove everything obsoleted by just using cynject. --- Mach/Inject.cpp => Inject.cpp | 0 Makefile.am | 9 +- Makefile.in | 43 +- configure | 358 +------ configure.ac | 12 +- cycript-ios.xml | 6 - include/System/machine/cpu_capabilities.h | 53 -- include/mach/mach_vm.h | 1033 --------------------- include/machine/cpu_capabilities.h | 53 -- include/posix_sched.h | 69 -- include/pthread_internals.h | 700 -------------- include/pthread_machdep.h | 311 ------- include/pthread_spinlock.h | 103 -- rules.old | 23 - 14 files changed, 39 insertions(+), 2734 deletions(-) rename Mach/Inject.cpp => Inject.cpp (100%) delete mode 100644 include/System/machine/cpu_capabilities.h delete mode 100644 include/mach/mach_vm.h delete mode 100644 include/machine/cpu_capabilities.h delete mode 100644 include/posix_sched.h delete mode 100644 include/pthread_internals.h delete mode 100644 include/pthread_machdep.h delete mode 100644 include/pthread_spinlock.h delete mode 100644 rules.old diff --git a/Mach/Inject.cpp b/Inject.cpp similarity index 100% rename from Mach/Inject.cpp rename to Inject.cpp diff --git a/Makefile.am b/Makefile.am index 9a4f5d6..f1c98d8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,7 +25,7 @@ SUBDIRS = ACLOCAL_AMFLAGS = -I m4 -AM_CPPFLAGS = -I$(srcdir)/include -DYYDEBUG=1 +AM_CPPFLAGS = -DYYDEBUG=1 AM_CPPFLAGS += -include config.h -include $(srcdir)/unconfig.h CY_LDFLAGS = -no-undefined -avoid-version -export-dynamic @@ -45,9 +45,6 @@ if CY_CONSOLE bin_PROGRAMS = cycript cycript_SOURCES = Console.cpp Display.cpp cycript_LDADD = libcycript.la $(LTLIBREADLINE) $(LTLIBTERMCAP) $(LTLIBGCC) $(PTHREAD_CFLAGS) -ldl - -ldid = true -entitle = $(ldid) -S$(srcdir)/cycript.xml endif if CY_EXECUTE @@ -81,11 +78,11 @@ libcycript_la_SOURCES += ObjectiveC/Output.cpp ObjectiveC/Replace.cpp ObjectiveC libcycript_la_LIBADD += $(LTOBJECTIVEC) endif -if CY_MACH +if CY_ATTACH libcycript_la_SOURCES += Handler.cpp if CY_CONSOLE -cycript_SOURCES += Mach/Inject.cpp +cycript_SOURCES += Inject.cpp AM_CPPFLAGS += -DCY_ATTACH endif endif diff --git a/Makefile.in b/Makefile.in index 3a82c91..e44ab27 100644 --- a/Makefile.in +++ b/Makefile.in @@ -112,9 +112,9 @@ host_triplet = @host@ @CY_OBJECTIVEC_TRUE@am__append_9 = ObjectiveC @CY_OBJECTIVEC_TRUE@am__append_10 = ObjectiveC/Output.cpp ObjectiveC/Replace.cpp ObjectiveC/Library.mm @CY_OBJECTIVEC_TRUE@am__append_11 = $(LTOBJECTIVEC) -@CY_MACH_TRUE@am__append_12 = Handler.cpp -@CY_CONSOLE_TRUE@@CY_MACH_TRUE@am__append_13 = Mach/Inject.cpp -@CY_CONSOLE_TRUE@@CY_MACH_TRUE@am__append_14 = -DCY_ATTACH +@CY_ATTACH_TRUE@am__append_12 = Handler.cpp +@CY_ATTACH_TRUE@@CY_CONSOLE_TRUE@am__append_13 = Inject.cpp +@CY_ATTACH_TRUE@@CY_CONSOLE_TRUE@am__append_14 = -DCY_ATTACH subdir = . DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ @@ -185,7 +185,7 @@ am__dirstamp = $(am__leading_dot)dirstamp @CY_OBJECTIVEC_TRUE@am__objects_3 = ObjectiveC/Output.lo \ @CY_OBJECTIVEC_TRUE@ ObjectiveC/Replace.lo \ @CY_OBJECTIVEC_TRUE@ ObjectiveC/Library.lo -@CY_MACH_TRUE@am__objects_4 = Handler.lo +@CY_ATTACH_TRUE@am__objects_4 = Handler.lo am_libcycript_la_OBJECTS = ConvertUTF.lo Decode.lo Driver.lo \ Highlight.lo Library.lo Network.lo Output.lo Parser.lo \ Replace.lo Cycript.tab.lo lex.cy.lo $(am__objects_1) \ @@ -199,8 +199,8 @@ libcycript_la_LINK = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(OBJCXXLD) $(AM_OBJCXXFLAGS) \ $(OBJCXXFLAGS) $(libcycript_la_LDFLAGS) $(LDFLAGS) -o $@ PROGRAMS = $(bin_PROGRAMS) -am__cycript_SOURCES_DIST = Console.cpp Display.cpp Mach/Inject.cpp -@CY_CONSOLE_TRUE@@CY_MACH_TRUE@am__objects_5 = Mach/Inject.$(OBJEXT) +am__cycript_SOURCES_DIST = Console.cpp Display.cpp Inject.cpp +@CY_ATTACH_TRUE@@CY_CONSOLE_TRUE@am__objects_5 = Inject.$(OBJEXT) @CY_CONSOLE_TRUE@am_cycript_OBJECTS = Console.$(OBJEXT) \ @CY_CONSOLE_TRUE@ Display.$(OBJEXT) $(am__objects_5) cycript_OBJECTS = $(am_cycript_OBJECTS) @@ -385,10 +385,8 @@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ CY_ARCH = @CY_ARCH@ -CY_ATTACH_GROUP = @CY_ATTACH_GROUP@ CY_EXECUTE = @CY_EXECUTE@ CY_JAVA = @CY_JAVA@ -CY_MACH = @CY_MACH@ CY_OBJECTIVEC = @CY_OBJECTIVEC@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -469,9 +467,6 @@ TIME = @TIME@ VERSION = @VERSION@ WEBKIT_CFLAGS = @WEBKIT_CFLAGS@ WEBKIT_LIBS = @WEBKIT_LIBS@ -_LIPO = @_LIPO@ -_NM = @_NM@ -_OTOOL = @_OTOOL@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -481,9 +476,6 @@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ ac_ct_OBJCXX = @ac_ct_OBJCXX@ -ac_ct__LIPO = @ac_ct__LIPO@ -ac_ct__NM = @ac_ct__NM@ -ac_ct__OTOOL = @ac_ct__OTOOL@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -535,8 +527,8 @@ CLEANFILES = $(am__append_5) Cycript.yy Cycript.l lex.cy.cpp \ Cycript.tab.cc Cycript.tab.hh stack.hh Cycript.output SUBDIRS = ACLOCAL_AMFLAGS = -I m4 -AM_CPPFLAGS = -I$(srcdir)/include -DYYDEBUG=1 -include config.h \ - -include $(srcdir)/unconfig.h $(am__append_3) $(am__append_14) +AM_CPPFLAGS = -DYYDEBUG=1 -include config.h -include \ + $(srcdir)/unconfig.h $(am__append_3) $(am__append_14) CY_LDFLAGS = -no-undefined -avoid-version -export-dynamic lib_LTLIBRARIES = libcycript.la libcycript_la_LDFLAGS = $(CY_LDFLAGS) @@ -550,8 +542,6 @@ filters = $(am__append_4) $(am__append_6) $(am__append_9) @CY_CONSOLE_TRUE@cycript_SOURCES = Console.cpp Display.cpp \ @CY_CONSOLE_TRUE@ $(am__append_13) @CY_CONSOLE_TRUE@cycript_LDADD = libcycript.la $(LTLIBREADLINE) $(LTLIBTERMCAP) $(LTLIBGCC) $(PTHREAD_CFLAGS) -ldl -@CY_CONSOLE_TRUE@ldid = true -@CY_CONSOLE_TRUE@entitle = $(ldid) -S$(srcdir)/cycript.xml all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -721,14 +711,6 @@ clean-binPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list -Mach/$(am__dirstamp): - @$(MKDIR_P) Mach - @: > Mach/$(am__dirstamp) -Mach/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) Mach/$(DEPDIR) - @: > Mach/$(DEPDIR)/$(am__dirstamp) -Mach/Inject.$(OBJEXT): Mach/$(am__dirstamp) \ - Mach/$(DEPDIR)/$(am__dirstamp) cycript$(EXEEXT): $(cycript_OBJECTS) $(cycript_DEPENDENCIES) $(EXTRA_cycript_DEPENDENCIES) @rm -f cycript$(EXEEXT) @@ -738,7 +720,6 @@ mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f Java/*.$(OBJEXT) -rm -f Java/*.lo - -rm -f Mach/*.$(OBJEXT) -rm -f ObjectiveC/*.$(OBJEXT) -rm -f ObjectiveC/*.lo -rm -f sig/*.$(OBJEXT) @@ -757,6 +738,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Execute.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Handler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Highlight.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Inject.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JavaScriptCore.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Library.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Network.Plo@am__quote@ @@ -765,7 +747,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Replace.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lex.cy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@Java/$(DEPDIR)/Execute.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@Mach/$(DEPDIR)/Inject.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ObjectiveC/$(DEPDIR)/Library.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ObjectiveC/$(DEPDIR)/Output.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@ObjectiveC/$(DEPDIR)/Replace.Plo@am__quote@ @@ -1214,8 +1195,6 @@ distclean-generic: -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f Java/$(DEPDIR)/$(am__dirstamp) -rm -f Java/$(am__dirstamp) - -rm -f Mach/$(DEPDIR)/$(am__dirstamp) - -rm -f Mach/$(am__dirstamp) -rm -f ObjectiveC/$(DEPDIR)/$(am__dirstamp) -rm -f ObjectiveC/$(am__dirstamp) -rm -f sig/$(DEPDIR)/$(am__dirstamp) @@ -1231,7 +1210,7 @@ clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf ./$(DEPDIR) Java/$(DEPDIR) Mach/$(DEPDIR) ObjectiveC/$(DEPDIR) sig/$(DEPDIR) + -rm -rf ./$(DEPDIR) Java/$(DEPDIR) ObjectiveC/$(DEPDIR) sig/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags @@ -1279,7 +1258,7 @@ installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf ./$(DEPDIR) Java/$(DEPDIR) Mach/$(DEPDIR) ObjectiveC/$(DEPDIR) sig/$(DEPDIR) + -rm -rf ./$(DEPDIR) Java/$(DEPDIR) ObjectiveC/$(DEPDIR) sig/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic diff --git a/configure b/configure index 1973916..c5d3179 100755 --- a/configure +++ b/configure @@ -638,16 +638,6 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS -CY_MACH_FALSE -CY_MACH_TRUE -CY_MACH -CY_ATTACH_GROUP -ac_ct__OTOOL -_OTOOL -ac_ct__NM -_NM -ac_ct__LIPO -_LIPO SO LTFLAGS LTLIBGCC @@ -667,6 +657,8 @@ LIBFFI_LIBS LIBFFI_CFLAGS CY_EXECUTE_FALSE CY_EXECUTE_TRUE +CY_ATTACH_FALSE +CY_ATTACH_TRUE CY_CONSOLE_FALSE CY_CONSOLE_TRUE LTJAVASCRIPTCORE @@ -833,6 +825,7 @@ with_sysroot enable_libtool_lock enable_javascript enable_console +enable_attach ' ac_precious_vars='build_alias host_alias @@ -1499,6 +1492,7 @@ Optional Features: available option for ENGINE is JavaScriptCore) [default=yes] --disable-console disable console + --disable-attach disable attach Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -20434,6 +20428,20 @@ else fi +# Check whether --enable-attach was given. +if test "${enable_attach+set}" = set; then : + enableval=$enable_attach; +fi + + if test "x$enable_attach" != "xno" -a "x$CY_EXECUTE" = x1; then + CY_ATTACH_TRUE= + CY_ATTACH_FALSE='#' +else + CY_ATTACH_TRUE='#' + CY_ATTACH_FALSE= +fi + + if test "x$CY_EXECUTE" = x1; then @@ -21372,328 +21380,6 @@ fi SO=$acl_shlibext -if test "x$CY_EXECUTE" = x1; then : - - ac_fn_cxx_check_header_mongrel "$LINENO" "mach/mach.h" "ac_cv_header_mach_mach_h" "$ac_includes_default" -if test "x$ac_cv_header_mach_mach_h" = xyes; then : - - if test -n "$ac_tool_prefix"; then - for ac_prog in lipo - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog__LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$_LIPO"; then - ac_cv_prog__LIPO="$_LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog__LIPO="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -_LIPO=$ac_cv_prog__LIPO -if test -n "$_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_LIPO" >&5 -$as_echo "$_LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$_LIPO" && break - done -fi -if test -z "$_LIPO"; then - ac_ct__LIPO=$_LIPO - for ac_prog in lipo -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct__LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct__LIPO"; then - ac_cv_prog_ac_ct__LIPO="$ac_ct__LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct__LIPO="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct__LIPO=$ac_cv_prog_ac_ct__LIPO -if test -n "$ac_ct__LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct__LIPO" >&5 -$as_echo "$ac_ct__LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct__LIPO" && break -done - - if test "x$ac_ct__LIPO" = x; then - _LIPO="as_fn_error $? "missing \"lipo\"" "$LINENO" 5" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - _LIPO=$ac_ct__LIPO - fi -fi - - if test -n "$ac_tool_prefix"; then - for ac_prog in nm - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog__NM+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$_NM"; then - ac_cv_prog__NM="$_NM" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog__NM="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -_NM=$ac_cv_prog__NM -if test -n "$_NM"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_NM" >&5 -$as_echo "$_NM" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$_NM" && break - done -fi -if test -z "$_NM"; then - ac_ct__NM=$_NM - for ac_prog in nm -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct__NM+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct__NM"; then - ac_cv_prog_ac_ct__NM="$ac_ct__NM" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct__NM="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct__NM=$ac_cv_prog_ac_ct__NM -if test -n "$ac_ct__NM"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct__NM" >&5 -$as_echo "$ac_ct__NM" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct__NM" && break -done - - if test "x$ac_ct__NM" = x; then - _NM="as_fn_error $? "missing \"nm\"" "$LINENO" 5" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - _NM=$ac_ct__NM - fi -fi - - if test -n "$ac_tool_prefix"; then - for ac_prog in otool - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog__OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$_OTOOL"; then - ac_cv_prog__OTOOL="$_OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog__OTOOL="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -_OTOOL=$ac_cv_prog__OTOOL -if test -n "$_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_OTOOL" >&5 -$as_echo "$_OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$_OTOOL" && break - done -fi -if test -z "$_OTOOL"; then - ac_ct__OTOOL=$_OTOOL - for ac_prog in otool -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct__OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct__OTOOL"; then - ac_cv_prog_ac_ct__OTOOL="$ac_ct__OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct__OTOOL="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct__OTOOL=$ac_cv_prog_ac_ct__OTOOL -if test -n "$ac_ct__OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct__OTOOL" >&5 -$as_echo "$ac_ct__OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct__OTOOL" && break -done - - if test "x$ac_ct__OTOOL" = x; then - _OTOOL="as_fn_error $? "missing \"otool\"" "$LINENO" 5" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - _OTOOL=$ac_ct__OTOOL - fi -fi - - CY_ATTACH_GROUP=procmod - - CY_MACH=1 - -fi - - -fi - if test "x$CY_MACH" = x1; then - CY_MACH_TRUE= - CY_MACH_FALSE='#' -else - CY_MACH_TRUE='#' - CY_MACH_FALSE= -fi - - ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF @@ -21845,6 +21531,10 @@ if test -z "${CY_CONSOLE_TRUE}" && test -z "${CY_CONSOLE_FALSE}"; then as_fn_error $? "conditional \"CY_CONSOLE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${CY_ATTACH_TRUE}" && test -z "${CY_ATTACH_FALSE}"; then + as_fn_error $? "conditional \"CY_ATTACH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${CY_EXECUTE_TRUE}" && test -z "${CY_EXECUTE_FALSE}"; then as_fn_error $? "conditional \"CY_EXECUTE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -21857,10 +21547,6 @@ if test -z "${CY_OBJECTIVEC_TRUE}" && test -z "${CY_OBJECTIVEC_FALSE}"; then as_fn_error $? "conditional \"CY_OBJECTIVEC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${CY_MACH_TRUE}" && test -z "${CY_MACH_FALSE}"; then - as_fn_error $? "conditional \"CY_MACH\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 diff --git a/configure.ac b/configure.ac index a423a99..7f23cf3 100644 --- a/configure.ac +++ b/configure.ac @@ -192,6 +192,9 @@ dnl }}} AC_ARG_ENABLE([console], AS_HELP_STRING([--disable-console], [disable console])) AM_CONDITIONAL([CY_CONSOLE], [test "x$enable_console" != "xno"]) +AC_ARG_ENABLE([attach], AS_HELP_STRING([--disable-attach], [disable attach])) +AM_CONDITIONAL([CY_ATTACH], [test "x$enable_attach" != "xno" -a "x$CY_EXECUTE" = x1]) + AC_DEFUN([CY_CHECK_PKG_CONFIG_LIBFFI], [ PKG_CHECK_MODULES([LIBFFI], [libffi], [ AC_LIB_APPENDTOVAR([CPPFLAGS], [`$PKG_CONFIG --cflags libffi`]) @@ -263,14 +266,5 @@ AC_SUBST([LTLIBGCC]) AC_SUBST([LTFLAGS]) AC_SUBST([SO], [$acl_shlibext]) -AS_IF([test "x$CY_EXECUTE" = x1], [ - AC_CHECK_HEADER([mach/mach.h], [ - AC_CHECK_TOOLS([_LIPO], [lipo], [AC_MSG_ERROR([missing "lipo"])]) - AC_CHECK_TOOLS([_NM], [nm], [AC_MSG_ERROR([missing "nm"])]) - AC_CHECK_TOOLS([_OTOOL], [otool], [AC_MSG_ERROR([missing "otool"])]) - AC_SUBST([CY_ATTACH_GROUP], [procmod]) - AC_SUBST([CY_MACH], [1])])]) -AM_CONDITIONAL([CY_MACH], [test "x$CY_MACH" = x1]) - AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/cycript-ios.xml b/cycript-ios.xml index 14cfc18..f1746fc 100644 --- a/cycript-ios.xml +++ b/cycript-ios.xml @@ -1,13 +1,7 @@ - com.apple.springboard.debugapplications - dynamic-codesigning - get-task-allow - - task_for_pid-allow - diff --git a/include/System/machine/cpu_capabilities.h b/include/System/machine/cpu_capabilities.h deleted file mode 100644 index 0dc5d45..0000000 --- a/include/System/machine/cpu_capabilities.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#ifdef PRIVATE - -#ifndef _MACHINE_CPU_CAPABILITIES_H -#define _MACHINE_CPU_CAPABILITIES_H - -#ifdef KERNEL_PRIVATE -#if defined (__ppc__) -#include "ppc/cpu_capabilities.h" -#elif defined (__i386__) -#include "i386/cpu_capabilities.h" -#else -#error architecture not supported -#endif - -#else /* !KERNEL_PRIVATE -- System Framework header */ -#if defined (__ppc__) || defined(__ppc64__) -#include -#elif defined (__i386__) || defined(__x86_64__) -#include -#else -#error architecture not supported -#endif -#endif /* KERNEL_PRIVATE */ - -#endif /* _MACHINE_CPU_CAPABILITIES_H */ -#endif /* PRIVATE */ diff --git a/include/mach/mach_vm.h b/include/mach/mach_vm.h deleted file mode 100644 index d618418..0000000 --- a/include/mach/mach_vm.h +++ /dev/null @@ -1,1033 +0,0 @@ -#ifndef _mach_vm_user_ -#define _mach_vm_user_ - -/* Module mach_vm */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef AUTOTEST -#ifndef FUNCTION_PTR_T -#define FUNCTION_PTR_T -typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); -typedef struct { - char *name; - function_ptr_t function; -} function_table_entry; -typedef function_table_entry *function_table_t; -#endif /* FUNCTION_PTR_T */ -#endif /* AUTOTEST */ - -#ifndef mach_vm_MSG_COUNT -#define mach_vm_MSG_COUNT 20 -#endif /* mach_vm_MSG_COUNT */ - -#include -#include -#include -#include -#include - -#ifdef __BeforeMigUserHeader -__BeforeMigUserHeader -#endif /* __BeforeMigUserHeader */ - -#include -__BEGIN_DECLS - - -/* Routine mach_vm_allocate */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_allocate -( - vm_map_t target, - mach_vm_address_t *address, - mach_vm_size_t size, - int flags -); - -/* Routine mach_vm_deallocate */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_deallocate -( - vm_map_t target, - mach_vm_address_t address, - mach_vm_size_t size -); - -/* Routine mach_vm_protect */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_protect -( - vm_map_t target_task, - mach_vm_address_t address, - mach_vm_size_t size, - boolean_t set_maximum, - vm_prot_t new_protection -); - -/* Routine mach_vm_inherit */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_inherit -( - vm_map_t target_task, - mach_vm_address_t address, - mach_vm_size_t size, - vm_inherit_t new_inheritance -); - -/* Routine mach_vm_read */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_read -( - vm_map_t target_task, - mach_vm_address_t address, - mach_vm_size_t size, - vm_offset_t *data, - mach_msg_type_number_t *dataCnt -); - -/* Routine mach_vm_read_list */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_read_list -( - vm_map_t target_task, - mach_vm_read_entry_t data_list, - natural_t count -); - -/* Routine mach_vm_write */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_write -( - vm_map_t target_task, - mach_vm_address_t address, - vm_offset_t data, - mach_msg_type_number_t dataCnt -); - -/* Routine mach_vm_copy */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_copy -( - vm_map_t target_task, - mach_vm_address_t source_address, - mach_vm_size_t size, - mach_vm_address_t dest_address -); - -/* Routine mach_vm_read_overwrite */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_read_overwrite -( - vm_map_t target_task, - mach_vm_address_t address, - mach_vm_size_t size, - mach_vm_address_t data, - mach_vm_size_t *outsize -); - -/* Routine mach_vm_msync */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_msync -( - vm_map_t target_task, - mach_vm_address_t address, - mach_vm_size_t size, - vm_sync_t sync_flags -); - -/* Routine mach_vm_behavior_set */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_behavior_set -( - vm_map_t target_task, - mach_vm_address_t address, - mach_vm_size_t size, - vm_behavior_t new_behavior -); - -/* Routine mach_vm_map */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_map -( - vm_map_t target_task, - mach_vm_address_t *address, - mach_vm_size_t size, - mach_vm_offset_t mask, - int flags, - mem_entry_name_port_t object, - memory_object_offset_t offset, - boolean_t copy, - vm_prot_t cur_protection, - vm_prot_t max_protection, - vm_inherit_t inheritance -); - -/* Routine mach_vm_machine_attribute */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_machine_attribute -( - vm_map_t target_task, - mach_vm_address_t address, - mach_vm_size_t size, - vm_machine_attribute_t attribute, - vm_machine_attribute_val_t *value -); - -/* Routine mach_vm_remap */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_remap -( - vm_map_t target_task, - mach_vm_address_t *target_address, - mach_vm_size_t size, - mach_vm_offset_t mask, - int flags, - vm_map_t src_task, - mach_vm_address_t src_address, - boolean_t copy, - vm_prot_t *cur_protection, - vm_prot_t *max_protection, - vm_inherit_t inheritance -); - -/* Routine mach_vm_page_query */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_page_query -( - vm_map_t target_map, - mach_vm_offset_t offset, - integer_t *disposition, - integer_t *ref_count -); - -/* Routine mach_vm_region_recurse */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_region_recurse -( - vm_map_t target_task, - mach_vm_address_t *address, - mach_vm_size_t *size, - natural_t *nesting_depth, - vm_region_recurse_info_t info, - mach_msg_type_number_t *infoCnt -); - -/* Routine mach_vm_region */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_region -( - vm_map_t target_task, - mach_vm_address_t *address, - mach_vm_size_t *size, - vm_region_flavor_t flavor, - vm_region_info_t info, - mach_msg_type_number_t *infoCnt, - mach_port_t *object_name -); - -/* Routine _mach_make_memory_entry */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t _mach_make_memory_entry -( - vm_map_t target_task, - memory_object_size_t *size, - memory_object_offset_t offset, - vm_prot_t permission, - mem_entry_name_port_t *object_handle, - mem_entry_name_port_t parent_handle -); - -/* Routine mach_vm_purgable_control */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_purgable_control -( - vm_map_t target_task, - mach_vm_address_t address, - vm_purgable_t control, - int *state -); - -/* Routine mach_vm_page_info */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t mach_vm_page_info -( - vm_map_t target_task, - mach_vm_address_t address, - vm_page_info_flavor_t flavor, - vm_page_info_t info, - mach_msg_type_number_t *infoCnt -); - -__END_DECLS - -/********************** Caution **************************/ -/* The following data types should be used to calculate */ -/* maximum message sizes only. The actual message may be */ -/* smaller, and the position of the arguments within the */ -/* message layout may vary from what is presented here. */ -/* For example, if any of the arguments are variable- */ -/* sized, and less than the maximum is sent, the data */ -/* will be packed tight in the actual message to reduce */ -/* the presence of holes. */ -/********************** Caution **************************/ - -/* typedefs for all requests */ - -#ifndef __Request__mach_vm_subsystem__defined -#define __Request__mach_vm_subsystem__defined - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_address_t address; - mach_vm_size_t size; - int flags; - } __Request__mach_vm_allocate_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_address_t address; - mach_vm_size_t size; - } __Request__mach_vm_deallocate_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_address_t address; - mach_vm_size_t size; - boolean_t set_maximum; - vm_prot_t new_protection; - } __Request__mach_vm_protect_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_address_t address; - mach_vm_size_t size; - vm_inherit_t new_inheritance; - } __Request__mach_vm_inherit_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_address_t address; - mach_vm_size_t size; - } __Request__mach_vm_read_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_read_entry_t data_list; - natural_t count; - } __Request__mach_vm_read_list_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - /* start of the kernel processed data */ - mach_msg_body_t msgh_body; - mach_msg_ool_descriptor_t data; - /* end of the kernel processed data */ - NDR_record_t NDR; - mach_vm_address_t address; - mach_msg_type_number_t dataCnt; - } __Request__mach_vm_write_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_address_t source_address; - mach_vm_size_t size; - mach_vm_address_t dest_address; - } __Request__mach_vm_copy_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_address_t address; - mach_vm_size_t size; - mach_vm_address_t data; - } __Request__mach_vm_read_overwrite_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_address_t address; - mach_vm_size_t size; - vm_sync_t sync_flags; - } __Request__mach_vm_msync_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_address_t address; - mach_vm_size_t size; - vm_behavior_t new_behavior; - } __Request__mach_vm_behavior_set_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - /* start of the kernel processed data */ - mach_msg_body_t msgh_body; - mach_msg_port_descriptor_t object; - /* end of the kernel processed data */ - NDR_record_t NDR; - mach_vm_address_t address; - mach_vm_size_t size; - mach_vm_offset_t mask; - int flags; - memory_object_offset_t offset; - boolean_t copy; - vm_prot_t cur_protection; - vm_prot_t max_protection; - vm_inherit_t inheritance; - } __Request__mach_vm_map_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_address_t address; - mach_vm_size_t size; - vm_machine_attribute_t attribute; - vm_machine_attribute_val_t value; - } __Request__mach_vm_machine_attribute_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - /* start of the kernel processed data */ - mach_msg_body_t msgh_body; - mach_msg_port_descriptor_t src_task; - /* end of the kernel processed data */ - NDR_record_t NDR; - mach_vm_address_t target_address; - mach_vm_size_t size; - mach_vm_offset_t mask; - int flags; - mach_vm_address_t src_address; - boolean_t copy; - vm_inherit_t inheritance; - } __Request__mach_vm_remap_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_offset_t offset; - } __Request__mach_vm_page_query_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_address_t address; - natural_t nesting_depth; - mach_msg_type_number_t infoCnt; - } __Request__mach_vm_region_recurse_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_address_t address; - vm_region_flavor_t flavor; - mach_msg_type_number_t infoCnt; - } __Request__mach_vm_region_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - /* start of the kernel processed data */ - mach_msg_body_t msgh_body; - mach_msg_port_descriptor_t parent_handle; - /* end of the kernel processed data */ - NDR_record_t NDR; - memory_object_size_t size; - memory_object_offset_t offset; - vm_prot_t permission; - } __Request___mach_make_memory_entry_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_address_t address; - vm_purgable_t control; - int state; - } __Request__mach_vm_purgable_control_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - mach_vm_address_t address; - vm_page_info_flavor_t flavor; - mach_msg_type_number_t infoCnt; - } __Request__mach_vm_page_info_t; -#ifdef __MigPackStructs -#pragma pack() -#endif -#endif /* !__Request__mach_vm_subsystem__defined */ - -/* union of all requests */ - -#ifndef __RequestUnion__mach_vm_subsystem__defined -#define __RequestUnion__mach_vm_subsystem__defined -union __RequestUnion__mach_vm_subsystem { - __Request__mach_vm_allocate_t Request_mach_vm_allocate; - __Request__mach_vm_deallocate_t Request_mach_vm_deallocate; - __Request__mach_vm_protect_t Request_mach_vm_protect; - __Request__mach_vm_inherit_t Request_mach_vm_inherit; - __Request__mach_vm_read_t Request_mach_vm_read; - __Request__mach_vm_read_list_t Request_mach_vm_read_list; - __Request__mach_vm_write_t Request_mach_vm_write; - __Request__mach_vm_copy_t Request_mach_vm_copy; - __Request__mach_vm_read_overwrite_t Request_mach_vm_read_overwrite; - __Request__mach_vm_msync_t Request_mach_vm_msync; - __Request__mach_vm_behavior_set_t Request_mach_vm_behavior_set; - __Request__mach_vm_map_t Request_mach_vm_map; - __Request__mach_vm_machine_attribute_t Request_mach_vm_machine_attribute; - __Request__mach_vm_remap_t Request_mach_vm_remap; - __Request__mach_vm_page_query_t Request_mach_vm_page_query; - __Request__mach_vm_region_recurse_t Request_mach_vm_region_recurse; - __Request__mach_vm_region_t Request_mach_vm_region; - __Request___mach_make_memory_entry_t Request__mach_make_memory_entry; - __Request__mach_vm_purgable_control_t Request_mach_vm_purgable_control; - __Request__mach_vm_page_info_t Request_mach_vm_page_info; -}; -#endif /* !__RequestUnion__mach_vm_subsystem__defined */ -/* typedefs for all replies */ - -#ifndef __Reply__mach_vm_subsystem__defined -#define __Reply__mach_vm_subsystem__defined - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - mach_vm_address_t address; - } __Reply__mach_vm_allocate_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - } __Reply__mach_vm_deallocate_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - } __Reply__mach_vm_protect_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - } __Reply__mach_vm_inherit_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - /* start of the kernel processed data */ - mach_msg_body_t msgh_body; - mach_msg_ool_descriptor_t data; - /* end of the kernel processed data */ - NDR_record_t NDR; - mach_msg_type_number_t dataCnt; - } __Reply__mach_vm_read_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - mach_vm_read_entry_t data_list; - } __Reply__mach_vm_read_list_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - } __Reply__mach_vm_write_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - } __Reply__mach_vm_copy_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - mach_vm_size_t outsize; - } __Reply__mach_vm_read_overwrite_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - } __Reply__mach_vm_msync_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - } __Reply__mach_vm_behavior_set_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - mach_vm_address_t address; - } __Reply__mach_vm_map_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - vm_machine_attribute_val_t value; - } __Reply__mach_vm_machine_attribute_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - mach_vm_address_t target_address; - vm_prot_t cur_protection; - vm_prot_t max_protection; - } __Reply__mach_vm_remap_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - integer_t disposition; - integer_t ref_count; - } __Reply__mach_vm_page_query_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - mach_vm_address_t address; - mach_vm_size_t size; - natural_t nesting_depth; - mach_msg_type_number_t infoCnt; - int info[19]; - } __Reply__mach_vm_region_recurse_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - /* start of the kernel processed data */ - mach_msg_body_t msgh_body; - mach_msg_port_descriptor_t object_name; - /* end of the kernel processed data */ - NDR_record_t NDR; - mach_vm_address_t address; - mach_vm_size_t size; - mach_msg_type_number_t infoCnt; - int info[10]; - } __Reply__mach_vm_region_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - /* start of the kernel processed data */ - mach_msg_body_t msgh_body; - mach_msg_port_descriptor_t object_handle; - /* end of the kernel processed data */ - NDR_record_t NDR; - memory_object_size_t size; - } __Reply___mach_make_memory_entry_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - int state; - } __Reply__mach_vm_purgable_control_t; -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - mach_msg_type_number_t infoCnt; - int info[32]; - } __Reply__mach_vm_page_info_t; -#ifdef __MigPackStructs -#pragma pack() -#endif -#endif /* !__Reply__mach_vm_subsystem__defined */ - -/* union of all replies */ - -#ifndef __ReplyUnion__mach_vm_subsystem__defined -#define __ReplyUnion__mach_vm_subsystem__defined -union __ReplyUnion__mach_vm_subsystem { - __Reply__mach_vm_allocate_t Reply_mach_vm_allocate; - __Reply__mach_vm_deallocate_t Reply_mach_vm_deallocate; - __Reply__mach_vm_protect_t Reply_mach_vm_protect; - __Reply__mach_vm_inherit_t Reply_mach_vm_inherit; - __Reply__mach_vm_read_t Reply_mach_vm_read; - __Reply__mach_vm_read_list_t Reply_mach_vm_read_list; - __Reply__mach_vm_write_t Reply_mach_vm_write; - __Reply__mach_vm_copy_t Reply_mach_vm_copy; - __Reply__mach_vm_read_overwrite_t Reply_mach_vm_read_overwrite; - __Reply__mach_vm_msync_t Reply_mach_vm_msync; - __Reply__mach_vm_behavior_set_t Reply_mach_vm_behavior_set; - __Reply__mach_vm_map_t Reply_mach_vm_map; - __Reply__mach_vm_machine_attribute_t Reply_mach_vm_machine_attribute; - __Reply__mach_vm_remap_t Reply_mach_vm_remap; - __Reply__mach_vm_page_query_t Reply_mach_vm_page_query; - __Reply__mach_vm_region_recurse_t Reply_mach_vm_region_recurse; - __Reply__mach_vm_region_t Reply_mach_vm_region; - __Reply___mach_make_memory_entry_t Reply__mach_make_memory_entry; - __Reply__mach_vm_purgable_control_t Reply_mach_vm_purgable_control; - __Reply__mach_vm_page_info_t Reply_mach_vm_page_info; -}; -#endif /* !__RequestUnion__mach_vm_subsystem__defined */ - -#ifndef subsystem_to_name_map_mach_vm -#define subsystem_to_name_map_mach_vm \ - { "mach_vm_allocate", 4800 },\ - { "mach_vm_deallocate", 4801 },\ - { "mach_vm_protect", 4802 },\ - { "mach_vm_inherit", 4803 },\ - { "mach_vm_read", 4804 },\ - { "mach_vm_read_list", 4805 },\ - { "mach_vm_write", 4806 },\ - { "mach_vm_copy", 4807 },\ - { "mach_vm_read_overwrite", 4808 },\ - { "mach_vm_msync", 4809 },\ - { "mach_vm_behavior_set", 4810 },\ - { "mach_vm_map", 4811 },\ - { "mach_vm_machine_attribute", 4812 },\ - { "mach_vm_remap", 4813 },\ - { "mach_vm_page_query", 4814 },\ - { "mach_vm_region_recurse", 4815 },\ - { "mach_vm_region", 4816 },\ - { "_mach_make_memory_entry", 4817 },\ - { "mach_vm_purgable_control", 4818 },\ - { "mach_vm_page_info", 4819 } -#endif - -#ifdef __AfterMigUserHeader -__AfterMigUserHeader -#endif /* __AfterMigUserHeader */ - -#endif /* _mach_vm_user_ */ diff --git a/include/machine/cpu_capabilities.h b/include/machine/cpu_capabilities.h deleted file mode 100644 index 0dc5d45..0000000 --- a/include/machine/cpu_capabilities.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2000-2007 Apple Inc. All rights reserved. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the License - * may not be used to create, or enable the creation or redistribution of, - * unlawful or unlicensed copies of an Apple operating system, or to - * circumvent, violate, or enable the circumvention or violation of, any - * terms of an Apple operating system software license agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ - */ -#ifdef PRIVATE - -#ifndef _MACHINE_CPU_CAPABILITIES_H -#define _MACHINE_CPU_CAPABILITIES_H - -#ifdef KERNEL_PRIVATE -#if defined (__ppc__) -#include "ppc/cpu_capabilities.h" -#elif defined (__i386__) -#include "i386/cpu_capabilities.h" -#else -#error architecture not supported -#endif - -#else /* !KERNEL_PRIVATE -- System Framework header */ -#if defined (__ppc__) || defined(__ppc64__) -#include -#elif defined (__i386__) || defined(__x86_64__) -#include -#else -#error architecture not supported -#endif -#endif /* KERNEL_PRIVATE */ - -#endif /* _MACHINE_CPU_CAPABILITIES_H */ -#endif /* PRIVATE */ diff --git a/include/posix_sched.h b/include/posix_sched.h deleted file mode 100644 index 8bbc4a5..0000000 --- a/include/posix_sched.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -/* - * Copyright 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991 - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appears in all copies and - * that both the copyright notice and this permission notice appear in - * supporting documentation. - * - * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, - * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* - * MkLinux - */ - -/* - * POSIX Realtime Scheduling Framework - IEEE 1003.1b - */ - -#ifndef _POSIX_SCHED_H -#define _POSIX_SCHED_H - -struct sched_param -{ - int sched_priority; - int quantum; -}; - -/* - * POSIX scheduling policies - */ - -#define SCHED_OTHER POLICY_TIMESHARE -#define SCHED_FIFO POLICY_FIFO -#define SCHED_RR POLICY_RR - -#endif /* _POSIX_SCHED_H */ diff --git a/include/pthread_internals.h b/include/pthread_internals.h deleted file mode 100644 index 3b06a07..0000000 --- a/include/pthread_internals.h +++ /dev/null @@ -1,700 +0,0 @@ -/* - * Copyright (c) 2000-2003, 2007 Apple Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -/* - * Copyright 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991 - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appears in all copies and - * that both the copyright notice and this permission notice appear in - * supporting documentation. - * - * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, - * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* - * MkLinux - */ - -/* - * POSIX Threads - IEEE 1003.1c - */ - -#ifndef _POSIX_PTHREAD_INTERNALS_H -#define _POSIX_PTHREAD_INTERNALS_H - -// suppress pthread_attr_t typedef in sys/signal.h -#define _PTHREAD_ATTR_T -struct _pthread_attr_t; /* forward reference */ -typedef struct _pthread_attr_t pthread_attr_t; - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#ifndef __POSIX_LIB__ -#define __POSIX_LIB__ -#endif - -#include "posix_sched.h" /* For POSIX scheduling policy & parameter */ -#include /* For POSIX scheduling policy & parameter */ -#include "pthread_machdep.h" /* Machine-dependent definitions. */ -#include "pthread_spinlock.h" /* spinlock definitions. */ - -TAILQ_HEAD(__pthread_list, _pthread); - -extern int __pthread_lock_debug; -extern int __pthread_lock_old; - -extern struct __pthread_list __pthread_head; /* head of list of open files */ -extern pthread_lock_t _pthread_list_lock; -extern size_t pthreadsize; -/* - * Compiled-in limits - */ -#define _EXTERNAL_POSIX_THREAD_KEYS_MAX 512 -#define _INTERNAL_POSIX_THREAD_KEYS_MAX 256 -#define _INTERNAL_POSIX_THREAD_KEYS_END 768 - -/* - * Threads - */ -#define MAXTHREADNAMESIZE 64 -#define _PTHREAD_T -typedef struct _pthread -{ - long sig; /* Unique signature for this structure */ - struct __darwin_pthread_handler_rec *__cleanup_stack; - pthread_lock_t lock; /* Used for internal mutex on structure */ - uint32_t detached:8, - inherit:8, - policy:8, - freeStackOnExit:1, - newstyle:1, - kernalloc:1, - schedset:1, - wqthread:1, - wqkillset:1, - pad:2; - size_t guardsize; /* size in bytes to guard stack overflow */ -#if !defined(__LP64__) - int pad0; /* for backwards compatibility */ -#endif - struct sched_param param; - uint32_t cancel_error; -#if defined(__LP64__) - uint32_t cancel_pad; /* pad value for alignment */ -#endif - struct _pthread *joiner; -#if !defined(__LP64__) - int pad1; /* for backwards compatibility */ -#endif - void *exit_value; - semaphore_t death; /* pthread_join() uses this to wait for death's call */ - mach_port_t kernel_thread; /* kernel thread this thread is bound to */ - void *(*fun)(void*);/* Thread start routine */ - void *arg; /* Argment for thread start routine */ - int cancel_state; /* Whether thread can be cancelled */ - int err_no; /* thread-local errno */ - void *tsd[_EXTERNAL_POSIX_THREAD_KEYS_MAX + _INTERNAL_POSIX_THREAD_KEYS_MAX]; /* Thread specific data */ - void *stackaddr; /* Base of the stack (is aligned on vm_page_size boundary */ - size_t stacksize; /* Size of the stack (is a multiple of vm_page_size and >= PTHREAD_STACK_MIN) */ - mach_port_t reply_port; /* Cached MiG reply port */ -#if defined(__LP64__) - int pad2; /* for natural alignment */ -#endif - void *cthread_self; /* cthread_self() if somebody calls cthread_set_self() */ - /* protected by list lock */ - uint32_t childrun:1, - parentcheck:1, - childexit:1, - pad3:29; -#if defined(__LP64__) - int pad4; /* for natural alignment */ -#endif - TAILQ_ENTRY(_pthread) plist; - void * freeaddr; - size_t freesize; - mach_port_t joiner_notify; - char pthread_name[MAXTHREADNAMESIZE]; /* including nulll the name */ - int max_tsd_key; - void * cur_workq; - void * cur_workitem; - uint64_t thread_id; -} *pthread_t; - -/* - * Thread attributes - */ -struct _pthread_attr_t -{ - long sig; /* Unique signature for this structure */ - pthread_lock_t lock; - uint32_t detached:8, - inherit:8, - policy:8, - freeStackOnExit:1, - fastpath:1, - schedset:1, - reserved1:5; - size_t guardsize; /* size in bytes to guard stack overflow */ - int reserved2; /* Should we free the stack when we exit? */ - struct sched_param param; - void *stackaddr; /* Base of the stack (is aligned on vm_page_size boundary */ - size_t stacksize; /* Size of the stack (is a multiple of vm_page_size and >= PTHREAD_STACK_MIN) */ - boolean_t reserved3; -}; - -/* - * Mutex attributes - */ -#define _PTHREAD_MUTEX_POLICY_NONE 0 -#define _PTHREAD_MUTEX_POLICY_FAIRSHARE 1 -#define _PTHREAD_MUTEX_POLICY_FIRSTFIT 2 -#define _PTHREAD_MUTEX_POLICY_REALTIME 3 -#define _PTHREAD_MUTEX_POLICY_ADAPTIVE 4 -#define _PTHREAD_MUTEX_POLICY_PRIPROTECT 5 -#define _PTHREAD_MUTEX_POLICY_PRIINHERIT 6 - -#define _PTHREAD_MUTEXATTR_T -typedef struct -{ - long sig; /* Unique signature for this structure */ - int prioceiling; - uint32_t protocol:2, /* protocol attribute */ - type:2, /* mutex type */ - pshared:2, - policy:3, - rfu:23; -} pthread_mutexattr_t; - -/* - * Mutex variables - */ -struct _pthread_mutex_options { - uint32_t protocol:2, /* protocol */ - type:2, /* mutex type */ - pshared:2, /* mutex type */ - policy:3, - hold:2, - misalign:1, /* 8 byte aligned? */ - notify:1, /* CV notify field for kernel */ - mutex:1, /* used in clrprepo that it is a mutex */ - rfu:2, - lock_count:16; -}; - - -#define _PTHREAD_MTX_OPT_PSHARED 0x010 -#define _PTHREAD_MTX_OPT_HOLD 0x200 /* current owner of the mutex */ -#define _PTHREAD_MTX_OPT_NOMTX 0x400 /* no mutex refs held */ - -#define _PTHREAD_MTX_OPT_NOTIFY 0x1000 /* notify to drop mutex handling in cvwait */ -#define _PTHREAD_MTX_OPT_MUTEX 0x2000 /* this is a mutex type */ - - -#define _PTHREAD_MUTEX_T -typedef struct _pthread_mutex -{ - long sig; /* Unique signature for this structure */ - pthread_lock_t lock; /* Used for internal mutex on structure */ - union { - uint32_t value; - struct _pthread_mutex_options options; - } mtxopts; - int16_t prioceiling; - int16_t priority; /* Priority to restore when mutex unlocked */ - uint32_t waiters; /* Count of threads waiting for this mutex */ - pthread_t owner; /* Which thread has this mutex locked */ - struct _pthread_mutex *next, *prev; /* List of other mutexes he owns */ - struct _pthread_cond *busy; /* List of condition variables using this mutex */ - semaphore_t sem; /* Semaphore used for waiting */ - semaphore_t order; -} pthread_mutex_t; - - -typedef struct _npthread_mutex -{ -/* keep same as pthread_mutex_t from here to .. */ - long sig; /* Unique signature for this structure */ - pthread_lock_t lock; /* Used for static init sequencing */ - union { - uint32_t value; - struct _pthread_mutex_options options; - } mtxopts; - int16_t prioceiling; - int16_t priority; /* Priority to restore when mutex unlocked */ - uint32_t m_seq[3]; -#if defined(__LP64__) - uint64_t m_tid; /* Which thread has this mutex locked */ - uint32_t * m_lseqaddr; - uint32_t * m_useqaddr; - uint32_t reserved[2]; -#else - uint32_t * m_lseqaddr; - uint64_t m_tid; /* Which thread has this mutex locked */ - uint32_t * m_useqaddr; -#endif -} npthread_mutex_t; - - - - -/* - * Condition variable attributes - */ -#define _PTHREAD_CONDATTR_T -typedef struct -{ - long sig; /* Unique signature for this structure */ - uint32_t pshared:2, /* pshared */ - unsupported:30; -} pthread_condattr_t; - -/* - * Condition variables - */ -#define _PTHREAD_COND_T -typedef struct _pthread_cond -{ - long sig; /* Unique signature for this structure */ - pthread_lock_t lock; /* Used for internal mutex on structure */ - uint32_t waiters:15, /* Number of threads waiting */ - sigspending:15, /* Number of outstanding signals */ - pshared:2; - struct _pthread_cond *next, *prev; /* List of condition variables using mutex */ - struct _pthread_mutex *busy; /* mutex associated with variable */ - semaphore_t sem; /* Kernel semaphore */ -} pthread_cond_t; - - -typedef struct _npthread_cond -{ - long sig; /* Unique signature for this structure */ - pthread_lock_t lock; /* Used for internal mutex on structure */ - uint32_t rfu:29, /* not in use*/ - misalign: 1, /* structure is not aligned to 8 byte boundary */ - pshared:2; - struct _npthread_mutex *busy; /* mutex associated with variable */ - uint32_t c_seq[3]; -#if defined(__LP64__) - uint32_t reserved[3]; -#endif /* __LP64__ */ -} npthread_cond_t; - -/* - * Initialization control (once) variables - */ -#define _PTHREAD_ONCE_T -typedef struct -{ - long sig; /* Unique signature for this structure */ - pthread_lock_t lock; /* Used for internal mutex on structure */ -} pthread_once_t; - -#define _PTHREAD_RWLOCKATTR_T -typedef struct { - long sig; /* Unique signature for this structure */ - int pshared; - int rfu[2]; /* reserved for future use */ -} pthread_rwlockattr_t; - -#define _PTHREAD_RWLOCK_T -typedef struct { - long sig; - pthread_mutex_t lock; /* monitor lock */ - int state; - pthread_cond_t read_signal; - pthread_cond_t write_signal; - int blocked_writers; - int reserved; - pthread_t owner; - int rfu[1]; - int pshared; -} pthread_rwlock_t; - -#define PTHRW_RFU_64BIT 124 /* 31 * sizeof(uint32_t) */ -#define PTHRW_RFU_32BIT 72 /* 18 * sizeof(uint32_t) */ - -#define _PTHREAD_RWLOCK_T -typedef struct { - long sig; - pthread_lock_t lock; -#if defined(__LP64__) - int reserv; - volatile uint32_t rw_seq[4]; - pthread_t rw_owner; -#else /* __LP64__ */ - volatile uint32_t rw_seq[4]; - pthread_t rw_owner; - int reserv; -#endif /* __LP64__ */ - volatile uint32_t * rw_lcntaddr; - volatile uint32_t * rw_seqaddr; - volatile uint32_t * rw_ucntaddr; - uint32_t rw_flags; - int misalign; -#if defined(__LP64__) - char rfu[PTHRW_RFU_64BIT]; -#else /* __LP64__ */ - char rfu[PTHRW_RFU_32BIT]; -#endif /* __LP64__ */ - int pshared; -} npthread_rwlock_t; - -/* flags for rw_flags */ -#define PTHRW_KERN_PROCESS_SHARED 0x10 -#define PTHRW_KERN_PROCESS_PRIVATE 0x20 -#define PTHRW_KERN_PROCESS_FLAGS_MASK 0x30 -#define _PTHREAD_RWLOCK_UPGRADE_TRY 0x10000 - -/* New model bits on Lword */ -#define PTH_RWL_KBIT 0x01 /* users cannot acquire in user mode */ -#define PTH_RWL_EBIT 0x02 /* exclusive lock in progress */ -#define PTH_RWL_WBIT 0x04 /* write waiters pending in kernel */ -#define PTH_RWL_PBIT 0x04 /* prepost (cv) pending in kernel */ -#define PTH_RWL_YBIT 0x08 /* yielding write waiters pending in kernel */ -#define PTH_RWL_RETRYBIT 0x08 /* mutex retry wait */ -#define PTH_RWL_LBIT 0x10 /* long read in progress */ -#define PTH_RWL_MTXNONE 0x10 /* indicates the cvwait does not have mutex held */ -#define PTH_RWL_UBIT 0x20 /* upgrade request pending */ -#define PTH_RWL_MTX_WAIT 0x20 /* in cvar in mutex wait */ -#define PTH_RWL_RBIT 0x40 /* reader pending in kernel(not used) */ -#define PTH_RWL_MBIT 0x40 /* overlapping grants from kernel */ -#define PTH_RWL_TRYLKBIT 0x40 /* sets try lock attempt */ -#define PTH_RWL_IBIT 0x80 /* lock reset, held untill first succeesful unlock */ - -/* UBIT values for mutex, cvar */ -#define PTH_RWU_SBIT 0x01 -#define PTH_RWU_BBIT 0x02 - -#define PTHRW_RWL_INIT PTH_RWL_IBIT /* reset on the lock bits (U)*/ -#define PTHRW_RWLOCK_INIT (PTH_RWL_IBIT | PTH_RWL_RBIT) /* reset on the lock bits (U)*/ -#define PTH_RWLOCK_RESET_RBIT 0xffffffbf - -#define PTHRW_INC 0x100 -#define PTHRW_BIT_MASK 0x000000ff - -#define PTHRW_UN_BIT_MASK 0x000000bf /* remove overlap bit */ - - -/* New model bits on Sword */ -#define PTH_RWS_SBIT 0x01 /* kernel transition seq not set yet*/ -#define PTH_RWS_IBIT 0x02 /* Sequence is not set on return from kernel */ - -#define PTH_RWS_CV_CBIT PTH_RWS_SBIT /* kernel has cleared all info w.r.s.t CV */ -#define PTH_RWS_CV_PBIT PTH_RWS_IBIT /* kernel has prepost/fake structs only,no waiters */ -#define PTH_RWS_CV_BITSALL (PTH_RWS_CV_CBIT | PTH_RWS_CV_PBIT) -#define PTH_RWS_CV_MBIT PTH_RWL_MBIT /* to indicate prepost return from kernel */ -#define PTH_RWS_CV_RESET_PBIT 0xfffffffd - -#define PTH_RWS_WSVBIT 0x04 /* save W bit */ -#define PTH_RWS_USVBIT 0x08 /* save U bit */ -#define PTH_RWS_YSVBIT 0x10 /* save Y bit */ -#define PTHRW_RWS_INIT PTH_RWS_SBIT /* reset on the lock bits (U)*/ -#define PTHRW_RWS_SAVEMASK (PTH_RWS_WSVBIT|PTH_RWS_USVBIT|PTH_RWS_YSVBIT) /*save bits mask*/ -#define PTHRW_SW_Reset_BIT_MASK 0x000000fe /* remove S bit and get rest of the bits */ - -#define PTHRW_COUNT_SHIFT 8 -#define PTHRW_COUNT_MASK 0xffffff00 -#define PTHRW_MAX_READERS 0xffffff00 - - -#define PTHREAD_MTX_TID_SWITCHING (uint64_t)-1 - -/* new L word defns */ -#define can_rwl_readinuser(x) ((((x) & (PTH_RWL_UBIT | PTH_RWL_WBIT | PTH_RWL_KBIT)) == 0)||(((x) & PTH_RWL_LBIT) != 0)) -#define can_rwl_longreadinuser(x) (((x) & (PTH_RWL_UBIT | PTH_RWL_WBIT | PTH_RWL_KBIT | PTH_RWL_YBIT)) == 0) -#define is_rwl_ebit_set(x) (((x) & PTH_RWL_EBIT) != 0) -#define is_rwl_eubit_set(x) (((x) & (PTH_RWL_EBIT | PTH_RWL_UBIT)) != 0) -#define is_rwl_wbit_set(x) (((x) & PTH_RWL_WBIT) != 0) -#define is_rwl_lbit_set(x) (((x) & PTH_RWL_LBIT) != 0) -#define is_rwl_ebit_clear(x) (((x) & PTH_RWL_EBIT) == 0) -#define is_rwl_lbit_clear(x) (((x) & PTH_RWL_LBIT) == 0) -#define is_rwl_readoverlap(x) (((x) & PTH_RWL_MBIT) != 0) - -/* S word checks */ -#define is_rws_setseq(x) (((x) & PTH_RWS_SBIT)) -#define is_rws_setunlockinit(x) (((x) & PTH_RWS_IBIT)) - -/* is x lower than Y */ -static inline int is_seqlower(uint32_t x, uint32_t y) { - if (x < y) { - if ((y-x) < (PTHRW_MAX_READERS/2)) - return(1); - } else { - if ((x-y) > (PTHRW_MAX_READERS/2)) - return(1); - } - return(0); -} - -/* is x lower than or eq Y */ -static inline int is_seqlower_eq(uint32_t x, uint32_t y) { - if (x==y) - return(1); - else - return(is_seqlower(x,y)); -} - -/* is x greater than Y */ -static inline int is_seqhigher(uint32_t x, uint32_t y) { - if (x > y) { - if ((x-y) < (PTHRW_MAX_READERS/2)) - return(1); - } else { - if ((y-x) > (PTHRW_MAX_READERS/2)) - return(1); - } - return(0); -} - -static inline int diff_genseq(uint32_t x, uint32_t y) { - if (x == y) { - return(0); - } else if (x > y) { - return(x-y); - } else { - return((PTHRW_MAX_READERS - y) + x + PTHRW_INC); - } -} - -/* keep the size to 64bytes for both 64 and 32 */ -#define _PTHREAD_WORKQUEUE_ATTR_T -typedef struct { - uint32_t sig; - int queueprio; - int overcommit; - unsigned int resv2[13]; -} pthread_workqueue_attr_t; - -#define _PTHREAD_WORKITEM_T -typedef struct _pthread_workitem { - TAILQ_ENTRY(_pthread_workitem) item_entry; /* pthread_workitem list in prio */ - void (*func)(void *); - void * func_arg; - struct _pthread_workqueue * workq; - unsigned int flags; - unsigned int fromcache; /* padding for 64bit */ -} * pthread_workitem_t; - -#define PTH_WQITEM_INKERNEL_QUEUE 1 -#define PTH_WQITEM_RUNNING 2 -#define PTH_WQITEM_COMPLETED 4 -#define PTH_WQITEM_REMOVED 8 -#define PTH_WQITEM_BARRIER 0x10 -#define PTH_WQITEM_DESTROY 0x20 -#define PTH_WQITEM_NOTINLIST 0x40 -#define PTH_WQITEM_APPLIED 0x80 -#define PTH_WQITEM_KERN_COUNT 0x100 - -/* try to fit these within multiple of pages (8 pages for now) */ -#define WORKITEM_POOL_SIZE 680 -/* ensure some multiple of the chunk is the pool size */ -#define WORKITEM_CHUNK_SIZE 40 - -#define WORKITEM_STARTPOOL_SIZE WORKITEM_CHUNK_SIZE - -TAILQ_HEAD(__pthread_workitem_pool, _pthread_workitem); -extern struct __pthread_workitem_pool __pthread_workitem_pool_head; /* head list of workitem pool */ - -#define _PTHREAD_WORKQUEUE_HEAD_T -typedef struct _pthread_workqueue_head { - TAILQ_HEAD(, _pthread_workqueue) wqhead; - struct _pthread_workqueue * next_workq; -} * pthread_workqueue_head_t; - - -/* sized to be 128 bytes both in 32 and 64bit archs */ -#define _PTHREAD_WORKQUEUE_T -typedef struct _pthread_workqueue { - unsigned int sig; /* Unique signature for this structure */ - pthread_lock_t lock; /* Used for internal mutex on structure */ - TAILQ_ENTRY(_pthread_workqueue) wq_list; /* workqueue list in prio */ - TAILQ_HEAD(, _pthread_workitem) item_listhead; /* pthread_workitem list in prio */ - TAILQ_HEAD(, _pthread_workitem) item_kernhead; /* pthread_workitem list in prio */ - unsigned int flags; - size_t stacksize; - int istimeshare; - int importance; - int affinity; - int queueprio; - int barrier_count; - int kq_count; - void (*term_callback)(struct _pthread_workqueue *,void *); - void * term_callarg; - pthread_workqueue_head_t headp; - int overcommit; -#if !defined(__LP64__) - unsigned int rev2[12]; -#endif -} * pthread_workqueue_t; - -#define PTHREAD_WORKQ_IN_CREATION 1 -#define PTHREAD_WORKQ_IN_TERMINATE 2 -#define PTHREAD_WORKQ_BARRIER_ON 4 -#define PTHREAD_WORKQ_TERM_ON 8 -#define PTHREAD_WORKQ_DESTROYED 0x10 -#define PTHREAD_WORKQ_REQUEUED 0x20 -#define PTHREAD_WORKQ_SUSPEND 0x40 - -#define WORKQUEUE_POOL_SIZE 16 -TAILQ_HEAD(__pthread_workqueue_pool, _pthread_workqueue); -extern struct __pthread_workqueue_pool __pthread_workqueue_pool_head; /* head list of workqueue pool */ - -#include "pthread_spis.h" - -#if defined(__i386__) || defined(__ppc64__) || defined(__x86_64__) || (defined(__arm__) && (defined(_ARM_ARCH_7) || !defined(_ARM_ARCH_6) || !defined(__thumb__))) -/* - * Inside libSystem, we can use r13 or %gs directly to get access to the - * thread-specific data area. The current thread is in the first slot. - */ -inline static pthread_t __attribute__((__pure__)) -_pthread_self_direct(void) -{ - pthread_t ret; - -#if defined(__i386__) || defined(__x86_64__) - ret = (pthread_t) _pthread_getspecific_direct(0); -#elif defined(__ppc64__) - register const pthread_t __pthread_self asm ("r13"); - ret = __pthread_self; -#elif defined(__arm__) && defined(_ARM_ARCH_6) - ret = (pthread_t) _pthread_getspecific_direct(0); -#elif defined(__arm__) && !defined(_ARM_ARCH_6) - ret = (pthread_t) _pthread_getspecific_direct(0); -#endif - return ret; -} -#define pthread_self() _pthread_self_direct() -#endif - -#define _PTHREAD_DEFAULT_INHERITSCHED PTHREAD_INHERIT_SCHED -#define _PTHREAD_DEFAULT_PROTOCOL PTHREAD_PRIO_NONE -#define _PTHREAD_DEFAULT_PRIOCEILING 0 -#define _PTHREAD_DEFAULT_POLICY SCHED_OTHER -#define _PTHREAD_DEFAULT_STACKSIZE 0x80000 /* 512K */ -#define _PTHREAD_DEFAULT_PSHARED PTHREAD_PROCESS_PRIVATE - -#define _PTHREAD_NO_SIG 0x00000000 -#define _PTHREAD_MUTEX_ATTR_SIG 0x4D545841 /* 'MTXA' */ -#define _PTHREAD_MUTEX_SIG 0x4D555458 /* 'MUTX' */ -#define _PTHREAD_MUTEX_SIG_init 0x32AAABA7 /* [almost] ~'MUTX' */ -#define _PTHREAD_ERRORCHECK_MUTEX_SIG_init 0x32AAABA1 -#define _PTHREAD_RECURSIVE_MUTEX_SIG_init 0x32AAABA2 -#define _PTHREAD_FIRSTFIT_MUTEX_SIG_init 0x32AAABA3 -#define _PTHREAD_MUTEX_SIG_init_MASK 0xfffffff0 -#define _PTHREAD_MUTEX_SIG_CMP 0x32AAABA0 -#define _PTHREAD_COND_ATTR_SIG 0x434E4441 /* 'CNDA' */ -#define _PTHREAD_COND_SIG 0x434F4E44 /* 'COND' */ -#define _PTHREAD_COND_SIG_init 0x3CB0B1BB /* [almost] ~'COND' */ -#define _PTHREAD_ATTR_SIG 0x54484441 /* 'THDA' */ -#define _PTHREAD_ONCE_SIG 0x4F4E4345 /* 'ONCE' */ -#define _PTHREAD_ONCE_SIG_init 0x30B1BCBA /* [almost] ~'ONCE' */ -#define _PTHREAD_SIG 0x54485244 /* 'THRD' */ -#define _PTHREAD_RWLOCK_ATTR_SIG 0x52574C41 /* 'RWLA' */ -#define _PTHREAD_RWLOCK_SIG 0x52574C4B /* 'RWLK' */ -#define _PTHREAD_RWLOCK_SIG_init 0x2DA8B3B4 /* [almost] ~'RWLK' */ - - -#define _PTHREAD_KERN_COND_SIG 0x12345678 /* */ -#define _PTHREAD_KERN_MUTEX_SIG 0x34567812 /* */ -#define _PTHREAD_KERN_RWLOCK_SIG 0x56781234 /* */ - -#define _PTHREAD_CREATE_PARENT 4 -#define _PTHREAD_EXITED 8 -// 4597450: begin -#define _PTHREAD_WASCANCEL 0x10 -// 4597450: end - -#if defined(DEBUG) -#define _PTHREAD_MUTEX_OWNER_SELF pthread_self() -#else -#define _PTHREAD_MUTEX_OWNER_SELF (pthread_t)0x12141968 -#endif -#define _PTHREAD_MUTEX_OWNER_SWITCHING (pthread_t)(~0) - -#define _PTHREAD_CANCEL_STATE_MASK 0x01 -#define _PTHREAD_CANCEL_TYPE_MASK 0x02 -#define _PTHREAD_CANCEL_PENDING 0x10 /* pthread_cancel() has been called for this thread */ - -extern boolean_t swtch_pri(int); - -#ifndef PTHREAD_MACH_CALL -#define PTHREAD_MACH_CALL(expr, ret) (ret) = (expr) -#endif - -/* Prototypes. */ - -/* Functions defined in machine-dependent files. */ -extern vm_address_t _sp(void); -extern vm_address_t _adjust_sp(vm_address_t sp); -extern void _pthread_setup(pthread_t th, void (*f)(pthread_t), void *sp, int suspended, int needresume); - -extern void _pthread_tsd_cleanup(pthread_t self); - -__private_extern__ void __mtx_holdlock(npthread_mutex_t *mutex, uint32_t diff, uint32_t * flagp, uint32_t ** pmtxp, uint32_t * mgenp, uint32_t * ugenp, uint64_t *tidp); -__private_extern__ int __mtx_droplock(npthread_mutex_t *mutex, uint32_t diff, uint32_t * flagp, uint32_t ** pmtxp, uint32_t * mgenp, uint32_t * ugenp); -__private_extern__ int __mtx_updatebits(npthread_mutex_t *mutex, uint32_t updateval, int firstfiti, int fromcond, uint64_t selfid); - -/* syscall interfaces */ -extern uint32_t __psynch_mutexwait(pthread_mutex_t * mutex, uint32_t mgen, uint32_t ugen, uint64_t tid, uint32_t flags); -extern uint32_t __psynch_mutexdrop(pthread_mutex_t * mutex, uint32_t mgen, uint32_t ugen, uint64_t tid, uint32_t flags); - -extern uint32_t __psynch_cvbroad(pthread_cond_t * cv, uint64_t cvlsgen, uint64_t cvudgen, uint32_t flags, pthread_mutex_t * mutex, uint64_t mugen, uint64_t tid); -extern uint32_t __psynch_cvsignal(pthread_cond_t * cv, uint64_t cvlsgen, uint32_t cvugen, int thread_port, pthread_mutex_t * mutex, uint64_t mugen, uint64_t tid, uint32_t flags); -extern uint32_t __psynch_cvwait(pthread_cond_t * cv, uint64_t cvlsgen, uint32_t cvugen, pthread_mutex_t * mutex, uint64_t mugen, uint32_t flags, int64_t sec, uint32_t nsec); -extern uint32_t __psynch_cvclrprepost(void * cv, uint32_t cvgen, uint32_t cvugen, uint32_t cvsgen, uint32_t prepocnt, uint32_t preposeq, uint32_t flags); -extern uint32_t __psynch_rw_longrdlock(pthread_rwlock_t * rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags); -extern uint32_t __psynch_rw_yieldwrlock(pthread_rwlock_t * rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags); -extern int __psynch_rw_downgrade(pthread_rwlock_t * rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags); -extern uint32_t __psynch_rw_upgrade(pthread_rwlock_t * rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags); -extern uint32_t __psynch_rw_rdlock(pthread_rwlock_t * rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags); -extern uint32_t __psynch_rw_wrlock(pthread_rwlock_t * rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags); -extern uint32_t __psynch_rw_unlock(pthread_rwlock_t * rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags); -extern uint32_t __psynch_rw_unlock2(pthread_rwlock_t * rwlock, uint32_t lgenval, uint32_t ugenval, uint32_t rw_wc, int flags); - -__private_extern__ semaphore_t new_sem_from_pool(void); -__private_extern__ void restore_sem_to_pool(semaphore_t); -__private_extern__ void _pthread_atfork_queue_init(void); -int _pthread_lookup_thread(pthread_t thread, mach_port_t * port, int only_joinable); -int _pthread_join_cleanup(pthread_t thread, void ** value_ptr, int conforming); -__private_extern__ int proc_setthreadname(void * buffer, int buffersize); - -#endif /* _POSIX_PTHREAD_INTERNALS_H */ diff --git a/include/pthread_machdep.h b/include/pthread_machdep.h deleted file mode 100644 index 4e4d71b..0000000 --- a/include/pthread_machdep.h +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright (c) 2003-2004, 2008 Apple Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -/* - * Copyright 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991 - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appears in all copies and - * that both the copyright notice and this permission notice appear in - * supporting documentation. - * - * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, - * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* - * MkLinux - */ - -/* Machine-dependent definitions for pthread internals. */ - -#ifndef _POSIX_PTHREAD_MACHDEP_H -#define _POSIX_PTHREAD_MACHDEP_H - -#ifndef __ASSEMBLER__ - -#include -#ifdef __arm__ -#include -#endif -#include - -/* -** Define macros for inline pthread_getspecific() usage. -** We reserve a number of slots for Apple internal use. -** This number can grow dynamically, no need to fix it. -*/ - -/* This header contains pre defined thread specific keys */ -/* 0 is used for pthread_self */ -#define _PTHREAD_TSD_SLOT_PTHREAD_SELF 0 -/* Keys 1- 9 for use by dyld, directly or indirectly */ -#define _PTHREAD_TSD_SLOT_DYLD_1 1 -#define _PTHREAD_TSD_SLOT_DYLD_2 2 -#define _PTHREAD_TSD_SLOT_DYLD_3 3 -#define _PTHREAD_TSD_RESERVED_SLOT_COUNT 4 -/* To mirror the usage by dyld for Unwind_SjLj */ -#define _PTHREAD_TSD_SLOT_DYLD_8 8 - -/* Keys 10 - 29 are for Libc/Libsystem internal ussage */ -/* used as __pthread_tsd_first + Num */ -#define __PTK_LIBC_LOCALE_KEY 10 -#define __PTK_LIBC_TTYNAME_KEY 11 -#define __PTK_LIBC_LOCALTIME_KEY 12 -#define __PTK_LIBC_GMTIME_KEY 13 -#define __PTK_LIBC_GDTOA_BIGINT_KEY 14 -#define __PTK_LIBC_PARSEFLOAT_KEY 15 -/* for usage by dyld */ -#define __PTK_LIBC_DYLD_Unwind_SjLj_Key 18 - -/* Keys 20-25 for libdispactch usage */ -#define __PTK_LIBDISPATCH_KEY0 20 -#define __PTK_LIBDISPATCH_KEY1 21 -#define __PTK_LIBDISPATCH_KEY2 22 -#define __PTK_LIBDISPATCH_KEY3 23 -#define __PTK_LIBDISPATCH_KEY4 24 -#define __PTK_LIBDISPATCH_KEY5 25 - -/* Keys 30-255 for Non Libsystem usage */ - -/* Keys 30-39 for Graphic frameworks usage */ -#define _PTHREAD_TSD_SLOT_OPENGL 30 /* backwards compat sake */ -#define __PTK_FRAMEWORK_OPENGL_KEY 30 -#define __PTK_FRAMEWORK_GRAPHICS_KEY1 31 -#define __PTK_FRAMEWORK_GRAPHICS_KEY2 32 -#define __PTK_FRAMEWORK_GRAPHICS_KEY3 33 -#define __PTK_FRAMEWORK_GRAPHICS_KEY4 34 -#define __PTK_FRAMEWORK_GRAPHICS_KEY5 35 -#define __PTK_FRAMEWORK_GRAPHICS_KEY6 36 -#define __PTK_FRAMEWORK_GRAPHICS_KEY7 37 -#define __PTK_FRAMEWORK_GRAPHICS_KEY8 38 -#define __PTK_FRAMEWORK_GRAPHICS_KEY9 39 - -/* Keys 40-49 for Objective-C runtime usage */ -#define __PTK_FRAMEWORK_OBJC_KEY0 40 -#define __PTK_FRAMEWORK_OBJC_KEY1 41 -#define __PTK_FRAMEWORK_OBJC_KEY2 42 -#define __PTK_FRAMEWORK_OBJC_KEY3 43 -#define __PTK_FRAMEWORK_OBJC_KEY4 44 -#define __PTK_FRAMEWORK_OBJC_KEY5 45 -#define __PTK_FRAMEWORK_OBJC_KEY6 46 -#define __PTK_FRAMEWORK_OBJC_KEY7 47 -#define __PTK_FRAMEWORK_OBJC_KEY8 48 -#define __PTK_FRAMEWORK_OBJC_KEY9 49 - -/* Keys 50-59 for Core Foundation usage */ -#define __PTK_FRAMEWORK_COREFOUNDATION_KEY0 50 -#define __PTK_FRAMEWORK_COREFOUNDATION_KEY1 51 -#define __PTK_FRAMEWORK_COREFOUNDATION_KEY2 52 -#define __PTK_FRAMEWORK_COREFOUNDATION_KEY3 53 -#define __PTK_FRAMEWORK_COREFOUNDATION_KEY4 54 -#define __PTK_FRAMEWORK_COREFOUNDATION_KEY5 55 -#define __PTK_FRAMEWORK_COREFOUNDATION_KEY6 56 -#define __PTK_FRAMEWORK_COREFOUNDATION_KEY7 57 -#define __PTK_FRAMEWORK_COREFOUNDATION_KEY8 58 -#define __PTK_FRAMEWORK_COREFOUNDATION_KEY9 59 - -/* Keys 60-69 for Foundation usage */ -#define __PTK_FRAMEWORK_FOUNDATION_KEY0 60 -#define __PTK_FRAMEWORK_FOUNDATION_KEY1 61 -#define __PTK_FRAMEWORK_FOUNDATION_KEY2 62 -#define __PTK_FRAMEWORK_FOUNDATION_KEY3 63 -#define __PTK_FRAMEWORK_FOUNDATION_KEY4 64 -#define __PTK_FRAMEWORK_FOUNDATION_KEY5 65 -#define __PTK_FRAMEWORK_FOUNDATION_KEY6 66 -#define __PTK_FRAMEWORK_FOUNDATION_KEY7 67 -#define __PTK_FRAMEWORK_FOUNDATION_KEY8 68 -#define __PTK_FRAMEWORK_FOUNDATION_KEY9 69 - -/* Keys 70-79 for Core Animation/QuartzCore usage */ -#define __PTK_FRAMEWORK_QUARTZCORE_KEY0 70 -#define __PTK_FRAMEWORK_QUARTZCORE_KEY1 71 -#define __PTK_FRAMEWORK_QUARTZCORE_KEY2 72 -#define __PTK_FRAMEWORK_QUARTZCORE_KEY3 73 -#define __PTK_FRAMEWORK_QUARTZCORE_KEY4 74 -#define __PTK_FRAMEWORK_QUARTZCORE_KEY5 75 -#define __PTK_FRAMEWORK_QUARTZCORE_KEY6 76 -#define __PTK_FRAMEWORK_QUARTZCORE_KEY7 77 -#define __PTK_FRAMEWORK_QUARTZCORE_KEY8 78 -#define __PTK_FRAMEWORK_QUARTZCORE_KEY9 79 - - -/* Keys 80-89 for Garbage Collection */ -#define __PTK_FRAMEWORK_OLDGC_KEY0 80 -#define __PTK_FRAMEWORK_OLDGC_KEY1 81 -#define __PTK_FRAMEWORK_OLDGC_KEY2 82 -#define __PTK_FRAMEWORK_OLDGC_KEY3 83 -#define __PTK_FRAMEWORK_OLDGC_KEY4 84 -#define __PTK_FRAMEWORK_OLDGC_KEY5 85 -#define __PTK_FRAMEWORK_OLDGC_KEY6 86 -#define __PTK_FRAMEWORK_OLDGC_KEY7 87 -#define __PTK_FRAMEWORK_OLDGC_KEY8 88 -#define __PTK_FRAMEWORK_OLDGC_KEY9 89 - -/* Keys 90-94 for JavaScriptCore Collection */ -#define __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0 90 -#define __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY1 91 -#define __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY2 92 -#define __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY3 93 -#define __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY4 94 - -/* Keys 110-119 for Garbage Collection */ -#define __PTK_FRAMEWORK_GC_KEY0 110 -#define __PTK_FRAMEWORK_GC_KEY1 111 -#define __PTK_FRAMEWORK_GC_KEY2 112 -#define __PTK_FRAMEWORK_GC_KEY3 113 -#define __PTK_FRAMEWORK_GC_KEY4 114 -#define __PTK_FRAMEWORK_GC_KEY5 115 -#define __PTK_FRAMEWORK_GC_KEY6 116 -#define __PTK_FRAMEWORK_GC_KEY7 117 -#define __PTK_FRAMEWORK_GC_KEY8 118 -#define __PTK_FRAMEWORK_GC_KEY9 119 - -/* -** Define macros for inline pthread_getspecific() usage. -** We reserve a number of slots for Apple internal use. -** This number can grow dynamically, no need to fix it. -*/ - - -#if defined(__cplusplus) -extern "C" { -#endif - -extern void *pthread_getspecific(unsigned long); -/* setup destructor function for static key as it is not created with pthread_key_create() */ -int pthread_key_init_np(int, void (*)(void *)); - -#if defined(__cplusplus) -} -#endif - -typedef int pthread_lock_t; - -#if TARGET_IPHONE_SIMULATOR - -/* Similator will use the host implementation, so bypass the macro that is in the target code */ - -inline static int -_pthread_has_direct_tsd(void) -{ - return 0; -} - -#define _pthread_getspecific_direct(key) pthread_getspecific(key) -#define _pthread_setspecific_direct(key, val) pthread_setspecific(key, val) - -#else /* TARGET_IPHONE_SIMULATOR */ - -inline static int -_pthread_has_direct_tsd(void) -{ -#if defined(__ppc__) - int *caps = (int *)_COMM_PAGE_CPU_CAPABILITIES; - if (*caps & kFastThreadLocalStorage) { - return 1; - } else { - return 0; - } -#else - return 1; -#endif -} - -/* To be used with static constant keys only */ -inline static void * -_pthread_getspecific_direct(unsigned long slot) -{ - void *ret; - -#if defined(__i386__) || defined(__x86_64__) - asm("mov %%gs:%1, %0" : "=r" (ret) : "m" (*(void **)(slot * sizeof(void *)))); -#elif defined(__ppc64__) || defined(__ppc__) - ret = pthread_getspecific(slot); -#elif defined(__arm__) && defined(_ARM_ARCH_6) && !defined(_ARM_ARCH_7) && defined(__thumb__) && !defined(__OPTIMIZE__) - ret = pthread_getspecific(slot); -#elif defined(__arm__) && defined(_ARM_ARCH_6) - void **__pthread_tsd; - __asm__ ( - "mrc p15, 0, %0, c13, c0, 3\n" - "bic %0, %0, #3\n" - : "=r"(__pthread_tsd)); - ret = __pthread_tsd[slot]; -#elif defined(__arm__) && !defined(_ARM_ARCH_6) - register void **__pthread_tsd asm ("r9"); - ret = __pthread_tsd[slot]; -#else -#error no pthread_getspecific_direct implementation for this arch -#endif - return ret; -} - -#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) -/* To be used with static constant keys only */ -inline static int -_pthread_setspecific_direct(unsigned long slot, void * val) -{ - -#if defined(__i386__) -#if defined(__PIC__) - asm("movl %1,%%gs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "rn" (val)); -#else - asm("movl %1,%%gs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "ri" (val)); -#endif -#elif defined(__x86_64__) - /* PIC is free and cannot be disabled, even with: gcc -mdynamic-no-pic ... */ - asm("movq %1,%%gs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "rn" (val)); -#elif defined(__arm__) && defined(_ARM_ARCH_6) - void **__pthread_tsd; - __asm__ ( - "mrc p15, 0, %0, c13, c0, 3\n" - "bic %0, %0, #3\n" - : "=r"(__pthread_tsd)); - __pthread_tsd[slot] = val; -#elif defined(__arm__) && !defined(_ARM_ARCH_6) - register void **__pthread_tsd asm ("r9"); - __pthread_tsd[slot] = val; -#endif - return(0); -} -#elif defined(__ppc__) || defined(__ppc64__) -/* To be used with static constant keys only */ -#define _pthread_setspecific_direct(key, val) pthread_setspecific(key, val) -#else -#error no pthread_setspecific_direct implementation for this arch -#endif - -#endif /* TARGET_IPHONE_SIMULATOR */ - -#define LOCK_INIT(l) ((l) = 0) -#define LOCK_INITIALIZER 0 - -#endif /* ! __ASSEMBLER__ */ -#endif /* _POSIX_PTHREAD_MACHDEP_H */ diff --git a/include/pthread_spinlock.h b/include/pthread_spinlock.h deleted file mode 100644 index 40fa601..0000000 --- a/include/pthread_spinlock.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. - * - * @APPLE_LICENSE_HEADER_START@ - * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and - * limitations under the License. - * - * @APPLE_LICENSE_HEADER_END@ - */ -/* - * Copyright 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991 - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appears in all copies and - * that both the copyright notice and this permission notice appear in - * supporting documentation. - * - * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, - * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* - * MkLinux - */ - -/* - * POSIX Threads - IEEE 1003.1c - */ - -#ifndef _POSIX_PTHREAD_SPINLOCK_H -#define _POSIX_PTHREAD_SPINLOCK_H - -#include -#define __APPLE_API_PRIVATE -#include - -#ifndef __POSIX_LIB__ -#define __POSIX_LIB__ -#endif - -#include "pthread_machdep.h" /* Machine-dependent definitions. */ - -/* Number of times to spin when the lock is unavailable and we are on a - multiprocessor. On a uniprocessor we yield the processor immediately. */ -#define MP_SPIN_TRIES 1000 -extern int _spin_tries; -extern int __is_threaded; - -/* Internal mutex locks for data structures */ -#define TRY_LOCK(v) (!__is_threaded || _spin_lock_try((pthread_lock_t *)&(v))) - -/* _DO_SPINLOCK_LOCK() takes a (pthread_lock_t *) */ -#define _DO_SPINLOCK_LOCK(v) _spin_lock(v) - -/* _DO_SPINLOCK_UNLOCK() takes a (pthread_lock_t *) */ -#define _DO_SPINLOCK_UNLOCK(v) _spin_unlock(v) - -/* LOCK() takes a (pthread_lock_t) */ -#define LOCK(v) \ - do { \ - if (__is_threaded) { \ - _DO_SPINLOCK_LOCK((pthread_lock_t *)&(v)); \ - } \ - } while (0) - -/* UNLOCK() takes a (pthread_lock_t) */ -#define UNLOCK(v) \ - do { \ - if (__is_threaded) { \ - _DO_SPINLOCK_UNLOCK((pthread_lock_t *)&(v)); \ - } \ - } while (0) - -/* Prototypes. */ - -/* Functions defined in machine-dependent files. */ -extern void _spin_lock(pthread_lock_t *lockp); -extern int _spin_lock_try(pthread_lock_t *lockp); -extern void _spin_unlock(pthread_lock_t *lockp); - -#endif /* _POSIX_PTHREAD_SPINLOCK_H */ diff --git a/rules.old b/rules.old deleted file mode 100644 index a7cb7b8..0000000 --- a/rules.old +++ /dev/null @@ -1,23 +0,0 @@ -PACKAGE_TARNAME := @PACKAGE_TARNAME@ - -CY_ATTACH_GROUP := @CY_ATTACH_GROUP@ - -lib := lib -dll := @SO@ -depends ?= - -deb := $(shell grep ^Package: $(srcdir)/control.in | cut -d ' ' -f 2-)_$(shell grep ^Version: $(srcdir)/control.in | cut -d ' ' -f 2 | $(sed) -e 's/\#/$(version)/')_$(arch).deb - -libcycript.la: $(code) - $(ldid) .libs/$(lib)cycript.$(dll) - -cycript: Console.lo libcycript.la $(inject) - $(entitle) .libs/cycript - -package: $(deb) - -install: cycript libcycript.la -ifneq ($(CY_ATTACH_GROUP),) - chgrp $(CY_ATTACH_GROUP) $(DESTDIR)$(bindir)/cycript - chmod g+s $(DESTDIR)$(bindir)/cycript -endif -- 2.47.2