this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge remote-tracking branch 'origin/master' into newlkm

+1753 -54
+15
.gitmodules
··· 218 218 [submodule "src/lkm"] 219 219 path = src/lkm 220 220 url = ../darling-newlkm.git 221 + [submodule "src/external/basic_cmds"] 222 + path = src/external/basic_cmds 223 + url = ../darling-basic_cmds.git 224 + [submodule "src/external/misc_cmds"] 225 + path = src/external/misc_cmds 226 + url = ../darling-misc_cmds.git 227 + [submodule "src/external/patch_cmds"] 228 + path = src/external/patch_cmds 229 + url = ../darling-patch_cmds.git 230 + [submodule "src/external/DSTools"] 231 + path = src/external/DSTools 232 + url = ../darling-DSTools.git 233 + [submodule "src/external/DirectoryService"] 234 + path = src/external/DirectoryService 235 + url = ../darling-DirectoryService.git
+1
platform-include/DSlibinfoMIG_types.h
··· 1 + ../src/external/DirectoryService/Server/DSlibinfoMIG_types.h
+1
platform-include/DSmemberdMIG.h
··· 1 + ../src/external/DirectoryService/gen/DSmemberdMIG.h
+1
platform-include/DSmemberdMIG_types.h
··· 1 + ../src/external/DirectoryService/Server/DSmemberdMIG_types.h
+1
platform-include/launch.h
··· 1 + ../src/launchd/liblaunch/launch.h
+1
platform-include/membership.h
··· 1 + ../src/libinfo/membership.subproj/membership.h
+1
platform-include/membershipPriv.h
··· 1 + ../src/libinfo/membership.subproj/membershipPriv.h
+1
platform-include/ntsid.h
··· 1 + ../src/libinfo/membership.subproj/ntsid.h
+1
platform-include/opendirectory
··· 1 + ../src/opendirectory/include/opendirectory/
+1
platform-include/xpc/private.h
··· 1 + ../../src/external/libxpc/xpc/private.h
+9
src/CMakeLists.txt
··· 186 186 add_subdirectory(unxip) 187 187 add_subdirectory(external/zsh) 188 188 add_subdirectory(external/doc_cmds) 189 + add_subdirectory(external/basic_cmds) 190 + add_subdirectory(external/misc_cmds) 191 + add_subdirectory(external/patch_cmds) 192 + add_subdirectory(external/DSTools) 193 + add_subdirectory(external/DirectoryService) 194 + add_subdirectory(ImageIO) 195 + add_subdirectory(login) 196 + add_subdirectory(DebugSymbols) 197 + 189 198 add_subdirectory(external/libcxxabi) 190 199 add_subdirectory(external/libcxx) 191 200 add_subdirectory(lkm)
+15 -13
src/DebugSymbols/CMakeLists.txt
··· 1 1 project(DebugSymbols) 2 2 3 - if(COMMAND cmake_policy) 4 - cmake_policy(SET CMP0003 NEW) 5 - cmake_policy(SET CMP0005 NEW) 6 - endif(COMMAND cmake_policy) 7 - 8 - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 3 + add_compile_options( 4 + -nostdinc 5 + ) 9 6 10 - set(DebugSymbols_sources 11 - DebugSymbols.mm 7 + include_directories( 8 + ${CMAKE_CURRENT_SOURCE_DIR} 12 9 ) 13 10 14 - SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/darling") 15 - SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 16 - SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) 11 + add_framework(DebugSymbols 12 + FAT 13 + CURRENT_VERSION 14 + PRIVATE 15 + VERSION "A" 17 16 18 - add_library(DebugSymbols SHARED ${DebugSymbols_sources}) 17 + SOURCES 18 + functions.c 19 19 20 - install(TARGETS DebugSymbols DESTINATION "${CMAKE_INSTALL_LIBDIR}/darling") 20 + DEPENDENCIES 21 + system 22 + )
-2
src/DebugSymbols/DebugSymbols.mm
··· 1 - void blank() { 2 - }
-4
src/DebugSymbols/README.md
··· 1 - # DebugSymbols.framework 2 - 3 - `DebugSymbols.framework` helps locate dSYM files when given a UUID. 4 -
+49
src/DebugSymbols/functions.c
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2017 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + void DBGAddDSYMURL(void) { } 21 + void DBGBlockPath(void) { } 22 + void DBGCopyDSYMPropertyLists(void) { } 23 + void DBGCopyDSYMURLForUUID(void) { } 24 + void DBGCopyDSYMURLForUUIDWithOptions(void) { } 25 + void DBGCopyFullDSYMURLForUUID(void) { } 26 + void DBGCopyFullDSYMURLForUUIDWithOptions(void) { } 27 + void DBGCopyMatchingUUIDsForURL(void) { } 28 + void DBGDwarfClose(void) { } 29 + void DBGDwarfGetAttributeKey(void) { } 30 + void DBGDwarfGetCompileUnitFunctions(void) { } 31 + void DBGDwarfGetCompileUnitLineTable(void) { } 32 + void DBGDwarfGetCompileUnits(void) { } 33 + void DBGDwarfGetDIEObjectsForAddress(void) { } 34 + void DBGDwarfGetFirstChild(void) { } 35 + void DBGDwarfGetLinkMap(void) { } 36 + void DBGDwarfGetParent(void) { } 37 + void DBGDwarfGetSibling(void) { } 38 + void DBGDwarfGetTagKey(void) { } 39 + void DBGDwarfOpen(void) { } 40 + void DBGExplicitSearchPathAdd(void) { } 41 + void DBGExplicitSearchPathRemove(void) { } 42 + void DBGExplicitSearchPathRemoveAll(void) { } 43 + void DBGPauseWatchingPaths(void) { } 44 + void DBGRegisterObserver(void) { } 45 + void DBGResumeWatchingPaths(void) { } 46 + void DBGSpotlightStart(void) { } 47 + void DBGSpotlightStop(void) { } 48 + void DBGTerminate(void) { } 49 + void DBGUnregisterObserver(void) { }
+49
src/DebugSymbols/functions.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2017 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + void DBGAddDSYMURL(void); 21 + void DBGBlockPath(void); 22 + void DBGCopyDSYMPropertyLists(void); 23 + void DBGCopyDSYMURLForUUID(void); 24 + void DBGCopyDSYMURLForUUIDWithOptions(void); 25 + void DBGCopyFullDSYMURLForUUID(void); 26 + void DBGCopyFullDSYMURLForUUIDWithOptions(void); 27 + void DBGCopyMatchingUUIDsForURL(void); 28 + void DBGDwarfClose(void); 29 + void DBGDwarfGetAttributeKey(void); 30 + void DBGDwarfGetCompileUnitFunctions(void); 31 + void DBGDwarfGetCompileUnitLineTable(void); 32 + void DBGDwarfGetCompileUnits(void); 33 + void DBGDwarfGetDIEObjectsForAddress(void); 34 + void DBGDwarfGetFirstChild(void); 35 + void DBGDwarfGetLinkMap(void); 36 + void DBGDwarfGetParent(void); 37 + void DBGDwarfGetSibling(void); 38 + void DBGDwarfGetTagKey(void); 39 + void DBGDwarfOpen(void); 40 + void DBGExplicitSearchPathAdd(void); 41 + void DBGExplicitSearchPathRemove(void); 42 + void DBGExplicitSearchPathRemoveAll(void); 43 + void DBGPauseWatchingPaths(void); 44 + void DBGRegisterObserver(void); 45 + void DBGResumeWatchingPaths(void); 46 + void DBGSpotlightStart(void); 47 + void DBGSpotlightStop(void); 48 + void DBGTerminate(void); 49 + void DBGUnregisterObserver(void);
src/DebugSymbols/include/DebugSymbols/DebugSymbols.h

This is a binary file and will not be displayed.

+21
src/ImageIO/CMakeLists.txt
··· 1 + project(ImageIO) 2 + 3 + add_compile_options( 4 + -nostdinc 5 + ) 6 + 7 + include_directories( 8 + ${CMAKE_CURRENT_SOURCE_DIR} 9 + ) 10 + 11 + add_framework(ImageIO 12 + FAT 13 + CURRENT_VERSION 14 + VERSION "A" 15 + 16 + SOURCES 17 + functions.c 18 + 19 + DEPENDENCIES 20 + system 21 + )
+165
src/ImageIO/functions.c
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2017 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + void CGCopyBasicPropertiesOfImageAtPath(void) { } 21 + void CGImageConvertExtendedSRGBToColorspace(void) { } 22 + void CGImageCopyFileWithGPSInformation(void) { } 23 + void CGImageCopyFileWithParameters(void) { } 24 + void CGImageCopyJPEGData(void) { } 25 + void CGImageCopyJPEGDataAndColorSpace(void) { } 26 + void CGImageCopySourceData(void) { } 27 + void CGImageCreateByMatchingToColorSpace(void) { } 28 + void CGImageCreateByMatchingToDisplay(void) { } 29 + void CGImageCreateByScaling(void) { } 30 + void CGImageCreateCopyWithAlphaInfo(void) { } 31 + void CGImageCreateCopyWithParameters(void) { } 32 + void CGImageCreateEXIFDataFromProperties(void) { } 33 + void CGImageCreateEXIFJPEGData(void) { } 34 + void CGImageCreateFromIOSurface(void) { } 35 + void CGImageCreateThumb(void) { } 36 + void CGImageDestinationAddImage(void) { } 37 + void CGImageDestinationAddImageAndMetadata(void) { } 38 + void CGImageDestinationAddImageFromSource(void) { } 39 + void CGImageDestinationAddImageFromSourceWithMetadata(void) { } 40 + void CGImageDestinationAddImageWithMetadata(void) { } 41 + void CGImageDestinationCopyImageFormats(void) { } 42 + void CGImageDestinationCopyImageSource(void) { } 43 + void CGImageDestinationCopyTypeIdentifiers(void) { } 44 + void CGImageDestinationCreateWithData(void) { } 45 + void CGImageDestinationCreateWithDataConsumer(void) { } 46 + void CGImageDestinationCreateWithURL(void) { } 47 + void CGImageDestinationFinalize(void) { } 48 + void CGImageDestinationGetTypeID(void) { } 49 + void CGImageDestinationSetProperties(void) { } 50 + void CGImageMetadataCopyStringValueWithPath(void) { } 51 + void CGImageMetadataCopyTagMatchingImageProperty(void) { } 52 + void CGImageMetadataCopyTagWithPath(void) { } 53 + void CGImageMetadataCopyTags(void) { } 54 + void CGImageMetadataCreateFromData(void) { } 55 + void CGImageMetadataCreateFromMetadataProperties(void) { } 56 + void CGImageMetadataCreateFromXMPData(void) { } 57 + void CGImageMetadataCreateMetadataProperties(void) { } 58 + void CGImageMetadataCreateMutable(void) { } 59 + void CGImageMetadataCreateMutableCopy(void) { } 60 + void CGImageMetadataCreateSerializedData(void) { } 61 + void CGImageMetadataCreateSidecar(void) { } 62 + void CGImageMetadataCreateXMPData(void) { } 63 + void CGImageMetadataEnumerateTagsUsingBlock(void) { } 64 + void CGImageMetadataGetTypeID(void) { } 65 + void CGImageMetadataPropertyCreate(void) { } 66 + void CGImageMetadataPropertyGetPropertyName(void) { } 67 + void CGImageMetadataPropertyGetSchema(void) { } 68 + void CGImageMetadataPropertyGetSuggestedPrefix(void) { } 69 + void CGImageMetadataPropertyGetTypeID(void) { } 70 + void CGImageMetadataPropertyGetValue(void) { } 71 + void CGImageMetadataPropertySetValue(void) { } 72 + void CGImageMetadataRegisterNamespaceForPrefix(void) { } 73 + void CGImageMetadataRemoveTagWithPath(void) { } 74 + void CGImageMetadataSerialize(void) { } 75 + void CGImageMetadataSetTagWithPath(void) { } 76 + void CGImageMetadataSetValueMatchingImageProperty(void) { } 77 + void CGImageMetadataSetValueWithPath(void) { } 78 + void CGImageMetadataTagCopyName(void) { } 79 + void CGImageMetadataTagCopyNamespace(void) { } 80 + void CGImageMetadataTagCopyPrefix(void) { } 81 + void CGImageMetadataTagCopyQualifiers(void) { } 82 + void CGImageMetadataTagCopyValue(void) { } 83 + void CGImageMetadataTagCreate(void) { } 84 + void CGImageMetadataTagGetType(void) { } 85 + void CGImageMetadataTagGetTypeID(void) { } 86 + void CGImageMetadataValueAddQualifier(void) { } 87 + void CGImageMetadataValueCreate(void) { } 88 + void CGImageMetadataValueGetNamespaceURI(void) { } 89 + void CGImageMetadataValueGetQualifiers(void) { } 90 + void CGImageMetadataValueGetSuggestedNamespacePrefix(void) { } 91 + void CGImageMetadataValueGetTypeID(void) { } 92 + void CGImageMetadataValueGetValue(void) { } 93 + void CGImageMetadataValueIsAlternate(void) { } 94 + void CGImageMetadataValueIsAlternateText(void) { } 95 + void CGImageMetadataValueSetIsAlternate(void) { } 96 + void CGImageMetadataValueSetIsAlternateText(void) { } 97 + void CGImageMetadataValueSetNamespaceURI(void) { } 98 + void CGImageMetadataValueSetSuggestedNamespacePrefix(void) { } 99 + void CGImagePluginGetMetadata(void) { } 100 + void CGImagePluginGetOptions(void) { } 101 + void CGImagePluginGetProperties(void) { } 102 + void CGImagePluginGetSession(void) { } 103 + void CGImagePluginInitJPEGAtOffset(void) { } 104 + void CGImagePluginInitThumbJPEGAtOffset(void) { } 105 + void CGImagePluginReadRawIPTCProps(void) { } 106 + void CGImagePluginReadRawXMPProps(void) { } 107 + void CGImagePluginReadRawXMPSidecarProps(void) { } 108 + void CGImagePluginSetBandProc(void) { } 109 + void CGImagePluginSetClipPath(void) { } 110 + void CGImagePluginSetImage(void) { } 111 + void CGImagePluginSetImageBlockProc(void) { } 112 + void CGImagePluginSetJpegProvider(void) { } 113 + void CGImageReadSessionCreateFILE(void) { } 114 + void CGImageReadSessionGetBytePointer(void) { } 115 + void CGImageReadSessionGetBytes(void) { } 116 + void CGImageReadSessionGetBytesAtOffset(void) { } 117 + void CGImageReadSessionGetFilePath(void) { } 118 + void CGImageReadSessionGetReadRef(void) { } 119 + void CGImageReadSessionGetSize(void) { } 120 + void CGImageReadSessionIsFinal(void) { } 121 + void CGImageReadSessionReleaseBytePointer(void) { } 122 + void CGImageReadSessionRewind(void) { } 123 + void CGImageReadSessionSeek(void) { } 124 + void CGImageReadSessionSkipBytes(void) { } 125 + void CGImageSaveToFile(void) { } 126 + void CGImageSourceAddProperty(void) { } 127 + void CGImageSourceCopyMetadataAtIndex(void) { } 128 + void CGImageSourceCopyMetadataPropertiesAtIndex(void) { } 129 + void CGImageSourceCopyProperties(void) { } 130 + void CGImageSourceCopyPropertiesAtIndex(void) { } 131 + void CGImageSourceCopyTypeExtensions(void) { } 132 + void CGImageSourceCopyTypeIdentifiers(void) { } 133 + void CGImageSourceCreateIOSurfaceAtIndex(void) { } 134 + void CGImageSourceCreateImageAtIndex(void) { } 135 + void CGImageSourceCreateIncremental(void) { } 136 + void CGImageSourceCreateThumbnailAtIndex(void) { } 137 + void CGImageSourceCreateWithData(void) { } 138 + void CGImageSourceCreateWithDataProvider(void) { } 139 + void CGImageSourceCreateWithFile(void) { } 140 + void CGImageSourceCreateWithURL(void) { } 141 + void CGImageSourceGetCount(void) { } 142 + void CGImageSourceGetImageCacheAtIndex(void) { } 143 + void CGImageSourceGetProperties(void) { } 144 + void CGImageSourceGetPropertiesAtIndex(void) { } 145 + void CGImageSourceGetStatus(void) { } 146 + void CGImageSourceGetStatusAtIndex(void) { } 147 + void CGImageSourceGetType(void) { } 148 + void CGImageSourceGetTypeID(void) { } 149 + void CGImageSourceGetTypeWithData(void) { } 150 + void CGImageSourceGetTypeWithDataProvider(void) { } 151 + void CGImageSourceGetTypeWithExtension(void) { } 152 + void CGImageSourceGetTypeWithFile(void) { } 153 + void CGImageSourceGetTypeWithURL(void) { } 154 + void CGImageSourceIsColorOptimizedForSharing(void) { } 155 + void CGImageSourceRemoveCacheAtIndex(void) { } 156 + void CGImageSourceUpdateData(void) { } 157 + void CGImageSourceUpdateDataProvider(void) { } 158 + void CGImageWriteEXIFJPEGToPath(void) { } 159 + void CGImageWriteEXIFJPEGWithMetadata(void) { } 160 + void CGImageWriteSessionPutBytes(void) { } 161 + void CopyMetadataFromFileAtPath(void) { } 162 + void CopyMetadataFromSequentialDataProviderCallbacks(void) { } 163 + void GetMetadataPropertyMatchingSchemaAndPropertyName(void) { } 164 + void ImageIODebug(void) { } 165 + void ImageIOSetLoggingProc(void) { }
+165
src/ImageIO/functions.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2017 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + void CGCopyBasicPropertiesOfImageAtPath(void); 21 + void CGImageConvertExtendedSRGBToColorspace(void); 22 + void CGImageCopyFileWithGPSInformation(void); 23 + void CGImageCopyFileWithParameters(void); 24 + void CGImageCopyJPEGData(void); 25 + void CGImageCopyJPEGDataAndColorSpace(void); 26 + void CGImageCopySourceData(void); 27 + void CGImageCreateByMatchingToColorSpace(void); 28 + void CGImageCreateByMatchingToDisplay(void); 29 + void CGImageCreateByScaling(void); 30 + void CGImageCreateCopyWithAlphaInfo(void); 31 + void CGImageCreateCopyWithParameters(void); 32 + void CGImageCreateEXIFDataFromProperties(void); 33 + void CGImageCreateEXIFJPEGData(void); 34 + void CGImageCreateFromIOSurface(void); 35 + void CGImageCreateThumb(void); 36 + void CGImageDestinationAddImage(void); 37 + void CGImageDestinationAddImageAndMetadata(void); 38 + void CGImageDestinationAddImageFromSource(void); 39 + void CGImageDestinationAddImageFromSourceWithMetadata(void); 40 + void CGImageDestinationAddImageWithMetadata(void); 41 + void CGImageDestinationCopyImageFormats(void); 42 + void CGImageDestinationCopyImageSource(void); 43 + void CGImageDestinationCopyTypeIdentifiers(void); 44 + void CGImageDestinationCreateWithData(void); 45 + void CGImageDestinationCreateWithDataConsumer(void); 46 + void CGImageDestinationCreateWithURL(void); 47 + void CGImageDestinationFinalize(void); 48 + void CGImageDestinationGetTypeID(void); 49 + void CGImageDestinationSetProperties(void); 50 + void CGImageMetadataCopyStringValueWithPath(void); 51 + void CGImageMetadataCopyTagMatchingImageProperty(void); 52 + void CGImageMetadataCopyTagWithPath(void); 53 + void CGImageMetadataCopyTags(void); 54 + void CGImageMetadataCreateFromData(void); 55 + void CGImageMetadataCreateFromMetadataProperties(void); 56 + void CGImageMetadataCreateFromXMPData(void); 57 + void CGImageMetadataCreateMetadataProperties(void); 58 + void CGImageMetadataCreateMutable(void); 59 + void CGImageMetadataCreateMutableCopy(void); 60 + void CGImageMetadataCreateSerializedData(void); 61 + void CGImageMetadataCreateSidecar(void); 62 + void CGImageMetadataCreateXMPData(void); 63 + void CGImageMetadataEnumerateTagsUsingBlock(void); 64 + void CGImageMetadataGetTypeID(void); 65 + void CGImageMetadataPropertyCreate(void); 66 + void CGImageMetadataPropertyGetPropertyName(void); 67 + void CGImageMetadataPropertyGetSchema(void); 68 + void CGImageMetadataPropertyGetSuggestedPrefix(void); 69 + void CGImageMetadataPropertyGetTypeID(void); 70 + void CGImageMetadataPropertyGetValue(void); 71 + void CGImageMetadataPropertySetValue(void); 72 + void CGImageMetadataRegisterNamespaceForPrefix(void); 73 + void CGImageMetadataRemoveTagWithPath(void); 74 + void CGImageMetadataSerialize(void); 75 + void CGImageMetadataSetTagWithPath(void); 76 + void CGImageMetadataSetValueMatchingImageProperty(void); 77 + void CGImageMetadataSetValueWithPath(void); 78 + void CGImageMetadataTagCopyName(void); 79 + void CGImageMetadataTagCopyNamespace(void); 80 + void CGImageMetadataTagCopyPrefix(void); 81 + void CGImageMetadataTagCopyQualifiers(void); 82 + void CGImageMetadataTagCopyValue(void); 83 + void CGImageMetadataTagCreate(void); 84 + void CGImageMetadataTagGetType(void); 85 + void CGImageMetadataTagGetTypeID(void); 86 + void CGImageMetadataValueAddQualifier(void); 87 + void CGImageMetadataValueCreate(void); 88 + void CGImageMetadataValueGetNamespaceURI(void); 89 + void CGImageMetadataValueGetQualifiers(void); 90 + void CGImageMetadataValueGetSuggestedNamespacePrefix(void); 91 + void CGImageMetadataValueGetTypeID(void); 92 + void CGImageMetadataValueGetValue(void); 93 + void CGImageMetadataValueIsAlternate(void); 94 + void CGImageMetadataValueIsAlternateText(void); 95 + void CGImageMetadataValueSetIsAlternate(void); 96 + void CGImageMetadataValueSetIsAlternateText(void); 97 + void CGImageMetadataValueSetNamespaceURI(void); 98 + void CGImageMetadataValueSetSuggestedNamespacePrefix(void); 99 + void CGImagePluginGetMetadata(void); 100 + void CGImagePluginGetOptions(void); 101 + void CGImagePluginGetProperties(void); 102 + void CGImagePluginGetSession(void); 103 + void CGImagePluginInitJPEGAtOffset(void); 104 + void CGImagePluginInitThumbJPEGAtOffset(void); 105 + void CGImagePluginReadRawIPTCProps(void); 106 + void CGImagePluginReadRawXMPProps(void); 107 + void CGImagePluginReadRawXMPSidecarProps(void); 108 + void CGImagePluginSetBandProc(void); 109 + void CGImagePluginSetClipPath(void); 110 + void CGImagePluginSetImage(void); 111 + void CGImagePluginSetImageBlockProc(void); 112 + void CGImagePluginSetJpegProvider(void); 113 + void CGImageReadSessionCreateFILE(void); 114 + void CGImageReadSessionGetBytePointer(void); 115 + void CGImageReadSessionGetBytes(void); 116 + void CGImageReadSessionGetBytesAtOffset(void); 117 + void CGImageReadSessionGetFilePath(void); 118 + void CGImageReadSessionGetReadRef(void); 119 + void CGImageReadSessionGetSize(void); 120 + void CGImageReadSessionIsFinal(void); 121 + void CGImageReadSessionReleaseBytePointer(void); 122 + void CGImageReadSessionRewind(void); 123 + void CGImageReadSessionSeek(void); 124 + void CGImageReadSessionSkipBytes(void); 125 + void CGImageSaveToFile(void); 126 + void CGImageSourceAddProperty(void); 127 + void CGImageSourceCopyMetadataAtIndex(void); 128 + void CGImageSourceCopyMetadataPropertiesAtIndex(void); 129 + void CGImageSourceCopyProperties(void); 130 + void CGImageSourceCopyPropertiesAtIndex(void); 131 + void CGImageSourceCopyTypeExtensions(void); 132 + void CGImageSourceCopyTypeIdentifiers(void); 133 + void CGImageSourceCreateIOSurfaceAtIndex(void); 134 + void CGImageSourceCreateImageAtIndex(void); 135 + void CGImageSourceCreateIncremental(void); 136 + void CGImageSourceCreateThumbnailAtIndex(void); 137 + void CGImageSourceCreateWithData(void); 138 + void CGImageSourceCreateWithDataProvider(void); 139 + void CGImageSourceCreateWithFile(void); 140 + void CGImageSourceCreateWithURL(void); 141 + void CGImageSourceGetCount(void); 142 + void CGImageSourceGetImageCacheAtIndex(void); 143 + void CGImageSourceGetProperties(void); 144 + void CGImageSourceGetPropertiesAtIndex(void); 145 + void CGImageSourceGetStatus(void); 146 + void CGImageSourceGetStatusAtIndex(void); 147 + void CGImageSourceGetType(void); 148 + void CGImageSourceGetTypeID(void); 149 + void CGImageSourceGetTypeWithData(void); 150 + void CGImageSourceGetTypeWithDataProvider(void); 151 + void CGImageSourceGetTypeWithExtension(void); 152 + void CGImageSourceGetTypeWithFile(void); 153 + void CGImageSourceGetTypeWithURL(void); 154 + void CGImageSourceIsColorOptimizedForSharing(void); 155 + void CGImageSourceRemoveCacheAtIndex(void); 156 + void CGImageSourceUpdateData(void); 157 + void CGImageSourceUpdateDataProvider(void); 158 + void CGImageWriteEXIFJPEGToPath(void); 159 + void CGImageWriteEXIFJPEGWithMetadata(void); 160 + void CGImageWriteSessionPutBytes(void); 161 + void CopyMetadataFromFileAtPath(void); 162 + void CopyMetadataFromSequentialDataProviderCallbacks(void); 163 + void GetMetadataPropertyMatchingSchemaAndPropertyName(void); 164 + void ImageIODebug(void); 165 + void ImageIOSetLoggingProc(void);
+14 -16
src/kernel/emulation/linux/process/execve.c
··· 96 96 char *nl, *interp, *arg; 97 97 char** modargvp; 98 98 int i, j; 99 - 99 + 100 100 nl = memchr(m.magic_array, '\n', sizeof(m.magic_array)); 101 101 if (nl == NULL) 102 102 return -ENOEXEC; 103 - 103 + 104 104 *nl = '\0'; 105 - 105 + 106 106 for (i = 2; isspace(m.magic_array[i]); i++); 107 - 107 + 108 108 interp = &m.magic_array[i]; 109 - 109 + 110 110 for (i = 0; !isspace(interp[i]) && interp[i]; i++); 111 - 111 + 112 112 if (interp[i] == '\0') 113 113 arg = NULL; 114 114 else 115 115 arg = &interp[i]; 116 - 116 + 117 117 if (arg != NULL) 118 118 { 119 119 *arg = '\0'; // terminate interp ··· 124 124 if (*arg == '\0') 125 125 arg = NULL; // no argument, just whitespace 126 126 } 127 - 127 + 128 128 // Count original arguments 129 129 while (argvp[len++]); 130 - 130 + 131 131 // Allocate a new argvp 132 132 modargvp = (char**) __builtin_alloca(sizeof(void*) * (len+3)); 133 - 133 + 134 134 i = 0; 135 135 136 136 modargvp[i++] = mldr_path; ··· 138 138 if (arg != NULL) 139 139 modargvp[i++] = arg; 140 140 modargvp[i] = fname; 141 - 141 + 142 142 // Append original arguments 143 143 for (j = 1; j < len+1; j++) 144 144 modargvp[i+j] = argvp[j]; 145 - 145 + 146 146 argvp = modargvp; 147 147 fname = mldr_path; 148 148 } 149 - else 150 - { 151 - return -ENOEXEC; 152 - } 149 + 150 + // otherwise, it's a native Linux executable (ELF) 153 151 154 152 ret = LINUX_SYSCALL(__NR_execve, fname, argvp, envp); 155 153 if (ret < 0)
+28 -2
src/kernel/emulation/linux/syscalls-table.S
··· 5 5 #if defined(__x86_64__) 6 6 7 7 __darling_bsd_syscall: 8 + Lentry_hook: 9 + .space 13, 0x90 8 10 movq ___bsd_syscall_table@GOTPCREL(%rip), %r10 9 11 movq (%r10,%rax,8), %r10 10 12 test %r10, %r10 ··· 16 18 pushq %r11 17 19 call *%r10 18 20 addq $16, %rsp 21 + .std_ret: 22 + Lexit_hook: 23 + .space 13, 0x90 19 24 ret 20 25 .no_sys: 21 26 movq %rax, %rdi 22 27 call ___unknown_syscall 23 - ret 28 + jmp .std_ret 29 + 30 + .section __DATA,__data 31 + .globl __darling_bsd_syscall_entry 32 + .globl __darling_bsd_syscall_exit 33 + __darling_bsd_syscall_entry: 34 + .quad Lentry_hook 35 + __darling_bsd_syscall_exit: 36 + .quad Lexit_hook 24 37 25 38 #elif defined(__i386__) 26 39 ··· 29 42 movl %ecx, -24+off(%esp) 30 43 31 44 __darling_bsd_syscall: 45 + Lentry_hook: 46 + .space 6, 0x90 32 47 calll 1f 33 48 1: 34 49 popl %ecx ··· 48 63 subl $24, %esp 49 64 call *%eax 50 65 addl $24, %esp 66 + .std_ret: 67 + Lexit_hook: 68 + .space 6, 0x90 51 69 ret 52 70 .no_sys: 53 71 pushl %ecx 54 72 call ___unknown_syscall 55 73 addl $4, %esp 56 - ret 74 + jmp .std_ret 57 75 58 76 .section __IMPORT,__pointers,non_lazy_symbol_pointers 59 77 L___bsd_syscall_table$non_lazy_ptr: 60 78 .indirect_symbol ___bsd_syscall_table 61 79 .long 0 80 + 81 + .section __DATA,__data 82 + .globl __darling_bsd_syscall_entry 83 + .globl __darling_bsd_syscall_exit 84 + __darling_bsd_syscall_entry: 85 + .long Lentry_hook 86 + __darling_bsd_syscall_exit: 87 + .long Lexit_hook 62 88 63 89 .subsections_via_symbols 64 90
+7
src/kernel/emulation/linux/unistd/getegid.c
··· 2 2 #include "../base.h" 3 3 #include "../errno.h" 4 4 #include <linux-syscalls/linux.h> 5 + #include <stddef.h> 6 + #include <stdlib.h> 5 7 6 8 long sys_getegid(void) 7 9 { 8 10 int ret; 11 + 12 + #ifndef VARIANT_DYLD // dyld cannot call getenv 13 + if (getenv("__FAKE_SETGID_ROOT") != NULL) 14 + return 0; 15 + #endif 9 16 10 17 #ifdef __NR_getegid32 11 18 ret = LINUX_SYSCALL0(__NR_getegid32);
+6
src/kernel/emulation/linux/unistd/getgid.c
··· 2 2 #include "../base.h" 3 3 #include "../errno.h" 4 4 #include <linux-syscalls/linux.h> 5 + #include <stddef.h> 6 + #include <stdlib.h> 5 7 6 8 long sys_getgid(void) 7 9 { 8 10 int ret; 11 + #ifndef VARIANT_DYLD // dyld cannot call getenv 12 + if (getenv("__FAKE_SETGID_ROOT") != NULL) 13 + return 0; 14 + #endif 9 15 10 16 #ifdef __NR_getgid32 11 17 ret = LINUX_SYSCALL0(__NR_getgid32);
+2 -2
src/kernel/emulation/linux/unistd/getgroups.c
··· 8 8 long sys_getgroups(unsigned int size, int* gidset) 9 9 { 10 10 int ret; 11 - 12 - if (getenv("__FAKE_SETUID_ROOT")) 11 + 12 + if (getenv("__FAKE_SETGID_ROOT")) 13 13 { 14 14 if (size >= 1) 15 15 {
+7
src/kernel/emulation/linux/unistd/write.c
··· 8 8 return sys_write_nocancel(fd, mem, len); 9 9 } 10 10 11 + __attribute__((visibility("default"))) 12 + long __write_for_xtrace(int fd, const void* mem, int len) 13 + { 14 + return sys_write_nocancel(fd, mem, len); 15 + } 16 + 17 + 11 18 long sys_write_nocancel(int fd, const void* mem, int len) 12 19 { 13 20 int ret;
+7 -1
src/libinfo/CMakeLists.txt
··· 15 15 add_definitions(-D__APPLE__ -D__DYNAMIC__) 16 16 add_definitions(-D__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=1080) 17 17 18 - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdinc -D__DARWIN_UNIX03 -fPIC -w -ggdb") 18 + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdinc -D__DARWIN_UNIX03 -fPIC -ggdb") 19 19 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -nostdlib") 20 + 21 + add_compile_options( 22 + -Wno-macro-redefined 23 + ) 20 24 21 25 include_directories(${CMAKE_SOURCE_DIR}/src/libc/darwin) 22 26 include_directories(${CMAKE_SOURCE_DIR}/src/kernel/libsyscall/wrappers) ··· 64 68 libdispatch_shared 65 69 system_notify 66 70 platform 71 + xpc 72 + compiler_rt 67 73 DEPENDENCIES 68 74 resolv-darwin 69 75 )
+4
src/libinfo/membership.subproj/CMakeLists.txt
··· 10 10 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../lookup.subproj) 11 11 include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 12 12 13 + add_definitions( 14 + -DDS_AVAILABLE 15 + ) 16 + 13 17 set(info-membership_sources 14 18 membership.c 15 19 )
+22
src/login/CMakeLists.txt
··· 1 + project(login) 2 + 3 + add_compile_options( 4 + -nostdinc 5 + ) 6 + 7 + include_directories( 8 + ${CMAKE_CURRENT_SOURCE_DIR} 9 + ) 10 + 11 + add_framework(login 12 + FAT 13 + CURRENT_VERSION 14 + PRIVATE 15 + VERSION "A" 16 + 17 + SOURCES 18 + functions.c 19 + 20 + DEPENDENCIES 21 + system 22 + )
+222
src/login/functions.c
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2017 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + void CFXPCRelease(void) { } 21 + void CreateArgumentsForFunction(void) { } 22 + void GetSessionAgentClient(void) { } 23 + void GetSessionManagementClient(void) { } 24 + void JoinAuditSessionIfNeeded(void) { } 25 + void LFAppleIDBreadcrumbCheckin(void) { } 26 + void LFAppleIDBreadcrumbCopyAppleIDForUser(void) { } 27 + void LFAppleIDBreadcrumbCopyOldKeychainPassword(void) { } 28 + void LFAppleIDBreadcrumbUpdate(void) { } 29 + void LFArgumentsAddAuditSessionID(void) { } 30 + void LFArgumentsAddBoolean(void) { } 31 + void LFArgumentsAddCFObject(void) { } 32 + void LFArgumentsAddCString(void) { } 33 + void LFArgumentsAddConnection(void) { } 34 + void LFArgumentsAddConnectionEndpoint(void) { } 35 + void LFArgumentsAddInt64(void) { } 36 + void LFArgumentsAddLFClient(void) { } 37 + void LFArgumentsAddLFServer(void) { } 38 + void LFArgumentsAddMachPort(void) { } 39 + void LFArgumentsAddNull(void) { } 40 + void LFArgumentsAddUInt64(void) { } 41 + void LFArgumentsCallFunction(void) { } 42 + void LFArgumentsCopyFunctionIdentifier(void) { } 43 + void LFArgumentsCreate(void) { } 44 + void LFArgumentsCreateWithArguments(void) { } 45 + void LFArgumentsCreateWithXPCDictionary(void) { } 46 + void LFArgumentsGetDictionary(void) { } 47 + void LFArgumentsGetFunction(void) { } 48 + void LFArgumentsIsValid(void) { } 49 + void LFArgumentsShouldAddArgumentForFlag(void) { } 50 + void LFClientAddErrorHandler(void) { } 51 + void LFClientCreateWithConnection(void) { } 52 + void LFClientCreateWithConnectionAndServer(void) { } 53 + void LFClientCreateWithServiceName(void) { } 54 + void LFClientGetConnection(void) { } 55 + void LFClientGetEndpoint(void) { } 56 + void LFClientGetPID(void) { } 57 + void LFClientGetServer(void) { } 58 + void LFClientGetTypeID(void) { } 59 + void LFClientRemoveErrorHandler(void) { } 60 + void LFClientSendArgumentsAndGetCFReply(void) { } 61 + void LFClientSendArgumentsAndGetReply(void) { } 62 + void LFClientSetEndpoint(void) { } 63 + void LFClientSetEventHandler(void) { } 64 + void LFClientSetInstance(void) { } 65 + void LFClientSetIsMachService(void) { } 66 + void LFClientSetPrivileged(void) { } 67 + void LFClientSetUserID(void) { } 68 + void LFClientStart(void) { } 69 + void LFClientStop(void) { } 70 + void LFDBLoggingControllerStart(void) { } 71 + void LFDBLoggingControllerStop(void) { } 72 + void LFDictionaryCreateMutableWithObjectForKey(void) { } 73 + void LFDictionaryGetBooleanForKey(void) { } 74 + void LFDictionaryGetCFIndexForKey(void) { } 75 + void LFDictionaryGetDictionaryForKey(void) { } 76 + void LFDictionaryGetDoubleForKey(void) { } 77 + void LFDictionarySetBoolean(void) { } 78 + void LFDictionarySetCFIndex(void) { } 79 + void LFDictionarySetDictionary(void) { } 80 + void LFFunctionCacheAddFunction(void) { } 81 + void LFFunctionCacheCreateServerFunction(void) { } 82 + void LFFunctionCacheGetFunction(void) { } 83 + void LFFunctionCreateClientFunction(void) { } 84 + void LFFunctionCreateServerFunction(void) { } 85 + void LFFunctionGetIdentifier(void) { } 86 + void LFLogUnhandledEventType(void) { } 87 + void LFSMCloseSession(void) { } 88 + void LFSMCopyAllSessions(void) { } 89 + void LFSMCopyCurrentSession(void) { } 90 + void LFSMCopySessionProperties(void) { } 91 + void LFSMCopySessionWithCGSessionID(void) { } 92 + void LFSMCreateDefaultSessionOptions(void) { } 93 + void LFSMCreateSessionWithOptions(void) { } 94 + void LFSMCreateSessionWithOptionsByStartingServer(void) { } 95 + void LFSMSessionGetTypeID(void) { } 96 + void LFSMSwitchToSessionWithOptions(void) { } 97 + void LFServerCreate(void) { } 98 + void LFServerGetClientForConnection(void) { } 99 + void LFServerGetConnection(void) { } 100 + void LFServerGetEventHandler(void) { } 101 + void LFServerGetServiceName(void) { } 102 + void LFServerGetTypeID(void) { } 103 + void LFServerSetIsMachService(void) { } 104 + void LFServerStart(void) { } 105 + void LFServerStop(void) { } 106 + void LFStringCreateFromString(void) { } 107 + void LogindServerCreate(void) { } 108 + void LogindServerRelease(void) { } 109 + void SACBeginLoginTransition(void) { } 110 + void SACCopyOnceMiniBuddyItem(void) { } 111 + void SACDeleteMiniBuddyItem(void) { } 112 + void SACDisableFileVaultForCurrentUserWithPassword(void) { } 113 + void SACEnableFileVaultForCurrentUserWithPassword(void) { } 114 + void SACFaceTimeCallRingStart(void) { } 115 + void SACFaceTimeCallRingStop(void) { } 116 + void SACLOFinishDelayedLogout(void) { } 117 + void SACLORegisterLogoutStatusCallbacks(void) { } 118 + void SACLOStartLogout(void) { } 119 + void SACLOStartLogoutWithOptions(void) { } 120 + void SACLegacyFileVaultCloseProgressWindow(void) { } 121 + void SACLegacyFileVaultSetBarPercentage(void) { } 122 + void SACLegacyFileVaultSetPhase(void) { } 123 + void SACLegacyFileVaultSetTask(void) { } 124 + void SACLegacyFileVaultShowErrorMessage(void) { } 125 + void SACLegacyFileVaultShowProgressWindow(void) { } 126 + void SACLegacyFileVaultUpdateTimeRemaining(void) { } 127 + void SACLegacyFileVaultUpdateUI(void) { } 128 + void SACLockScreenImmediate(void) { } 129 + void SACLogoutComplete(void) { } 130 + void SACMessageFaceTimeCancelCall(void) { } 131 + void SACMessageFaceTimeMuteCall(void) { } 132 + void SACMessageLogoutStatusClientLogoutFailed(void) { } 133 + void SACMessageLogoutStatusClientLogoutSuccess(void) { } 134 + void SACMessageMiniBuddyUIShowing(void) { } 135 + void SACMiniBuddyCopyUpgradeDictionary(void) { } 136 + void SACMiniBuddySignalCompleted(void) { } 137 + void SACMiniBuddySignalFinishedStage1WithOptions(void) { } 138 + void SACProximityPreferencesChanged(void) { } 139 + void SACRestartForUser(void) { } 140 + void SACSaveSetupUserScreenShots(void) { } 141 + void SACScreenLockEnabled(void) { } 142 + void SACScreenLockPreferencesChanged(void) { } 143 + void SACScreenSaverCanRun(void) { } 144 + void SACScreenSaverDidFadeInBackground(void) { } 145 + void SACScreenSaverIsRunning(void) { } 146 + void SACScreenSaverIsRunningInBackground(void) { } 147 + void SACScreenSaverStartNow(void) { } 148 + void SACScreenSaverStopNow(void) { } 149 + void SACScreenSaverStopNowWithOptions(void) { } 150 + void SACScreenSaverTimeRemaining(void) { } 151 + void SACSetAppleIDVerified(void) { } 152 + void SACSetAutoLoginPassword(void) { } 153 + void SACSetFileVaultPassword(void) { } 154 + void SACSetFinalSnapshot(void) { } 155 + void SACSetMiniBuddyItem(void) { } 156 + void SACSetPhoneProximity(void) { } 157 + void SACSetScreenSaverCanRun(void) { } 158 + void SACShieldWindowShowing(void) { } 159 + void SACStartProgressIndicator(void) { } 160 + void SACStartSessionForLoginWindow(void) { } 161 + void SACStartSessionForUser(void) { } 162 + void SACStopProgressIndicator(void) { } 163 + void SACStopSessionForLoginWindow(void) { } 164 + void SACSwitchToLoginWindow(void) { } 165 + void SACSwitchToUser(void) { } 166 + void SACUpdateAppleIDUserLogin(void) { } 167 + void SACWriteKeyboardType(void) { } 168 + void SAClearLWScreenShots(void) { } 169 + void SAClearLaunchSoftwareUpdateTrigger(void) { } 170 + void SAClearSoftwareUpdateOptions(void) { } 171 + void SAPrepareForSetupUserScreenShots(void) { } 172 + void SAResetLoginKeychainForAutoLoginPassword(void) { } 173 + void SASSessionStateForUser(void) { } 174 + void SASetAppleIDVerified(void) { } 175 + void SASetAutoLoginUserScreenLocked(void) { } 176 + void SASetAutologinPW(void) { } 177 + void SASetLaunchSoftwareUpdateTrigger(void) { } 178 + void SASetPreviousStartupWasPanic(void) { } 179 + void SASetSCDynamicStoreConsoleInformation(void) { } 180 + void SASetSessionAuthenticatedFlag(void) { } 181 + void SASetSessionHasConsoleAccessFlag(void) { } 182 + void SASetSessionState(void) { } 183 + void SASetSoftwareUpdateOption(void) { } 184 + void SASetSwapCompaction(void) { } 185 + void SASetTextEncodingBias(void) { } 186 + void SASync(void) { } 187 + void SASystemNotifyPost(void) { } 188 + void SAWriteKeyboardType(void) { } 189 + void SLOAddErrorHandler(void) { } 190 + void SLOLegacyFileVaultSetState(void) { } 191 + void SLOStartLogoutOfType(void) { } 192 + void SMCopySessionUserInfo(void) { } 193 + void SMGetSessionAgentConnection(void) { } 194 + void SMRegisterSessionAgent(void) { } 195 + void SMSetSessionUserInfo(void) { } 196 + void SOStartSessionWithOptions(void) { } 197 + void SessionAgentServerCreate(void) { } 198 + void SessionAgentServerGetServer(void) { } 199 + void SessionAgentServerRelease(void) { } 200 + void SessionLogoutServerCreate(void) { } 201 + void SessionLogoutServerRelease(void) { } 202 + void SessionOwnerServerCreate(void) { } 203 + void SessionOwnerServerRelease(void) { } 204 + void _LFArgumentsCopyDebugDesc(void) { } 205 + void _LFArgumentsCopyFormattingDesc(void) { } 206 + void _LFArgumentsFinalize(void) { } 207 + void _LFArgumentsInit(void) { } 208 + void _LFFunctionCopyDebugDesc(void) { } 209 + void _LFFunctionCopyFormattingDesc(void) { } 210 + void _LFFunctionCreateServerFunction(void) { } 211 + void _LFFunctionEqual(void) { } 212 + void _LFFunctionFinalize(void) { } 213 + void _LFFunctionHash(void) { } 214 + void _LFFunctionInit(void) { } 215 + void _LFGetBreadcrumbEncryptedKeyWithBlock(void) { } 216 + void _LFServerCopyDebugDesc(void) { } 217 + void _LFServerCopyFormattingDesc(void) { } 218 + void _LFServerEqual(void) { } 219 + void _LFServerFinalize(void) { } 220 + void _LFServerHash(void) { } 221 + void _LFSetBreadcrumbEncryptedKeyWithBlock(void) { } 222 + void logindServerGetServer(void) { }
+222
src/login/functions.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2017 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + void CFXPCRelease(void); 21 + void CreateArgumentsForFunction(void); 22 + void GetSessionAgentClient(void); 23 + void GetSessionManagementClient(void); 24 + void JoinAuditSessionIfNeeded(void); 25 + void LFAppleIDBreadcrumbCheckin(void); 26 + void LFAppleIDBreadcrumbCopyAppleIDForUser(void); 27 + void LFAppleIDBreadcrumbCopyOldKeychainPassword(void); 28 + void LFAppleIDBreadcrumbUpdate(void); 29 + void LFArgumentsAddAuditSessionID(void); 30 + void LFArgumentsAddBoolean(void); 31 + void LFArgumentsAddCFObject(void); 32 + void LFArgumentsAddCString(void); 33 + void LFArgumentsAddConnection(void); 34 + void LFArgumentsAddConnectionEndpoint(void); 35 + void LFArgumentsAddInt64(void); 36 + void LFArgumentsAddLFClient(void); 37 + void LFArgumentsAddLFServer(void); 38 + void LFArgumentsAddMachPort(void); 39 + void LFArgumentsAddNull(void); 40 + void LFArgumentsAddUInt64(void); 41 + void LFArgumentsCallFunction(void); 42 + void LFArgumentsCopyFunctionIdentifier(void); 43 + void LFArgumentsCreate(void); 44 + void LFArgumentsCreateWithArguments(void); 45 + void LFArgumentsCreateWithXPCDictionary(void); 46 + void LFArgumentsGetDictionary(void); 47 + void LFArgumentsGetFunction(void); 48 + void LFArgumentsIsValid(void); 49 + void LFArgumentsShouldAddArgumentForFlag(void); 50 + void LFClientAddErrorHandler(void); 51 + void LFClientCreateWithConnection(void); 52 + void LFClientCreateWithConnectionAndServer(void); 53 + void LFClientCreateWithServiceName(void); 54 + void LFClientGetConnection(void); 55 + void LFClientGetEndpoint(void); 56 + void LFClientGetPID(void); 57 + void LFClientGetServer(void); 58 + void LFClientGetTypeID(void); 59 + void LFClientRemoveErrorHandler(void); 60 + void LFClientSendArgumentsAndGetCFReply(void); 61 + void LFClientSendArgumentsAndGetReply(void); 62 + void LFClientSetEndpoint(void); 63 + void LFClientSetEventHandler(void); 64 + void LFClientSetInstance(void); 65 + void LFClientSetIsMachService(void); 66 + void LFClientSetPrivileged(void); 67 + void LFClientSetUserID(void); 68 + void LFClientStart(void); 69 + void LFClientStop(void); 70 + void LFDBLoggingControllerStart(void); 71 + void LFDBLoggingControllerStop(void); 72 + void LFDictionaryCreateMutableWithObjectForKey(void); 73 + void LFDictionaryGetBooleanForKey(void); 74 + void LFDictionaryGetCFIndexForKey(void); 75 + void LFDictionaryGetDictionaryForKey(void); 76 + void LFDictionaryGetDoubleForKey(void); 77 + void LFDictionarySetBoolean(void); 78 + void LFDictionarySetCFIndex(void); 79 + void LFDictionarySetDictionary(void); 80 + void LFFunctionCacheAddFunction(void); 81 + void LFFunctionCacheCreateServerFunction(void); 82 + void LFFunctionCacheGetFunction(void); 83 + void LFFunctionCreateClientFunction(void); 84 + void LFFunctionCreateServerFunction(void); 85 + void LFFunctionGetIdentifier(void); 86 + void LFLogUnhandledEventType(void); 87 + void LFSMCloseSession(void); 88 + void LFSMCopyAllSessions(void); 89 + void LFSMCopyCurrentSession(void); 90 + void LFSMCopySessionProperties(void); 91 + void LFSMCopySessionWithCGSessionID(void); 92 + void LFSMCreateDefaultSessionOptions(void); 93 + void LFSMCreateSessionWithOptions(void); 94 + void LFSMCreateSessionWithOptionsByStartingServer(void); 95 + void LFSMSessionGetTypeID(void); 96 + void LFSMSwitchToSessionWithOptions(void); 97 + void LFServerCreate(void); 98 + void LFServerGetClientForConnection(void); 99 + void LFServerGetConnection(void); 100 + void LFServerGetEventHandler(void); 101 + void LFServerGetServiceName(void); 102 + void LFServerGetTypeID(void); 103 + void LFServerSetIsMachService(void); 104 + void LFServerStart(void); 105 + void LFServerStop(void); 106 + void LFStringCreateFromString(void); 107 + void LogindServerCreate(void); 108 + void LogindServerRelease(void); 109 + void SACBeginLoginTransition(void); 110 + void SACCopyOnceMiniBuddyItem(void); 111 + void SACDeleteMiniBuddyItem(void); 112 + void SACDisableFileVaultForCurrentUserWithPassword(void); 113 + void SACEnableFileVaultForCurrentUserWithPassword(void); 114 + void SACFaceTimeCallRingStart(void); 115 + void SACFaceTimeCallRingStop(void); 116 + void SACLOFinishDelayedLogout(void); 117 + void SACLORegisterLogoutStatusCallbacks(void); 118 + void SACLOStartLogout(void); 119 + void SACLOStartLogoutWithOptions(void); 120 + void SACLegacyFileVaultCloseProgressWindow(void); 121 + void SACLegacyFileVaultSetBarPercentage(void); 122 + void SACLegacyFileVaultSetPhase(void); 123 + void SACLegacyFileVaultSetTask(void); 124 + void SACLegacyFileVaultShowErrorMessage(void); 125 + void SACLegacyFileVaultShowProgressWindow(void); 126 + void SACLegacyFileVaultUpdateTimeRemaining(void); 127 + void SACLegacyFileVaultUpdateUI(void); 128 + void SACLockScreenImmediate(void); 129 + void SACLogoutComplete(void); 130 + void SACMessageFaceTimeCancelCall(void); 131 + void SACMessageFaceTimeMuteCall(void); 132 + void SACMessageLogoutStatusClientLogoutFailed(void); 133 + void SACMessageLogoutStatusClientLogoutSuccess(void); 134 + void SACMessageMiniBuddyUIShowing(void); 135 + void SACMiniBuddyCopyUpgradeDictionary(void); 136 + void SACMiniBuddySignalCompleted(void); 137 + void SACMiniBuddySignalFinishedStage1WithOptions(void); 138 + void SACProximityPreferencesChanged(void); 139 + void SACRestartForUser(void); 140 + void SACSaveSetupUserScreenShots(void); 141 + void SACScreenLockEnabled(void); 142 + void SACScreenLockPreferencesChanged(void); 143 + void SACScreenSaverCanRun(void); 144 + void SACScreenSaverDidFadeInBackground(void); 145 + void SACScreenSaverIsRunning(void); 146 + void SACScreenSaverIsRunningInBackground(void); 147 + void SACScreenSaverStartNow(void); 148 + void SACScreenSaverStopNow(void); 149 + void SACScreenSaverStopNowWithOptions(void); 150 + void SACScreenSaverTimeRemaining(void); 151 + void SACSetAppleIDVerified(void); 152 + void SACSetAutoLoginPassword(void); 153 + void SACSetFileVaultPassword(void); 154 + void SACSetFinalSnapshot(void); 155 + void SACSetMiniBuddyItem(void); 156 + void SACSetPhoneProximity(void); 157 + void SACSetScreenSaverCanRun(void); 158 + void SACShieldWindowShowing(void); 159 + void SACStartProgressIndicator(void); 160 + void SACStartSessionForLoginWindow(void); 161 + void SACStartSessionForUser(void); 162 + void SACStopProgressIndicator(void); 163 + void SACStopSessionForLoginWindow(void); 164 + void SACSwitchToLoginWindow(void); 165 + void SACSwitchToUser(void); 166 + void SACUpdateAppleIDUserLogin(void); 167 + void SACWriteKeyboardType(void); 168 + void SAClearLWScreenShots(void); 169 + void SAClearLaunchSoftwareUpdateTrigger(void); 170 + void SAClearSoftwareUpdateOptions(void); 171 + void SAPrepareForSetupUserScreenShots(void); 172 + void SAResetLoginKeychainForAutoLoginPassword(void); 173 + void SASSessionStateForUser(void); 174 + void SASetAppleIDVerified(void); 175 + void SASetAutoLoginUserScreenLocked(void); 176 + void SASetAutologinPW(void); 177 + void SASetLaunchSoftwareUpdateTrigger(void); 178 + void SASetPreviousStartupWasPanic(void); 179 + void SASetSCDynamicStoreConsoleInformation(void); 180 + void SASetSessionAuthenticatedFlag(void); 181 + void SASetSessionHasConsoleAccessFlag(void); 182 + void SASetSessionState(void); 183 + void SASetSoftwareUpdateOption(void); 184 + void SASetSwapCompaction(void); 185 + void SASetTextEncodingBias(void); 186 + void SASync(void); 187 + void SASystemNotifyPost(void); 188 + void SAWriteKeyboardType(void); 189 + void SLOAddErrorHandler(void); 190 + void SLOLegacyFileVaultSetState(void); 191 + void SLOStartLogoutOfType(void); 192 + void SMCopySessionUserInfo(void); 193 + void SMGetSessionAgentConnection(void); 194 + void SMRegisterSessionAgent(void); 195 + void SMSetSessionUserInfo(void); 196 + void SOStartSessionWithOptions(void); 197 + void SessionAgentServerCreate(void); 198 + void SessionAgentServerGetServer(void); 199 + void SessionAgentServerRelease(void); 200 + void SessionLogoutServerCreate(void); 201 + void SessionLogoutServerRelease(void); 202 + void SessionOwnerServerCreate(void); 203 + void SessionOwnerServerRelease(void); 204 + void _LFArgumentsCopyDebugDesc(void); 205 + void _LFArgumentsCopyFormattingDesc(void); 206 + void _LFArgumentsFinalize(void); 207 + void _LFArgumentsInit(void); 208 + void _LFFunctionCopyDebugDesc(void); 209 + void _LFFunctionCopyFormattingDesc(void); 210 + void _LFFunctionCreateServerFunction(void); 211 + void _LFFunctionEqual(void); 212 + void _LFFunctionFinalize(void); 213 + void _LFFunctionHash(void); 214 + void _LFFunctionInit(void); 215 + void _LFGetBreadcrumbEncryptedKeyWithBlock(void); 216 + void _LFServerCopyDebugDesc(void); 217 + void _LFServerCopyFormattingDesc(void); 218 + void _LFServerEqual(void); 219 + void _LFServerFinalize(void); 220 + void _LFServerHash(void); 221 + void _LFSetBreadcrumbEncryptedKeyWithBlock(void); 222 + void logindServerGetServer(void);
+7
src/opendirectory/include/opendirectory/odipc.h
··· 1 + #ifndef _OD_ODIPC_H_ 2 + #define _OD_ODIPC_H_ 3 + 4 + #define kODMachMembershipPortNameDebug 1 5 + #define kODMachMembershipPortName 1 6 + 7 + #endif
+6
src/tools/sudo
··· 27 27 fi 28 28 29 29 export __FAKE_SETUID_ROOT=1 30 + export __FAKE_SETGID_ROOT=1 31 + 32 + if [ $1 == "-k" ]; then 33 + shift 34 + fi 35 + 30 36 exec "${@:1}"
+1
src/xtrace/CMakeLists.txt
··· 10 10 simple.c 11 11 trampoline.S 12 12 mach_trace.cpp 13 + bsd_trace.cpp 13 14 ) 14 15 15 16 set(DYLIB_INSTALL_NAME "/usr/lib/darling/libxtrace.dylib")
+573
src/xtrace/bsd_trace.cpp
··· 1 + #include "simple.h" 2 + #include <unistd.h> 3 + #include <pthread.h> 4 + #include "xtracelib.h" 5 + 6 + _Thread_local int bsd_call_nr = -1; 7 + 8 + static void print_errno(char* buf, uintptr_t rv); 9 + static void print_errno_num(char* buf, uintptr_t rv); 10 + static void print_errno_ptr(char* buf, uintptr_t rv); 11 + 12 + // awk '/^[0-9]/ { if ($6 !~ "nosys") { split($6, a, "("); print "[" $1 "] = { \"" a[1] "\", NULL, print_errno }," } }' 13 + 14 + static const struct calldef bsd_defs[600] = { 15 + [1] = { "exit", NULL, print_errno_num }, 16 + [2] = { "fork", NULL, print_errno_num }, 17 + [3] = { "read", NULL, print_errno_num }, 18 + [4] = { "write", NULL, print_errno_num }, 19 + [5] = { "open", NULL, print_errno_num }, 20 + [6] = { "close", NULL, print_errno_num }, 21 + [7] = { "wait4", NULL, print_errno_num }, 22 + [9] = { "link", NULL, print_errno_num }, 23 + [10] = { "unlink", NULL, print_errno_num }, 24 + [12] = { "chdir", NULL, print_errno_num }, 25 + [13] = { "fchdir", NULL, print_errno_num }, 26 + [14] = { "mknod", NULL, print_errno_num }, 27 + [15] = { "chmod", NULL, print_errno_num }, 28 + [16] = { "chown", NULL, print_errno_num }, 29 + [18] = { "getfsstat", NULL, print_errno_num }, 30 + [20] = { "getpid", NULL, print_errno_num }, 31 + [23] = { "setuid", NULL, print_errno_num }, 32 + [24] = { "getuid", NULL, print_errno_num }, 33 + [25] = { "geteuid", NULL, print_errno_num }, 34 + [26] = { "ptrace", NULL, print_errno_num }, 35 + [27] = { "recvmsg", NULL, print_errno_num }, 36 + [28] = { "sendmsg", NULL, print_errno_num }, 37 + [29] = { "recvfrom", NULL, print_errno_num }, 38 + [30] = { "accept", NULL, print_errno_num }, 39 + [31] = { "getpeername", NULL, print_errno_num }, 40 + [32] = { "getsockname", NULL, print_errno_num }, 41 + [33] = { "access", NULL, print_errno_num }, 42 + [34] = { "chflags", NULL, print_errno_num }, 43 + [35] = { "fchflags", NULL, print_errno_num }, 44 + [36] = { "sync", NULL, print_errno_num }, 45 + [37] = { "kill", NULL, print_errno_num }, 46 + [39] = { "getppid", NULL, print_errno_num }, 47 + [41] = { "dup", NULL, print_errno_num }, 48 + [42] = { "pipe", NULL, print_errno_num }, 49 + [43] = { "getegid", NULL, print_errno_num }, 50 + [46] = { "sigaction", NULL, print_errno_num }, 51 + [47] = { "getgid", NULL, print_errno_num }, 52 + [48] = { "sigprocmask", NULL, print_errno_num }, 53 + [49] = { "getlogin", NULL, print_errno_num }, 54 + [50] = { "setlogin", NULL, print_errno_num }, 55 + [51] = { "acct", NULL, print_errno_num }, 56 + [52] = { "sigpending", NULL, print_errno_num }, 57 + [53] = { "sigaltstack", NULL, print_errno_num }, 58 + [54] = { "ioctl", NULL, print_errno_num }, 59 + [55] = { "reboot", NULL, print_errno_num }, 60 + [56] = { "revoke", NULL, print_errno_num }, 61 + [57] = { "symlink", NULL, print_errno_num }, 62 + [58] = { "readlink", NULL, print_errno_num }, 63 + [59] = { "execve", NULL, print_errno_num }, 64 + [60] = { "umask", NULL, print_errno_num }, 65 + [61] = { "chroot", NULL, print_errno_num }, 66 + [65] = { "msync", NULL, print_errno_num }, 67 + [66] = { "vfork", NULL, print_errno_num }, 68 + [73] = { "munmap", NULL, print_errno_num }, 69 + [74] = { "mprotect", NULL, print_errno_num }, 70 + [75] = { "madvise", NULL, print_errno_num }, 71 + [78] = { "mincore", NULL, print_errno_num }, 72 + [79] = { "getgroups", NULL, print_errno_num }, 73 + [80] = { "setgroups", NULL, print_errno_num }, 74 + [81] = { "getpgrp", NULL, print_errno_num }, 75 + [82] = { "setpgid", NULL, print_errno_num }, 76 + [83] = { "setitimer", NULL, print_errno_num }, 77 + [85] = { "swapon", NULL, print_errno_num }, 78 + [86] = { "getitimer", NULL, print_errno_num }, 79 + [89] = { "getdtablesize", NULL, print_errno_num }, 80 + [90] = { "dup2", NULL, print_errno_num }, 81 + [92] = { "fcntl", NULL, print_errno_num }, 82 + [93] = { "select", NULL, print_errno_num }, 83 + [95] = { "fsync", NULL, print_errno_num }, 84 + [96] = { "setpriority", NULL, print_errno_num }, 85 + [97] = { "socket", NULL, print_errno_num }, 86 + [98] = { "connect", NULL, print_errno_num }, 87 + [100] = { "getpriority", NULL, print_errno_num }, 88 + [104] = { "bind", NULL, print_errno_num }, 89 + [105] = { "setsockopt", NULL, print_errno_num }, 90 + [106] = { "listen", NULL, print_errno_num }, 91 + [111] = { "sigsuspend", NULL, print_errno_num }, 92 + [116] = { "gettimeofday", NULL, print_errno_num }, 93 + [117] = { "getrusage", NULL, print_errno_num }, 94 + [118] = { "getsockopt", NULL, print_errno_num }, 95 + [120] = { "readv", NULL, print_errno_num }, 96 + [121] = { "writev", NULL, print_errno_num }, 97 + [122] = { "settimeofday", NULL, print_errno_num }, 98 + [123] = { "fchown", NULL, print_errno_num }, 99 + [124] = { "fchmod", NULL, print_errno_num }, 100 + [126] = { "setreuid", NULL, print_errno_num }, 101 + [127] = { "setregid", NULL, print_errno_num }, 102 + [128] = { "rename", NULL, print_errno_num }, 103 + [131] = { "flock", NULL, print_errno_num }, 104 + [132] = { "mkfifo", NULL, print_errno_num }, 105 + [133] = { "sendto", NULL, print_errno_num }, 106 + [134] = { "shutdown", NULL, print_errno_num }, 107 + [135] = { "socketpair", NULL, print_errno_num }, 108 + [136] = { "mkdir", NULL, print_errno_num }, 109 + [137] = { "rmdir", NULL, print_errno_num }, 110 + [138] = { "utimes", NULL, print_errno_num }, 111 + [139] = { "futimes", NULL, print_errno_num }, 112 + [140] = { "adjtime", NULL, print_errno_num }, 113 + [142] = { "gethostuuid", NULL, print_errno_num }, 114 + [147] = { "setsid", NULL, print_errno_num }, 115 + [151] = { "getpgid", NULL, print_errno_num }, 116 + [152] = { "setprivexec", NULL, print_errno_num }, 117 + [153] = { "pread", NULL, print_errno_num }, 118 + [154] = { "pwrite", NULL, print_errno_num }, 119 + [155] = { "nfssvc", NULL, print_errno_num }, 120 + [157] = { "statfs", NULL, print_errno_num }, 121 + [158] = { "fstatfs", NULL, print_errno_num }, 122 + [159] = { "unmount", NULL, print_errno_num }, 123 + [161] = { "getfh", NULL, print_errno_num }, 124 + [165] = { "quotactl", NULL, print_errno_num }, 125 + [167] = { "mount", NULL, print_errno_num }, 126 + [169] = { "csops", NULL, print_errno_num }, 127 + [170] = { "csops_audittoken", NULL, print_errno_num }, 128 + [173] = { "waitid", NULL, print_errno_num }, 129 + [177] = { "kdebug_typefilter", NULL, print_errno_num }, 130 + [178] = { "kdebug_trace_string", NULL, print_errno_num }, 131 + [179] = { "kdebug_trace64", NULL, print_errno_num }, 132 + [180] = { "kdebug_trace", NULL, print_errno_num }, 133 + [181] = { "setgid", NULL, print_errno_num }, 134 + [182] = { "setegid", NULL, print_errno_num }, 135 + [183] = { "seteuid", NULL, print_errno_num }, 136 + [184] = { "sigreturn", NULL, print_errno_num }, 137 + [187] = { "fdatasync", NULL, print_errno_num }, 138 + [188] = { "stat", NULL, print_errno_num }, 139 + [189] = { "fstat", NULL, print_errno_num }, 140 + [190] = { "lstat", NULL, print_errno_num }, 141 + [191] = { "pathconf", NULL, print_errno_num }, 142 + [192] = { "fpathconf", NULL, print_errno_num }, 143 + [194] = { "getrlimit", NULL, print_errno_num }, 144 + [195] = { "setrlimit", NULL, print_errno_num }, 145 + [196] = { "getdirentries", NULL, print_errno_num }, 146 + [197] = { "mmap", NULL, print_errno_ptr }, 147 + [199] = { "lseek", NULL, print_errno_num }, 148 + [200] = { "truncate", NULL, print_errno_num }, 149 + [201] = { "ftruncate", NULL, print_errno_num }, 150 + [202] = { "sysctl", NULL, print_errno_num }, 151 + [203] = { "mlock", NULL, print_errno_num }, 152 + [204] = { "munlock", NULL, print_errno_num }, 153 + [205] = { "undelete", NULL, print_errno_num }, 154 + [216] = { "open_dprotected_np", NULL, print_errno_num }, 155 + [220] = { "getattrlist", NULL, print_errno_num }, 156 + [221] = { "setattrlist", NULL, print_errno_num }, 157 + [222] = { "getdirentriesattr", NULL, print_errno_num }, 158 + [223] = { "exchangedata", NULL, print_errno_num }, 159 + [225] = { "searchfs", NULL, print_errno_num }, 160 + [226] = { "delete", NULL, print_errno_num }, 161 + [227] = { "copyfile", NULL, print_errno_num }, 162 + [228] = { "fgetattrlist", NULL, print_errno_num }, 163 + [229] = { "fsetattrlist", NULL, print_errno_num }, 164 + [230] = { "poll", NULL, print_errno_num }, 165 + [231] = { "watchevent", NULL, print_errno_num }, 166 + [232] = { "waitevent", NULL, print_errno_num }, 167 + [233] = { "modwatch", NULL, print_errno_num }, 168 + [234] = { "getxattr", NULL, print_errno_num }, 169 + [235] = { "fgetxattr", NULL, print_errno_num }, 170 + [236] = { "setxattr", NULL, print_errno_num }, 171 + [237] = { "fsetxattr", NULL, print_errno_num }, 172 + [238] = { "removexattr", NULL, print_errno_num }, 173 + [239] = { "fremovexattr", NULL, print_errno_num }, 174 + [240] = { "listxattr", NULL, print_errno_num }, 175 + [241] = { "flistxattr", NULL, print_errno_num }, 176 + [242] = { "fsctl", NULL, print_errno_num }, 177 + [243] = { "initgroups", NULL, print_errno_num }, 178 + [244] = { "posix_spawn", NULL, print_errno_num }, 179 + [245] = { "ffsctl", NULL, print_errno_num }, 180 + [247] = { "nfsclnt", NULL, print_errno_num }, 181 + [248] = { "fhopen", NULL, print_errno_num }, 182 + [250] = { "minherit", NULL, print_errno_num }, 183 + [251] = { "semsys", NULL, print_errno_num }, 184 + [252] = { "msgsys", NULL, print_errno_num }, 185 + [253] = { "shmsys", NULL, print_errno_num }, 186 + [254] = { "semctl", NULL, print_errno_num }, 187 + [255] = { "semget", NULL, print_errno_num }, 188 + [256] = { "semop", NULL, print_errno_num }, 189 + [258] = { "msgctl", NULL, print_errno_num }, 190 + [259] = { "msgget", NULL, print_errno_num }, 191 + [260] = { "msgsnd", NULL, print_errno_num }, 192 + [261] = { "msgrcv", NULL, print_errno_num }, 193 + [262] = { "shmat", NULL, print_errno_num }, 194 + [263] = { "shmctl", NULL, print_errno_num }, 195 + [264] = { "shmdt", NULL, print_errno_num }, 196 + [265] = { "shmget", NULL, print_errno_num }, 197 + [266] = { "shm_open", NULL, print_errno_num }, 198 + [267] = { "shm_unlink", NULL, print_errno_num }, 199 + [268] = { "sem_open", NULL, print_errno_num }, 200 + [269] = { "sem_close", NULL, print_errno_num }, 201 + [270] = { "sem_unlink", NULL, print_errno_num }, 202 + [271] = { "sem_wait", NULL, print_errno_num }, 203 + [272] = { "sem_trywait", NULL, print_errno_num }, 204 + [273] = { "sem_post", NULL, print_errno_num }, 205 + [274] = { "sysctlbyname", NULL, print_errno_num }, 206 + [277] = { "open_extended", NULL, print_errno_num }, 207 + [278] = { "umask_extended", NULL, print_errno_num }, 208 + [279] = { "stat_extended", NULL, print_errno_num }, 209 + [280] = { "lstat_extended", NULL, print_errno_num }, 210 + [281] = { "fstat_extended", NULL, print_errno_num }, 211 + [282] = { "chmod_extended", NULL, print_errno_num }, 212 + [283] = { "fchmod_extended", NULL, print_errno_num }, 213 + [284] = { "access_extended", NULL, print_errno_num }, 214 + [285] = { "settid", NULL, print_errno_num }, 215 + [286] = { "gettid", NULL, print_errno_num }, 216 + [287] = { "setsgroups", NULL, print_errno_num }, 217 + [288] = { "getsgroups", NULL, print_errno_num }, 218 + [289] = { "setwgroups", NULL, print_errno_num }, 219 + [290] = { "getwgroups", NULL, print_errno_num }, 220 + [291] = { "mkfifo_extended", NULL, print_errno_num }, 221 + [292] = { "mkdir_extended", NULL, print_errno_num }, 222 + [293] = { "identitysvc", NULL, print_errno_num }, 223 + [294] = { "shared_region_check_np", NULL, print_errno_num }, 224 + [296] = { "vm_pressure_monitor", NULL, print_errno_num }, 225 + [297] = { "psynch_rw_longrdlock", NULL, print_errno_num }, 226 + [298] = { "psynch_rw_yieldwrlock", NULL, print_errno_num }, 227 + [299] = { "psynch_rw_downgrade", NULL, print_errno_num }, 228 + [300] = { "psynch_rw_upgrade", NULL, print_errno_num }, 229 + [301] = { "psynch_mutexwait", NULL, print_errno_num }, 230 + [302] = { "psynch_mutexdrop", NULL, print_errno_num }, 231 + [303] = { "psynch_cvbroad", NULL, print_errno_num }, 232 + [304] = { "psynch_cvsignal", NULL, print_errno_num }, 233 + [305] = { "psynch_cvwait", NULL, print_errno_num }, 234 + [306] = { "psynch_rw_rdlock", NULL, print_errno_num }, 235 + [307] = { "psynch_rw_wrlock", NULL, print_errno_num }, 236 + [308] = { "psynch_rw_unlock", NULL, print_errno_num }, 237 + [309] = { "psynch_rw_unlock2", NULL, print_errno_num }, 238 + [310] = { "getsid", NULL, print_errno_num }, 239 + [311] = { "settid_with_pid", NULL, print_errno_num }, 240 + [312] = { "psynch_cvclrprepost", NULL, print_errno_num }, 241 + [313] = { "aio_fsync", NULL, print_errno_num }, 242 + [314] = { "aio_return", NULL, print_errno_num }, 243 + [315] = { "aio_suspend", NULL, print_errno_num }, 244 + [316] = { "aio_cancel", NULL, print_errno_num }, 245 + [317] = { "aio_error", NULL, print_errno_num }, 246 + [318] = { "aio_read", NULL, print_errno_num }, 247 + [319] = { "aio_write", NULL, print_errno_num }, 248 + [320] = { "lio_listio", NULL, print_errno_num }, 249 + [322] = { "iopolicysys", NULL, print_errno_num }, 250 + [323] = { "process_policy", NULL, print_errno_num }, 251 + [324] = { "mlockall", NULL, print_errno_num }, 252 + [325] = { "munlockall", NULL, print_errno_num }, 253 + [327] = { "issetugid", NULL, print_errno_num }, 254 + [328] = { "__pthread_kill", NULL, print_errno_num }, 255 + [329] = { "__pthread_sigmask", NULL, print_errno_num }, 256 + [330] = { "__sigwait", NULL, print_errno_num }, 257 + [331] = { "__disable_threadsignal", NULL, print_errno_num }, 258 + [332] = { "__pthread_markcancel", NULL, print_errno_num }, 259 + [333] = { "__pthread_canceled", NULL, print_errno_num }, 260 + [334] = { "__semwait_signal", NULL, print_errno_num }, 261 + [336] = { "proc_info", NULL, print_errno_num }, 262 + [337] = { "sendfile", NULL, print_errno_num }, 263 + [338] = { "stat64", NULL, print_errno_num }, 264 + [339] = { "fstat64", NULL, print_errno_num }, 265 + [340] = { "lstat64", NULL, print_errno_num }, 266 + [341] = { "stat64_extended", NULL, print_errno_num }, 267 + [342] = { "lstat64_extended", NULL, print_errno_num }, 268 + [343] = { "fstat64_extended", NULL, print_errno_num }, 269 + [344] = { "getdirentries64", NULL, print_errno_num }, 270 + [345] = { "statfs64", NULL, print_errno_num }, 271 + [346] = { "fstatfs64", NULL, print_errno_num }, 272 + [347] = { "getfsstat64", NULL, print_errno_num }, 273 + [348] = { "__pthread_chdir", NULL, print_errno_num }, 274 + [349] = { "__pthread_fchdir", NULL, print_errno_num }, 275 + [350] = { "audit", NULL, print_errno_num }, 276 + [351] = { "auditon", NULL, print_errno_num }, 277 + [353] = { "getauid", NULL, print_errno_num }, 278 + [354] = { "setauid", NULL, print_errno_num }, 279 + [357] = { "getaudit_addr", NULL, print_errno_num }, 280 + [358] = { "setaudit_addr", NULL, print_errno_num }, 281 + [359] = { "auditctl", NULL, print_errno_num }, 282 + [360] = { "bsdthread_create", NULL, print_errno_num }, 283 + [361] = { "bsdthread_terminate", NULL, print_errno_num }, 284 + [362] = { "kqueue", NULL, print_errno_num }, 285 + [363] = { "kevent", NULL, print_errno_num }, 286 + [364] = { "lchown", NULL, print_errno_num }, 287 + [366] = { "bsdthread_register", NULL, print_errno_num }, 288 + [367] = { "workq_open", NULL, print_errno_num }, 289 + [368] = { "workq_kernreturn", NULL, print_errno_num }, 290 + [369] = { "kevent64", NULL, print_errno_num }, 291 + [370] = { "__old_semwait_signal", NULL, print_errno_num }, 292 + [371] = { "__old_semwait_signal_nocancel", NULL, print_errno_num }, 293 + [372] = { "thread_selfid", NULL, print_errno_num }, 294 + [373] = { "ledger", NULL, print_errno_num }, 295 + [374] = { "kevent_qos", NULL, print_errno_num }, 296 + [380] = { "__mac_execve", NULL, print_errno_num }, 297 + [381] = { "__mac_syscall", NULL, print_errno_num }, 298 + [382] = { "__mac_get_file", NULL, print_errno_num }, 299 + [383] = { "__mac_set_file", NULL, print_errno_num }, 300 + [384] = { "__mac_get_link", NULL, print_errno_num }, 301 + [385] = { "__mac_set_link", NULL, print_errno_num }, 302 + [386] = { "__mac_get_proc", NULL, print_errno_num }, 303 + [387] = { "__mac_set_proc", NULL, print_errno_num }, 304 + [388] = { "__mac_get_fd", NULL, print_errno_num }, 305 + [389] = { "__mac_set_fd", NULL, print_errno_num }, 306 + [390] = { "__mac_get_pid", NULL, print_errno_num }, 307 + [394] = { "pselect", NULL, print_errno_num }, 308 + [395] = { "pselect_nocancel", NULL, print_errno_num }, 309 + [396] = { "read_nocancel", NULL, print_errno_num }, 310 + [397] = { "write_nocancel", NULL, print_errno_num }, 311 + [398] = { "open_nocancel", NULL, print_errno_num }, 312 + [399] = { "close_nocancel", NULL, print_errno_num }, 313 + [400] = { "wait4_nocancel", NULL, print_errno_num }, 314 + [401] = { "recvmsg_nocancel", NULL, print_errno_num }, 315 + [402] = { "sendmsg_nocancel", NULL, print_errno_num }, 316 + [403] = { "recvfrom_nocancel", NULL, print_errno_num }, 317 + [404] = { "accept_nocancel", NULL, print_errno_num }, 318 + [405] = { "msync_nocancel", NULL, print_errno_num }, 319 + [406] = { "fcntl_nocancel", NULL, print_errno_num }, 320 + [407] = { "select_nocancel", NULL, print_errno_num }, 321 + [408] = { "fsync_nocancel", NULL, print_errno_num }, 322 + [409] = { "connect_nocancel", NULL, print_errno_num }, 323 + [410] = { "sigsuspend_nocancel", NULL, print_errno_num }, 324 + [411] = { "readv_nocancel", NULL, print_errno_num }, 325 + [412] = { "writev_nocancel", NULL, print_errno_num }, 326 + [413] = { "sendto_nocancel", NULL, print_errno_num }, 327 + [414] = { "pread_nocancel", NULL, print_errno_num }, 328 + [415] = { "pwrite_nocancel", NULL, print_errno_num }, 329 + [416] = { "waitid_nocancel", NULL, print_errno_num }, 330 + [417] = { "poll_nocancel", NULL, print_errno_num }, 331 + [418] = { "msgsnd_nocancel", NULL, print_errno_num }, 332 + [419] = { "msgrcv_nocancel", NULL, print_errno_num }, 333 + [420] = { "sem_wait_nocancel", NULL, print_errno_num }, 334 + [421] = { "aio_suspend_nocancel", NULL, print_errno_num }, 335 + [422] = { "__sigwait_nocancel", NULL, print_errno_num }, 336 + [423] = { "__semwait_signal_nocancel", NULL, print_errno_num }, 337 + [424] = { "__mac_mount", NULL, print_errno_num }, 338 + [425] = { "__mac_get_mount", NULL, print_errno_num }, 339 + [426] = { "__mac_getfsstat", NULL, print_errno_num }, 340 + [427] = { "fsgetpath", NULL, print_errno_num }, 341 + [428] = { "audit_session_self", NULL, print_errno_num }, 342 + [429] = { "audit_session_join", NULL, print_errno_num }, 343 + [430] = { "fileport_makeport", NULL, print_errno_num }, 344 + [431] = { "fileport_makefd", NULL, print_errno_num }, 345 + [432] = { "audit_session_port", NULL, print_errno_num }, 346 + [433] = { "pid_suspend", NULL, print_errno_num }, 347 + [434] = { "pid_resume", NULL, print_errno_num }, 348 + [438] = { "shared_region_map_and_slide_np", NULL, print_errno_num }, 349 + [439] = { "kas_info", NULL, print_errno_num }, 350 + [440] = { "memorystatus_control", NULL, print_errno_num }, 351 + [441] = { "guarded_open_np", NULL, print_errno_num }, 352 + [442] = { "guarded_close_np", NULL, print_errno_num }, 353 + [443] = { "guarded_kqueue_np", NULL, print_errno_num }, 354 + [444] = { "change_fdguard_np", NULL, print_errno_num }, 355 + [445] = { "usrctl", NULL, print_errno_num }, 356 + [446] = { "proc_rlimit_control", NULL, print_errno_num }, 357 + [447] = { "connectx", NULL, print_errno_num }, 358 + [448] = { "disconnectx", NULL, print_errno_num }, 359 + [449] = { "peeloff", NULL, print_errno_num }, 360 + [450] = { "socket_delegate", NULL, print_errno_num }, 361 + [451] = { "telemetry", NULL, print_errno_num }, 362 + [452] = { "proc_uuid_policy", NULL, print_errno_num }, 363 + [453] = { "memorystatus_get_level", NULL, print_errno_num }, 364 + [454] = { "system_override", NULL, print_errno_num }, 365 + [455] = { "vfs_purge", NULL, print_errno_num }, 366 + [456] = { "sfi_ctl", NULL, print_errno_num }, 367 + [457] = { "sfi_pidctl", NULL, print_errno_num }, 368 + [458] = { "coalition", NULL, print_errno_num }, 369 + [459] = { "coalition_info", NULL, print_errno_num }, 370 + [460] = { "necp_match_policy", NULL, print_errno_num }, 371 + [461] = { "getattrlistbulk", NULL, print_errno_num }, 372 + [462] = { "clonefileat", NULL, print_errno_num }, 373 + [463] = { "openat", NULL, print_errno_num }, 374 + [464] = { "openat_nocancel", NULL, print_errno_num }, 375 + [465] = { "renameat", NULL, print_errno_num }, 376 + [466] = { "faccessat", NULL, print_errno_num }, 377 + [467] = { "fchmodat", NULL, print_errno_num }, 378 + [468] = { "fchownat", NULL, print_errno_num }, 379 + [469] = { "fstatat", NULL, print_errno_num }, 380 + [470] = { "fstatat64", NULL, print_errno_num }, 381 + [471] = { "linkat", NULL, print_errno_num }, 382 + [472] = { "unlinkat", NULL, print_errno_num }, 383 + [473] = { "readlinkat", NULL, print_errno_num }, 384 + [474] = { "symlinkat", NULL, print_errno_num }, 385 + [475] = { "mkdirat", NULL, print_errno_num }, 386 + [476] = { "getattrlistat", NULL, print_errno_num }, 387 + [477] = { "proc_trace_log", NULL, print_errno_num }, 388 + [478] = { "bsdthread_ctl", NULL, print_errno_num }, 389 + [479] = { "openbyid_np", NULL, print_errno_num }, 390 + [480] = { "recvmsg_x", NULL, print_errno_num }, 391 + [481] = { "sendmsg_x", NULL, print_errno_num }, 392 + [482] = { "thread_selfusage", NULL, print_errno_num }, 393 + [483] = { "csrctl", NULL, print_errno_num }, 394 + [484] = { "guarded_open_dprotected_np", NULL, print_errno_num }, 395 + [485] = { "guarded_write_np", NULL, print_errno_num }, 396 + [486] = { "guarded_pwrite_np", NULL, print_errno_num }, 397 + [487] = { "guarded_writev_np", NULL, print_errno_num }, 398 + [488] = { "renameatx_np", NULL, print_errno_num }, 399 + [489] = { "mremap_encrypted", NULL, print_errno_num }, 400 + [490] = { "netagent_trigger", NULL, print_errno_num }, 401 + [491] = { "stack_snapshot_with_config", NULL, print_errno_num }, 402 + [492] = { "microstackshot", NULL, print_errno_num }, 403 + [493] = { "grab_pgo_data", NULL, print_errno_num }, 404 + [494] = { "persona", NULL, print_errno_num }, 405 + [499] = { "work_interval_ctl", NULL, print_errno_num }, 406 + [500] = { "getentropy", NULL, print_errno_num }, 407 + [501] = { "necp_open", NULL, print_errno_num }, 408 + [502] = { "necp_client_action", NULL, print_errno_num }, 409 + [515] = { "ulock_wait", NULL, print_errno_num }, 410 + [516] = { "ulock_wake", NULL, print_errno_num }, 411 + [517] = { "fclonefileat", NULL, print_errno_num }, 412 + [518] = { "fs_snapshot", NULL, print_errno_num }, 413 + [520] = { "terminate_with_payload", NULL, print_errno_num }, 414 + [521] = { "abort_with_payload", NULL, print_errno_num }, 415 + }; 416 + 417 + extern "C" 418 + void darling_bsd_syscall_entry_print(int nr, void* args[]) 419 + { 420 + bsd_call_nr = nr; 421 + handle_generic_entry(bsd_defs, "bsd", bsd_call_nr, args); 422 + } 423 + 424 + extern "C" 425 + void darling_bsd_syscall_exit_print(uintptr_t retval) 426 + { 427 + handle_generic_exit(bsd_defs, "bsd", bsd_call_nr, retval); 428 + bsd_call_nr = -1; 429 + } 430 + 431 + const char* error_strings[128] = { 432 + [1] = "EPERM", 433 + [2] = "ENOENT", 434 + [3] = "ESRCH", 435 + [4] = "EINTR", 436 + [5] = "EIO", 437 + [6] = "ENXIO", 438 + [7] = "E2BIG", 439 + [8] = "ENOEXEC", 440 + [9] = "EBADF", 441 + [10] = "ECHILD", 442 + [11] = "EDEADLK", 443 + [12] = "ENOMEM", 444 + [13] = "EACCES", 445 + [14] = "EFAULT", 446 + [15] = "ENOTBLK", 447 + [16] = "EBUSY", 448 + [17] = "EEXIST", 449 + [18] = "EXDEV", 450 + [19] = "ENODEV", 451 + [20] = "ENOTDIR", 452 + [21] = "EISDIR", 453 + [22] = "EINVAL", 454 + [23] = "ENFILE", 455 + [24] = "EMFILE", 456 + [25] = "ENOTTY", 457 + [26] = "ETXTBSY", 458 + [27] = "EFBIG", 459 + [28] = "ENOSPC", 460 + [29] = "ESPIPE", 461 + [30] = "EROFS", 462 + [31] = "EMLINK", 463 + [32] = "EPIPE", 464 + [33] = "EDOM", 465 + [34] = "ERANGE", 466 + [35] = "EAGAIN", 467 + [36] = "EINPROGRESS", 468 + [37] = "EALREADY", 469 + [38] = "ENOTSOCK", 470 + [39] = "EDESTADDRREQ", 471 + [40] = "EMSGSIZE", 472 + [41] = "EPROTOTYPE", 473 + [42] = "ENOPROTOOPT", 474 + [43] = "EPROTONOSUPPORT", 475 + [44] = "ESOCKTNOSUPPORT", 476 + [45] = "ENOTSUP", 477 + [46] = "EPFNOSUPPORT", 478 + [47] = "EAFNOSUPPORT", 479 + [48] = "EADDRINUSE", 480 + [49] = "EADDRNOTAVAIL", 481 + [50] = "ENETDOWN", 482 + [51] = "ENETUNREACH", 483 + [52] = "ENETRESET", 484 + [53] = "ECONNABORTED", 485 + [54] = "ECONNRESET", 486 + [55] = "ENOBUFS", 487 + [56] = "EISCONN", 488 + [57] = "ENOTCONN", 489 + [58] = "ESHUTDOWN", 490 + [59] = "ETOOMANYREFS", 491 + [60] = "ETIMEDOUT", 492 + [61] = "ECONNREFUSED", 493 + [62] = "ELOOP", 494 + [63] = "ENAMETOOLONG", 495 + [64] = "EHOSTDOWN", 496 + [65] = "EHOSTUNREACH", 497 + [66] = "ENOTEMPTY", 498 + [67] = "EPROCLIM", 499 + [68] = "EUSERS", 500 + [69] = "EDQUOT", 501 + [70] = "ESTALE", 502 + [71] = "EREMOTE", 503 + [72] = "EBADRPC", 504 + [73] = "ERPCMISMATCH", 505 + [74] = "EPROGUNAVAIL", 506 + [75] = "EPROGMISMATCH", 507 + [76] = "EPROCUNAVAIL", 508 + [77] = "ENOLCK", 509 + [78] = "ENOSYS", 510 + [79] = "EFTYPE", 511 + [80] = "EAUTH", 512 + [81] = "ENEEDAUTH", 513 + [82] = "EPWROFF", 514 + [83] = "EDEVERR", 515 + [84] = "EOVERFLOW", 516 + [85] = "EBADEXEC", 517 + [86] = "EBADARCH", 518 + [87] = "ESHLIBVERS", 519 + [88] = "EBADMACHO", 520 + [89] = "ECANCELED", 521 + [90] = "EIDRM", 522 + [91] = "ENOMSG", 523 + [92] = "EILSEQ", 524 + [93] = "ENOATTR", 525 + [94] = "EBADMSG", 526 + [95] = "EMULTIHOP", 527 + [96] = "ENODATA", 528 + [97] = "ENOLINK", 529 + [98] = "ENOSR", 530 + [99] = "ENOSTR", 531 + [100] = "EPROTO", 532 + [101] = "ETIME", 533 + [102] = "EOPNOTSUPP", 534 + [103] = "ENOPOLICY", 535 + [104] = "ENOTRECOVERABLE", 536 + [105] = "EOWNERDEAD", 537 + [106] = "EQFULL", 538 + }; 539 + 540 + static void print_errno_num(char* buf, uintptr_t rv) 541 + { 542 + intptr_t v = (intptr_t)rv; 543 + if (v >= 0 || v < -4095) 544 + { 545 + __simple_sprintf(buf, "%d", rv); 546 + } 547 + else 548 + print_errno(buf, rv); 549 + } 550 + 551 + static void print_errno_ptr(char* buf, uintptr_t rv) 552 + { 553 + intptr_t v = (intptr_t)rv; 554 + if (v >= 0 || v < -4095) 555 + { 556 + __simple_sprintf(buf, "%p", rv); 557 + } 558 + else 559 + print_errno(buf, rv); 560 + } 561 + 562 + static void print_errno(char* buf, uintptr_t rv) 563 + { 564 + const char* error = NULL; 565 + intptr_t v = (intptr_t)rv; 566 + if (-v < 128) 567 + error = error_strings[-v]; 568 + if (error != NULL) 569 + __simple_sprintf(buf, "%s", error); 570 + else 571 + __simple_sprintf(buf, "%d", v); 572 + } 573 +
+4 -2
src/xtrace/simple.c
··· 1 1 #include "simple.h" 2 2 #include <stdarg.h> 3 3 #include <stddef.h> 4 - #include <unistd.h> 5 4 6 5 void __simple_vsprintf(char* buf, const char* format, va_list vl); 7 6 extern char* memchr(char* buf, int c, __SIZE_TYPE__ n); 7 + 8 + // We cannot call standard write(), because it would loop back to xtrace 9 + extern int __write_for_xtrace(int fd, const void* mem, __SIZE_TYPE__ count); 8 10 9 11 int __simple_strlen(const char* text) 10 12 { ··· 123 125 __simple_vsprintf(buffer, format, vl); 124 126 va_end(vl); 125 127 126 - write(2, buffer, __simple_strlen(buffer)); 128 + __write_for_xtrace(2, buffer, __simple_strlen(buffer)); 127 129 } 128 130 129 131 void __simple_sprintf(char *buffer, const char* format, ...)
+13
src/xtrace/trampoline.S
··· 34 34 trampoline_leave 35 35 ret 36 36 37 + .private_extern _darling_bsd_syscall_entry_trampoline 38 + _darling_bsd_syscall_entry_trampoline: 39 + trampoline_enter 40 + call _darling_bsd_syscall_entry_print 41 + trampoline_leave 42 + ret 43 + 44 + .private_extern _darling_bsd_syscall_exit_trampoline 45 + _darling_bsd_syscall_exit_trampoline: 46 + trampoline_enter 47 + call _darling_bsd_syscall_exit_print 48 + trampoline_leave 49 + ret 37 50
+39 -12
src/xtrace/xtracelib.c
··· 9 9 // Defined in assembly 10 10 extern void darling_mach_syscall_entry_trampoline(void); 11 11 extern void darling_mach_syscall_exit_trampoline(void); 12 + extern void darling_bsd_syscall_entry_trampoline(void); 13 + extern void darling_bsd_syscall_exit_trampoline(void); 12 14 extern int sys_thread_selfid(void); 13 15 14 16 #ifdef __x86_64__ ··· 24 26 // Defined in libsystem_kernel 25 27 extern struct hook* _darling_mach_syscall_entry; 26 28 extern struct hook* _darling_mach_syscall_exit; 29 + extern struct hook* _darling_bsd_syscall_entry; 30 + extern struct hook* _darling_bsd_syscall_exit; 31 + 32 + static void xtrace_setup_mach(void); 33 + static void xtrace_setup_bsd(void); 34 + static void setup_hook(struct hook* hook, void* fnptr); 27 35 28 36 __attribute__((constructor)) 29 37 void xtrace_setup() 30 38 { 39 + xtrace_setup_mach(); 40 + xtrace_setup_bsd(); 41 + } 42 + 43 + static void setup_hook(struct hook* hook, void* fnptr) 44 + { 45 + hook->movabs[0] = 0x49; 46 + hook->movabs[1] = 0xbc; 47 + hook->call[0] = 0x41; 48 + hook->call[1] = 0xff; 49 + hook->call[2] = 0xd4; 50 + hook->addr = (uintptr_t)fnptr; 51 + } 52 + 53 + static void xtrace_setup_mach(void) 54 + { 31 55 uintptr_t area = (uintptr_t)_darling_mach_syscall_entry; 32 56 33 57 // __asm__("int3"); ··· 35 59 36 60 mprotect((void*) area, 4096, PROT_READ | PROT_WRITE | PROT_EXEC); 37 61 38 - _darling_mach_syscall_entry->movabs[0] = 0x49; 39 - _darling_mach_syscall_entry->movabs[1] = 0xbc; 40 - _darling_mach_syscall_entry->call[0] = 0x41; 41 - _darling_mach_syscall_entry->call[1] = 0xff; 42 - _darling_mach_syscall_entry->call[2] = 0xd4; 62 + setup_hook(_darling_mach_syscall_entry, darling_mach_syscall_entry_trampoline); 63 + setup_hook(_darling_mach_syscall_exit, darling_mach_syscall_exit_trampoline); 64 + 65 + mprotect((void*) area, 4096, PROT_READ | PROT_EXEC); 66 + } 67 + 68 + static void xtrace_setup_bsd(void) 69 + { 70 + uintptr_t area = (uintptr_t)_darling_bsd_syscall_entry; 71 + 72 + // __asm__("int3"); 73 + area &= ~(4096-1); 43 74 44 - _darling_mach_syscall_exit->movabs[0] = 0x49; 45 - _darling_mach_syscall_exit->movabs[1] = 0xbc; 46 - _darling_mach_syscall_exit->call[0] = 0x41; 47 - _darling_mach_syscall_exit->call[1] = 0xff; 48 - _darling_mach_syscall_exit->call[2] = 0xd4; 75 + mprotect((void*) area, 4096, PROT_READ | PROT_WRITE | PROT_EXEC); 49 76 50 - _darling_mach_syscall_entry->addr = (uint64_t)darling_mach_syscall_entry_trampoline; 51 - _darling_mach_syscall_exit->addr = (uint64_t)darling_mach_syscall_exit_trampoline; 77 + setup_hook(_darling_bsd_syscall_entry, darling_bsd_syscall_entry_trampoline); 78 + setup_hook(_darling_bsd_syscall_exit, darling_bsd_syscall_exit_trampoline); 52 79 53 80 mprotect((void*) area, 4096, PROT_READ | PROT_EXEC); 54 81 }
+72
tools/stub-gen-c-func.py
··· 1 + # This file is part of Darling. 2 + # 3 + # Copyright (C) 2017 Lubos Dolezel 4 + # 5 + # Darling is free software: you can redistribute it and/or modify 6 + # it under the terms of the GNU General Public License as published by 7 + # the Free Software Foundation, either version 3 of the License, or 8 + # (at your option) any later version. 9 + # 10 + # Darling is distributed in the hope that it will be useful, 11 + # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + # GNU General Public License for more details. 14 + # 15 + # You should have received a copy of the GNU General Public License 16 + # along with Darling. If not, see <http://www.gnu.org/licenses/>. 17 + 18 + import sys 19 + import subprocess 20 + 21 + def usage(): 22 + print("Usage: %s <Mach-O> <output directory>" % sys.argv[0]) 23 + 24 + if len(sys.argv) != 3: 25 + usage() 26 + 27 + macho = sys.argv[1] 28 + dest = sys.argv[2] 29 + 30 + out = subprocess.check_output(["nm", "-Ug", macho]) 31 + 32 + functions = [] 33 + for line in out.splitlines(): 34 + if line == "": 35 + continue 36 + address, id, name = line.split(" ") 37 + # Remove the underscore 38 + name = name[1 : ] 39 + 40 + if id == "T": 41 + functions.append(name) 42 + 43 + header = open(dest + "/functions.h", "w") 44 + source = open(dest + "/functions.c", "w") 45 + 46 + copyright ="""/* 47 + This file is part of Darling. 48 + 49 + Copyright (C) 2017 Lubos Dolezel 50 + 51 + Darling is free software: you can redistribute it and/or modify 52 + it under the terms of the GNU General Public License as published by 53 + the Free Software Foundation, either version 3 of the License, or 54 + (at your option) any later version. 55 + 56 + Darling is distributed in the hope that it will be useful, 57 + but WITHOUT ANY WARRANTY; without even the implied warranty of 58 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 59 + GNU General Public License for more details. 60 + 61 + You should have received a copy of the GNU General Public License 62 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 63 + */ 64 + 65 + """ 66 + 67 + header.write(copyright) 68 + source.write(copyright) 69 + 70 + for funcname in functions: 71 + header.write("void %s(void);\n" % funcname) 72 + source.write("void %s(void) { }\n" % funcname)