diff --git a/GVFS.sln b/GVFS.sln
index 2cee10493b..b79f30d251 100644
--- a/GVFS.sln
+++ b/GVFS.sln
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.27428.2015
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30509.20
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DCE11095-DA5F-4878-B58D-2702765560F5}"
ProjectSection(SolutionItems) = preProject
@@ -58,8 +58,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Service.Windows", "GVF
{24D161E9-D1F0-4299-BBD3-5D940BEDD535} = {24D161E9-D1F0-4299-BBD3-5D940BEDD535}
EndProjectSection
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Service.Mac", "GVFS\GVFS.Service\GVFS.Service.Mac.csproj", "{03769A07-F216-456B-886B-E07CAF6C5E81}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.ReadObjectHook.Windows", "GVFS\GVFS.ReadObjectHook\GVFS.ReadObjectHook.Windows.vcxproj", "{5A6656D5-81C7-472C-9DC8-32D071CB2258}"
ProjectSection(ProjectDependencies) = postProject
{A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574}
@@ -92,23 +90,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Installer.Windows", "G
{2F63B22B-EE26-4266-BF17-28A9146483A1} = {2F63B22B-EE26-4266-BF17-28A9146483A1}
EndProjectSection
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Installer.Mac", "GVFS\GVFS.Installer.Mac\GVFS.Installer.Mac.csproj", "{25229A04-6554-49B1-A95A-3F3B76C5B0C8}"
- ProjectSection(ProjectDependencies) = postProject
- {03769A07-F216-456B-886B-E07CAF6C5E81} = {03769A07-F216-456B-886B-E07CAF6C5E81}
- {4CC2A90D-D240-4382-B4BF-5E175515E492} = {4CC2A90D-D240-4382-B4BF-5E175515E492}
- {28939122-7263-41E7-A7E2-CBFB01AD6A04} = {28939122-7263-41E7-A7E2-CBFB01AD6A04}
- {A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574}
- {F468B05A-95E5-46BC-8C67-B80A78527B7D} = {F468B05A-95E5-46BC-8C67-B80A78527B7D}
- {1DAC3DA6-3D21-4917-B9A8-D60C8712252A} = {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}
- {FAC6EFC5-A890-4CB2-8C80-6358E358C637} = {FAC6EFC5-A890-4CB2-8C80-6358E358C637}
- {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09} = {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09}
- {35CA4DFB-1320-4055-B8F6-F12E0F252FF0} = {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}
- {AECEC217-2499-403D-B0BB-2962B9BE5970} = {AECEC217-2499-403D-B0BB-2962B9BE5970}
- EndProjectSection
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.SignFiles", "GVFS\GVFS.SignFiles\GVFS.SignFiles.csproj", "{2F63B22B-EE26-4266-BF17-28A9146483A1}"
ProjectSection(ProjectDependencies) = postProject
{17498502-AEFF-4E70-90CC-1D0B56A8ADF5} = {17498502-AEFF-4E70-90CC-1D0B56A8ADF5}
+ {AECEC217-2499-403D-B0BB-2962B9BE5970} = {AECEC217-2499-403D-B0BB-2962B9BE5970}
{1118B427-7063-422F-83B9-5023C8EC5A7A} = {1118B427-7063-422F-83B9-5023C8EC5A7A}
{2D23AB54-541F-4ABC-8DCA-08C199E97ABB} = {2D23AB54-541F-4ABC-8DCA-08C199E97ABB}
{F468B05A-95E5-46BC-8C67-B80A78527B7D} = {F468B05A-95E5-46BC-8C67-B80A78527B7D}
@@ -121,7 +106,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.SignFiles", "GVFS\GVFS
{4CE404E7-D3FC-471C-993C-64615861EA63} = {4CE404E7-D3FC-471C-993C-64615861EA63}
{24D161E9-D1F0-4299-BBD3-5D940BEDD535} = {24D161E9-D1F0-4299-BBD3-5D940BEDD535}
{93B403FD-DAFB-46C5-9636-B122792A548A} = {93B403FD-DAFB-46C5-9636-B122792A548A}
- {AECEC217-2499-403D-B0BB-2962B9BE5970} = {AECEC217-2499-403D-B0BB-2962B9BE5970}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.VirtualFileSystemHook.Windows", "GVFS\GVFS.VirtualFileSystemHook\GVFS.VirtualFileSystemHook.Windows.vcxproj", "{2D23AB54-541F-4ABC-8DCA-08C199E97ABB}"
@@ -131,18 +115,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.VirtualFileSystemHook.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Virtualization", "GVFS\GVFS.Virtualization\GVFS.Virtualization.csproj", "{F468B05A-95E5-46BC-8C67-B80A78527B7D}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrjFSLib.Mac.Managed", "ProjFS.Mac\PrjFSLib.Mac.Managed\PrjFSLib.Mac.Managed.csproj", "{FAC6EFC5-A890-4CB2-8C80-6358E358C637}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Platform.Mac", "GVFS\GVFS.Platform.Mac\GVFS.Platform.Mac.csproj", "{1DAC3DA6-3D21-4917-B9A8-D60C8712252A}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Platform.POSIX", "GVFS\GVFS.Platform.POSIX\GVFS.Platform.POSIX.csproj", "{15FAE44C-0D21-4312-9FD3-28F05A5AB7A6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.UnitTests", "GVFS\GVFS.UnitTests\GVFS.UnitTests.csproj", "{0D434FA7-6D8C-481E-B0CE-779B59EAEF53}"
+ ProjectSection(ProjectDependencies) = postProject
+ {93B403FD-DAFB-46C5-9636-B122792A548A} = {93B403FD-DAFB-46C5-9636-B122792A548A}
+ EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Platform.Windows", "GVFS\GVFS.Platform.Windows\GVFS.Platform.Windows.csproj", "{4CE404E7-D3FC-471C-993C-64615861EA63}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Mac", "GVFS\GVFS\GVFS.Mac.csproj", "{28939122-7263-41E7-A7E2-CBFB01AD6A04}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Windows", "GVFS\GVFS\GVFS.Windows.csproj", "{32220664-594C-4425-B9A0-88E0BE2F3D2A}"
ProjectSection(ProjectDependencies) = postProject
{2D23AB54-541F-4ABC-8DCA-08C199E97ABB} = {2D23AB54-541F-4ABC-8DCA-08C199E97ABB}
@@ -160,8 +141,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Mount.Windows", "GVFS\
{24D161E9-D1F0-4299-BBD3-5D940BEDD535} = {24D161E9-D1F0-4299-BBD3-5D940BEDD535}
EndProjectSection
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Mount.Mac", "GVFS\GVFS.Mount\GVFS.Mount.Mac.csproj", "{35CA4DFB-1320-4055-B8F6-F12E0F252FF0}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.FunctionalTests.Windows", "GVFS\GVFS.FunctionalTests.Windows\GVFS.FunctionalTests.Windows.csproj", "{0F0A008E-AB12-40EC-A671-37A541B08C7F}"
ProjectSection(ProjectDependencies) = postProject
{17498502-AEFF-4E70-90CC-1D0B56A8ADF5} = {17498502-AEFF-4E70-90CC-1D0B56A8ADF5}
@@ -176,22 +155,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.FunctionalTests", "GVF
ProjectSection(ProjectDependencies) = postProject
{17498502-AEFF-4E70-90CC-1D0B56A8ADF5} = {17498502-AEFF-4E70-90CC-1D0B56A8ADF5}
{07F2A520-2AB7-46DD-97C0-75D8E988D55B} = {07F2A520-2AB7-46DD-97C0-75D8E988D55B}
- {28939122-7263-41E7-A7E2-CBFB01AD6A04} = {28939122-7263-41E7-A7E2-CBFB01AD6A04}
{3771C555-B5C1-45E2-B8B7-2CEF1619CDC5} = {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5}
{32220664-594C-4425-B9A0-88E0BE2F3D2A} = {32220664-594C-4425-B9A0-88E0BE2F3D2A}
{FA273F69-5762-43D8-AEA1-B4F08090D624} = {FA273F69-5762-43D8-AEA1-B4F08090D624}
{B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B} = {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B}
{BDA91EE5-C684-4FC5-A90A-B7D677421917} = {BDA91EE5-C684-4FC5-A90A-B7D677421917}
- {35CA4DFB-1320-4055-B8F6-F12E0F252FF0} = {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.FunctionalTests.LockHolder", "GVFS\GVFS.FunctionalTests.LockHolder\GVFS.FunctionalTests.LockHolder.csproj", "{FA273F69-5762-43D8-AEA1-B4F08090D624}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Hooks.Mac", "GVFS\GVFS.Hooks\GVFS.Hooks.Mac.csproj", "{4CC2A90D-D240-4382-B4BF-5E175515E492}"
- ProjectSection(ProjectDependencies) = postProject
- {A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574}
- EndProjectSection
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Upgrader", "GVFS\GVFS.Upgrader\GVFS.Upgrader.csproj", "{AECEC217-2499-403D-B0BB-2962B9BE5970}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.PostIndexChangedHook.Windows", "GVFS\GVFS.PostIndexChangedHook\GVFS.PostIndexChangedHook.Windows.vcxproj", "{24D161E9-D1F0-4299-BBD3-5D940BEDD535}"
@@ -261,14 +233,6 @@ Global
{B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B}.Release.Mac|x64.ActiveCfg = Release|x64
{B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B}.Release.Windows|x64.ActiveCfg = Release|x64
{B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B}.Release.Windows|x64.Build.0 = Release|x64
- {03769A07-F216-456B-886B-E07CAF6C5E81}.Debug.Mac|x64.ActiveCfg = Debug|x64
- {03769A07-F216-456B-886B-E07CAF6C5E81}.Debug.Mac|x64.Build.0 = Debug|x64
- {03769A07-F216-456B-886B-E07CAF6C5E81}.Debug.Windows|x64.ActiveCfg = Debug|x64
- {03769A07-F216-456B-886B-E07CAF6C5E81}.Debug.Windows|x64.Build.0 = Debug|x64
- {03769A07-F216-456B-886B-E07CAF6C5E81}.Release.Mac|x64.ActiveCfg = Release|x64
- {03769A07-F216-456B-886B-E07CAF6C5E81}.Release.Mac|x64.Build.0 = Release|x64
- {03769A07-F216-456B-886B-E07CAF6C5E81}.Release.Windows|x64.ActiveCfg = Release|x64
- {03769A07-F216-456B-886B-E07CAF6C5E81}.Release.Windows|x64.Build.0 = Release|x64
{5A6656D5-81C7-472C-9DC8-32D071CB2258}.Debug.Mac|x64.ActiveCfg = Debug|x64
{5A6656D5-81C7-472C-9DC8-32D071CB2258}.Debug.Windows|x64.ActiveCfg = Debug|x64
{5A6656D5-81C7-472C-9DC8-32D071CB2258}.Debug.Windows|x64.Build.0 = Debug|x64
@@ -305,12 +269,6 @@ Global
{3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893}.Release.Mac|x64.ActiveCfg = Release|x64
{3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893}.Release.Windows|x64.ActiveCfg = Release|x64
{3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893}.Release.Windows|x64.Build.0 = Release|x64
- {25229A04-6554-49B1-A95A-3F3B76C5B0C8}.Debug.Mac|x64.ActiveCfg = Debug|x64
- {25229A04-6554-49B1-A95A-3F3B76C5B0C8}.Debug.Mac|x64.Build.0 = Debug|x64
- {25229A04-6554-49B1-A95A-3F3B76C5B0C8}.Debug.Windows|x64.ActiveCfg = Debug|x64
- {25229A04-6554-49B1-A95A-3F3B76C5B0C8}.Release.Mac|x64.ActiveCfg = Release|x64
- {25229A04-6554-49B1-A95A-3F3B76C5B0C8}.Release.Mac|x64.Build.0 = Release|x64
- {25229A04-6554-49B1-A95A-3F3B76C5B0C8}.Release.Windows|x64.ActiveCfg = Release|x64
{2F63B22B-EE26-4266-BF17-28A9146483A1}.Debug.Mac|x64.ActiveCfg = Debug|x64
{2F63B22B-EE26-4266-BF17-28A9146483A1}.Debug.Windows|x64.ActiveCfg = Debug|x64
{2F63B22B-EE26-4266-BF17-28A9146483A1}.Debug.Windows|x64.Build.0 = Debug|x64
@@ -331,22 +289,6 @@ Global
{F468B05A-95E5-46BC-8C67-B80A78527B7D}.Release.Mac|x64.Build.0 = Release|x64
{F468B05A-95E5-46BC-8C67-B80A78527B7D}.Release.Windows|x64.ActiveCfg = Release|x64
{F468B05A-95E5-46BC-8C67-B80A78527B7D}.Release.Windows|x64.Build.0 = Release|x64
- {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Debug.Mac|x64.ActiveCfg = Debug|x64
- {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Debug.Mac|x64.Build.0 = Debug|x64
- {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Debug.Windows|x64.ActiveCfg = Debug|x64
- {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Debug.Windows|x64.Build.0 = Debug|x64
- {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Release.Mac|x64.ActiveCfg = Release|x64
- {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Release.Mac|x64.Build.0 = Release|x64
- {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Release.Windows|x64.ActiveCfg = Release|x64
- {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Release.Windows|x64.Build.0 = Release|x64
- {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Debug.Mac|x64.ActiveCfg = Debug|x64
- {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Debug.Mac|x64.Build.0 = Debug|x64
- {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Debug.Windows|x64.ActiveCfg = Debug|x64
- {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Debug.Windows|x64.Build.0 = Debug|x64
- {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Release.Mac|x64.ActiveCfg = Release|x64
- {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Release.Mac|x64.Build.0 = Release|x64
- {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Release.Windows|x64.ActiveCfg = Release|x64
- {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Release.Windows|x64.Build.0 = Release|x64
{15FAE44C-0D21-4312-9FD3-28F05A5AB7A6}.Debug.Mac|x64.ActiveCfg = Debug|x64
{15FAE44C-0D21-4312-9FD3-28F05A5AB7A6}.Debug.Mac|x64.Build.0 = Debug|x64
{15FAE44C-0D21-4312-9FD3-28F05A5AB7A6}.Debug.Windows|x64.ActiveCfg = Debug|x64
@@ -369,14 +311,6 @@ Global
{4CE404E7-D3FC-471C-993C-64615861EA63}.Release.Mac|x64.ActiveCfg = Release|x64
{4CE404E7-D3FC-471C-993C-64615861EA63}.Release.Windows|x64.ActiveCfg = Release|x64
{4CE404E7-D3FC-471C-993C-64615861EA63}.Release.Windows|x64.Build.0 = Release|x64
- {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Debug.Mac|x64.ActiveCfg = Debug|x64
- {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Debug.Mac|x64.Build.0 = Debug|x64
- {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Debug.Windows|x64.ActiveCfg = Debug|x64
- {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Debug.Windows|x64.Build.0 = Debug|x64
- {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Release.Mac|x64.ActiveCfg = Release|x64
- {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Release.Mac|x64.Build.0 = Release|x64
- {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Release.Windows|x64.ActiveCfg = Release|x64
- {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Release.Windows|x64.Build.0 = Release|x64
{32220664-594C-4425-B9A0-88E0BE2F3D2A}.Debug.Mac|x64.ActiveCfg = Debug|x64
{32220664-594C-4425-B9A0-88E0BE2F3D2A}.Debug.Windows|x64.ActiveCfg = Debug|x64
{32220664-594C-4425-B9A0-88E0BE2F3D2A}.Debug.Windows|x64.Build.0 = Debug|x64
@@ -389,14 +323,6 @@ Global
{17498502-AEFF-4E70-90CC-1D0B56A8ADF5}.Release.Mac|x64.ActiveCfg = Release|x64
{17498502-AEFF-4E70-90CC-1D0B56A8ADF5}.Release.Windows|x64.ActiveCfg = Release|x64
{17498502-AEFF-4E70-90CC-1D0B56A8ADF5}.Release.Windows|x64.Build.0 = Release|x64
- {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Debug.Mac|x64.ActiveCfg = Debug|x64
- {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Debug.Mac|x64.Build.0 = Debug|x64
- {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Debug.Windows|x64.ActiveCfg = Debug|x64
- {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Debug.Windows|x64.Build.0 = Debug|x64
- {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Release.Mac|x64.ActiveCfg = Release|x64
- {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Release.Mac|x64.Build.0 = Release|x64
- {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Release.Windows|x64.ActiveCfg = Release|x64
- {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Release.Windows|x64.Build.0 = Release|x64
{0F0A008E-AB12-40EC-A671-37A541B08C7F}.Debug.Mac|x64.ActiveCfg = Debug|x64
{0F0A008E-AB12-40EC-A671-37A541B08C7F}.Debug.Windows|x64.ActiveCfg = Debug|x64
{0F0A008E-AB12-40EC-A671-37A541B08C7F}.Debug.Windows|x64.Build.0 = Debug|x64
@@ -419,22 +345,14 @@ Global
{FA273F69-5762-43D8-AEA1-B4F08090D624}.Release.Mac|x64.Build.0 = Release|x64
{FA273F69-5762-43D8-AEA1-B4F08090D624}.Release.Windows|x64.ActiveCfg = Release|x64
{FA273F69-5762-43D8-AEA1-B4F08090D624}.Release.Windows|x64.Build.0 = Release|x64
- {4CC2A90D-D240-4382-B4BF-5E175515E492}.Debug.Mac|x64.ActiveCfg = Debug|x64
- {4CC2A90D-D240-4382-B4BF-5E175515E492}.Debug.Mac|x64.Build.0 = Debug|x64
- {4CC2A90D-D240-4382-B4BF-5E175515E492}.Debug.Windows|x64.ActiveCfg = Debug|x64
- {4CC2A90D-D240-4382-B4BF-5E175515E492}.Debug.Windows|x64.Build.0 = Debug|x64
- {4CC2A90D-D240-4382-B4BF-5E175515E492}.Release.Mac|x64.ActiveCfg = Release|x64
- {4CC2A90D-D240-4382-B4BF-5E175515E492}.Release.Mac|x64.Build.0 = Release|x64
- {4CC2A90D-D240-4382-B4BF-5E175515E492}.Release.Windows|x64.ActiveCfg = Release|x64
- {4CC2A90D-D240-4382-B4BF-5E175515E492}.Release.Windows|x64.Build.0 = Release|x64
{AECEC217-2499-403D-B0BB-2962B9BE5970}.Debug.Mac|x64.ActiveCfg = Debug|x64
+ {AECEC217-2499-403D-B0BB-2962B9BE5970}.Debug.Mac|x64.Build.0 = Debug|x64
{AECEC217-2499-403D-B0BB-2962B9BE5970}.Debug.Windows|x64.ActiveCfg = Debug|x64
{AECEC217-2499-403D-B0BB-2962B9BE5970}.Debug.Windows|x64.Build.0 = Debug|x64
{AECEC217-2499-403D-B0BB-2962B9BE5970}.Release.Mac|x64.ActiveCfg = Release|x64
+ {AECEC217-2499-403D-B0BB-2962B9BE5970}.Release.Mac|x64.Build.0 = Release|x64
{AECEC217-2499-403D-B0BB-2962B9BE5970}.Release.Windows|x64.ActiveCfg = Release|x64
{AECEC217-2499-403D-B0BB-2962B9BE5970}.Release.Windows|x64.Build.0 = Release|x64
- {AECEC217-2499-403D-B0BB-2962B9BE5970}.Debug.Mac|x64.Build.0 = Debug|x64
- {AECEC217-2499-403D-B0BB-2962B9BE5970}.Release.Mac|x64.Build.0 = Release|x64
{24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Debug.Mac|x64.ActiveCfg = Debug|x64
{24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Debug.Windows|x64.ActiveCfg = Debug|x64
{24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Debug.Windows|x64.Build.0 = Debug|x64
@@ -454,30 +372,23 @@ Global
{3771C555-B5C1-45E2-B8B7-2CEF1619CDC5} = {C41F10F9-1163-4CFA-A465-EA728F75E9FA}
{BDA91EE5-C684-4FC5-A90A-B7D677421917} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
{B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
- {03769A07-F216-456B-886B-E07CAF6C5E81} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
{5A6656D5-81C7-472C-9DC8-32D071CB2258} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
{28674A4B-1223-4633-A460-C8CC39B09318} = {DCE11095-DA5F-4878-B58D-2702765560F5}
{C5D3CA26-562F-4CA4-A378-B93E97A730E3} = {C41F10F9-1163-4CFA-A465-EA728F75E9FA}
{93B403FD-DAFB-46C5-9636-B122792A548A} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
{A4984251-840E-4622-AD0C-66DFCE2B2574} = {AB0D9230-3893-4486-8899-F9C871FB5D5F}
{3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
- {25229A04-6554-49B1-A95A-3F3B76C5B0C8} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
{2F63B22B-EE26-4266-BF17-28A9146483A1} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
{2D23AB54-541F-4ABC-8DCA-08C199E97ABB} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
{F468B05A-95E5-46BC-8C67-B80A78527B7D} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
- {FAC6EFC5-A890-4CB2-8C80-6358E358C637} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
- {1DAC3DA6-3D21-4917-B9A8-D60C8712252A} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
{15FAE44C-0D21-4312-9FD3-28F05A5AB7A6} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
{0D434FA7-6D8C-481E-B0CE-779B59EAEF53} = {C41F10F9-1163-4CFA-A465-EA728F75E9FA}
{4CE404E7-D3FC-471C-993C-64615861EA63} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
- {28939122-7263-41E7-A7E2-CBFB01AD6A04} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
{32220664-594C-4425-B9A0-88E0BE2F3D2A} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
{17498502-AEFF-4E70-90CC-1D0B56A8ADF5} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
- {35CA4DFB-1320-4055-B8F6-F12E0F252FF0} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
{0F0A008E-AB12-40EC-A671-37A541B08C7F} = {C41F10F9-1163-4CFA-A465-EA728F75E9FA}
{BD7C5776-82F2-40C6-AF01-B3CC1E2D83AF} = {C41F10F9-1163-4CFA-A465-EA728F75E9FA}
{FA273F69-5762-43D8-AEA1-B4F08090D624} = {C41F10F9-1163-4CFA-A465-EA728F75E9FA}
- {4CC2A90D-D240-4382-B4BF-5E175515E492} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
{AECEC217-2499-403D-B0BB-2962B9BE5970} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
{24D161E9-D1F0-4299-BBD3-5D940BEDD535} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}
EndGlobalSection
diff --git a/GVFS/GVFS.FunctionalTests.LockHolder/AcquireGVFSLock.cs b/GVFS/GVFS.FunctionalTests.LockHolder/AcquireGVFSLock.cs
index a1e47f35d5..2a64fdeadc 100644
--- a/GVFS/GVFS.FunctionalTests.LockHolder/AcquireGVFSLock.cs
+++ b/GVFS/GVFS.FunctionalTests.LockHolder/AcquireGVFSLock.cs
@@ -1,7 +1,6 @@
using CommandLine;
using GVFS.Common;
using GVFS.Common.NamedPipes;
-using GVFS.Platform.Mac;
using GVFS.Platform.Windows;
using System;
using System.Diagnostics;
@@ -43,11 +42,6 @@ public void Execute()
private static bool TryGetGVFSEnlistmentRootImplementation(string directory, out string enlistmentRoot, out string errorMessage)
{
- if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
- {
- return MacPlatform.TryGetGVFSEnlistmentRootImplementation(directory, out enlistmentRoot, out errorMessage);
- }
-
// Not able to use WindowsPlatform here - because of its dependency on WindowsIdentity (and also kernel32.dll).
enlistmentRoot = null;
@@ -70,11 +64,6 @@ private static bool TryGetGVFSEnlistmentRootImplementation(string directory, out
private static string GetNamedPipeNameImplementation(string enlistmentRoot)
{
- if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
- {
- return MacPlatform.GetNamedPipeNameImplementation(enlistmentRoot);
- }
-
// Not able to use WindowsPlatform here - because of its dependency on WindowsIdentity (and also kernel32.dll).
return "GVFS_" + enlistmentRoot.ToUpper().Replace(':', '_');
}
diff --git a/GVFS/GVFS.FunctionalTests.LockHolder/GVFS.FunctionalTests.LockHolder.csproj b/GVFS/GVFS.FunctionalTests.LockHolder/GVFS.FunctionalTests.LockHolder.csproj
index 82a673437f..837fd98698 100644
--- a/GVFS/GVFS.FunctionalTests.LockHolder/GVFS.FunctionalTests.LockHolder.csproj
+++ b/GVFS/GVFS.FunctionalTests.LockHolder/GVFS.FunctionalTests.LockHolder.csproj
@@ -25,7 +25,6 @@
-
diff --git a/GVFS/GVFS.Hooks/GVFS.Hooks.Mac.csproj b/GVFS/GVFS.Hooks/GVFS.Hooks.Mac.csproj
deleted file mode 100644
index 9cf4b76519..0000000000
--- a/GVFS/GVFS.Hooks/GVFS.Hooks.Mac.csproj
+++ /dev/null
@@ -1,112 +0,0 @@
-
-
-
- Exe
- GVFS.Hooks
- netcoreapp2.1
- x64
- osx-x64
- false
-
-
-
- GVFS.Hooks
- GVFS.Hooks
-
-
- $(GVFSVersion)
-
-
- $(GVFSVersion)
-
-
-
-
-
-
-
-
- Common\ConsoleHelper.cs
-
-
- Common\Git\GitConfigHelper.cs
-
-
- Common\Git\GitConfigSetting.cs
-
-
- Common\Git\GitVersion.cs
-
-
- Common\GVFSConstants.cs
-
-
- Common\GVFSEnlistment.Shared.cs
-
-
- Common\GVFSLock.Shared.cs
-
-
- Common\NamedPipes\BrokenPipeException.cs
-
-
- Common\NamedPipes\LockNamedPipeMessages.cs
-
-
- Common\NamedPipes\NamedPipeClient.cs
-
-
- Common\NamedPipes\NamedPipeStreamReader.cs
-
-
- Common\NamedPipes\NamedPipeStreamWriter.cs
-
-
- Common\NativeMethods.Shared.cs
-
-
- Common\Paths.Shared.cs
-
-
- Common\ProcessHelper.cs
-
-
- Common\ProcessResult.cs
-
-
-
- Common\Tracing\EventLevel.cs
-
-
- Common\Tracing\EventMetadata.cs
-
-
- Common\Tracing\EventOpcode.cs
-
-
- Common\Tracing\ITracer.cs
-
-
- Common\Tracing\Keywords.cs
-
-
- POSIX\POSIXFileSystem.Shared.cs
-
-
- POSIX\POSIXPlatform.Shared.cs
-
-
- Mac\MacPlatform.Shared.cs
-
-
-
-
-
- all
-
-
-
diff --git a/GVFS/GVFS.Installer.Mac/GVFS.Installer.Mac.csproj b/GVFS/GVFS.Installer.Mac/GVFS.Installer.Mac.csproj
deleted file mode 100644
index 5c05fceb38..0000000000
--- a/GVFS/GVFS.Installer.Mac/GVFS.Installer.Mac.csproj
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
- GVFS.Installer.Mac
- GVFS.Installer.Mac
- netcoreapp2.1
- x64
- osx-x64
-
-
-
- $(GVFSVersion)
-
-
-
- $(GVFSVersion)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/GVFS/GVFS.Mount/GVFS.Mount.Mac.csproj b/GVFS/GVFS.Mount/GVFS.Mount.Mac.csproj
deleted file mode 100644
index 11d456863f..0000000000
--- a/GVFS/GVFS.Mount/GVFS.Mount.Mac.csproj
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
- Exe
- gvfs.mount
- netcoreapp2.1
- x64
- osx-x64
-
-
-
- $(GVFSVersion)
-
-
- $(GVFSVersion)
-
-
-
-
- PlatformLoader.Mac.cs
-
-
-
-
-
-
-
-
-
-
- all
-
-
-
-
diff --git a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/contents.xcworkspacedata b/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/contents.xcworkspacedata
deleted file mode 100644
index 790b6419be..0000000000
--- a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/contents.xcworkspacedata
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
deleted file mode 100644
index 18d981003d..0000000000
--- a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
- IDEDidComputeMac32BitWarning
-
-
-
diff --git a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
deleted file mode 100644
index 08de0be8d3..0000000000
--- a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
- IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded
-
-
-
diff --git a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/xcschemes/GVFS.Native.Mac.xcscheme b/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/xcschemes/GVFS.Native.Mac.xcscheme
deleted file mode 100644
index c6476e6593..0000000000
--- a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/xcschemes/GVFS.Native.Mac.xcscheme
+++ /dev/null
@@ -1,122 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/GVFS/GVFS.Platform.Mac/DiskLayoutUpgrades/DiskLayout18to19Upgrade_SqlitePlacholders.cs b/GVFS/GVFS.Platform.Mac/DiskLayoutUpgrades/DiskLayout18to19Upgrade_SqlitePlacholders.cs
deleted file mode 100644
index f844b235b8..0000000000
--- a/GVFS/GVFS.Platform.Mac/DiskLayoutUpgrades/DiskLayout18to19Upgrade_SqlitePlacholders.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using GVFS.Common.DiskLayoutUpgrades;
-
-namespace GVFS.Platform.Mac.DiskLayoutUpgrades
-{
- public class DiskLayout18to19Upgrade_SqlitePlacholders : DiskLayoutUpgrade_SqlitePlaceholders
- {
- protected override int SourceMajorVersion => 18;
- }
-}
diff --git a/GVFS/GVFS.Platform.Mac/DiskLayoutUpgrades/MacDiskLayoutUpgradeData.cs b/GVFS/GVFS.Platform.Mac/DiskLayoutUpgrades/MacDiskLayoutUpgradeData.cs
deleted file mode 100644
index bd257b313c..0000000000
--- a/GVFS/GVFS.Platform.Mac/DiskLayoutUpgrades/MacDiskLayoutUpgradeData.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using GVFS.Common;
-using GVFS.DiskLayoutUpgrades;
-using GVFS.Platform.Mac.DiskLayoutUpgrades;
-
-namespace GVFS.Platform.Mac
-{
- public class MacDiskLayoutUpgradeData : IDiskLayoutUpgradeData
- {
- public DiskLayoutUpgrade[] Upgrades
- {
- get
- {
- return new DiskLayoutUpgrade[]
- {
- new DiskLayout18to19Upgrade_SqlitePlacholders(),
- };
- }
- }
-
- public DiskLayoutVersion Version => new DiskLayoutVersion(
- currentMajorVersion: 19,
- currentMinorVersion: 0,
- minimumSupportedMajorVersion: 18);
-
- public bool TryParseLegacyDiskLayoutVersion(string dotGVFSPath, out int majorVersion)
- {
- majorVersion = 0;
- return false;
- }
- }
-}
diff --git a/GVFS/GVFS.Platform.Mac/GVFS.Platform.Mac.csproj b/GVFS/GVFS.Platform.Mac/GVFS.Platform.Mac.csproj
deleted file mode 100644
index d702269054..0000000000
--- a/GVFS/GVFS.Platform.Mac/GVFS.Platform.Mac.csproj
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
- netcoreapp2.1;netstandard2.0
- x64
- true
- true
-
-
-
- $(GVFSVersion)
-
-
- $(GVFSVersion)
-
-
-
- $(GVFSVersion)
-
-
-
-
-
-
-
-
-
-
-
-
- all
-
-
-
-
-
-
-
diff --git a/GVFS/GVFS.Platform.Mac/MacDaemonController.cs b/GVFS/GVFS.Platform.Mac/MacDaemonController.cs
deleted file mode 100644
index a54e9a38dc..0000000000
--- a/GVFS/GVFS.Platform.Mac/MacDaemonController.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using GVFS.Common;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-
-namespace GVFS.Platform.Mac
-{
- ///
- /// Class to query the configured services on macOS
- ///
- public class MacDaemonController
- {
- private const string LaunchCtlPath = @"/bin/launchctl";
- private const string LaunchCtlArg = @"list";
-
- private IProcessRunner processRunner;
-
- public MacDaemonController(IProcessRunner processRunner)
- {
- this.processRunner = processRunner;
- }
-
- public bool TryGetDaemons(string currentUser, out List daemons, out string error)
- {
- // Consider for future improvement:
- // Use Launchtl to run Launchctl as the "real" user, so we can get the process list from the user.
- ProcessResult result = this.processRunner.Run(LaunchCtlPath, "asuser " + currentUser + " " + LaunchCtlPath + " " + LaunchCtlArg, true);
-
- if (result.ExitCode != 0)
- {
- error = result.Output;
- daemons = null;
- return false;
- }
-
- return this.TryParseOutput(result.Output, out daemons, out error);
- }
-
- private bool TryParseOutput(string output, out List daemonInfos, out string error)
- {
- daemonInfos = new List();
-
- // 1st line is the header, skip it
- foreach (string line in output.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).Skip(1))
- {
- // The expected output is a list of tab delimited entried:
- // PID\tSTATUS\tLABEL
- string[] tokens = line.Split('\t');
-
- if (tokens.Length != 3)
- {
- daemonInfos = null;
- error = $"Unexpected number of tokens in line: {line}";
- return false;
- }
-
- string label = tokens[2];
- bool isRunning = int.TryParse(tokens[0], out _);
-
- daemonInfos.Add(new DaemonInfo() { Name = label, IsRunning = isRunning });
- }
-
- error = null;
- return true;
- }
-
- public class DaemonInfo
- {
- public string Name { get; set; }
- public bool IsRunning { get; set; }
- }
- }
-}
diff --git a/GVFS/GVFS.Platform.Mac/MacFileBasedLock.cs b/GVFS/GVFS.Platform.Mac/MacFileBasedLock.cs
deleted file mode 100644
index 10451482fe..0000000000
--- a/GVFS/GVFS.Platform.Mac/MacFileBasedLock.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-using GVFS.Common;
-using GVFS.Common.FileSystem;
-using GVFS.Common.Tracing;
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-
-namespace GVFS.Platform.Mac
-{
- public class MacFileBasedLock : FileBasedLock
- {
- private int lockFileDescriptor;
-
- public MacFileBasedLock(
- PhysicalFileSystem fileSystem,
- ITracer tracer,
- string lockPath)
- : base(fileSystem, tracer, lockPath)
- {
- this.lockFileDescriptor = NativeMethods.InvalidFileDescriptor;
- }
-
- public override bool TryAcquireLock()
- {
- if (this.lockFileDescriptor == NativeMethods.InvalidFileDescriptor)
- {
- this.FileSystem.CreateDirectory(Path.GetDirectoryName(this.LockPath));
-
- this.lockFileDescriptor = NativeMethods.Open(
- this.LockPath,
- NativeMethods.OpenCreate | NativeMethods.OpenWriteOnly,
- NativeMethods.FileMode644);
-
- if (this.lockFileDescriptor == NativeMethods.InvalidFileDescriptor)
- {
- int errno = Marshal.GetLastWin32Error();
- EventMetadata metadata = this.CreateEventMetadata(errno);
- this.Tracer.RelatedWarning(
- metadata,
- $"{nameof(MacFileBasedLock)}.{nameof(this.TryAcquireLock)}: Failed to open lock file");
-
- return false;
- }
- }
-
- if (NativeMethods.FLock(this.lockFileDescriptor, NativeMethods.LockEx | NativeMethods.LockNb) != 0)
- {
- int errno = Marshal.GetLastWin32Error();
- if (errno != NativeMethods.EIntr && errno != NativeMethods.EWouldBlock)
- {
- EventMetadata metadata = this.CreateEventMetadata(errno);
- this.Tracer.RelatedWarning(
- metadata,
- $"{nameof(MacFileBasedLock)}.{nameof(this.TryAcquireLock)}: Unexpected error when locking file");
- }
-
- return false;
- }
-
- return true;
- }
-
- public override void Dispose()
- {
- if (this.lockFileDescriptor != NativeMethods.InvalidFileDescriptor)
- {
- if (NativeMethods.Close(this.lockFileDescriptor) != 0)
- {
- // Failures of close() are logged for diagnostic purposes only.
- // It's possible that errors from a previous operation (e.g. write(2))
- // are only reported in close(). We should *not* retry the close() if
- // it fails since it may cause a re-used file descriptor from another
- // thread to be closed.
-
- int errno = Marshal.GetLastWin32Error();
- EventMetadata metadata = this.CreateEventMetadata(errno);
- this.Tracer.RelatedWarning(
- metadata,
- $"{nameof(MacFileBasedLock)}.{nameof(this.Dispose)}: Error when closing lock fd");
- }
-
- this.lockFileDescriptor = NativeMethods.InvalidFileDescriptor;
- }
- }
-
- private EventMetadata CreateEventMetadata(int errno = 0)
- {
- EventMetadata metadata = new EventMetadata();
- metadata.Add("Area", nameof(MacFileBasedLock));
- metadata.Add(nameof(this.LockPath), this.LockPath);
- if (errno != 0)
- {
- metadata.Add(nameof(errno), errno);
- }
-
- return metadata;
- }
-
- private static class NativeMethods
- {
- // #define O_WRONLY 0x0001 /* open for writing only */
- public const int OpenWriteOnly = 0x0001;
-
- // #define O_CREAT 0x0200 /* create if nonexistant */
- public const int OpenCreate = 0x0200;
-
- // #define EINTR 4 /* Interrupted system call */
- public const int EIntr = 4;
-
- // #define EAGAIN 35 /* Resource temporarily unavailable */
- // #define EWOULDBLOCK EAGAIN /* Operation would block */
- public const int EWouldBlock = 35;
-
- public const int LockSh = 1; // #define LOCK_SH 1 /* shared lock */
- public const int LockEx = 2; // #define LOCK_EX 2 /* exclusive lock */
- public const int LockNb = 4; // #define LOCK_NB 4 /* don't block when locking */
- public const int LockUn = 8; // #define LOCK_UN 8 /* unlock */
-
- public const int InvalidFileDescriptor = -1;
-
- public static readonly ushort FileMode644 = Convert.ToUInt16("644", 8);
-
- [DllImport("libc", EntryPoint = "open", SetLastError = true)]
- public static extern int Open(string pathname, int flags, ushort mode);
-
- [DllImport("libc", EntryPoint = "close", SetLastError = true)]
- public static extern int Close(int fd);
-
- [DllImport("libc", EntryPoint = "flock", SetLastError = true)]
- public static extern int FLock(int fd, int operation);
- }
- }
-}
diff --git a/GVFS/GVFS.Platform.Mac/MacFileSystem.cs b/GVFS/GVFS.Platform.Mac/MacFileSystem.cs
deleted file mode 100644
index 39119e30e5..0000000000
--- a/GVFS/GVFS.Platform.Mac/MacFileSystem.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-using GVFS.Common;
-using GVFS.Platform.POSIX;
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-
-namespace GVFS.Platform.Mac
-{
- public class MacFileSystem : POSIXFileSystem
- {
- public override void ChangeMode(string path, ushort mode)
- {
- Chmod(path, mode);
- }
-
- public override bool HydrateFile(string fileName, byte[] buffer)
- {
- return NativeFileReader.TryReadFirstByteOfFile(fileName, buffer);
- }
-
- public override bool IsExecutable(string fileName)
- {
- NativeStat.StatBuffer statBuffer = this.StatFile(fileName);
- return NativeStat.IsExecutable(statBuffer.Mode);
- }
-
- public override bool IsSocket(string fileName)
- {
- NativeStat.StatBuffer statBuffer = this.StatFile(fileName);
- return NativeStat.IsSock(statBuffer.Mode);
- }
-
- public override bool IsFileSystemSupported(string path, out string error)
- {
- error = null;
-
- try
- {
- string lowerCaseFilePath = Path.Combine(path, $"casetest{Guid.NewGuid().ToString()}");
- string upperCaseFilePath = lowerCaseFilePath.ToUpper();
-
- File.Create(lowerCaseFilePath);
- if (File.Exists(upperCaseFilePath))
- {
- File.Delete(lowerCaseFilePath);
- return true;
- }
-
- File.Delete(lowerCaseFilePath);
- error = "VFS for Git does not support case sensitive filesystems";
- return false;
- }
- catch (Exception ex)
- {
- error = $"Exception when performing {nameof(MacFileSystem)}.{nameof(this.IsFileSystemSupported)}: {ex.ToString()}";
- return false;
- }
- }
-
- [DllImport("libc", EntryPoint = "chmod", SetLastError = true)]
- private static extern int Chmod(string pathname, ushort mode);
-
- private NativeStat.StatBuffer StatFile(string fileName)
- {
- if (NativeStat.Stat(fileName, out NativeStat.StatBuffer statBuffer) != 0)
- {
- NativeMethods.ThrowLastWin32Exception($"Failed to stat {fileName}");
- }
-
- return statBuffer;
- }
-
- private static class NativeStat
- {
- // #define S_IFMT 0170000 /* [XSI] type of file mask */
- private static readonly ushort IFMT = Convert.ToUInt16("170000", 8);
-
- // #define S_IFSOCK 0140000 /* [XSI] socket */
- private static readonly ushort IFSOCK = Convert.ToUInt16("0140000", 8);
-
- // #define S_IXUSR 0000100 /* [XSI] X for owner */
- private static readonly ushort IXUSR = Convert.ToUInt16("100", 8);
-
- // #define S_IXGRP 0000010 /* [XSI] X for group */
- private static readonly ushort IXGRP = Convert.ToUInt16("10", 8);
-
- // #define S_IXOTH 0000001 /* [XSI] X for other */
- private static readonly ushort IXOTH = Convert.ToUInt16("1", 8);
-
- public static bool IsSock(ushort mode)
- {
- // #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) /* socket */
- return (mode & IFMT) == IFSOCK;
- }
-
- public static bool IsExecutable(ushort mode)
- {
- return (mode & (IXUSR | IXGRP | IXOTH)) != 0;
- }
-
- [DllImport("libc", EntryPoint = "stat$INODE64", SetLastError = true)]
- public static extern int Stat(string path, [Out] out StatBuffer statBuffer);
-
- [StructLayout(LayoutKind.Sequential)]
- public struct TimeSpec
- {
- public long Sec;
- public long Nsec;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public struct StatBuffer
- {
- public int Dev; /* ID of device containing file */
- public ushort Mode; /* Mode of file (see below) */
- public ushort NLink; /* Number of hard links */
- public ulong Ino; /* File serial number */
- public uint UID; /* User ID of the file */
- public uint GID; /* Group ID of the file */
- public int RDev; /* Device ID */
-
- public TimeSpec ATimespec; /* time of last access */
- public TimeSpec MTimespec; /* time of last data modification */
- public TimeSpec CTimespec; /* time of last status change */
- public TimeSpec BirthTimespec; /* time of file creation(birth) */
-
- public long Size; /* file size, in bytes */
- public long Blocks; /* blocks allocated for file */
- public int BlkSize; /* optimal blocksize for I/O */
- public uint Glags; /* user defined flags for file */
- public uint Gen; /* file generation number */
- public int LSpare; /* RESERVED: DO NOT USE! */
-
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
- public long[] QSpare; /* RESERVED: DO NOT USE! */
- }
- }
-
- private static class NativeFileReader
- {
- // #define O_RDONLY 0x0000 /* open for reading only */
- private const int ReadOnly = 0x0000;
-
- internal static bool TryReadFirstByteOfFile(string fileName, byte[] buffer)
- {
- int fileDescriptor = -1;
- bool readStatus = false;
- try
- {
- fileDescriptor = Open(fileName, ReadOnly);
- if (fileDescriptor != -1)
- {
- readStatus = TryReadOneByte(fileDescriptor, buffer);
- }
- }
- finally
- {
- Close(fileDescriptor);
- }
-
- return readStatus;
- }
-
- [DllImport("libc", EntryPoint = "open", SetLastError = true)]
- private static extern int Open(string path, int flag);
-
- [DllImport("libc", EntryPoint = "close", SetLastError = true)]
- private static extern int Close(int fd);
-
- [DllImport("libc", EntryPoint = "read", SetLastError = true)]
- private static extern int Read(int fd, [Out] byte[] buf, int count);
-
- private static bool TryReadOneByte(int fileDescriptor, byte[] buffer)
- {
- int numBytes = Read(fileDescriptor, buffer, 1);
-
- if (numBytes == -1)
- {
- return false;
- }
-
- return true;
- }
- }
- }
-}
diff --git a/GVFS/GVFS.Platform.Mac/MacFileSystemVirtualizer.cs b/GVFS/GVFS.Platform.Mac/MacFileSystemVirtualizer.cs
deleted file mode 100644
index 2efb84f2e3..0000000000
--- a/GVFS/GVFS.Platform.Mac/MacFileSystemVirtualizer.cs
+++ /dev/null
@@ -1,734 +0,0 @@
-using GVFS.Common;
-using GVFS.Common.Git;
-using GVFS.Common.Tracing;
-using GVFS.Virtualization.BlobSize;
-using GVFS.Virtualization.FileSystem;
-using GVFS.Virtualization.Projection;
-using PrjFSLib.Mac;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-using System.Threading;
-
-namespace GVFS.Platform.Mac
-{
- public class MacFileSystemVirtualizer : FileSystemVirtualizer
- {
- public static readonly byte[] PlaceholderVersionId = ToVersionIdByteArray(new byte[] { PlaceholderVersion });
-
- private const int SymLinkTargetBufferSize = 4096;
- private const long DummyFileSize = -1;
-
- private const string ClassName = nameof(MacFileSystemVirtualizer);
-
- private VirtualizationInstance virtualizationInstance;
-
- public MacFileSystemVirtualizer(GVFSContext context, GVFSGitObjects gitObjects)
- : this(context, gitObjects, virtualizationInstance: null)
- {
- }
-
- public MacFileSystemVirtualizer(
- GVFSContext context,
- GVFSGitObjects gitObjects,
- VirtualizationInstance virtualizationInstance)
- : base(context, gitObjects)
- {
- this.virtualizationInstance = virtualizationInstance ?? new VirtualizationInstance();
- }
-
- protected override string EtwArea => ClassName;
-
- public static FSResult ResultToFSResult(Result result)
- {
- switch (result)
- {
- case Result.Invalid:
- return FSResult.IOError;
-
- case Result.Success:
- return FSResult.Ok;
-
- case Result.EFileNotFound:
- case Result.EPathNotFound:
- return FSResult.FileOrPathNotFound;
-
- case Result.EDirectoryNotEmpty:
- return FSResult.DirectoryNotEmpty;
-
- case Result.EVirtualizationInvalidOperation:
- return FSResult.VirtualizationInvalidOperation;
-
- default:
- return FSResult.IOError;
- }
- }
-
- public override FileSystemResult ClearNegativePathCache(out uint totalEntryCount)
- {
- totalEntryCount = 0;
- return new FileSystemResult(FSResult.Ok, rawResult: unchecked((int)Result.Success));
- }
-
- public override FileSystemResult DeleteFile(string relativePath, UpdatePlaceholderType updateFlags, out UpdateFailureReason failureReason)
- {
- UpdateFailureCause failureCause;
- Result result = this.virtualizationInstance.DeleteFile(relativePath, (UpdateType)updateFlags, out failureCause);
- failureReason = (UpdateFailureReason)failureCause;
- return new FileSystemResult(ResultToFSResult(result), unchecked((int)result));
- }
-
- public override void Stop()
- {
- this.Context.Tracer.RelatedEvent(EventLevel.Informational, $"{nameof(this.Stop)}_StopRequested", metadata: null);
- }
-
- ///
- /// Writes a placeholder file.
- ///
- /// Placeholder's path relative to the root of the repo
- /// Length of the file (ignored on this platform)
- /// The SHA of the placeholder's contents, stored as the content ID in the placeholder
- public override FileSystemResult WritePlaceholderFile(
- string relativePath,
- long endOfFile,
- string sha)
- {
- // TODO(#223): Add functional tests that validate file mode is set correctly
- GitIndexProjection.FileType fileType;
- ushort fileMode;
- this.FileSystemCallbacks.GitIndexProjection.GetFileTypeAndMode(relativePath, out fileType, out fileMode);
-
- if (fileType == GitIndexProjection.FileType.Regular)
- {
- Result result = this.virtualizationInstance.WritePlaceholderFile(
- relativePath,
- PlaceholderVersionId,
- ToVersionIdByteArray(FileSystemVirtualizer.ConvertShaToContentId(sha)),
- fileMode);
-
- return new FileSystemResult(ResultToFSResult(result), unchecked((int)result));
- }
- else if (fileType == GitIndexProjection.FileType.SymLink)
- {
- string symLinkTarget;
- if (this.TryGetSymLinkTarget(sha, out symLinkTarget))
- {
- Result result = this.virtualizationInstance.WriteSymLink(relativePath, symLinkTarget);
-
- this.FileSystemCallbacks.OnFileSymLinkCreated(relativePath);
-
- return new FileSystemResult(ResultToFSResult(result), unchecked((int)result));
- }
-
- EventMetadata metadata = this.CreateEventMetadata(relativePath);
- metadata.Add(nameof(sha), sha);
- this.Context.Tracer.RelatedError(metadata, $"{nameof(this.WritePlaceholderFile)}: Failed to read contents of symlink object");
- return new FileSystemResult(FSResult.IOError, 0);
- }
- else
- {
- EventMetadata metadata = this.CreateEventMetadata(relativePath);
- metadata.Add(nameof(fileType), fileType);
- metadata.Add(nameof(fileMode), fileMode);
- this.Context.Tracer.RelatedError(metadata, $"{nameof(this.WritePlaceholderFile)}: Unsupported fileType");
- return new FileSystemResult(FSResult.IOError, 0);
- }
- }
-
- public override FileSystemResult WritePlaceholderDirectory(string relativePath)
- {
- Result result = this.virtualizationInstance.WritePlaceholderDirectory(relativePath);
- return new FileSystemResult(ResultToFSResult(result), unchecked((int)result));
- }
-
- /// Length of the file, not required on the Mac platform
- public override FileSystemResult UpdatePlaceholderIfNeeded(
- string relativePath,
- DateTime creationTime,
- DateTime lastAccessTime,
- DateTime lastWriteTime,
- DateTime changeTime,
- FileAttributes fileAttributes,
- long endOfFile,
- string shaContentId,
- UpdatePlaceholderType updateFlags,
- out UpdateFailureReason failureReason)
- {
- UpdateFailureCause failureCause = UpdateFailureCause.NoFailure;
-
- // TODO(#223): Add functional tests that include:
- // - Mode + content changes between commits
- // - Mode only changes (without any change to content, see issue #223)
- GitIndexProjection.FileType fileType;
- ushort fileMode;
- this.FileSystemCallbacks.GitIndexProjection.GetFileTypeAndMode(relativePath, out fileType, out fileMode);
-
- if (fileType == GitIndexProjection.FileType.Regular)
- {
- Result result = this.virtualizationInstance.UpdatePlaceholderIfNeeded(
- relativePath,
- PlaceholderVersionId,
- ToVersionIdByteArray(ConvertShaToContentId(shaContentId)),
- fileMode,
- (UpdateType)updateFlags,
- out failureCause);
-
- failureReason = (UpdateFailureReason)failureCause;
- return new FileSystemResult(ResultToFSResult(result), unchecked((int)result));
- }
- else if (fileType == GitIndexProjection.FileType.SymLink)
- {
- string symLinkTarget;
- if (this.TryGetSymLinkTarget(shaContentId, out symLinkTarget))
- {
- Result result = this.virtualizationInstance.ReplacePlaceholderFileWithSymLink(
- relativePath,
- symLinkTarget,
- (UpdateType)updateFlags,
- out failureCause);
-
- this.FileSystemCallbacks.OnFileSymLinkCreated(relativePath);
-
- failureReason = (UpdateFailureReason)failureCause;
- return new FileSystemResult(ResultToFSResult(result), unchecked((int)result));
- }
-
- EventMetadata metadata = this.CreateEventMetadata(relativePath);
- metadata.Add(nameof(shaContentId), shaContentId);
- this.Context.Tracer.RelatedError(metadata, $"{nameof(this.UpdatePlaceholderIfNeeded)}: Failed to read contents of symlink object");
- failureReason = UpdateFailureReason.NoFailure;
- return new FileSystemResult(FSResult.IOError, 0);
- }
- else
- {
- EventMetadata metadata = this.CreateEventMetadata(relativePath);
- metadata.Add(nameof(fileType), fileType);
- metadata.Add(nameof(fileMode), fileMode);
- this.Context.Tracer.RelatedError(metadata, $"{nameof(this.UpdatePlaceholderIfNeeded)}: Unsupported fileType");
- failureReason = UpdateFailureReason.NoFailure;
- return new FileSystemResult(FSResult.IOError, 0);
- }
- }
-
- public override FileSystemResult DehydrateFolder(string relativePath)
- {
- FileSystemResult result = new FileSystemResult(FSResult.Ok, 0);
- GitIndexProjection.PathSparseState sparseState = this.FileSystemCallbacks.GitIndexProjection.GetFolderPathSparseState(relativePath);
-
- if (sparseState == GitIndexProjection.PathSparseState.Included)
- {
- // When the folder is included we need to create the placeholder to make sure it is on disk for enumeration
- result = this.WritePlaceholderDirectory(relativePath);
- if (result.Result == FSResult.Ok)
- {
- this.FileSystemCallbacks.OnPlaceholderFolderCreated(relativePath, string.Empty);
- }
- else if (result.Result == FSResult.FileOrPathNotFound)
- {
- // This will happen when the parent folder is also in the dehydrate list and is no longer on disk.
- result = new FileSystemResult(FSResult.Ok, 0);
- }
- else
- {
- EventMetadata metadata = this.CreateEventMetadata(relativePath);
- metadata.Add(nameof(result.Result), result.Result);
- metadata.Add(nameof(result.RawResult), result.RawResult);
- this.Context.Tracer.RelatedError(metadata, $"{nameof(this.DehydrateFolder)}: Write placeholder failed");
- }
- }
-
- return result;
- }
-
- public override bool TryStart(out string error)
- {
- error = string.Empty;
-
- // Callbacks
- this.virtualizationInstance.OnEnumerateDirectory = this.OnEnumerateDirectory;
- this.virtualizationInstance.OnGetFileStream = this.OnGetFileStream;
- this.virtualizationInstance.OnLogError = this.OnLogError;
- this.virtualizationInstance.OnLogWarning = this.OnLogWarning;
- this.virtualizationInstance.OnLogInfo = this.OnLogInfo;
- this.virtualizationInstance.OnFileModified = this.OnFileModified;
- this.virtualizationInstance.OnPreDelete = this.OnPreDelete;
- this.virtualizationInstance.OnNewFileCreated = this.OnNewFileCreated;
- this.virtualizationInstance.OnFileRenamed = this.OnFileRenamed;
- this.virtualizationInstance.OnHardLinkCreated = this.OnHardLinkCreated;
- this.virtualizationInstance.OnFilePreConvertToFull = this.NotifyFilePreConvertToFull;
-
- uint threadCount = (uint)Environment.ProcessorCount * 2;
-
- Result result = this.virtualizationInstance.StartVirtualizationInstance(
- this.Context.Enlistment.WorkingDirectoryRoot,
- threadCount);
-
- if (result != Result.Success)
- {
- this.Context.Tracer.RelatedError($"{nameof(this.virtualizationInstance.StartVirtualizationInstance)} failed: " + result.ToString("X") + "(" + result.ToString("G") + ")");
- error = "Failed to start virtualization instance (" + result.ToString() + ")";
- return false;
- }
-
- this.Context.Tracer.RelatedEvent(EventLevel.Informational, $"{nameof(this.TryStart)}_StartedVirtualization", metadata: null);
- return true;
- }
-
- private static byte[] ToVersionIdByteArray(byte[] version)
- {
- byte[] bytes = new byte[VirtualizationInstance.PlaceholderIdLength];
- Buffer.BlockCopy(version, 0, bytes, 0, version.Length);
- return bytes;
- }
-
- ///
- /// Gets the target of the symbolic link.
- ///
- /// SHA of the loose object containing the target path of the symbolic link
- /// Target path of the symbolic link
- private bool TryGetSymLinkTarget(string sha, out string symLinkTarget)
- {
- symLinkTarget = null;
-
- string symLinkBlobContents = null;
- try
- {
- if (!this.GitObjects.TryCopyBlobContentStream(
- sha,
- CancellationToken.None,
- GVFSGitObjects.RequestSource.SymLinkCreation,
- (stream, blobLength) =>
- {
- byte[] buffer = new byte[SymLinkTargetBufferSize];
- uint bufferIndex = 0;
-
- // TODO(#1361): Find a better solution than reading from the stream one byte at at time
- int nextByte = stream.ReadByte();
- while (nextByte != -1)
- {
- while (bufferIndex < buffer.Length && nextByte != -1)
- {
- buffer[bufferIndex] = (byte)nextByte;
- nextByte = stream.ReadByte();
- ++bufferIndex;
- }
-
- if (bufferIndex < buffer.Length)
- {
- buffer[bufferIndex] = 0;
- symLinkBlobContents = Encoding.UTF8.GetString(buffer);
- }
- else
- {
- buffer[bufferIndex - 1] = 0;
-
- EventMetadata metadata = this.CreateEventMetadata();
- metadata.Add(nameof(sha), sha);
- metadata.Add("bufferContents", Encoding.UTF8.GetString(buffer));
- this.Context.Tracer.RelatedError(metadata, $"{nameof(this.TryGetSymLinkTarget)}: SymLink target exceeds buffer size");
-
- throw new GetSymLinkTargetException("SymLink target exceeds buffer size");
- }
- }
- }))
- {
- EventMetadata metadata = this.CreateEventMetadata();
- metadata.Add(nameof(sha), sha);
- this.Context.Tracer.RelatedError(metadata, $"{nameof(this.TryGetSymLinkTarget)}: TryCopyBlobContentStream failed");
-
- return false;
- }
- }
- catch (GetSymLinkTargetException e)
- {
- EventMetadata metadata = this.CreateEventMetadata(relativePath: null, exception: e);
- metadata.Add(nameof(sha), sha);
- this.Context.Tracer.RelatedError(metadata, $"{nameof(this.TryGetSymLinkTarget)}: TryCopyBlobContentStream caught GetSymLinkTargetException");
-
- return false;
- }
- catch (DecoderFallbackException e)
- {
- EventMetadata metadata = this.CreateEventMetadata(relativePath: null, exception: e);
- metadata.Add(nameof(sha), sha);
- this.Context.Tracer.RelatedError(metadata, $"{nameof(this.TryGetSymLinkTarget)}: TryCopyBlobContentStream caught DecoderFallbackException");
-
- return false;
- }
-
- symLinkTarget = symLinkBlobContents;
-
- return true;
- }
-
- private Result OnGetFileStream(
- ulong commandId,
- string relativePath,
- byte[] providerId,
- byte[] contentId,
- int triggeringProcessId,
- string triggeringProcessName,
- IntPtr fileHandle)
- {
- try
- {
- if (contentId == null)
- {
- this.Context.Tracer.RelatedError($"{nameof(this.OnGetFileStream)} called with null contentId, path: " + relativePath);
- return Result.EInvalidOperation;
- }
-
- if (providerId == null)
- {
- this.Context.Tracer.RelatedError($"{nameof(this.OnGetFileStream)} called with null epochId, path: " + relativePath);
- return Result.EInvalidOperation;
- }
-
- string sha = GetShaFromContentId(contentId);
- byte placeholderVersion = GetPlaceholderVersionFromProviderId(providerId);
-
- EventMetadata metadata = this.CreateEventMetadata(relativePath);
- metadata.Add(nameof(triggeringProcessId), triggeringProcessId);
- metadata.Add(nameof(triggeringProcessName), triggeringProcessName);
- metadata.Add(nameof(sha), sha);
- metadata.Add(nameof(placeholderVersion), placeholderVersion);
- metadata.Add(nameof(commandId), commandId);
- ITracer activity = this.Context.Tracer.StartActivity("GetFileStream", EventLevel.Verbose, Keywords.Telemetry, metadata);
-
- if (placeholderVersion != FileSystemVirtualizer.PlaceholderVersion)
- {
- activity.RelatedError(metadata, nameof(this.OnGetFileStream) + ": Unexpected placeholder version");
- activity.Dispose();
-
- // TODO(#1362): Is this the correct Result to return?
- return Result.EIOError;
- }
-
- try
- {
- if (!this.GitObjects.TryCopyBlobContentStream(
- sha,
- CancellationToken.None,
- GVFSGitObjects.RequestSource.FileStreamCallback,
- (stream, blobLength) =>
- {
- // TODO(#1361): Find a better solution than reading from the stream one byte at at time
- byte[] buffer = new byte[4096];
- uint bufferIndex = 0;
- int nextByte = stream.ReadByte();
- int bytesWritten = 0;
- while (nextByte != -1)
- {
- while (bufferIndex < buffer.Length && nextByte != -1)
- {
- buffer[bufferIndex] = (byte)nextByte;
- nextByte = stream.ReadByte();
- ++bufferIndex;
- }
-
- Result result = this.virtualizationInstance.WriteFileContents(
- fileHandle,
- buffer,
- bufferIndex);
- if (result != Result.Success)
- {
- activity.RelatedError(metadata, $"{nameof(this.virtualizationInstance.WriteFileContents)} failed, error: " + result.ToString("X") + "(" + result.ToString("G") + ")");
- throw new GetFileStreamException(result);
- }
-
- if (bufferIndex == buffer.Length)
- {
- bufferIndex = 0;
- bytesWritten += buffer.Length;
- }
- }
- bytesWritten += Convert.ToInt32(bufferIndex);
-
- if (bytesWritten != blobLength)
- {
- // If the read size does not match the expected size print an error and add the file to ModifiedPaths.dat
- // This allows the user to see that something went wrong with file hydration
- // Unfortunitely we must do this check *after* the file is hydrated since the header isn't corrupt for trunctated objects on mac
- this.Context.Tracer.RelatedError($"Read {relativePath} to {bytesWritten}, not expected size of {blobLength}");
- this.FileSystemCallbacks.OnFailedFileHydration(relativePath);
- }
- }))
- {
- activity.RelatedError(metadata, $"{nameof(this.OnGetFileStream)}: TryCopyBlobContentStream failed");
-
- // TODO(#1362): Is this the correct Result to return?
- return Result.EFileNotFound;
- }
- }
- catch (GetFileStreamException e)
- {
- return e.Result;
- }
-
- this.FileSystemCallbacks.OnPlaceholderFileHydrated(triggeringProcessName);
- return Result.Success;
- }
- catch (Exception e)
- {
- EventMetadata metadata = this.CreateEventMetadata(relativePath, e);
- metadata.Add(nameof(triggeringProcessId), triggeringProcessId);
- metadata.Add(nameof(triggeringProcessName), triggeringProcessName);
- metadata.Add(nameof(commandId), commandId);
- this.LogUnhandledExceptionAndExit(nameof(this.OnGetFileStream), metadata);
- }
-
- return Result.EIOError;
- }
-
- private void OnLogError(string errorMessage)
- {
- this.Context.Tracer.RelatedError($"{nameof(MacFileSystemVirtualizer)}::{nameof(this.OnLogError)}: {errorMessage}");
- }
-
- private void OnLogWarning(string warningMessage)
- {
- this.Context.Tracer.RelatedWarning($"{nameof(MacFileSystemVirtualizer)}::{nameof(this.OnLogWarning)}: {warningMessage}");
- }
-
- private void OnLogInfo(string infoMessage)
- {
- this.Context.Tracer.RelatedInfo($"{nameof(MacFileSystemVirtualizer)}::{nameof(this.OnLogInfo)}: {infoMessage}");
- }
-
- private void OnFileModified(string relativePath)
- {
- try
- {
- if (Virtualization.FileSystemCallbacks.IsPathInsideDotGit(relativePath))
- {
- this.OnDotGitFileOrFolderChanged(relativePath);
- }
- }
- catch (Exception e)
- {
- this.LogUnhandledExceptionAndExit(nameof(this.OnFileModified), this.CreateEventMetadata(relativePath, e));
- }
- }
-
- private Result NotifyFilePreConvertToFull(string relativePath)
- {
- this.OnFilePreConvertToFull(relativePath);
- return Result.Success;
- }
-
- private Result OnPreDelete(string relativePath, bool isDirectory)
- {
- try
- {
- bool pathInsideDotGit = Virtualization.FileSystemCallbacks.IsPathInsideDotGit(relativePath);
- if (pathInsideDotGit)
- {
- if (relativePath.Equals(GVFSConstants.DotGit.Index, GVFSPlatform.Instance.Constants.PathComparison))
- {
- string lockedGitCommand = this.Context.Repository.GVFSLock.GetLockedGitCommand();
- if (string.IsNullOrEmpty(lockedGitCommand))
- {
- EventMetadata metadata = new EventMetadata();
- metadata.Add("Area", this.EtwArea);
- metadata.Add(TracingConstants.MessageKey.WarningMessage, "Blocked index delete outside the lock");
- this.Context.Tracer.RelatedEvent(EventLevel.Warning, $"{nameof(this.OnPreDelete)}_BlockedIndexDelete", metadata);
-
- return Result.EAccessDenied;
- }
- }
-
- this.OnDotGitFileOrFolderDeleted(relativePath);
- }
- else
- {
- this.OnWorkingDirectoryFileOrFolderDeleteNotification(relativePath, isDirectory, isPreDelete: true);
- }
- }
- catch (Exception e)
- {
- EventMetadata metadata = this.CreateEventMetadata(relativePath, e);
- metadata.Add("isDirectory", isDirectory);
- this.LogUnhandledExceptionAndExit(nameof(this.OnPreDelete), metadata);
- }
-
- return Result.Success;
- }
-
- private void OnNewFileCreated(string relativePath, bool isDirectory)
- {
- try
- {
- if (!Virtualization.FileSystemCallbacks.IsPathInsideDotGit(relativePath))
- {
- if (isDirectory)
- {
- string lockedGitCommand = this.Context.Repository.GVFSLock.GetLockedGitCommand();
- GitCommandLineParser gitCommand = new GitCommandLineParser(lockedGitCommand);
- if (gitCommand.IsValidGitCommand)
- {
- EventMetadata metadata = this.CreateEventMetadata(relativePath);
- metadata.Add(nameof(lockedGitCommand), lockedGitCommand);
- metadata.Add(TracingConstants.MessageKey.InfoMessage, "Git command created new folder");
- this.Context.Tracer.RelatedEvent(EventLevel.Informational, $"{nameof(this.OnNewFileCreated)}_GitCreatedFolder", metadata);
-
- // Record this folder as expanded so that GitIndexProjection will re-expand the folder
- // when the projection change completes.
- //
- // Git creates new folders when there are files that it needs to create.
- // However, git will only create files that are in ModifiedPaths.dat. There could
- // be other files in the projection (that were not created by git) and so VFS must re-expand the
- // newly created folder to ensure that all files are written to disk.
- this.FileSystemCallbacks.OnPlaceholderFolderExpanded(relativePath);
- }
- else
- {
- this.FileSystemCallbacks.OnFolderCreated(relativePath, out bool sparseFoldersUpdated);
- if (sparseFoldersUpdated)
- {
- // When sparseFoldersUpdated is true it means the folder was previously excluded from the projection and was
- // included so it needs to enumerate the directory to get and create placeholders
- // for all the directory items that are now included
- this.OnEnumerateDirectory(0, relativePath, -1, $"{nameof(this.OnNewFileCreated)}_FolderIncluded");
- }
- }
- }
- else
- {
- this.FileSystemCallbacks.OnFileCreated(relativePath);
- }
- }
- }
- catch (Exception e)
- {
- EventMetadata metadata = this.CreateEventMetadata(relativePath, e);
- metadata.Add("isDirectory", isDirectory);
- this.LogUnhandledExceptionAndExit(nameof(this.OnNewFileCreated), metadata);
- }
- }
-
- private void OnFileRenamed(string relativeDestinationPath, bool isDirectory)
- {
- // ProjFS for Mac *could* be updated to provide us with relativeSourcePath as well,
- // but because VFSForGit doesn't need the source path on Mac for correct behavior
- // the relativeSourcePath is left out of the notification to keep the kext simple
- this.OnFileRenamed(
- relativeSourcePath: string.Empty,
- relativeDestinationPath: relativeDestinationPath,
- isDirectory: isDirectory);
- }
-
- private Result OnEnumerateDirectory(
- ulong commandId,
- string relativePath,
- int triggeringProcessId,
- string triggeringProcessName)
- {
- try
- {
- IEnumerable projectedItems = this.FileSystemCallbacks.GitIndexProjection.GetProjectedItems(
- CancellationToken.None,
- blobSizesConnection: null,
- folderPath: relativePath);
-
- return this.CreatePlaceholders(relativePath, projectedItems, triggeringProcessName);
- }
- catch (Exception e)
- {
- EventMetadata metadata = this.CreateEventMetadata(relativePath, e);
- metadata.Add("commandId", commandId);
- this.LogUnhandledExceptionAndExit(nameof(this.OnEnumerateDirectory), metadata);
- }
-
- return Result.EIOError;
- }
-
- private Result CreatePlaceholders(string directoryRelativePath, IEnumerable projectedItems, string triggeringProcessName)
- {
- foreach (ProjectedFileInfo fileInfo in projectedItems)
- {
- string childRelativePath = Path.Combine(directoryRelativePath, fileInfo.Name);
-
- string sha;
- FileSystemResult fileSystemResult;
- if (fileInfo.IsFolder)
- {
- sha = string.Empty;
- fileSystemResult = this.WritePlaceholderDirectory(childRelativePath);
- }
- else
- {
- sha = fileInfo.Sha.ToString();
-
- // Writing placeholders on Mac does not require a file size
- fileSystemResult = this.WritePlaceholderFile(childRelativePath, DummyFileSize, sha);
- }
-
- Result result = (Result)fileSystemResult.RawResult;
- if (result != Result.Success)
- {
- EventMetadata metadata = this.CreateEventMetadata(childRelativePath);
- metadata.Add("fileInfo.Name", fileInfo.Name);
- metadata.Add("fileInfo.Size", fileInfo.Size);
- metadata.Add("fileInfo.IsFolder", fileInfo.IsFolder);
- metadata.Add(nameof(result), result.ToString());
- metadata.Add(nameof(sha), sha);
- this.Context.Tracer.RelatedError(metadata, $"{nameof(this.CreatePlaceholders)}: Write placeholder failed");
-
- if (result == Result.EIOError)
- {
- // If there is an IO error writing the placeholder then the file might already exist and it needs to
- // be added to the modified paths so that git will show any differences or errors when interacting with the file
- // This will happen in the include mode when the user creates a file that is already in the files that
- // should be projected but we are trying to create the placeholder after it has already been created
- this.FileSystemCallbacks.OnFileConvertedToFull(childRelativePath);
- }
- else
- {
- return result;
- }
- }
- else
- {
- if (fileInfo.IsFolder)
- {
- this.FileSystemCallbacks.OnPlaceholderFolderCreated(childRelativePath, triggeringProcessName);
- }
- else
- {
- this.FileSystemCallbacks.OnPlaceholderFileCreated(childRelativePath, sha, triggeringProcessName);
- }
- }
- }
-
- this.FileSystemCallbacks.OnPlaceholderFolderExpanded(directoryRelativePath);
-
- return Result.Success;
- }
-
- private class GetFileStreamException : Exception
- {
- public GetFileStreamException(Result errorCode)
- : this("GetFileStreamException exception, error: " + errorCode.ToString(), errorCode)
- {
- }
-
- public GetFileStreamException(string message, Result result)
- : base(message)
- {
- this.Result = result;
- }
-
- public Result Result { get; }
- }
-
- private class GetSymLinkTargetException : Exception
- {
- public GetSymLinkTargetException(string message)
- : base(message)
- {
- }
- }
- }
-}
diff --git a/GVFS/GVFS.Platform.Mac/MacPlatform.Shared.cs b/GVFS/GVFS.Platform.Mac/MacPlatform.Shared.cs
deleted file mode 100644
index c2dfcf071f..0000000000
--- a/GVFS/GVFS.Platform.Mac/MacPlatform.Shared.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using System;
-using System.IO;
-using GVFS.Common;
-using GVFS.Platform.POSIX;
-
-namespace GVFS.Platform.Mac
-{
- public partial class MacPlatform
- {
- public const string DotGVFSRoot = ".gvfs";
- public const string UpgradeConfirmMessage = "`sudo gvfs upgrade --confirm --no-verify`";
-
- public static string GetDataRootForGVFSImplementation()
- {
- return Path.Combine(
- Environment.GetEnvironmentVariable("HOME"),
- "Library",
- "Application Support",
- "GVFS");
- }
-
- public static string GetDataRootForGVFSComponentImplementation(string componentName)
- {
- return Path.Combine(GetDataRootForGVFSImplementation(), componentName);
- }
-
- public static bool TryGetGVFSEnlistmentRootImplementation(string directory, out string enlistmentRoot, out string errorMessage)
- {
- return POSIXPlatform.TryGetGVFSEnlistmentRootImplementation(directory, DotGVFSRoot, out enlistmentRoot, out errorMessage);
- }
-
- public static string GetUpgradeHighestAvailableVersionDirectoryImplementation()
- {
- return GetUpgradeNonProtectedDirectoryImplementation();
- }
-
- public static string GetUpgradeNonProtectedDirectoryImplementation()
- {
- return Path.Combine(GetDataRootForGVFSImplementation(), ProductUpgraderInfo.UpgradeDirectoryName);
- }
-
- public static string GetNamedPipeNameImplementation(string enlistmentRoot)
- {
- return POSIXPlatform.GetNamedPipeNameImplementation(enlistmentRoot, DotGVFSRoot);
- }
-
- public static string GetUpgradeReminderNotificationImplementation()
- {
- return $"A new version of VFS for Git is available. Run {UpgradeConfirmMessage} to upgrade.";
- }
-
- private string GetUpgradeNonProtectedDataDirectory()
- {
- return GetUpgradeNonProtectedDirectoryImplementation();
- }
- }
-}
diff --git a/GVFS/GVFS.Platform.Mac/MacPlatform.cs b/GVFS/GVFS.Platform.Mac/MacPlatform.cs
deleted file mode 100644
index 64030cde98..0000000000
--- a/GVFS/GVFS.Platform.Mac/MacPlatform.cs
+++ /dev/null
@@ -1,273 +0,0 @@
-using GVFS.Common;
-using GVFS.Common.FileSystem;
-using GVFS.Common.Tracing;
-using GVFS.Platform.POSIX;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Xml;
-using System.Xml.Linq;
-using System.Xml.XPath;
-
-namespace GVFS.Platform.Mac
-{
- public partial class MacPlatform : POSIXPlatform
- {
- private const string UpgradeProtectedDataDirectory = "/usr/local/vfsforgit_upgrader";
- private const string DiagnosticReportsDirectory = "/Library/Logs/DiagnosticReports";
- private const string PanicFileNamePattern = "*panic";
- private const string SystemInstallerLogPath = "/var/log/install.log";
-
- public MacPlatform() : base(
- underConstruction: new UnderConstructionFlags(
- supportsGVFSUpgrade: true,
- supportsGVFSConfig: true,
- supportsNuGetEncryption: false,
- supportsNuGetVerification: false))
- {
- }
-
- public override IDiskLayoutUpgradeData DiskLayoutUpgrade { get; } = new MacDiskLayoutUpgradeData();
- public override IKernelDriver KernelDriver { get; } = new ProjFSKext();
- public override string Name { get => "macOS"; }
- public override GVFSPlatformConstants Constants { get; } = new MacPlatformConstants();
- public override IPlatformFileSystem FileSystem { get; } = new MacFileSystem();
-
- public override string GVFSConfigPath
- {
- get
- {
- return Path.Combine(this.Constants.GVFSBinDirectoryPath, LocalGVFSConfig.FileName);
- }
- }
-
- ///
- /// On the Mac VFSForGit installer messages get captured in the system
- /// wide installer log file. There is no customized log file specific
- /// to VFSForGit installer.
- ///
- public override bool SupportsSystemInstallLog
- {
- get
- {
- return true;
- }
- }
-
- public override string GetOSVersionInformation()
- {
- ProcessResult result = ProcessHelper.Run("sw_vers", args: string.Empty, redirectOutput: true);
- return string.IsNullOrWhiteSpace(result.Output) ? result.Errors : result.Output;
- }
-
- public override string GetSecureDataRootForGVFS()
- {
- // On the Mac, unlike Windows, there is no separate secure data root directory.
- return MacPlatform.GetDataRootForGVFSImplementation();
- }
-
- public override string GetSecureDataRootForGVFSComponent(string componentName)
- {
- // On the Mac, unlike Windows, there is no separate secure data root directory.
- return MacPlatform.GetDataRootForGVFSComponentImplementation(componentName);
- }
-
- public override string GetCommonAppDataRootForGVFS()
- {
- return this.GetSecureDataRootForGVFS();
- }
-
- public override string GetLogsDirectoryForGVFSComponent(string componentName)
- {
- return Path.Combine(this.GetCommonAppDataRootForGVFS(), componentName);
- }
-
- public override bool TryGetGVFSEnlistmentRoot(string directory, out string enlistmentRoot, out string errorMessage)
- {
- return MacPlatform.TryGetGVFSEnlistmentRootImplementation(directory, out enlistmentRoot, out errorMessage);
- }
-
- public override string GetNamedPipeName(string enlistmentRoot)
- {
- return MacPlatform.GetNamedPipeNameImplementation(enlistmentRoot);
- }
-
- public override FileBasedLock CreateFileBasedLock(
- PhysicalFileSystem fileSystem,
- ITracer tracer,
- string lockPath)
- {
- return new MacFileBasedLock(fileSystem, tracer, lockPath);
- }
-
- public override string GetUpgradeProtectedDataDirectory()
- {
- return UpgradeProtectedDataDirectory;
- }
-
- public override string GetUpgradeHighestAvailableVersionDirectory()
- {
- return GetUpgradeHighestAvailableVersionDirectoryImplementation();
- }
-
- ///
- /// This is the directory in which the upgradelogs directory should go.
- /// There can be multiple logs directories, so here we return the containing
- /// directory.
- ///
- public override string GetUpgradeLogDirectoryParentDirectory()
- {
- return this.GetUpgradeNonProtectedDataDirectory();
- }
-
- public override string GetSystemInstallerLogPath()
- {
- return SystemInstallerLogPath;
- }
-
- public override Dictionary GetPhysicalDiskInfo(string path, bool sizeStatsOnly)
- {
- // DiskUtil will return disk statistics in xml format
- ProcessResult processResult = ProcessHelper.Run("diskutil", "info -plist /", true);
- Dictionary result = new Dictionary();
- if (string.IsNullOrEmpty(processResult.Output))
- {
- result.Add("DiskUtilError", processResult.Errors);
- return result;
- }
-
- try
- {
- // Parse the XML looking for FilesystemType
- XDocument xmlDoc = XDocument.Parse(processResult.Output);
- XElement filesystemTypeValue = xmlDoc.XPathSelectElement("plist/dict/key[text()=\"FilesystemType\"]")?.NextNode as XElement;
- result.Add("FileSystemType", filesystemTypeValue != null ? filesystemTypeValue.Value: "Not Found");
- }
- catch (XmlException ex)
- {
- result.Add("DiskUtilError", ex.ToString());
- }
-
- return result;
- }
-
- public override ProductUpgraderPlatformStrategy CreateProductUpgraderPlatformInteractions(
- PhysicalFileSystem fileSystem,
- ITracer tracer)
- {
- return new MacProductUpgraderPlatformStrategy(fileSystem, tracer);
- }
-
- public override void IsServiceInstalledAndRunning(string name, out bool installed, out bool running)
- {
- string currentUser = this.GetCurrentUser();
- MacDaemonController macDaemonController = new MacDaemonController(new ProcessRunnerImpl());
- List daemons;
- if (!macDaemonController.TryGetDaemons(currentUser, out daemons, out string error))
- {
- installed = false;
- running = false;
- }
-
- MacDaemonController.DaemonInfo gvfsService = daemons.FirstOrDefault(sc => string.Equals(sc.Name, "org.vfsforgit.service"));
- installed = gvfsService != null;
- running = installed && gvfsService.IsRunning;
- }
-
- public override bool TryCopyPanicLogs(string copyToDir, out string error)
- {
- error = null;
- try
- {
- if (!Directory.Exists(DiagnosticReportsDirectory))
- {
- return true;
- }
-
- string copyToPanicDir = Path.Combine(copyToDir, ProjFSKext.DriverLogDirectory, "panic_logs");
- Directory.CreateDirectory(copyToPanicDir);
-
- foreach (string filePath in Directory.GetFiles(DiagnosticReportsDirectory, PanicFileNamePattern))
- {
- try
- {
- // We only include panic logs caused by our kext
- // Panics caused by our kext will be in the form DriverName(Version)
- // We match the minimal requirement here
- if (File.ReadAllText(filePath).Contains(ProjFSKext.DriverName + "("))
- {
- File.Copy(filePath, Path.Combine(copyToPanicDir, Path.GetFileName(filePath)));
- }
- }
- catch (Exception ex)
- {
- error = error == null ? string.Empty : error + "\n";
- error += $"{nameof(this.TryCopyPanicLogs)}: Failed to handle log {filePath}: {ex.ToString()}";
- }
- }
- }
- catch (Exception ex)
- {
- error = error == null ? string.Empty : error + "\n";
- error += $"{nameof(this.TryCopyPanicLogs)}: Failed to copy panic logs: {ex.ToString()}";
- return false;
- }
-
- return error == null;
- }
-
- public class MacPlatformConstants : POSIXPlatformConstants
- {
- public override string InstallerExtension
- {
- get { return ".dmg"; }
- }
-
- public override string WorkingDirectoryBackingRootPath
- {
- get { return GVFSConstants.WorkingDirectoryRootName; }
- }
-
- public override string DotGVFSRoot
- {
- get { return MacPlatform.DotGVFSRoot; }
- }
-
- public override string GVFSBinDirectoryPath
- {
- get { return Path.Combine("/usr", "local", this.GVFSBinDirectoryName); }
- }
-
- public override string GVFSBinDirectoryName
- {
- get { return "vfsforgit"; }
- }
-
- // Documented here (in the addressing section): https://www.unix.com/man-page/mojave/4/unix/
- public override int MaxPipePathLength => 104;
-
- public override string UpgradeInstallAdviceMessage
- {
- get { return $"When ready, run {this.UpgradeConfirmCommandMessage} to upgrade."; }
- }
-
- public override string UpgradeConfirmCommandMessage
- {
- get { return UpgradeConfirmMessage; }
- }
-
- public override string StartServiceCommandMessage
- {
- get { return "`launchctl load /Library/LaunchAgents/org.vfsforgit.service.plist`"; }
- }
-
- public override string RunUpdateMessage
- {
- get { return $"Run {UpgradeConfirmMessage}."; }
- }
-
- public override bool CaseSensitiveFileSystem => false;
- }
- }
-}
diff --git a/GVFS/GVFS.Platform.Mac/MacProductUpgraderPlatformStrategy.cs b/GVFS/GVFS.Platform.Mac/MacProductUpgraderPlatformStrategy.cs
deleted file mode 100644
index 3237caad82..0000000000
--- a/GVFS/GVFS.Platform.Mac/MacProductUpgraderPlatformStrategy.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-using GVFS.Common;
-using GVFS.Common.FileSystem;
-using GVFS.Common.Tracing;
-using System;
-using System.IO;
-
-namespace GVFS.Platform.Mac
-{
- public class MacProductUpgraderPlatformStrategy : ProductUpgraderPlatformStrategy
- {
- public MacProductUpgraderPlatformStrategy(PhysicalFileSystem fileSystem, ITracer tracer)
- : base(fileSystem, tracer)
- {
- }
-
- public override bool TryPrepareLogDirectory(out string error)
- {
- error = null;
- return true;
- }
-
- public override bool TryPrepareApplicationDirectory(out string error)
- {
- string upgradeApplicationDirectory = ProductUpgraderInfo.GetUpgradeApplicationDirectory();
-
- Exception deleteDirectoryException;
- if (this.FileSystem.DirectoryExists(upgradeApplicationDirectory) &&
- !this.FileSystem.TryDeleteDirectory(upgradeApplicationDirectory, out deleteDirectoryException))
- {
- error = $"Failed to delete {upgradeApplicationDirectory} - {deleteDirectoryException.Message}";
-
- this.TraceException(deleteDirectoryException, nameof(this.TryPrepareApplicationDirectory), $"Error deleting {upgradeApplicationDirectory}.");
- return false;
- }
-
- this.FileSystem.CreateDirectory(upgradeApplicationDirectory);
-
- error = null;
- return true;
- }
-
- public override bool TryPrepareDownloadDirectory(out string error)
- {
- string directory = ProductUpgraderInfo.GetAssetDownloadsPath();
-
- Exception deleteDirectoryException;
- if (this.FileSystem.DirectoryExists(directory) &&
- !this.FileSystem.TryDeleteDirectory(directory, out deleteDirectoryException))
- {
- error = $"Failed to delete {directory} - {deleteDirectoryException.Message}";
-
- this.TraceException(deleteDirectoryException, nameof(this.TryPrepareDownloadDirectory), $"Error deleting {directory}.");
- return false;
- }
-
- this.FileSystem.CreateDirectory(directory);
-
- error = null;
- return true;
- }
- }
-}
diff --git a/GVFS/GVFS.Platform.Mac/ProjFSKext.cs b/GVFS/GVFS.Platform.Mac/ProjFSKext.cs
deleted file mode 100644
index debaf35e6f..0000000000
--- a/GVFS/GVFS.Platform.Mac/ProjFSKext.cs
+++ /dev/null
@@ -1,137 +0,0 @@
-using GVFS.Common;
-using GVFS.Common.FileSystem;
-using GVFS.Common.Tracing;
-using PrjFSLib.Mac;
-using System;
-using System.IO;
-using System.Linq;
-
-namespace GVFS.Platform.Mac
-{
- public class ProjFSKext : IKernelDriver
- {
- public const string DriverName = "org.vfsforgit.PrjFSKext";
- public const string DriverLogDirectory = "PrjFSKext";
-
- private const int LoadKext_ExitCode_Success = 0;
-
- // This exit code was found in the following article
- // https://developer.apple.com/library/archive/technotes/tn2459/_index.html
- private const int LoadKext_ExitCode_NotApproved = 27;
-
- public bool EnumerationExpandsDirectories { get; } = true;
- public bool EmptyPlaceholdersRequireFileSize { get; } = false;
-
- public string LogsFolderPath
- {
- get
- {
- return Path.Combine(System.IO.Path.GetTempPath(), DriverLogDirectory);
- }
- }
-
- public bool IsGVFSUpgradeSupported()
- {
- return true;
- }
-
- public bool IsSupported(string normalizedEnlistmentRootPath, out string warning, out string error)
- {
- warning = null;
- error = null;
-
- string pathRoot = Path.GetPathRoot(normalizedEnlistmentRootPath);
- DriveInfo rootDriveInfo = DriveInfo.GetDrives().FirstOrDefault(x => x.Name == pathRoot);
- if (rootDriveInfo == null)
- {
- warning = $"Unable to ensure that '{normalizedEnlistmentRootPath}' is an APFS or HFS+ volume.";
- }
- else if (!string.Equals(rootDriveInfo.DriveFormat, "APFS", StringComparison.OrdinalIgnoreCase) &&
- !string.Equals(rootDriveInfo.DriveFormat, "HFS", StringComparison.OrdinalIgnoreCase))
- {
- error = $"Error: Currently only APFS and HFS+ volumes are supported. Ensure repo is located into an APFS or HFS+ volume.";
- return false;
- }
-
- return true;
- }
-
- public bool TryFlushLogs(out string error)
- {
- Directory.CreateDirectory(this.LogsFolderPath);
- ProcessResult logShowOutput = ProcessHelper.Run("log", args: "show --predicate \"subsystem contains \'org.vfsforgit\'\" --info", redirectOutput: true);
- File.WriteAllText(Path.Combine(this.LogsFolderPath, "PrjFSKext.log"), logShowOutput.Output);
- error = string.Empty;
-
- return true;
- }
-
- public bool IsReady(JsonTracer tracer, string enlistmentRoot, TextWriter output, out string error)
- {
- error = null;
- return
- this.IsKextLoaded() ||
- this.TryLoad(tracer, output, out error);
- }
-
- public bool TryPrepareFolderForCallbacks(string folderPath, out string error, out Exception exception)
- {
- exception = null;
- error = string.Empty;
- Result result = VirtualizationInstance.ConvertDirectoryToVirtualizationRoot(folderPath);
- if (result != Result.Success)
- {
- error = "Failed to prepare \"" + folderPath + "\" for callbacks, error: " + result.ToString("F");
- return false;
- }
-
- return true;
- }
-
- public bool RegisterForOfflineIO()
- {
- return PrjFSLib.Mac.Managed.OfflineIO.RegisterForOfflineIO();
- }
-
- public bool UnregisterForOfflineIO()
- {
- return PrjFSLib.Mac.Managed.OfflineIO.UnregisterForOfflineIO();
- }
-
- private bool TryLoad(ITracer tracer, TextWriter output, out string errorMessage)
- {
- output?.WriteLine("Driver not loaded. Attempting to load. You may be prompted for sudo password...");
- EventMetadata metadata = new EventMetadata();
- ProcessResult loadKext = ProcessHelper.Run("sudo", "/sbin/kextload -b " + DriverName);
- if (loadKext.ExitCode == LoadKext_ExitCode_Success)
- {
- tracer.RelatedWarning(metadata, $"{DriverName} was successfully loaded but should have been autoloaded.", Keywords.Telemetry);
- errorMessage = null;
- return true;
- }
- else if (loadKext.ExitCode == LoadKext_ExitCode_NotApproved)
- {
- tracer.RelatedError("Kext unable to load. Not approved by the user");
- errorMessage = DriverName + @" was unable to load. Please check and make sure you have allowed the extension in
-System Preferences -> Security & Privacy";
- }
- else
- {
- metadata.Add("ExitCode", loadKext.ExitCode);
- metadata.Add("Output", loadKext.Output);
- metadata.Add("Errors", loadKext.Errors);
- tracer.RelatedError(metadata, "Failed to load kext");
-
- errorMessage = DriverName + " is not loaded. Make sure the kext is loaded and try again.";
- }
-
- return false;
- }
-
- private bool IsKextLoaded()
- {
- ProcessResult loadedKexts = ProcessHelper.Run("kextstat", args: "-b " + DriverName, redirectOutput: true);
- return loadedKexts.Output.Contains(DriverName);
- }
- }
-}
diff --git a/GVFS/GVFS.Platform.Mac/Properties/AssemblyInfo.cs b/GVFS/GVFS.Platform.Mac/Properties/AssemblyInfo.cs
deleted file mode 100644
index a71456402b..0000000000
--- a/GVFS/GVFS.Platform.Mac/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("GVFS.Platform.Mac")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("GVFS.Platform.Mac")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("4ce404e7-d3fc-471c-993c-64615861ea63")]
diff --git a/GVFS/GVFS.Service/GVFS.Service.Mac.csproj b/GVFS/GVFS.Service/GVFS.Service.Mac.csproj
deleted file mode 100644
index 4f34b2c450..0000000000
--- a/GVFS/GVFS.Service/GVFS.Service.Mac.csproj
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
- Exe
- GVFS.Service
- GVFS.Service
-
- netcoreapp2.1; netstandard2.0
- x64
- osx-x64
- false
- true
-
-
-
- $(GVFSVersion)
-
-
- $(GVFSVersion)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- all
-
-
-
diff --git a/GVFS/GVFS.UnitTests.Windows/GVFS.UnitTests.Windows.csproj b/GVFS/GVFS.UnitTests.Windows/GVFS.UnitTests.Windows.csproj
index 361446da6f..2150248d73 100644
--- a/GVFS/GVFS.UnitTests.Windows/GVFS.UnitTests.Windows.csproj
+++ b/GVFS/GVFS.UnitTests.Windows/GVFS.UnitTests.Windows.csproj
@@ -141,10 +141,6 @@
-
- {fac6efc5-a890-4cb2-8c80-6358e358c637}
- PrjFSLib.Mac.Managed
-
{374bf1e5-0b2d-4d4a-bd5e-4212299def09}
GVFS.Common
@@ -153,10 +149,6 @@
{1118b427-7063-422f-83b9-5023c8ec5a7a}
GVFS.GVFlt
-
- {1dac3da6-3d21-4917-b9a8-d60c8712252a}
- GVFS.Platform.Mac
-
{15fae44c-0d21-4312-9fd3-28f05a5ab7a6}
GVFS.Platform.POSIX
@@ -169,9 +161,9 @@
{93b403fd-dafb-46c5-9636-b122792a548a}
GVFS.Service.UI
-
- {03769a07-f216-456b-886b-e07caf6c5e81}
- GVFS.Service.Mac
+
+ {b8c1dfba-cafd-4f7e-a1a3-e11907b5467b}
+ GVFS.Service.Windows
{72701bc3-5da9-4c7a-bf10-9e98c9fc8eac}
@@ -194,8 +186,326 @@
-
- NetCore\%(RecursiveDir)\%(Filename)%(Extension)
+
+ NetCore\Category\\CategoryConstants.cs
+
+
+ NetCore\CommandLine\\HooksInstallerTests.cs
+
+
+ NetCore\Common\\AzDevOpsOrgFromNuGetFeedTests.cs
+
+
+ NetCore\Common\\BackgroundTaskQueueTests.cs
+
+
+ NetCore\Common\\CacheServerResolverTests.cs
+
+
+ NetCore\Common\Database\\GVFSDatabaseTests.cs
+
+
+ NetCore\Common\Database\\PlaceholderTableTests.cs
+
+
+ NetCore\Common\Database\\SparseTableTests.cs
+
+
+ NetCore\Common\Database\\TableTests.cs
+
+
+ NetCore\Common\\EpochConverterTests.cs
+
+
+ NetCore\Common\\FileBasedDictionaryTests.cs
+
+
+ NetCore\Common\\GitCommandLineParserTests.cs
+
+
+ NetCore\Common\\GitConfigHelperTests.cs
+
+
+ NetCore\Common\\GitObjectsTests.cs
+
+
+ NetCore\Common\\GitPathConverterTests.cs
+
+
+ NetCore\Common\\GitStatusCacheTests.cs
+
+
+ NetCore\Common\\GitVersionTests.cs
+
+
+ NetCore\Common\Git\\GitSslTests.cs
+
+
+ NetCore\Common\Git\\Sha1IdTests.cs
+
+
+ NetCore\Common\\GVFSEnlistmentHealthTests.cs
+
+
+ NetCore\Common\\GVFSEnlistmentTests.cs
+
+
+ NetCore\Common\\GVFSLockTests.cs
+
+
+ NetCore\Common\\InstallManifestTests.cs
+
+
+ NetCore\Common\\JsonTracerTests.cs
+
+
+ NetCore\Common\\LegacyPlaceholderDatabaseTests.cs
+
+
+ NetCore\Common\\LibGit2RepoInvokerTests.cs
+
+
+ NetCore\Common\\ModifiedPathsDatabaseTests.cs
+
+
+ NetCore\Common\\NamedPipeStreamReaderWriterTests.cs
+
+
+ NetCore\Common\\NamedPipeTests.cs
+
+
+ NetCore\Common\NuGetUpgrade\\NuGetUpgraderTests.cs
+
+
+ NetCore\Common\NuGetUpgrade\\OrgNuGetUpgraderTests.cs
+
+
+ NetCore\Common\\OrgInfoApiClientTests.cs
+
+
+ NetCore\Common\\PathsTests.cs
+
+
+ NetCore\Common\\PhysicalFileSystemDeleteTests.cs
+
+
+ NetCore\Common\\ProductUpgraderInfoTests.cs
+
+
+ NetCore\Common\\RefLogEntryTests.cs
+
+
+ NetCore\Common\\RetryBackoffTests.cs
+
+
+ NetCore\Common\\RetryConfigTests.cs
+
+
+ NetCore\Common\\RetryWrapperTests.cs
+
+
+ NetCore\Common\\SHA1UtilTests.cs
+
+
+ NetCore\Common\\TryCreateProductUpgraderTests.cs
+
+
+ NetCore\Git\\GitAuthenticationTests.cs
+
+
+ NetCore\Git\\GitObjectsTests.cs
+
+
+ NetCore\Git\\GitProcessTests.cs
+
+
+ NetCore\Git\\GVFSGitObjectsTests.cs
+
+
+ NetCore\Maintenance\\GitMaintenanceQueueTests.cs
+
+
+ NetCore\Maintenance\\GitMaintenanceStepTests.cs
+
+
+ NetCore\Maintenance\\LooseObjectStepTests.cs
+
+
+ NetCore\Maintenance\\PackfileMaintenanceStepTests.cs
+
+
+ NetCore\Maintenance\\PostFetchStepTests.cs
+
+
+ NetCore\Mock\Common\\MockFileBasedLock.cs
+
+
+ NetCore\Mock\Common\\MockGitStatusCache.cs
+
+
+ NetCore\Mock\Common\\MockGVFSEnlistment.cs
+
+
+ NetCore\Mock\Common\\MockLocalGVFSConfig.cs
+
+
+ NetCore\Mock\Common\\MockLocalGVFSConfigBuilder.cs
+
+
+ NetCore\Mock\Common\\MockPhysicalGitObjects.cs
+
+
+ NetCore\Mock\Common\\MockPlatform.cs
+
+
+ NetCore\Mock\Common\\MockProductUpgraderPlatformStrategy.cs
+
+
+ NetCore\Mock\Common\\MockTracer.cs
+
+
+ NetCore\Mock\Common\Tracing\\MockListener.cs
+
+
+ NetCore\Mock\FileSystem\\ConfigurableFileSystem.cs
+
+
+ NetCore\Mock\FileSystem\\MockDirectory.cs
+
+
+ NetCore\Mock\FileSystem\\MockFile.cs
+
+
+ NetCore\Mock\FileSystem\\MockFileSystem.cs
+
+
+ NetCore\Mock\FileSystem\\MockFileSystemCallbacks.cs
+
+
+ NetCore\Mock\FileSystem\\MockFileSystemWithCallbacks.cs
+
+
+ NetCore\Mock\FileSystem\\MockPlatformFileSystem.cs
+
+
+ NetCore\Mock\Git\\MockBatchHttpGitObjects.cs
+
+
+ NetCore\Mock\Git\\MockGitInstallation.cs
+
+
+ NetCore\Mock\Git\\MockGitProcess.cs
+
+
+ NetCore\Mock\Git\\MockGitRepo.cs
+
+
+ NetCore\Mock\Git\\MockGVFSGitObjects.cs
+
+
+ NetCore\Mock\Git\\MockHttpGitObjects.cs
+
+
+ NetCore\Mock\Git\\MockLibGit2Repo.cs
+
+
+ NetCore\Mock\\MockCacheServerInfo.cs
+
+
+ NetCore\Mock\\MockGitHubUpgrader.cs
+
+
+ NetCore\Mock\\MockInstallerPreRunChecker.cs
+
+
+ NetCore\Mock\\MockTextWriter.cs
+
+
+ NetCore\Mock\\ReusableMemoryStream.cs
+
+
+ NetCore\Mock\Virtualization\Background\\MockBackgroundTaskManager.cs
+
+
+ NetCore\Mock\Virtualization\BlobSize\\MockBlobSizesDatabase.cs
+
+
+ NetCore\Mock\Virtualization\FileSystem\\MockFileSystemVirtualizer.cs
+
+
+ NetCore\Mock\Virtualization\Projection\\MockGitIndexProjection.cs
+
+
+ NetCore\Prefetch\\BatchObjectDownloadStageTests.cs
+
+
+ NetCore\Prefetch\\BlobPrefetcherTests.cs
+
+
+ NetCore\Prefetch\\DiffHelperTests.cs
+
+
+ NetCore\Prefetch\\DiffTreeResultTests.cs
+
+
+ NetCore\Prefetch\\PrefetchPacksDeserializerTests.cs
+
+
+ NetCore\Prefetch\\PrefetchTracingTests.cs
+
+
+ NetCore\\Program.cs
+
+
+ NetCore\Service\\RepoRegistryTests.cs
+
+
+ NetCore\\Setup.cs
+
+
+ NetCore\Tracing\\EventListenerTests.cs
+
+
+ NetCore\Tracing\\QueuedPipeStringWriterTests.cs
+
+
+ NetCore\Tracing\\TelemetryDaemonEventListenerTests.cs
+
+
+ NetCore\Upgrader\\ProductUpgraderTests.cs
+
+
+ NetCore\Upgrader\\UpgradeOrchestratorTests.cs
+
+
+ NetCore\Upgrader\\UpgradeOrchestratorWithGitHubUpgraderTests.cs
+
+
+ NetCore\Upgrader\\UpgradeTests.cs
+
+
+ NetCore\Virtualization\\FileSystemCallbacksTests.cs
+
+
+ NetCore\Virtualization\Projection\\GitIndexEntryTests.cs
+
+
+ NetCore\Virtualization\Projection\\LazyUTF8StringTests.cs
+
+
+ NetCore\Virtualization\Projection\\ObjectPoolTests.cs
+
+
+ NetCore\Virtualization\Projection\\SortedFolderEntriesTests.cs
+
+
+ NetCore\Virtual\\CommonRepoSetup.cs
+
+
+ NetCore\Virtual\\FileSystemVirtualizerTester.cs
+
+
+ NetCore\Virtual\\TestsWithCommonRepo.cs
Data\%(RecursiveDir)\%(Filename)%(Extension)
@@ -230,4 +540,4 @@
-->
-
+
\ No newline at end of file
diff --git a/GVFS/GVFS.UnitTests/GVFS.UnitTests.csproj b/GVFS/GVFS.UnitTests/GVFS.UnitTests.csproj
index 786009ac60..8013af848b 100644
--- a/GVFS/GVFS.UnitTests/GVFS.UnitTests.csproj
+++ b/GVFS/GVFS.UnitTests/GVFS.UnitTests.csproj
@@ -1,4 +1,4 @@
-
+
Exe
@@ -51,10 +51,9 @@
-
-
-
+
+
diff --git a/GVFS/GVFS.UnitTests/Mock/Mac/MacFileSystemVirtualizerTester.cs b/GVFS/GVFS.UnitTests/Mock/Mac/MacFileSystemVirtualizerTester.cs
deleted file mode 100644
index 6877ae0dcd..0000000000
--- a/GVFS/GVFS.UnitTests/Mock/Mac/MacFileSystemVirtualizerTester.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-using GVFS.Platform.Mac;
-using GVFS.Tests.Should;
-using GVFS.UnitTests.Virtual;
-using GVFS.Virtualization.FileSystem;
-using PrjFSLib.Mac;
-using System;
-using System.IO;
-
-namespace GVFS.UnitTests.Mock.Mac
-{
- public class MacFileSystemVirtualizerTester : FileSystemVirtualizerTester
- {
- public MacFileSystemVirtualizerTester(CommonRepoSetup repo)
- : base(repo)
- {
- }
-
- public MacFileSystemVirtualizerTester(CommonRepoSetup repo, string[] projectedFiles)
- : base(repo, projectedFiles)
- {
- }
-
- public MockVirtualizationInstance MockVirtualization { get; private set; }
- public MacFileSystemVirtualizer MacVirtualizer { get; private set; }
-
- public void InvokeOnGetFileStream(Result expectedResult = Result.Pending, byte[] providerId = null)
- {
- if (providerId == null)
- {
- providerId = MacFileSystemVirtualizer.PlaceholderVersionId;
- }
-
- this.MockVirtualization.OnGetFileStream(
- commandId: 1,
- relativePath: "test.txt",
- providerId: MacFileSystemVirtualizer.PlaceholderVersionId,
- contentId: CommonRepoSetup.DefaultContentId,
- triggeringProcessId: 2,
- triggeringProcessName: "UnitTest",
- fileHandle: IntPtr.Zero).ShouldEqual(expectedResult);
- }
-
- public void InvokeUpdatePlaceholderIfNeeded(string fileName, FileSystemResult expectedResult, UpdateFailureCause expectedFailureCause)
- {
- UpdateFailureReason failureReason = UpdateFailureReason.NoFailure;
- this.MacVirtualizer.UpdatePlaceholderIfNeeded(
- fileName,
- DateTime.Now,
- DateTime.Now,
- DateTime.Now,
- DateTime.Now,
- 0,
- 15,
- string.Empty,
- UpdatePlaceholderType.AllowReadOnly,
- out failureReason)
- .ShouldEqual(expectedResult);
- failureReason.ShouldEqual((UpdateFailureReason)expectedFailureCause);
- }
-
- protected override FileSystemVirtualizer CreateVirtualizer(CommonRepoSetup repo)
- {
- this.MockVirtualization = new MockVirtualizationInstance();
- this.MacVirtualizer = new MacFileSystemVirtualizer(repo.Context, repo.GitObjects, this.MockVirtualization);
- return this.MacVirtualizer;
- }
- }
-}
diff --git a/GVFS/GVFS.UnitTests/Mock/Mac/MockVirtualizationInstance.cs b/GVFS/GVFS.UnitTests/Mock/Mac/MockVirtualizationInstance.cs
deleted file mode 100644
index f53aca9c74..0000000000
--- a/GVFS/GVFS.UnitTests/Mock/Mac/MockVirtualizationInstance.cs
+++ /dev/null
@@ -1,152 +0,0 @@
-using GVFS.Common;
-using GVFS.Tests.Should;
-using PrjFSLib.Mac;
-using System;
-using System.Collections.Concurrent;
-using System.Threading;
-
-namespace GVFS.UnitTests.Mock.Mac
-{
- public class MockVirtualizationInstance : VirtualizationInstance, IDisposable
- {
- private AutoResetEvent commandCompleted;
-
- public MockVirtualizationInstance()
- {
- this.commandCompleted = new AutoResetEvent(false);
- this.CreatedPlaceholders = new ConcurrentDictionary();
- this.UpdatedPlaceholders = new ConcurrentDictionary();
- this.CreatedSymLinks = new ConcurrentHashSet();
- this.WriteFileReturnResult = Result.Success;
- }
-
- public Result CompletionResult { get; set; }
- public uint BytesWritten { get; private set; }
- public Result WriteFileReturnResult { get; set; }
- public Result UpdatePlaceholderIfNeededResult { get; set; }
- public UpdateFailureCause UpdatePlaceholderIfNeededFailureCause { get; set; }
- public Result DeleteFileResult { get; set; }
- public UpdateFailureCause DeleteFileUpdateFailureCause { get; set; }
-
- public ConcurrentDictionary CreatedPlaceholders { get; private set; }
- public ConcurrentDictionary UpdatedPlaceholders { get; private set; }
-
- public ConcurrentHashSet CreatedSymLinks { get; }
-
- public override EnumerateDirectoryCallback OnEnumerateDirectory { get; set; }
- public override GetFileStreamCallback OnGetFileStream { get; set; }
-
- public override Result StartVirtualizationInstance(
- string virtualizationRootFullPath,
- uint poolThreadCount)
- {
- poolThreadCount.ShouldBeAtLeast(1U, "poolThreadCount must be greater than 0");
- return Result.Success;
- }
-
- public override Result StopVirtualizationInstance()
- {
- return Result.Success;
- }
-
- public override Result WriteFileContents(
- IntPtr fileHandle,
- byte[] bytes,
- uint byteCount)
- {
- this.BytesWritten = byteCount;
- return this.WriteFileReturnResult;
- }
-
- public override Result DeleteFile(
- string relativePath,
- UpdateType updateFlags,
- out UpdateFailureCause failureCause)
- {
- failureCause = this.DeleteFileUpdateFailureCause;
- return this.DeleteFileResult;
- }
-
- public override Result WritePlaceholderDirectory(
- string relativePath)
- {
- throw new NotImplementedException();
- }
-
- public override Result WritePlaceholderFile(
- string relativePath,
- byte[] providerId,
- byte[] contentId,
- ushort fileMode)
- {
- this.CreatedPlaceholders.TryAdd(relativePath, fileMode);
- return Result.Success;
- }
-
- public override Result WriteSymLink(
- string relativePath,
- string symLinkTarget)
- {
- this.CreatedSymLinks.Add(relativePath);
- return Result.Success;
- }
-
- public override Result UpdatePlaceholderIfNeeded(
- string relativePath,
- byte[] providerId,
- byte[] contentId,
- ushort fileMode,
- UpdateType updateFlags,
- out UpdateFailureCause failureCause)
- {
- failureCause = this.UpdatePlaceholderIfNeededFailureCause;
- if (failureCause == UpdateFailureCause.NoFailure)
- {
- this.UpdatedPlaceholders[relativePath] = fileMode;
- }
-
- return this.UpdatePlaceholderIfNeededResult;
- }
-
- public override Result ReplacePlaceholderFileWithSymLink(
- string relativePath,
- string symLinkTarget,
- UpdateType updateFlags,
- out UpdateFailureCause failureCause)
- {
- this.CreatedSymLinks.Add(relativePath);
- failureCause = this.UpdatePlaceholderIfNeededFailureCause;
- return this.UpdatePlaceholderIfNeededResult;
- }
-
- public override Result CompleteCommand(
- ulong commandId,
- Result result)
- {
- this.CompletionResult = result;
- this.commandCompleted.Set();
- return Result.Success;
- }
-
- public Result WaitForCompletionStatus()
- {
- this.commandCompleted.WaitOne();
- return this.CompletionResult;
- }
-
- public override Result ConvertDirectoryToPlaceholder(
- string relativeDirectoryPath)
- {
- throw new NotImplementedException();
- }
-
- public void Dispose()
- {
- if (this.commandCompleted != null)
- {
- this.commandCompleted.Dispose();
- this.commandCompleted = null;
- }
- }
- }
-}
diff --git a/GVFS/GVFS.UnitTests/Platform.Mac/MacDaemonControllerTests.cs b/GVFS/GVFS.UnitTests/Platform.Mac/MacDaemonControllerTests.cs
deleted file mode 100644
index d8a43e2780..0000000000
--- a/GVFS/GVFS.UnitTests/Platform.Mac/MacDaemonControllerTests.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using GVFS.Common;
-using GVFS.Platform.Mac;
-using GVFS.Tests.Should;
-using Moq;
-using NUnit.Framework;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-
-namespace GVFS.UnitTests.Platform.Mac
-{
- [TestFixture]
- public class MacServiceProcessTests
- {
- [TestCase]
- public void CanGetServices()
- {
- Mock processHelperMock = new Mock(MockBehavior.Strict);
-
- StringBuilder sb = new StringBuilder();
- sb.AppendLine("PID\tStatus\tLabel");
- sb.AppendLine("1\t0\tcom.apple.process1");
- sb.AppendLine("2\t0\tcom.apple.process2");
- sb.AppendLine("3\t0\tcom.apple.process3");
- sb.AppendLine("-\t0\tcom.apple.process4");
-
- ProcessResult processResult = new ProcessResult(sb.ToString(), string.Empty, 0);
-
- processHelperMock.Setup(m => m.Run("/bin/launchctl", "asuser 521 /bin/launchctl list", true)).Returns(processResult);
-
- MacDaemonController daemonController = new MacDaemonController(processHelperMock.Object);
- bool success = daemonController.TryGetDaemons("521", out List daemons, out string error);
-
- success.ShouldBeTrue();
- daemons.ShouldNotBeNull();
- daemons.Count.ShouldEqual(4);
- processHelperMock.VerifyAll();
- }
- }
-}
diff --git a/GVFS/GVFS.UnitTests/Platform.Mac/MacFileSystemVirtualizerTests.cs b/GVFS/GVFS.UnitTests/Platform.Mac/MacFileSystemVirtualizerTests.cs
deleted file mode 100644
index d2bdcb8168..0000000000
--- a/GVFS/GVFS.UnitTests/Platform.Mac/MacFileSystemVirtualizerTests.cs
+++ /dev/null
@@ -1,390 +0,0 @@
-using GVFS.Common;
-using GVFS.Platform.Mac;
-using GVFS.Tests.Should;
-using GVFS.UnitTests.Category;
-using GVFS.UnitTests.Mock.Git;
-using GVFS.UnitTests.Mock.Mac;
-using GVFS.UnitTests.Virtual;
-using GVFS.Virtualization.Background;
-using GVFS.Virtualization.FileSystem;
-using GVFS.Virtualization.Projection;
-using NUnit.Framework;
-using PrjFSLib.Mac;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-
-namespace GVFS.UnitTests.Platform.Mac
-{
- [TestFixture]
- public class MacFileSystemVirtualizerTests : TestsWithCommonRepo
- {
- private static readonly Dictionary MappedResults = new Dictionary()
- {
- { Result.Success, FSResult.Ok },
- { Result.EFileNotFound, FSResult.FileOrPathNotFound },
- { Result.EPathNotFound, FSResult.FileOrPathNotFound },
- { Result.EDirectoryNotEmpty, FSResult.DirectoryNotEmpty },
- { Result.EVirtualizationInvalidOperation, FSResult.VirtualizationInvalidOperation },
- };
-
- [TestCase]
- public void ResultToFSResultMapsHResults()
- {
- foreach (Result result in Enum.GetValues(typeof(Result)))
- {
- if (MappedResults.ContainsKey(result))
- {
- MacFileSystemVirtualizer.ResultToFSResult(result).ShouldEqual(MappedResults[result]);
- }
- else
- {
- MacFileSystemVirtualizer.ResultToFSResult(result).ShouldEqual(FSResult.IOError);
- }
- }
- }
-
- [TestCase]
- public void DeleteFile()
- {
- using (MockVirtualizationInstance mockVirtualization = new MockVirtualizationInstance())
- using (MacFileSystemVirtualizer virtualizer = new MacFileSystemVirtualizer(this.Repo.Context, this.Repo.GitObjects, mockVirtualization))
- {
- const string DeleteTestFileName = "deleteMe.txt";
- UpdateFailureReason failureReason = UpdateFailureReason.NoFailure;
-
- mockVirtualization.DeleteFileResult = Result.Success;
- mockVirtualization.DeleteFileUpdateFailureCause = UpdateFailureCause.NoFailure;
- virtualizer
- .DeleteFile(DeleteTestFileName, UpdatePlaceholderType.AllowReadOnly, out failureReason)
- .ShouldEqual(new FileSystemResult(FSResult.Ok, (int)mockVirtualization.DeleteFileResult));
- failureReason.ShouldEqual((UpdateFailureReason)mockVirtualization.DeleteFileUpdateFailureCause);
-
- mockVirtualization.DeleteFileResult = Result.EFileNotFound;
- mockVirtualization.DeleteFileUpdateFailureCause = UpdateFailureCause.NoFailure;
- virtualizer
- .DeleteFile(DeleteTestFileName, UpdatePlaceholderType.AllowReadOnly, out failureReason)
- .ShouldEqual(new FileSystemResult(FSResult.FileOrPathNotFound, (int)mockVirtualization.DeleteFileResult));
- failureReason.ShouldEqual((UpdateFailureReason)mockVirtualization.DeleteFileUpdateFailureCause);
-
- // TODO: What will the result be when the UpdateFailureCause is DirtyData
- mockVirtualization.DeleteFileResult = Result.EInvalidOperation;
-
- // TODO: The result should probably be VirtualizationInvalidOperation but for now it's IOError
- mockVirtualization.DeleteFileUpdateFailureCause = UpdateFailureCause.DirtyData;
- virtualizer
- .DeleteFile(DeleteTestFileName, UpdatePlaceholderType.AllowReadOnly, out failureReason)
- .ShouldEqual(new FileSystemResult(FSResult.IOError, (int)mockVirtualization.DeleteFileResult));
- failureReason.ShouldEqual((UpdateFailureReason)mockVirtualization.DeleteFileUpdateFailureCause);
- }
- }
-
- [TestCase]
- public void UpdatePlaceholderIfNeeded()
- {
- const string UpdatePlaceholderFileName = "testUpdatePlaceholder.txt";
- using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo, new[] { UpdatePlaceholderFileName }))
- {
- tester.GitIndexProjection.MockFileTypesAndModes.TryAdd(
- UpdatePlaceholderFileName,
- ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.Regular, GitIndexProjection.FileMode644));
-
- tester.MockVirtualization.UpdatePlaceholderIfNeededResult = Result.Success;
- tester.MockVirtualization.UpdatePlaceholderIfNeededFailureCause = UpdateFailureCause.NoFailure;
- tester.InvokeUpdatePlaceholderIfNeeded(
- UpdatePlaceholderFileName,
- expectedResult: new FileSystemResult(FSResult.Ok, (int)Result.Success),
- expectedFailureCause: UpdateFailureCause.NoFailure);
-
- tester.MockVirtualization.UpdatedPlaceholders.ShouldContain(path => path.Key.Equals(UpdatePlaceholderFileName) && path.Value == GitIndexProjection.FileMode644);
- tester.MockVirtualization.UpdatedPlaceholders.Clear();
-
- tester.MockVirtualization.UpdatePlaceholderIfNeededResult = Result.EFileNotFound;
- tester.MockVirtualization.UpdatePlaceholderIfNeededFailureCause = UpdateFailureCause.NoFailure;
- tester.InvokeUpdatePlaceholderIfNeeded(
- UpdatePlaceholderFileName,
- expectedResult: new FileSystemResult(FSResult.FileOrPathNotFound, (int)Result.EFileNotFound),
- expectedFailureCause: UpdateFailureCause.NoFailure);
-
- // TODO: What will the result be when the UpdateFailureCause is DirtyData
- tester.MockVirtualization.UpdatePlaceholderIfNeededResult = Result.EInvalidOperation;
- tester.MockVirtualization.UpdatePlaceholderIfNeededFailureCause = UpdateFailureCause.DirtyData;
-
- // TODO: The result should probably be VirtualizationInvalidOperation but for now it's IOError
- tester.InvokeUpdatePlaceholderIfNeeded(
- UpdatePlaceholderFileName,
- expectedResult: new FileSystemResult(FSResult.IOError, (int)Result.EInvalidOperation),
- expectedFailureCause: UpdateFailureCause.DirtyData);
- }
- }
-
- [TestCase]
- public void WritePlaceholderForSymLink()
- {
- const string WriteSymLinkFileName = "testWriteSymLink.txt";
- using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo, new[] { WriteSymLinkFileName }))
- {
- tester.GitIndexProjection.MockFileTypesAndModes.TryAdd(
- WriteSymLinkFileName,
- ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.SymLink, fileMode: 0));
-
- tester.Virtualizer.WritePlaceholderFile(
- WriteSymLinkFileName,
- endOfFile: 0,
- sha: string.Empty).ShouldEqual(new FileSystemResult(FSResult.Ok, (int)Result.Success));
-
- tester.MockVirtualization.CreatedPlaceholders.ShouldBeEmpty();
- tester.MockVirtualization.CreatedSymLinks.Count.ShouldEqual(1);
- tester.MockVirtualization.CreatedSymLinks.ShouldContain(entry => entry.Equals(WriteSymLinkFileName));
-
- tester.BackgroundTaskShouldBeScheduled(WriteSymLinkFileName, FileSystemTask.OperationType.OnFileSymLinkCreated);
- }
- }
-
- [TestCase]
- public void UpdatePlaceholderToSymLink()
- {
- const string PlaceholderToLinkFileName = "testUpdatePlaceholderToLink.txt";
- using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo, new[] { PlaceholderToLinkFileName }))
- {
- tester.GitIndexProjection.MockFileTypesAndModes.TryAdd(
- PlaceholderToLinkFileName,
- ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.SymLink, fileMode: 0));
-
- tester.MockVirtualization.UpdatePlaceholderIfNeededResult = Result.Success;
- tester.MockVirtualization.UpdatePlaceholderIfNeededFailureCause = UpdateFailureCause.NoFailure;
- tester.InvokeUpdatePlaceholderIfNeeded(
- PlaceholderToLinkFileName,
- expectedResult: new FileSystemResult(FSResult.Ok, (int)Result.Success),
- expectedFailureCause: UpdateFailureCause.NoFailure);
-
- tester.MockVirtualization.UpdatedPlaceholders.Count.ShouldEqual(0, "UpdatePlaceholderIfNeeded should not be called when converting a placeholder to a link");
- tester.MockVirtualization.CreatedSymLinks.Count.ShouldEqual(1);
- tester.MockVirtualization.CreatedSymLinks.ShouldContain(entry => entry.Equals(PlaceholderToLinkFileName));
-
- tester.BackgroundTaskShouldBeScheduled(PlaceholderToLinkFileName, FileSystemTask.OperationType.OnFileSymLinkCreated);
- }
- }
-
- [TestCase]
- public void ClearNegativePathCacheIsNoOp()
- {
- using (MockVirtualizationInstance mockVirtualization = new MockVirtualizationInstance())
- using (MacFileSystemVirtualizer virtualizer = new MacFileSystemVirtualizer(this.Repo.Context, this.Repo.GitObjects, mockVirtualization))
- {
- uint totalEntryCount = 0;
- virtualizer.ClearNegativePathCache(out totalEntryCount).ShouldEqual(new FileSystemResult(FSResult.Ok, (int)Result.Success));
- totalEntryCount.ShouldEqual(0U);
- }
- }
-
- [TestCase]
- public void OnEnumerateDirectoryReturnsSuccessWhenResultsNotInMemory()
- {
- const string TestFileName = "test.txt";
- const string TestFolderName = "testFolder";
- string testFilePath = Path.Combine(TestFolderName, TestFileName);
-
- // Don't include TestFolderName as MockGitIndexProjection returns the same list of files regardless of what folder name
- // it is passed
- using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo))
- {
- tester.GitIndexProjection.MockFileTypesAndModes.TryAdd(
- testFilePath,
- ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.Regular, GitIndexProjection.FileMode644));
-
- tester.GitIndexProjection.EnumerationInMemory = false;
- tester.MockVirtualization.OnEnumerateDirectory(1, TestFolderName, triggeringProcessId: 1, triggeringProcessName: "UnitTests").ShouldEqual(Result.Success);
- tester.MockVirtualization.CreatedPlaceholders.ShouldContain(
- kvp => kvp.Key.Equals(testFilePath, GVFSPlatform.Instance.Constants.PathComparison) && kvp.Value == GitIndexProjection.FileMode644);
- }
- }
-
- [TestCase]
- public void OnEnumerateDirectoryReturnsSuccessWhenResultsInMemory()
- {
- const string TestFileName = "test.txt";
- const string TestFolderName = "testFolder";
- string testFilePath = Path.Combine(TestFolderName, TestFileName);
-
- // Don't include TestFolderName as MockGitIndexProjection returns the same list of files regardless of what folder name
- // it is passed
- using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo))
- {
- tester.GitIndexProjection.MockFileTypesAndModes.TryAdd(
- testFilePath,
- ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.Regular, GitIndexProjection.FileMode644));
-
- tester.GitIndexProjection.EnumerationInMemory = true;
- tester.MockVirtualization.OnEnumerateDirectory(1, TestFolderName, triggeringProcessId: 1, triggeringProcessName: "UnitTests").ShouldEqual(Result.Success);
- tester.MockVirtualization.CreatedPlaceholders.ShouldContain(
- kvp => kvp.Key.Equals(testFilePath, GVFSPlatform.Instance.Constants.PathComparison) && kvp.Value == GitIndexProjection.FileMode644);
- tester.GitIndexProjection.ExpandedFolders.ShouldMatchInOrder(TestFolderName);
- }
- }
-
- [TestCase]
- public void OnEnumerateDirectorySetsFileModes()
- {
- const string TestFile644Name = "test644.txt";
- const string TestFile664Name = "test664.txt";
- const string TestFile755Name = "test755.txt";
- const string TestFolderName = "testFolder";
- string testFile644Path = Path.Combine(TestFolderName, TestFile644Name);
- string testFile664Path = Path.Combine(TestFolderName, TestFile664Name);
- string testFile755Path = Path.Combine(TestFolderName, TestFile755Name);
-
- // Don't include TestFolderName as MockGitIndexProjection returns the same list of files regardless of what folder name
- // it is passed
- using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo, new[] { TestFile644Name, TestFile664Name, TestFile755Name }))
- {
- tester.GitIndexProjection.MockFileTypesAndModes.TryAdd(
- testFile644Path,
- ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.Regular, GitIndexProjection.FileMode644));
- tester.GitIndexProjection.MockFileTypesAndModes.TryAdd(
- testFile664Path,
- ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.Regular, GitIndexProjection.FileMode664));
- tester.GitIndexProjection.MockFileTypesAndModes.TryAdd(
- testFile755Path,
- ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.Regular, GitIndexProjection.FileMode755));
-
- tester.GitIndexProjection.EnumerationInMemory = true;
- tester.MockVirtualization.OnEnumerateDirectory(1, TestFolderName, triggeringProcessId: 1, triggeringProcessName: "UnitTests").ShouldEqual(Result.Success);
- tester.MockVirtualization.CreatedPlaceholders.ShouldContain(
- kvp => kvp.Key.Equals(testFile644Path, GVFSPlatform.Instance.Constants.PathComparison) && kvp.Value == GitIndexProjection.FileMode644);
- tester.MockVirtualization.CreatedPlaceholders.ShouldContain(
- kvp => kvp.Key.Equals(testFile664Path, GVFSPlatform.Instance.Constants.PathComparison) && kvp.Value == GitIndexProjection.FileMode664);
- tester.MockVirtualization.CreatedPlaceholders.ShouldContain(
- kvp => kvp.Key.Equals(testFile755Path, GVFSPlatform.Instance.Constants.PathComparison) && kvp.Value == GitIndexProjection.FileMode755);
- }
- }
-
- [TestCase]
- public void OnGetFileStreamReturnsSuccessWhenFileStreamAvailable()
- {
- using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo))
- {
- tester.MockVirtualization.WriteFileReturnResult = Result.Success;
- tester.InvokeOnGetFileStream(expectedResult: Result.Success);
- tester.MockVirtualization.BytesWritten.ShouldEqual(MockGVFSGitObjects.DefaultFileLength);
- }
- }
-
- [TestCase]
- [Category(CategoryConstants.ExceptionExpected)]
- public void OnGetFileStreamReturnsErrorWhenWriteFileContentsFails()
- {
- using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo))
- {
- tester.MockVirtualization.WriteFileReturnResult = Result.EIOError;
- tester.InvokeOnGetFileStream(expectedResult: Result.EIOError);
- }
- }
-
- [TestCase]
- public void OnNewFileCreatedInsideDotGitDirectoryShouldNotScheduleBackgroundTask()
- {
- using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo))
- {
- tester.MockVirtualization.OnNewFileCreated(Path.Combine(".git", "testing.txt"), isDirectory: false);
- tester.BackgroundTaskRunner.Count.ShouldEqual(0);
- }
- }
-
- [TestCase]
- public void OnNewFileCreatedFileShouldScheduleBackgroundTask()
- {
- using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo))
- {
- tester.MockVirtualization.OnNewFileCreated("testing.txt", isDirectory: false);
- tester.BackgroundTaskShouldBeScheduled("testing.txt", FileSystemTask.OperationType.OnFileCreated);
- tester.GitIndexProjection.SparseEntries.Count.ShouldEqual(0);
- }
- }
-
- [TestCase]
- public void OnNewFileCreatedDirectoryIncludedShouldScheduleBackgroundTask()
- {
- using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo))
- {
- tester.GitIndexProjection.GetFolderPathSparseStateValue = GitIndexProjection.PathSparseState.Included;
- tester.MockVirtualization.OnNewFileCreated("testing", isDirectory: true);
- tester.BackgroundTaskShouldBeScheduled("testing", FileSystemTask.OperationType.OnFolderCreated);
- tester.GitIndexProjection.SparseEntries.Count.ShouldEqual(0);
- }
- }
-
- [TestCase]
- public void OnNewFileCreatedDirectoryExcludedShouldNotScheduleBackgroundTask()
- {
- const string TestFileName = "test.txt";
- const string TestFolderName = "testFolder";
- string testFilePath = Path.Combine(TestFolderName, TestFileName);
-
- using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo))
- {
- tester.GitIndexProjection.MockFileTypesAndModes.TryAdd(
- testFilePath,
- ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.Regular, GitIndexProjection.FileMode644));
-
- tester.GitIndexProjection.GetFolderPathSparseStateValue = GitIndexProjection.PathSparseState.Excluded;
- tester.MockVirtualization.OnNewFileCreated(TestFolderName, isDirectory: true);
- tester.BackgroundTaskRunner.Count.ShouldEqual(0);
- tester.GitIndexProjection.SparseEntries.Count.ShouldEqual(1);
- tester.GitIndexProjection.SparseEntries.First().ShouldEqual(TestFolderName);
- tester.MockVirtualization.CreatedPlaceholders.ShouldContain(
- kvp => kvp.Key.Equals(testFilePath, GVFSPlatform.Instance.Constants.PathComparison) && kvp.Value == GitIndexProjection.FileMode644);
- }
- }
-
- [TestCase]
- public void OnNewFileCreatedDirectoryNotFoundShouldScheduleBackgroundTask()
- {
- using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo))
- {
- tester.GitIndexProjection.GetFolderPathSparseStateValue = GitIndexProjection.PathSparseState.NotFound;
- tester.MockVirtualization.OnNewFileCreated("testing", isDirectory: true);
- tester.BackgroundTaskShouldBeScheduled("testing", FileSystemTask.OperationType.OnFolderCreated);
- tester.GitIndexProjection.SparseEntries.Count.ShouldEqual(0);
- }
- }
-
- [TestCase]
- public void OnNewFileCreatedDirectoryExcludedTryAddSparseFolderFailureShouldScheduleBackgroundTask()
- {
- using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo))
- {
- tester.GitIndexProjection.GetFolderPathSparseStateValue = GitIndexProjection.PathSparseState.Excluded;
- tester.GitIndexProjection.TryAddSparseFolderReturnValue = false;
- tester.MockVirtualization.OnNewFileCreated("testing", isDirectory: true);
- tester.BackgroundTaskShouldBeScheduled("testing", FileSystemTask.OperationType.OnFolderCreated);
- tester.GitIndexProjection.SparseEntries.Count.ShouldEqual(0);
- }
- }
-
- private static ushort ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType fileType, ushort fileMode)
- {
- // Values used in the index file to indicate the type of the file
- const ushort RegularFileIndexEntry = 0x8000;
- const ushort SymLinkFileIndexEntry = 0xA000;
- const ushort GitLinkFileIndexEntry = 0xE000;
-
- switch (fileType)
- {
- case GitIndexProjection.FileType.Regular:
- return (ushort)(RegularFileIndexEntry | fileMode);
-
- case GitIndexProjection.FileType.SymLink:
- return (ushort)(SymLinkFileIndexEntry | fileMode);
-
- case GitIndexProjection.FileType.GitLink:
- return (ushort)(GitLinkFileIndexEntry | fileMode);
-
- default:
- Assert.Fail($"Invalid fileType {fileType}");
- return 0;
- }
- }
- }
-}
diff --git a/GVFS/GVFS.UnitTests/Service/Mac/MacServiceTests.cs b/GVFS/GVFS.UnitTests/Service/Mac/MacServiceTests.cs
deleted file mode 100644
index 5dffa80a49..0000000000
--- a/GVFS/GVFS.UnitTests/Service/Mac/MacServiceTests.cs
+++ /dev/null
@@ -1,137 +0,0 @@
-using GVFS.Common;
-using GVFS.Common.NamedPipes;
-using GVFS.Service;
-using GVFS.Service.Handlers;
-using GVFS.UnitTests.Mock.Common;
-using GVFS.UnitTests.Mock.FileSystem;
-using Moq;
-using NUnit.Framework;
-using System.IO;
-
-namespace GVFS.UnitTests.Service.Mac
-{
- [TestFixture]
- public class MacServiceTests
- {
- private const string GVFSServiceName = "GVFS.Service";
- private const int ExpectedActiveUserId = 502;
- private const int ExpectedSessionId = 502;
- private static readonly string ExpectedActiveRepoPath = Path.Combine("mock:", "code", "repo2");
- private static readonly string ServiceDataLocation = Path.Combine("mock:", "registryDataFolder");
-
- private MockFileSystem fileSystem;
- private MockTracer tracer;
- private MockPlatform gvfsPlatform;
-
- [SetUp]
- public void SetUp()
- {
- this.tracer = new MockTracer();
- this.fileSystem = new MockFileSystem(new MockDirectory(ServiceDataLocation, null, null));
- this.gvfsPlatform = (MockPlatform)GVFSPlatform.Instance;
- this.gvfsPlatform.MockCurrentUser = ExpectedActiveUserId.ToString();
- }
-
- [TestCase]
- public void ServiceStartTriggersAutoMountForCurrentUser()
- {
- Mock repoRegistry = new Mock(MockBehavior.Strict);
- repoRegistry.Setup(r => r.AutoMountRepos(ExpectedActiveUserId.ToString(), ExpectedSessionId, true));
- repoRegistry.Setup(r => r.TraceStatus());
-
- GVFSService service = new GVFSService(
- this.tracer,
- serviceName: null,
- repoRegistry: repoRegistry.Object);
-
- service.Run();
-
- repoRegistry.VerifyAll();
- }
-
- [TestCase]
- public void ServiceHandlesEnablePrjfsRequest()
- {
- string expectedServiceResponse = "TRequestResponse|{\"State\":1,\"ErrorMessage\":null}";
- Mock connectionMock = new Mock(
- MockBehavior.Strict,
- null, // serverStream
- this.tracer, // tracer
- null); // isStopping
- connectionMock.Setup(mp => mp.TrySendResponse(expectedServiceResponse)).Returns(true);
-
- NamedPipeMessages.EnableAndAttachProjFSRequest request = new NamedPipeMessages.EnableAndAttachProjFSRequest();
- request.EnlistmentRoot = string.Empty;
-
- RequestHandler serviceRequestHandler = new RequestHandler(this.tracer, etwArea: string.Empty, repoRegistry: null);
- serviceRequestHandler.HandleRequest(this.tracer, request.ToMessage().ToString(), connectionMock.Object);
-
- connectionMock.VerifyAll();
- }
-
- [TestCase]
- public void RepoRegistryMountsOnlyRegisteredRepos()
- {
- Mock repoMounterMock = new Mock(MockBehavior.Strict);
- repoMounterMock.Setup(mp => mp.MountRepository(ExpectedActiveRepoPath, ExpectedActiveUserId)).Returns(true);
-
- this.CreateTestRepos(ServiceDataLocation);
-
- RepoRegistry repoRegistry = new RepoRegistry(
- this.tracer,
- this.fileSystem,
- ServiceDataLocation,
- repoMounterMock.Object,
- null);
-
- repoRegistry.AutoMountRepos(ExpectedActiveUserId.ToString(), ExpectedSessionId, checkDirectoryExists: false);
-
- repoMounterMock.VerifyAll();
- }
-
- [TestCase]
- public void MountProcessLaunchedUsingCorrectArgs()
- {
- string executable = @"/bin/launchctl";
- string gvfsBinPath = Path.Combine(this.gvfsPlatform.Constants.GVFSBinDirectoryPath, this.gvfsPlatform.Constants.GVFSExecutableName);
- string expectedArgs = $"asuser {ExpectedActiveUserId} {gvfsBinPath} mount {ExpectedActiveRepoPath}";
-
- Mock mountLauncherMock = new Mock(MockBehavior.Strict, this.tracer);
- mountLauncherMock.Setup(mp => mp.LaunchProcess(
- executable,
- expectedArgs,
- ExpectedActiveRepoPath))
- .Returns(true);
-
- string errorString = null;
- mountLauncherMock.Setup(mp => mp.WaitUntilMounted(
- this.tracer,
- ExpectedActiveRepoPath,
- It.IsAny(),
- out errorString))
- .Returns(true);
-
- GVFSMountProcess mountProcess = new GVFSMountProcess(this.tracer, mountLauncherMock.Object);
- mountProcess.MountRepository(ExpectedActiveRepoPath, ExpectedActiveUserId);
-
- mountLauncherMock.VerifyAll();
- }
-
- private void CreateTestRepos(string dataLocation)
- {
- string repo1 = Path.Combine("mock:", "code", "repo1");
- string repo2 = ExpectedActiveRepoPath;
- string repo3 = Path.Combine("mock:", "code", "repo3");
- string repo4 = Path.Combine("mock:", "code", "repo4");
-
- this.fileSystem.WriteAllText(
- Path.Combine(dataLocation, RepoRegistry.RegistryName),
- $@"1
- {{""EnlistmentRoot"":""{repo1.Replace("\\", "\\\\")}"",""OwnerSID"":502,""IsActive"":false}}
- {{""EnlistmentRoot"":""{repo2.Replace("\\", "\\\\")}"",""OwnerSID"":502,""IsActive"":true}}
- {{""EnlistmentRoot"":""{repo3.Replace("\\", "\\\\")}"",""OwnerSID"":501,""IsActive"":false}}
- {{""EnlistmentRoot"":""{repo4.Replace("\\", "\\\\")}"",""OwnerSID"":501,""IsActive"":true}}
- ");
- }
- }
-}
diff --git a/GVFS/GVFS/GVFS.Mac.csproj b/GVFS/GVFS/GVFS.Mac.csproj
deleted file mode 100644
index 50dd74a110..0000000000
--- a/GVFS/GVFS/GVFS.Mac.csproj
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
- Exe
- gvfs
- netcoreapp2.1
- x64
- osx-x64
-
-
-
- $(GVFSVersion)
-
-
- $(GVFSVersion)
-
-
-
- all
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/MirrorProvider/MirrorProvider.Mac/MirrorProvider.Mac.csproj b/MirrorProvider/MirrorProvider.Mac/MirrorProvider.Mac.csproj
deleted file mode 100644
index 11e84c84e3..0000000000
--- a/MirrorProvider/MirrorProvider.Mac/MirrorProvider.Mac.csproj
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
- Exe
- netcoreapp2.1
- osx.10.12-x64
- x64
- Debug;Release
-
-
-
- ..\..\..\BuildOutput
-
-
-
- $(BuildOutputDir)\MirrorProvider.Mac\obj\$(Configuration)\$(Platform)
- $(BuildOutputDir)\MirrorProvider.Mac\bin\$(Configuration)\$(Platform)
- true
-
-
-
- true
- full
- false
- TRACE;DEBUG
-
-
-
- true
- TRACE;RELEASE
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Scripts/Mac/BuildGVFSForMac.sh b/Scripts/Mac/BuildGVFSForMac.sh
deleted file mode 100755
index 64f109751f..0000000000
--- a/Scripts/Mac/BuildGVFSForMac.sh
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/bin/bash
-
-. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh"
-
-CONFIGURATION=$1
-if [ -z $CONFIGURATION ]; then
- CONFIGURATION=Debug
-fi
-
-runVersionUpdater="yes"
-VERSION=$2
-if [ -z $VERSION ]; then
- VERSION="0.2.173.2"
-
- # don't update version number for developer builds
- runVersionUpdater="no"
-fi
-
-if [ ! -d $VFS_OUTPUTDIR ]; then
- mkdir $VFS_OUTPUTDIR
-fi
-
-echo 'Building ProjFS kext and libraries...'
-$VFS_SRCDIR/ProjFS.Mac/Scripts/Build.sh $CONFIGURATION || exit 1
-
-# Create the directory where we'll do pre build tasks
-BUILDDIR=$VFS_OUTPUTDIR/GVFS.Build
-if [ ! -d $BUILDDIR ]; then
- mkdir $BUILDDIR || exit 1
-fi
-
-echo 'Downloading a VFS-enabled version of Git...'
-$VFS_SCRIPTDIR/DownloadGVFSGit.sh || exit 1
-GITVERSION="$($VFS_SCRIPTDIR/GetGitVersionNumber.sh)"
-GITPATH="$(find $VFS_PACKAGESDIR/gitformac.gvfs.installer/$GITVERSION -type f -name *.dmg)" || exit 1
-echo "Downloaded Git $GITVERSION"
-# Now that we have a path containing the version number, generate GVFSConstants.GitVersion.cs
-$VFS_SCRIPTDIR/GenerateGitVersionConstants.sh "$GITPATH" $BUILDDIR || exit 1
-
-# If we're building the Profiling(Release) configuration, remove Profiling() for building .NET code
-if [ "$CONFIGURATION" == "Profiling(Release)" ]; then
- CONFIGURATION=Release
-fi
-
-echo "Generating CommonAssemblyVersion.cs as $VERSION..."
-$VFS_SCRIPTDIR/GenerateCommonAssemblyVersion.sh $VERSION || exit 1
-
-# /warnasmessage:MSB4011. Reference: https://bugzilla.xamarin.com/show_bug.cgi?id=58564
-# Visual Studio Mac does not support explicit import of Sdks. GVFS.Installer.Mac.csproj
-# does need this ability to override "Build" and "Publish" targets. As a workaround the
-# project implicitly imports "Microsoft.Net.Sdk" in the beginning of its csproj (because
-# otherwise Visual Studio Mac IDE will not be able to open the GVFS.Install.Mac project)
-# and explicitly imports Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" later, before
-# overriding build targets. The duplicate import generates warning MSB4011 that is ignored
-# by this switch.
-echo 'Restoring packages...'
-dotnet restore $VFS_SRCDIR/GVFS.sln /p:Configuration=$CONFIGURATION.Mac --packages $VFS_PACKAGESDIR /warnasmessage:MSB4011 || exit 1
-dotnet build $VFS_SRCDIR/GVFS.sln --runtime osx-x64 --framework netcoreapp2.1 --configuration $CONFIGURATION.Mac -p:CopyPrjFS=true /maxcpucount:1 /warnasmessage:MSB4011 || exit 1
-
-NATIVEDIR=$VFS_SRCDIR/GVFS/GVFS.Native.Mac
-xcodebuild -configuration $CONFIGURATION -workspace $NATIVEDIR/GVFS.Native.Mac.xcworkspace build -scheme GVFS.Native.Mac -derivedDataPath $VFS_OUTPUTDIR/GVFS.Native.Mac || exit 1
-
-USERNOTIFICATIONDIR=$VFS_SRCDIR/GVFS/GVFS.Notifications/VFSForGit.Mac
-USERNOTIFICATIONPROJECT="$USERNOTIFICATIONDIR/VFSForGit.xcodeproj"
-USERNOTIFICATIONSCHEME="VFS For Git"
-if [ "$runVersionUpdater" == "yes" ]; then
- updateAppVersionCmd="(cd \"$USERNOTIFICATIONDIR\" && /usr/bin/xcrun agvtool new-marketing-version \"$VERSION\")"
- echo $updateAppVersionCmd
- eval $updateAppVersionCmd || exit 1
-fi
-# Build user notification app
-xcodebuild -configuration $CONFIGURATION -project "$USERNOTIFICATIONPROJECT" build -scheme "$USERNOTIFICATIONSCHEME" -derivedDataPath $VFS_OUTPUTDIR/GVFS.Notifications/VFSForGit.Mac || exit 1
-
-# Build the tests in a separate directory, so the binary for distribution does not contain
-# test plugins created and injected by the test build.
-xcodebuild -configuration $CONFIGURATION -project "$USERNOTIFICATIONPROJECT" test -scheme "$USERNOTIFICATIONSCHEME" -derivedDataPath $VFS_OUTPUTDIR/GVFS.Notifications/VFSForGit.Mac/Tests || exit 1
-
-if [ ! -d $VFS_PUBLISHDIR ]; then
- mkdir $VFS_PUBLISHDIR || exit 1
-fi
-
-echo 'Copying native binaries to Publish directory...'
-cp $VFS_OUTPUTDIR/GVFS.Native.Mac/Build/Products/$CONFIGURATION/GVFS.ReadObjectHook $VFS_PUBLISHDIR || exit 1
-cp $VFS_OUTPUTDIR/GVFS.Native.Mac/Build/Products/$CONFIGURATION/GVFS.VirtualFileSystemHook $VFS_PUBLISHDIR || exit 1
-cp $VFS_OUTPUTDIR/GVFS.Native.Mac/Build/Products/$CONFIGURATION/GVFS.PostIndexChangedHook $VFS_PUBLISHDIR || exit 1
-
-# Publish after native build, so installer package can include the native binaries.
-dotnet publish $VFS_SRCDIR/GVFS.sln /p:Configuration=$CONFIGURATION.Mac /p:Platform=x64 -p:CopyPrjFS=true --runtime osx-x64 --framework netcoreapp2.1 --self-contained --output $VFS_PUBLISHDIR /maxcpucount:1 /warnasmessage:MSB4011 || exit 1
-
-echo 'Copying Git installer to the output directory...'
-$VFS_SCRIPTDIR/PublishGit.sh $GITPATH || exit 1
-
-echo 'Installing shared data queue stall workaround...'
-# We'll generate a temporary project if and only if we don't find the correct dylib already in place.
-BUILDDIR=$VFS_OUTPUTDIR/GVFS.Build
-if [ ! -e $BUILDDIR/libSharedDataQueue.dylib ]; then
- cp $VFS_SRCDIR/nuget.config $BUILDDIR
- dotnet new classlib -n Restore.SharedDataQueueStallWorkaround -o $BUILDDIR --force
- dotnet add $BUILDDIR/Restore.SharedDataQueueStallWorkaround.csproj package --package-directory $VFS_PACKAGESDIR SharedDataQueueStallWorkaround --version '1.0.0'
- cp $VFS_PACKAGESDIR/shareddataqueuestallworkaround/1.0.0/libSharedDataQueue.dylib $BUILDDIR/libSharedDataQueue.dylib
-fi
-
-echo 'Running VFS for Git unit tests...'
-$VFS_PUBLISHDIR/GVFS.UnitTests || exit 1
diff --git a/Scripts/Mac/CI/CreateBuildDrop.sh b/Scripts/Mac/CI/CreateBuildDrop.sh
deleted file mode 100755
index b02188ab31..0000000000
--- a/Scripts/Mac/CI/CreateBuildDrop.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-
-. "$(dirname ${BASH_SOURCE[0]})/../InitializeEnvironment.sh"
-
-CONFIGURATION=$1
-BUILDDROP_ROOT=$2
-if [ -z $BUILDDROP_ROOT ] || [ -z $CONFIGURATION ]; then
- echo 'ERROR: Usage: CreateBuildDrop.sh [configuration] [build drop root directory]'
- exit 1
-fi
-
-# Set up some paths
-BUILDDROP_BUILDOUTPUT=$BUILDDROP_ROOT/BuildOutput
-BUILDDROP_SRC=$BUILDDROP_ROOT/src
-BUILDDROP_PROJFS=$BUILDDROP_SRC/ProjFS.Mac
-BUILDDROP_KEXT=$BUILDDROP_BUILDOUTPUT/ProjFS.Mac/Native
-
-# Set up the build drop directory structure
-rm -rf $BUILDDROP_ROOT
-mkdir -p $BUILDDROP_BUILDOUTPUT
-mkdir -p $BUILDDROP_SRC
-mkdir -p $BUILDDROP_PROJFS
-mkdir -p $BUILDDROP_KEXT
-
-# Copy to the build drop, retaining directory structure.
-rsync -avm $VFS_OUTPUTDIR/Git $BUILDDROP_BUILDOUTPUT
-rsync -avm $VFS_PUBLISHDIR $BUILDDROP_ROOT
-rsync -avm $VFS_SCRIPTDIR $BUILDDROP_SRC/Scripts
-rsync -avm $VFS_SRCDIR/ProjFS.Mac/Scripts $BUILDDROP_PROJFS
-rsync -avm $VFS_OUTPUTDIR/ProjFS.Mac/Native/$CONFIGURATION $BUILDDROP_KEXT
-cp $VFS_SRCDIR/nuget.config $BUILDDROP_SRC
diff --git a/Scripts/Mac/CleanupFunctionalTests.sh b/Scripts/Mac/CleanupFunctionalTests.sh
deleted file mode 100755
index 40653b8910..0000000000
--- a/Scripts/Mac/CleanupFunctionalTests.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh"
-
-pkill -9 -l GVFS.FunctionalTests
-pkill -9 -l git
-pkill -9 -l gvfs
-pkill -9 -l GVFS.Mount
-pkill -9 -l prjfs-log
-
-$VFS_SRCDIR/ProjFS.Mac/Scripts/UnloadPrjFSKext.sh
-
-if [ -d /GVFS.FT ]; then
- sudo rm -r /GVFS.FT
-fi
diff --git a/Scripts/Mac/Common-Functions.ps1 b/Scripts/Mac/Common-Functions.ps1
deleted file mode 100644
index a8124c1801..0000000000
--- a/Scripts/Mac/Common-Functions.ps1
+++ /dev/null
@@ -1,159 +0,0 @@
-<#
-.SYNOPSIS
-Generates the text for GVFS.Installer.Mac nuspec file from the provided inputs
-#>
-function Write-Nuspec
-{
- param
- (
- [Parameter(Mandatory)]
- [string]
- $PackageVersion,
-
- [Parameter(Mandatory)]
- [string]
- $GvfsInstallerPkg,
-
- [Parameter(Mandatory)]
- [string]
- $GitInstallerPkg,
-
- [Parameter(Mandatory)]
- [string]
- $GcmInstallerPkg
- )
-
- $template =
- "
-
-
- GVFS.Installers.Mac
- $PackageVersion
- Microsoft
- false
- GVFS and G4M Mac installers
-
-
-
-
-
-
- "
-
- return $template
-}
-
-<#
-.DESCRIPTION
-Downloads the specified version of GCM Core to the specified DownloadLocation
-#>
-function Download-GCM
-{
- param
- (
- [Parameter(Mandatory)]
- [string]
- $GcmReleaseVersion,
-
- [Parameter(Mandatory)]
- [string]
- $GcmPackageName,
-
- [Parameter(Mandatory)]
- [string]
- $DownloadLocation
- )
-
- $url = "https://github.com/microsoft/Git-Credential-Manager-Core/releases/download/$GcmReleaseVersion/$GcmPackageName"
- $outfile = $DownloadLocation + "/" + $GcmPackageName
-
- Invoke-WebRequest -Uri $url -Outfile $outfile
-
- return $outfile
-}
-
-<#
-.SYNOPSIS
-Parses the version of the NuGet package that contains the Git installer from a props file.
-#>
-function Get-GitPackageVersionFromProps
-{
- param
- (
- [Parameter(Mandatory)]
- [string]
- $GvfsPropsPath
- )
-
- $gitPackageVersionLine = Get-ChildItem -Path $GvfsPropsPath | Select-String -Pattern 'GitPackageVersion'
- $matchFount = $gitPackageVersionLine -match '(.*?)'
- return $matches[1]
-}
-
-<#
-.SYNOPSIS
-Given a path to where NuGet packages are located, find the GitForMac NuGetPackage version and extract the Git version.
-#>
-function Get-GitVersionFromNuGetPackage
-{
- param
- (
- [Parameter(Mandatory)]
- [string]
- $NuGetPackagesDir,
-
- [Parameter(Mandatory)]
- [string]
- $GitPackageVersion
- )
-
- # Find the git version number (looking through packages directory)
- $gitInstallerPath = $NuGetPackagesDir + "/gitformac.gvfs.installer/" + $GitPackageVersion + "/tools"
- $toolsContents = Get-ChildItem -Path ($NuGetPackagesDir + "/gitformac.gvfs.installer/" + $GitPackageVersion + "/tools") -Include *.pkg
-
- $gitInstallerPkgName = $toolsContents[0].Name
- return $gitInstallerPkgName
-}
-
-<#
-.DESCRIPTION
-Generate and write a GVFS.Installers.Mac NuSpec from given
-parameters. This function orchestrates finding the various packages
-required for generating the installer assuming the behavior for how
-the current CI/CD Release pipleline lays out artifacts. It will also
-download GCM core.
-#>
-function Generate-NuSpec
-{
- param
- (
- [Parameter(Mandatory)]
- [string]
- $PackageDir,
-
- [Parameter(Mandatory)]
- [string]
- $GvfsVersion,
-
- [Parameter(Mandatory)]
- [string]
- $GcmReleaseVersion,
-
- [Parameter(Mandatory)]
- [string]
- $GcmPackageName
- )
-
- # Git installer pkg: Look throuhg the packages directory to find the git installer pkg
- $gitInstallers = Get-ChildItem -Path ($PackageDir + "/*") -Include 'git-*.pkg'
- $gitInstallerPkg = $gitInstallers[0]
-
- # Gcm installer pkg: Download
- $GcmInstallerPkg = Download-GCM -GcmReleaseVersion $GcmReleaseVersion -GcmPackageName $GcmPackageName -DownloadLocation $PackageDir
-
- # GVFS installer pkg
- $GvfsInstallerPkg = $PackageDir + "/" + "VFSForGit.$GvfsVersion.pkg"
-
- $template = Write-Nuspec -PackageVersion $GvfsVersion -GvfsInstallerPkg $GvfsInstallerPkg -GitInstallerPkg $gitInstallerPkg -GcmInstallerPkg $GcmInstallerPkg
- return $template
-}
diff --git a/Scripts/Mac/DownloadGVFSGit.sh b/Scripts/Mac/DownloadGVFSGit.sh
deleted file mode 100755
index 54a742b906..0000000000
--- a/Scripts/Mac/DownloadGVFSGit.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh"
-
-BUILDDIR=$VFS_OUTPUTDIR/GVFS.Build
-GITVERSION="$($VFS_SCRIPTDIR/GetGitVersionNumber.sh)"
-cp $VFS_SRCDIR/nuget.config $BUILDDIR
-dotnet new classlib -n Restore.GitInstaller -o $BUILDDIR --force
-dotnet add $BUILDDIR/Restore.GitInstaller.csproj package --package-directory $VFS_PACKAGESDIR GitForMac.GVFS.Installer --version $GITVERSION
\ No newline at end of file
diff --git a/Scripts/Mac/GVFS_Clone.sh b/Scripts/Mac/GVFS_Clone.sh
deleted file mode 100755
index 250d3aa9a1..0000000000
--- a/Scripts/Mac/GVFS_Clone.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh"
-
-REPOURL=$1
-
-CONFIGURATION=$2
-if [ -z $CONFIGURATION ]; then
- CONFIGURATION=Debug
-fi
-
-$VFS_PUBLISHDIR/gvfs clone $REPOURL ~/GVFSTest --local-cache-path ~/GVFSTest/.gvfsCache --no-mount --no-prefetch
diff --git a/Scripts/Mac/GVFS_Mount.sh b/Scripts/Mac/GVFS_Mount.sh
deleted file mode 100755
index 78e6f946ac..0000000000
--- a/Scripts/Mac/GVFS_Mount.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh"
-
-CONFIGURATION=$1
-if [ -z $CONFIGURATION ]; then
- CONFIGURATION=Debug
-fi
-
-$VFS_PUBLISHDIR/gvfs mount ~/GVFSTest
diff --git a/Scripts/Mac/GVFS_Unmount.sh b/Scripts/Mac/GVFS_Unmount.sh
deleted file mode 100755
index 36d7460d2b..0000000000
--- a/Scripts/Mac/GVFS_Unmount.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh"
-
-CONFIGURATION=$1
-if [ -z $CONFIGURATION ]; then
- CONFIGURATION=Debug
-fi
-
-$VFS_PUBLISHDIR/gvfs unmount ~/GVFSTest
diff --git a/Scripts/Mac/GenerateCommonAssemblyVersion.sh b/Scripts/Mac/GenerateCommonAssemblyVersion.sh
deleted file mode 100755
index b8a08a8845..0000000000
--- a/Scripts/Mac/GenerateCommonAssemblyVersion.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh"
-
-if [ -z $1 ]; then
- echo "Version Number not defined for CommonAssemblyVersion.cs"
-fi
-
-# Update the version number in GVFS.props for other consumers of GVFSVersion
-sed -i "" -E "s@[0-9]+(\.[0-9]+)*@$1@g" $VFS_SRCDIR/GVFS/GVFS.Build/GVFS.props
-
-# Then generate CommonAssemblyVersion.cs
-cat >$VFS_OUTPUTDIR/CommonAssemblyVersion.cs <
-param (
- [Parameter(Mandatory)]
- [string]$PackageDir,
-
- [Parameter(Mandatory)]
- [string]$GvfsVersion,
-
- [Parameter(Mandatory)]
- [string]$OutputPath
-)
-
-[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
-
-. "$PSScriptRoot\Common-Functions.ps1"
-
-$GcmReleaseVersion = "v2.0.33-beta"
-$GcmPackageName = "gcmcore-osx-2.0.33.21076.pkg"
-$nuspec = Generate-NuSpec -PackageDir $PackageDir -GvfsVersion $GvfsVersion -GcmReleaseVersion $GcmReleaseVersion -GcmPackageName $GcmPackageName
-Set-Content -Path $OutputPath/GVFS.Installers.Mac.nuspec -Value $nuspec
diff --git a/Scripts/Mac/GenerateGitVersionConstants.sh b/Scripts/Mac/GenerateGitVersionConstants.sh
deleted file mode 100755
index 559571b1c7..0000000000
--- a/Scripts/Mac/GenerateGitVersionConstants.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-VERSIONREGEX="([[:digit:]]+).([[:digit:]]+).([[:digit:]]+).([[:alpha:]]+).([[:digit:]]+).([[:digit:]]+)"
-if [[ $1 =~ $VERSIONREGEX ]]
-then
- cat >$2/GVFSConstants.GitVersion.cs </dev/null
-export VFS_SCRIPTDIR="$(pwd)"
-popd &>/dev/null
-
-export VFS_SRCDIR=$VFS_SCRIPTDIR/../..
-
-VFS_ENLISTMENTDIR=$VFS_SRCDIR/..
-export VFS_OUTPUTDIR=$VFS_ENLISTMENTDIR/BuildOutput
-export VFS_PUBLISHDIR=$VFS_ENLISTMENTDIR/Publish
-export VFS_PACKAGESDIR=$VFS_ENLISTMENTDIR/packages
diff --git a/Scripts/Mac/InstallSharedDataQueueStallWorkaround.sh b/Scripts/Mac/InstallSharedDataQueueStallWorkaround.sh
deleted file mode 100755
index 8fc3519690..0000000000
--- a/Scripts/Mac/InstallSharedDataQueueStallWorkaround.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh"
-
-# DYLD_LIBRARY_PATH contains /usr/local/lib by default, so we'll copy this library there.
-BUILDDIR=$VFS_OUTPUTDIR/GVFS.Build
-cp $BUILDDIR/libSharedDataQueue.dylib /usr/local/lib
diff --git a/Scripts/Mac/NukeBuildOutputs.sh b/Scripts/Mac/NukeBuildOutputs.sh
deleted file mode 100755
index 287a657a48..0000000000
--- a/Scripts/Mac/NukeBuildOutputs.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh"
-
-sudo rm -Rf $VFS_OUTPUTDIR
-rm -Rf $VFS_PACKAGESDIR
-rm -Rf $VFS_PUBLISHDIR
-
-echo git --work-tree=$VFS_SRCDIR clean -Xdf -n
-git --work-tree=$VFS_SRCDIR clean -Xdf -n
diff --git a/Scripts/Mac/PrepFunctionalTests.sh b/Scripts/Mac/PrepFunctionalTests.sh
deleted file mode 100755
index 6ebaa33d08..0000000000
--- a/Scripts/Mac/PrepFunctionalTests.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-
-. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh"
-
-# Ensure the kext isn't loaded before installing Git
-$VFS_SRCDIR/ProjFS.Mac/Scripts/UnloadPrjFSKext.sh
-
-# Install GVFS-aware Git (that was published by the build script)
-GITPUBLISH=$VFS_OUTPUTDIR/Git
-if [[ ! -d $GITPUBLISH ]]; then
- echo "GVFS-aware Git package not found. Run BuildGVFSForMac.sh and try again"
- exit 1
-fi
-hdiutil attach $GITPUBLISH/*.dmg || exit 1
-GITPKG="$(find /Volumes/Git* -type f -name *.pkg)" || exit 1
-sudo installer -pkg "$GITPKG" -target / || exit 1
-hdiutil detach /Volumes/Git*
diff --git a/Scripts/Mac/PublishGit.sh b/Scripts/Mac/PublishGit.sh
deleted file mode 100755
index cb048fa1df..0000000000
--- a/Scripts/Mac/PublishGit.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh"
-
-GITPATH=$1
-INSTALLER=$(basename $GITPATH)
-
-GITPUBLISH=$VFS_OUTPUTDIR/Git
-if [[ ! -d $GITPUBLISH ]] ; then
- mkdir $GITPUBLISH
-fi
-
-find $GITPUBLISH -type f ! -name $INSTALLER -delete
-
-if [[ ! -e $GITPUBLISH/$INSTALLER ]] ; then
- cp $GITPATH $GITPUBLISH
-fi
diff --git a/Scripts/Mac/RunFunctionalTests.sh b/Scripts/Mac/RunFunctionalTests.sh
deleted file mode 100755
index 52dc6cb253..0000000000
--- a/Scripts/Mac/RunFunctionalTests.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh"
-
-CONFIGURATION=$1
-if [ -z $CONFIGURATION ]; then
- CONFIGURATION=Debug
-fi
-
-mkdir ~/GVFS.FT
-if [ "$2" != "--test-gvfs-on-path" ]; then
- echo "Calling LoadPrjFSKext.sh as --test-gvfs-on-path not set..."
- $VFS_SRCDIR/ProjFS.Mac/Scripts/LoadPrjFSKext.sh $CONFIGURATION
-fi
-
-$VFS_PUBLISHDIR/GVFS.FunctionalTests --full-suite $2
diff --git a/Scripts/Mac/Tracing/Docs/cddl1.txt b/Scripts/Mac/Tracing/Docs/cddl1.txt
deleted file mode 100644
index b3487ade1b..0000000000
--- a/Scripts/Mac/Tracing/Docs/cddl1.txt
+++ /dev/null
@@ -1,385 +0,0 @@
-
-COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
-
-
- 1. Definitions.
-
- 1.1. ÒContributorÓ means each individual or entity that
- creates or contributes to the creation of Modifications.
-
- 1.2. ÒContributor VersionÓ means the combination of the
- Original Software, prior Modifications used by a
- Contributor (if any), and the Modifications made by that
- particular Contributor.
-
- 1.3. ÒCovered SoftwareÓ means (a) the Original Software, or
- (b) Modifications, or (c) the combination of files
- containing Original Software with files containing
- Modifications, in each case including portions thereof.
-
- 1.4. ÒExecutableÓ means the Covered Software in any form
- other than Source Code.
-
- 1.5. ÒInitial DeveloperÓ means the individual or entity
- that first makes Original Software available under this
- License.
-
- 1.6. ÒLarger WorkÓ means a work which combines Covered
- Software or portions thereof with code not governed by the
- terms of this License.
-
- 1.7. ÒLicenseÓ means this document.
-
- 1.8. ÒLicensableÓ means having the right to grant, to the
- maximum extent possible, whether at the time of the initial
- grant or subsequently acquired, any and all of the rights
- conveyed herein.
-
- 1.9. ÒModificationsÓ means the Source Code and Executable
- form of any of the following:
-
- A. Any file that results from an addition to,
- deletion from or modification of the contents of a
- file containing Original Software or previous
- Modifications;
-
- B. Any new file that contains any part of the
- Original Software or previous Modification; or
-
- C. Any new file that is contributed or otherwise made
- available under the terms of this License.
-
- 1.10. ÒOriginal SoftwareÓ means the Source Code and
- Executable form of computer software code that is
- originally released under this License.
-
- 1.11. ÒPatent ClaimsÓ means any patent claim(s), now owned
- or hereafter acquired, including without limitation,
- method, process, and apparatus claims, in any patent
- Licensable by grantor.
-
- 1.12. ÒSource CodeÓ means (a) the common form of computer
- software code in which modifications are made and (b)
- associated documentation included in or with such code.
-
- 1.13. ÒYouÓ (or ÒYourÓ) means an individual or a legal
- entity exercising rights under, and complying with all of
- the terms of, this License. For legal entities, ÒYouÓ
- includes any entity which controls, is controlled by, or is
- under common control with You. For purposes of this
- definition, ÒcontrolÓ means (a) the power, direct or
- indirect, to cause the direction or management of such
- entity, whether by contract or otherwise, or (b) ownership
- of more than fifty percent (50%) of the outstanding shares
- or beneficial ownership of such entity.
-
- 2. License Grants.
-
- 2.1. The Initial Developer Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, the
- Initial Developer hereby grants You a world-wide,
- royalty-free, non-exclusive license:
-
- (a) under intellectual property rights (other than
- patent or trademark) Licensable by Initial Developer,
- to use, reproduce, modify, display, perform,
- sublicense and distribute the Original Software (or
- portions thereof), with or without Modifications,
- and/or as part of a Larger Work; and
-
- (b) under Patent Claims infringed by the making,
- using or selling of Original Software, to make, have
- made, use, practice, sell, and offer for sale, and/or
- otherwise dispose of the Original Software (or
- portions thereof).
-
- (c) The licenses granted in Sections 2.1(a) and (b)
- are effective on the date Initial Developer first
- distributes or otherwise makes the Original Software
- available to a third party under the terms of this
- License.
-
- (d) Notwithstanding Section 2.1(b) above, no patent
- license is granted: (1) for code that You delete from
- the Original Software, or (2) for infringements
- caused by: (i) the modification of the Original
- Software, or (ii) the combination of the Original
- Software with other software or devices.
-
- 2.2. Contributor Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, each
- Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- (a) under intellectual property rights (other than
- patent or trademark) Licensable by Contributor to
- use, reproduce, modify, display, perform, sublicense
- and distribute the Modifications created by such
- Contributor (or portions thereof), either on an
- unmodified basis, with other Modifications, as
- Covered Software and/or as part of a Larger Work; and
-
-
- (b) under Patent Claims infringed by the making,
- using, or selling of Modifications made by that
- Contributor either alone and/or in combination with
- its Contributor Version (or portions of such
- combination), to make, use, sell, offer for sale,
- have made, and/or otherwise dispose of: (1)
- Modifications made by that Contributor (or portions
- thereof); and (2) the combination of Modifications
- made by that Contributor with its Contributor Version
- (or portions of such combination).
-
- (c) The licenses granted in Sections 2.2(a) and
- 2.2(b) are effective on the date Contributor first
- distributes or otherwise makes the Modifications
- available to a third party.
-
- (d) Notwithstanding Section 2.2(b) above, no patent
- license is granted: (1) for any code that Contributor
- has deleted from the Contributor Version; (2) for
- infringements caused by: (i) third party
- modifications of Contributor Version, or (ii) the
- combination of Modifications made by that Contributor
- with other software (except as part of the
- Contributor Version) or other devices; or (3) under
- Patent Claims infringed by Covered Software in the
- absence of Modifications made by that Contributor.
-
- 3. Distribution Obligations.
-
- 3.1. Availability of Source Code.
-
- Any Covered Software that You distribute or otherwise make
- available in Executable form must also be made available in
- Source Code form and that Source Code form must be
- distributed only under the terms of this License. You must
- include a copy of this License with every copy of the
- Source Code form of the Covered Software You distribute or
- otherwise make available. You must inform recipients of any
- such Covered Software in Executable form as to how they can
- obtain such Covered Software in Source Code form in a
- reasonable manner on or through a medium customarily used
- for software exchange.
-
- 3.2. Modifications.
-
- The Modifications that You create or to which You
- contribute are governed by the terms of this License. You
- represent that You believe Your Modifications are Your
- original creation(s) and/or You have sufficient rights to
- grant the rights conveyed by this License.
-
- 3.3. Required Notices.
-
- You must include a notice in each of Your Modifications
- that identifies You as the Contributor of the Modification.
- You may not remove or alter any copyright, patent or
- trademark notices contained within the Covered Software, or
- any notices of licensing or any descriptive text giving
- attribution to any Contributor or the Initial Developer.
-
- 3.4. Application of Additional Terms.
-
- You may not offer or impose any terms on any Covered
- Software in Source Code form that alters or restricts the
- applicable version of this License or the recipientsÕ
- rights hereunder. You may choose to offer, and to charge a
- fee for, warranty, support, indemnity or liability
- obligations to one or more recipients of Covered Software.
- However, you may do so only on Your own behalf, and not on
- behalf of the Initial Developer or any Contributor. You
- must make it absolutely clear that any such warranty,
- support, indemnity or liability obligation is offered by
- You alone, and You hereby agree to indemnify the Initial
- Developer and every Contributor for any liability incurred
- by the Initial Developer or such Contributor as a result of
- warranty, support, indemnity or liability terms You offer.
-
-
- 3.5. Distribution of Executable Versions.
-
- You may distribute the Executable form of the Covered
- Software under the terms of this License or under the terms
- of a license of Your choice, which may contain terms
- different from this License, provided that You are in
- compliance with the terms of this License and that the
- license for the Executable form does not attempt to limit
- or alter the recipientÕs rights in the Source Code form
- from the rights set forth in this License. If You
- distribute the Covered Software in Executable form under a
- different license, You must make it absolutely clear that
- any terms which differ from this License are offered by You
- alone, not by the Initial Developer or Contributor. You
- hereby agree to indemnify the Initial Developer and every
- Contributor for any liability incurred by the Initial
- Developer or such Contributor as a result of any such terms
- You offer.
-
- 3.6. Larger Works.
-
- You may create a Larger Work by combining Covered Software
- with other code not governed by the terms of this License
- and distribute the Larger Work as a single product. In such
- a case, You must make sure the requirements of this License
- are fulfilled for the Covered Software.
-
- 4. Versions of the License.
-
- 4.1. New Versions.
-
- Sun Microsystems, Inc. is the initial license steward and
- may publish revised and/or new versions of this License
- from time to time. Each version will be given a
- distinguishing version number. Except as provided in
- Section 4.3, no one other than the license steward has the
- right to modify this License.
-
- 4.2. Effect of New Versions.
-
- You may always continue to use, distribute or otherwise
- make the Covered Software available under the terms of the
- version of the License under which You originally received
- the Covered Software. If the Initial Developer includes a
- notice in the Original Software prohibiting it from being
- distributed or otherwise made available under any
- subsequent version of the License, You must distribute and
- make the Covered Software available under the terms of the
- version of the License under which You originally received
- the Covered Software. Otherwise, You may also choose to
- use, distribute or otherwise make the Covered Software
- available under the terms of any subsequent version of the
- License published by the license steward.
-
- 4.3. Modified Versions.
-
- When You are an Initial Developer and You want to create a
- new license for Your Original Software, You may create and
- use a modified version of this License if You: (a) rename
- the license and remove any references to the name of the
- license steward (except to note that the license differs
- from this License); and (b) otherwise make it clear that
- the license contains terms which differ from this License.
-
-
- 5. DISCLAIMER OF WARRANTY.
-
- COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN ÒAS ISÓ
- BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
- INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
- SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
- PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
- PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
- COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
- INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
- ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
- WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
- ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
- DISCLAIMER.
-
- 6. TERMINATION.
-
- 6.1. This License and the rights granted hereunder will
- terminate automatically if You fail to comply with terms
- herein and fail to cure such breach within 30 days of
- becoming aware of the breach. Provisions which, by their
- nature, must remain in effect beyond the termination of
- this License shall survive.
-
- 6.2. If You assert a patent infringement claim (excluding
- declaratory judgment actions) against Initial Developer or
- a Contributor (the Initial Developer or Contributor against
- whom You assert such claim is referred to as ÒParticipantÓ)
- alleging that the Participant Software (meaning the
- Contributor Version where the Participant is a Contributor
- or the Original Software where the Participant is the
- Initial Developer) directly or indirectly infringes any
- patent, then any and all rights granted directly or
- indirectly to You by such Participant, the Initial
- Developer (if the Initial Developer is not the Participant)
- and all Contributors under Sections 2.1 and/or 2.2 of this
- License shall, upon 60 days notice from Participant
- terminate prospectively and automatically at the expiration
- of such 60 day notice period, unless if within such 60 day
- period You withdraw Your claim with respect to the
- Participant Software against such Participant either
- unilaterally or pursuant to a written agreement with
- Participant.
-
- 6.3. In the event of termination under Sections 6.1 or 6.2
- above, all end user licenses that have been validly granted
- by You or any distributor hereunder prior to termination
- (excluding licenses granted to You by any distributor)
- shall survive termination.
-
- 7. LIMITATION OF LIABILITY.
-
- UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
- (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
- INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
- COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
- LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
- CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
- LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
- STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
- COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
- INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
- LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
- INJURY RESULTING FROM SUCH PARTYÕS NEGLIGENCE TO THE EXTENT
- APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
- NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
- CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
- APPLY TO YOU.
-
- 8. U.S. GOVERNMENT END USERS.
-
- The Covered Software is a Òcommercial item,Ó as that term is
- defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of Òcommercial
- computer softwareÓ (as that term is defined at 48 C.F.R. ¤
- 252.227-7014(a)(1)) and Òcommercial computer software
- documentationÓ as such terms are used in 48 C.F.R. 12.212 (Sept.
- 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
- through 227.7202-4 (June 1995), all U.S. Government End Users
- acquire Covered Software with only those rights set forth herein.
- This U.S. Government Rights clause is in lieu of, and supersedes,
- any other FAR, DFAR, or other clause or provision that addresses
- Government rights in computer software under this License.
-
- 9. MISCELLANEOUS.
-
- This License represents the complete agreement concerning subject
- matter hereof. If any provision of this License is held to be
- unenforceable, such provision shall be reformed only to the
- extent necessary to make it enforceable. This License shall be
- governed by the law of the jurisdiction specified in a notice
- contained within the Original Software (except to the extent
- applicable law, if any, provides otherwise), excluding such
- jurisdictionÕs conflict-of-law provisions. Any litigation
- relating to this License shall be subject to the jurisdiction of
- the courts located in the jurisdiction and venue specified in a
- notice contained within the Original Software, with the losing
- party responsible for costs, including, without limitation, court
- costs and reasonable attorneysÕ fees and expenses. The
- application of the United Nations Convention on Contracts for the
- International Sale of Goods is expressly excluded. Any law or
- regulation which provides that the language of a contract shall
- be construed against the drafter shall not apply to this License.
- You agree that You alone are responsible for compliance with the
- United States export administration regulations (and the export
- control laws and regulation of any other countries) when You use,
- distribute or otherwise make available any Covered Software.
-
- 10. RESPONSIBILITY FOR CLAIMS.
-
- As between Initial Developer and the Contributors, each party is
- responsible for claims and damages arising, directly or
- indirectly, out of its utilization of rights under this License
- and You agree to work with Initial Developer and Contributors to
- distribute such responsibility on an equitable basis. Nothing
- herein is intended or shall be deemed to constitute any admission
- of liability.
diff --git a/Scripts/Mac/Tracing/Tracing.md b/Scripts/Mac/Tracing/Tracing.md
deleted file mode 100644
index 735aeb48a4..0000000000
--- a/Scripts/Mac/Tracing/Tracing.md
+++ /dev/null
@@ -1,78 +0,0 @@
-# Tracing on macOS
-
-[DTrace](https://en.wikipedia.org/wiki/DTrace) is the main low-level tool for tracing and diagnostics on macOS.
-For diagnosing issues potentially caused by VFS for Git, tracing syscalls to track down errors has proven to be a useful technique on Windows.
-On macOS, the DTrace script `dtruss` which ships with the OS can be used for tracing system calls made by processes.
-However, it has not been updated for newer OS versions for a while, making some of its features unreliable.
-We therefore recommend using our [updated version of the script](./dtruss), and the instructions below assume you are using this version.
-
-## TL;DR: This build command is failing/misbehaving and I've been asked to collect a trace
-
-To capture a trace of the syscalls made by the failing command, run the following:
-
- ++path-to-vfs4g-source++/Scripts/Mac/Tracing/dtruss -d -e -F -f ++command-to-run++ 2> >(tee ++trace-filename.txt++ >&2)
-
-## General tips
-
-`dtruss` simply outputs a live list of all syscalls (or all calls to one specific syscall) made by the selected/matching process(es), including return value/errno and arguments.
-Arguments are formatted for human readability to some extent. (e.g. string arguments are typically printed as a string, not just the raw `char` pointer.)
-
-The output is written to stderr, so to save it to a file use `2> filename.txt`, or to both save it to file *and* print it to the terminal, this will work in `bash`:
-
- sudo dtruss -p 1000 2> >(tee clang-trace.txt >&2)
-
-When starting `dtruss`, wait for the column headers to appear before starting whatever activity you're trying to trace; dtrace can take a few seconds to compile and inject the script, and events that occur before this is done will be dropped.
-This is of course not an issue if you are starting the traced command on the `dtruss` command line directly.
-The column headers will look something like this, the exact headers will depend on the command line flags passed:
-
- PID/THRD RELATIVE ELAPSD SYSCALL(args) = return
-
-## Specifying processes to trace
-
-### Named processes
-
-Use `-n `, for example if there seems to be a problem with syscalls made by `clang`:
-
- sudo ./Scripts/Mac/Tracing/dtruss -d -e -n clang
-
-Note that process names in macOS are limited to `MAXCOMLEN`, i.e. 16 characters.
-
-The `-d` and `-e` flags enable printing of time stamps (in µs, where 0 = time when `dtruss` was started) and elapsed wall time during the syscall (also µs), respectively.
-
-### By PID
-
-Use `-p ` in place of `-n`.
-
-### Tracing a command
-
-For tracing processes started from the command line, launching the command directly together with dtruss is typically the most convenient. To trace the `ls` command, simply use:
-
- ./Scripts/Mac/Tracing/dtruss ls
-
-Note the lack of `sudo` on this command. This was required on stock `dtruss` but meant all commands launched this way ran as the root user. Instead, the script now runs only `dtrace` itself as root via sudo, so you will still need to be an admin (`wheel` group) and type your password.
-
-### Tracing child processes
-
-Often, the thing you're trying to diagnose is a more complex mix of multiple processes; for example, building some software from source will typically kick off many different processes for the build system itself, compilers, linkers, and other tools. For tracing the activity of the whole build, it's often most convenient to trace the root build command *and all processes launched by it, recursively.*
-`dtruss` supports this via the `-f` flag, which can be combined with any of the other process selectors. For example:
-
- ./Scripts/Mac/Tracing/dtruss -d -e -f xcodebuild
-
-This will run an `xcodebuild` in the current directory, trace that process and any other processes below it in the hierarchy and additionally output time stamps and syscall runtimes.
-
-## Changes over stock `dtruss`
-
-For reference, the following improvements have been made so far:
-
- * When launching a command with `dtruss`, it's now possible to run the command as a non-root user. Simply run `dtruss [-options]Â ` as a non-privileged admin user; the command will run as this user, and `dtrace` itself will be run as root via `sudo` (you will likely be prompted for your password).
- * Correct logging of `execve()` and `posix_spawn()` syscalls.
- * Improvements to output for syscalls with buffer or string parameters. (Better handling of `NULL` pointers, large buffers, etc.)
- * A new `-F` option for filtering out common but typically uninteresting syscalls. At the moment, this only filters out `close()` calls returning `EBADF`. Some programs seem to call `close()` on thousands of sequential integers, most of which are not valid file descriptors.
- * The mode for following child processes (`-f`) is much more reliable. Previously, processes created with `posix_spawn()` were typically ignored. (They were typically only detected if the parent process had previously already used `fork()`; a mix of both techniques in the same program is rare, however.) `posix_spawn()` is a very common method for creating new processes on macOS nowadays, especially as `fork()`/`execve()` is explicitly disallowed for Objective-C based apps. Following `posix_spawn()`ed processes is now directly supported and some bugs that tended to occur when following *any* child process have also been fixed.
-
-### Remaining bugs/limitations in `dtruss`
-
- * `dtruss` no longer exits when the specified command itself exits. (This regression is a consequence of the non-privileged command launch change.)
- * There are still some syscalls which are badly formatted in the trace output.
- * The buffers can fill up and miss events when a lot of traced events occur. This is indicated by the message `dtrace: 6228 dynamic variable drops with non-empty dirty list` - try increasing the dynamic variable memory (e.g. `-b 100m` for 100MB - default is currently 30MB) in this case. Better still, try to narrow the focus of your tracing.
- * Currently, you can trace either all syscalls or just one, not some subset.
diff --git a/Scripts/Mac/Tracing/dtruss b/Scripts/Mac/Tracing/dtruss
deleted file mode 100755
index 508b8071a7..0000000000
--- a/Scripts/Mac/Tracing/dtruss
+++ /dev/null
@@ -1,1434 +0,0 @@
-#!/bin/sh
-# #!/usr/bin/sh
-#
-# dtruss - print process system call time details.
-# Written using DTrace (Solaris 10 3/05).
-#
-# 17-Jun-2005, ver 0.80 (check for newer versions)
-#
-# USAGE: dtruss [-acdeflhoLs] [-t syscall] { -p PID | -n name | command }
-#
-# -p PID # examine this PID
-# -n name # examine this process name
-# -t syscall # examine this syscall only
-# -a # print all details
-# -c # print system call counts
-# -d # print relative timestamps (us)
-# -e # print elapsed times (us)
-# -f # follow children as they are forked
-# -l # force printing of pid/lwpid per line
-# -o # print on cpu times (us)
-# -s # print stack backtraces
-# -L # don't print pid/lwpid per line
-# -b bufsize # dynamic variable buf size (default is "4m")
-# eg,
-# dtruss df -h # run and examine the "df -h" command
-# dtruss -p 1871 # examine PID 1871
-# dtruss -n tar # examine all processes called "tar"
-# dtruss -f test.sh # run test.sh and follow children
-#
-# The elapsed times are interesting, to help identify syscalls that take
-# some time to complete (during which the process may have context
-# switched off the CPU).
-#
-# SEE ALSO: procsystime # DTraceToolkit
-# dapptrace # DTraceToolkit
-# truss
-#
-# COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at Docs/cddl1.txt
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# CDDL HEADER END
-#
-# Author: Brendan Gregg [Sydney, Australia]
-#
-# TODO: Track signals, more output formatting.
-#
-# 29-Apr-2005 Brendan Gregg Created this.
-# 09-May-2005 " " Fixed evaltime (thanks Adam L.)
-# 16-May-2005 " " Added -t syscall tracing.
-# 17-Jun-2005 " " Added -s stack backtraces.
-#
-
-
-##############################
-# --- Process Arguments ---
-#
-
-### Default variables
-opt_pid=0; opt_name=0; pid=0; pname="."
-opt_elapsed=0; opt_cpu=0; opt_counts=0;
-opt_relative=0; opt_printid=0; opt_follow=0
-opt_command=0; command=""; opt_buf=0; buf="30m"
-opt_trace=0; trace="."; opt_stack=0;
-opt_wait=0; wname="."; opt_has_target=0
-opt_filter=0
-### Process options
-while getopts ab:cdefhln:op:st:LFW: name
-do
- case $name in
- b) opt_buf=1; buf=$OPTARG ;;
- p) opt_pid=1; pid=$OPTARG ;;
- n) opt_name=1; pname=$OPTARG ;;
- W) opt_wait=1; wname=$OPTARG ;;
- t) opt_trace=1; trace=$OPTARG ;;
- a) opt_counts=1; opt_relative=1; opt_elapsed=1; opt_follow=1
- opt_printid=1; opt_cpu=1 ;;
- c) opt_counts=1 ;;
- d) opt_relative=1 ;;
- e) opt_elapsed=1 ;;
- f) opt_follow=1 ;;
- l) opt_printid=1 ;;
- o) opt_cpu=1 ;;
- L) opt_printid=-1 ;;
- s) opt_stack=-1 ;;
- F) opt_filter=1 ;;
- h|?) cat <<-END >&2
- USAGE: dtruss [-acdefholLFs] [-t syscall] { -p PID | -n name | command | -W name }
-
- -p PID # examine this PID
- -n name # examine this process name
- -t syscall # examine this syscall only
- -W name # wait for a process matching this name
- -a # print all details
- -c # print syscall counts
- -d # print relative times (us)
- -e # print elapsed times (us)
- -f # follow children
- -l # force printing pid/lwpid
- -o # print on cpu times
- -s # print stack backtraces
- -L # don't print pid/lwpid
- -F # filter out common & noisy syscalls
- -b bufsize # dynamic variable buf size
- eg,
- dtruss df -h # run and examine "df -h"
- dtruss -p 1871 # examine PID 1871
- dtruss -n tar # examine all processes called "tar"
- dtruss -f test.sh # run test.sh and follow children
- END
- exit 1
- esac
-done
-shift `expr $OPTIND - 1`
-
-### Option logic
-if [ $opt_pid -eq 0 -a $opt_name -eq 0 -a $opt_wait -eq 0 ]; then
- opt_pid=1
- opt_command=1
- if [ "$*" = "" ]; then
- $0 -h
- exit
- fi
- command="$*" # yes, I meant $*!
-fi
-if [ $opt_wait -eq 1 ]; then
- opt_has_target=1
-fi
-if [ $opt_follow -eq 1 -o $opt_name -eq 1 ]; then
- if [ $opt_printid -ne -1 ]; then
- opt_printid=1
- else
- opt_printid=0
- fi
-fi
-
-### Option translation
-## if [ "$trace" = "exec" ]; then trace="exece"; fi
-if [ "$trace" = "exec" ]; then trace="execve"; fi
-
-
-#################################
-# --- Main Program, DTrace ---
-#
-
-### Define D Script
-dtrace='
- #pragma D option quiet
-
- /*
- * Command line arguments
- */
- inline int OPT_has_target = '$opt_has_target';
- inline int OPT_command = '$opt_command';
- inline int OPT_follow = '$opt_follow';
- inline int OPT_printid = '$opt_printid';
- inline int OPT_relative = '$opt_relative';
- inline int OPT_elapsed = '$opt_elapsed';
- inline int OPT_cpu = '$opt_cpu';
- inline int OPT_counts = '$opt_counts';
- inline int OPT_pid = '$opt_pid';
- inline int OPT_name = '$opt_name';
- inline int OPT_trace = '$opt_trace';
- inline int OPT_stack = '$opt_stack';
- inline int OPT_filtercommon = '$opt_filter';
- inline int PID_OPT = '$pid';
- inline string NAME = "'"$pname"'";
- inline string TRACE = "'$trace'";
-
- dtrace:::BEGIN
- {
- PID = PID_OPT;
- /* print header */
- /* OPT_printid ? printf("%-8s ","PID/LWP") : 1; */
- OPT_printid ? printf("\t%-8s ","PID/THRD") : 1;
- OPT_relative ? printf("%8s ","RELATIVE") : 1;
- OPT_elapsed ? printf("%7s ","ELAPSD") : 1;
- OPT_cpu ? printf("%6s ","CPU") : 1;
- printf("SYSCALL(args) \t\t = return\n");
-
- /* Apple: Names of top-level sysctl MIBs */
- sysctl_first[0] = "CTL_UNSPEC";
- sysctl_first[1] = "CTL_KERN";
- sysctl_first[2] = "CTL_VM";
- sysctl_first[3] = "CTL_VFS";
- sysctl_first[4] = "CTL_NET";
- sysctl_first[5] = "CTL_DEBUG";
- sysctl_first[6] = "CTL_HW";
- sysctl_first[7] = "CTL_MACHDEP";
- sysctl_first[9] = "CTL_MAXID";
-
- /* globals */
- /* variables for following child processes.
- * trackedpid is indexed by PID; values:
- * 0 = not tracing this process
- * -1 = tracing this process
- * >0 = thread ID (tid) during vfork call */
- trackedpid[pid] = 0;
- /* child: set to PID once a thread has been identified as part of a traced
- * process due to its descendence from a traced process. Threads get recycled
- * by other processes, so storing the PID here catches that case. */
- self->child = 0;
-
- self->follow_in_spawn_call = 0;
- }
-
- dtrace:::BEGIN
- /OPT_command && $1 > 0/
- {
- PID = $1;
- system("/bin/kill -CONT %d", $1);
- }
-
-
- /*
- * Save syscall entry info
- */
-
-
- /* Threads seem to be recycled on macOS, including thread-local DTrace
- * variables; check for mismatch between self->child and pid to detect and
- * reset the variables. */
- syscall:::entry
- /OPT_follow && (self->child != 0) && (self->child != pid)/
- {
- /* Clean up recycled threads */
- self->child = 0;
- self->start = (uint64_t)0;
- self->vstart = (uint64_t)0;
- self->arg0 = (uint64_t)0;
- self->arg1 = (uint64_t)0;
- self->arg2 = (uint64_t)0;
- self->arg3 = (uint64_t)0;
- self->arg4 = (uint64_t)0;
- self->arg5 = (uint64_t)0;
- }
-
- /* MacOS X: notice first appearance of child process´s thread from fork or
- * posix_spawn. Checking the own process for presence in the trackedpid table
- * also catches new threads in child processes whose parent process has died. */
- syscall:::entry
- /OPT_follow && 0 == self->child && (trackedpid[ppid] == -1 || trackedpid[pid] == -1)/
- {
- /* set as child */
- self->child = pid;
- }
-
- /* MacOS X: notice first appearance of child and parent from vfork */
- syscall:::entry
- /OPT_follow && trackedpid[ppid] > 0 && 0 == self->child/
- {
- /* set as child */
- this->vforking_tid = trackedpid[ppid];
- self->child = (this->vforking_tid == tid) ? 0 : pid;
-
- /* print output */
- self->code = errno == 0 ? "" : "Err#";
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",(this->vforking_tid == tid) ? ppid : pid,tid) : 1;
- OPT_relative ? printf("%8d: ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d: ",0) : 1;
- OPT_cpu ? printf("%6d ",0) : 1;
- printf("%s()\t\t = %d %s%d\n","vfork",
- (this->vforking_tid == tid) ? pid : 0,self->code,(int)errno);
- }
-
- /* Alternative detection of recycled threads: start time stamp is still set,
- * although no tracking criteria are met. Again, reset thread-local variables. */
- syscall:::entry
- /self->start &&
- !((OPT_has_target && pid == $target) ||
- (OPT_pid && pid == PID) ||
- (OPT_name && NAME == strstr(NAME, execname)) ||
- (OPT_name && execname == strstr(execname, NAME)) ||
- (self->child == pid))/
- {
- self->child = 0;
- self->start = (uint64_t)0;
- self->vstart = (uint64_t)0;
- self->arg0 = (uint64_t)0;
- self->arg1 = (uint64_t)0;
- self->arg2 = (uint64_t)0;
- self->arg3 = (uint64_t)0;
- self->arg4 = (uint64_t)0;
- self->arg5 = (uint64_t)0;
- }
-
- syscall:::entry
- /(OPT_has_target && pid == $target) ||
- (OPT_pid && pid == PID) ||
- (OPT_name && NAME == strstr(NAME, execname)) ||
- (OPT_name && execname == strstr(execname, NAME)) ||
- (self->child == pid)/
- {
- /* set start details */
- self->start = timestamp;
- self->vstart = vtimestamp;
- self->arg0 = arg0;
- self->arg1 = arg1;
- self->arg2 = arg2;
-
- /* count occurances */
- OPT_counts == 1 ? @Counts[probefunc] = count() : 1;
- }
-
-/* 4, 5 and 6 arguments */
- syscall::select:entry,
- syscall::mmap:entry,
- syscall::pwrite:entry,
- syscall::pread:entry,
- syscall::openat:entry,
- syscall::unlinkat:entry,
- syscall::getattrlistat:entry,
- syscall::getattrlistbulk:entry,
- syscall::fstatat:entry,
- syscall::fstatat64:entry,
- syscall::readlinkat:entry,
- syscall::linkat:entry,
- syscall::fchownat:entry,
- syscall::renameat:entry,
- syscall::sysctl:entry,
- syscall::sysctlbyname:entry,
- syscall::faccessat:entry,
- syscall::kdebug_trace64:entry
- /(OPT_has_target && pid == $target) ||
- (OPT_pid && pid == PID) ||
- (OPT_name && NAME == strstr(NAME, execname)) ||
- (OPT_name && execname == strstr(execname, NAME)) ||
- (self->child == pid)/
- {
- self->arg3 = arg3;
- self->arg4 = arg4;
- self->arg5 = arg5;
- }
-
- syscall::posix_spawn:entry
- /(OPT_has_target && pid == $target) ||
- (OPT_pid && pid == PID) ||
- (OPT_name && NAME == strstr(NAME, execname)) ||
- (OPT_name && execname == strstr(execname, NAME)) ||
- (self->child == pid)/
- {
- /* Save the executable path as it often seems to be unavailable on return */
- self->arg1_str = (arg1 != 0 ? copyinstr(arg1) : "");
- self->arg3 = arg3;
- self->arg4 = arg4;
- self->arg5 = arg5;
- }
-
- syscall::execve:entry
- /(OPT_has_target && pid == $target) ||
- (OPT_pid && pid == PID) ||
- (OPT_name && NAME == strstr(NAME, execname)) ||
- (OPT_name && execname == strstr(execname, NAME)) ||
- (self->child == pid)/
- {
- // Save the PID as this is reported incorrectly in the :return probe
- self->execve_self_pid = pid;
- /* Copy the executable path from user space now, as the process will have an
- * entirely new address space when execve() returns. */
- self->arg0_str = arg0 ? copyinstr(arg0) : "";
-}
-
-
- /*
- * Follow children
- */
- syscall::fork:entry
- /OPT_follow && self->start/
- {
- /* track this parent process */
- trackedpid[pid] = -1;
- }
-
- syscall::vfork:entry
- /OPT_follow && self->start/
- {
- /* track this parent process */
- trackedpid[pid] = tid;
- }
-
- /* syscall::rexit:entry */
- syscall::exit:entry
- /(self->child != 0)/
- {
- /* forget child */
- self->child = 0;
- trackedpid[pid] = 0;
- }
-
- proc::proc_exit:exited
- /tracepid[args[0]->pr_pid] != 0/
- {
- /* Clears exited processes from the table in case the PID gets recycled */
- self->child = 0;
- tracepid[args[0]->pr_pid] = 0;
- }
-
- /* Follow posix_spawn()ed child processes */
-
- proc:mach_kernel:posix_spawn:create
- /OPT_follow &&
- ((OPT_has_target && pid == $target) ||
- (OPT_pid && pid == PID) ||
- (OPT_name && NAME == strstr(NAME, execname)) ||
- (OPT_name && execname == strstr(execname, NAME)) ||
- (self->child == pid))/
- {
- trackedpid[pid] = -1;
- self->follow_posix_spawn_child_pid = args[0]->pr_pid;
- self->follow_in_spawn_call = 1;
- }
-
- proc::posix_spawn:spawn-success
- /self->follow_in_spawn_call/
- {
- trackedpid[self->follow_posix_spawn_child_pid] = -1;
-
- self->follow_posix_spawn_child_pid = 0;
- self->follow_in_spawn_call = 0;
- }
-
- // If the posix_spawn() call failed, reset our state, ready for the next such call.
-proc::posix_spawn:*-failure
-/self->follow_in_spawn_call/
-{
- self->follow_posix_spawn_child_pid = 0;
- self->follow_in_spawn_call = 0;
-}
-
-
- /*
- * Check for syscall tracing
- */
- syscall:::entry
- /OPT_trace && probefunc != TRACE/
- {
- /* drop info */
- self->start = 0;
- self->vstart = 0;
- self->arg0 = (uint64_t)0;
- self->arg1 = (uint64_t)0;
- self->arg2 = (uint64_t)0;
- self->arg3 = (uint64_t)0;
- self->arg4 = (uint64_t)0;
- self->arg5 = (uint64_t)0;
- }
-
- /*
- * Print return data
- */
-
- /*
- * NOTE:
- * The following code is written in an intentionally repetetive way.
- * The first versions had no code redundancies, but performed badly during
- * benchmarking. The priority here is speed, not cleverness. I know there
- * are many obvious shortcuts to this code, Ive tried them. This style has
- * shown in benchmarks to be the fastest (fewest probes, fewest actions).
- */
-
- /* print 3 args, return as hex */
- syscall::sigprocmask:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(0x%X, 0x%X, 0x%X)\t\t = 0x%X %s%d\n",probefunc,
- (int)self->arg0,self->arg1,self->arg2,(int)arg0,
- self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- }
-
- /* print 3 args, arg0 as a string */
- syscall::stat:return,
- syscall::stat64:return,
- syscall::lstat:return,
- syscall::lstat64:return,
- syscall::access:return,
- syscall::mkdir:return,
- syscall::chdir:return,
- syscall::chroot:return,
- syscall::getattrlist:return, /* XXX 5 arguments */
- syscall::chown:return,
- syscall::lchown:return,
- syscall::chflags:return,
- syscall::readlink:return,
- syscall::utimes:return,
- syscall::pathconf:return,
- syscall::truncate:return,
- syscall::getxattr:return,
- syscall::setxattr:return,
- syscall::removexattr:return,
- syscall::unlink:return,
- syscall::open:return,
- syscall::open_nocancel:return,
- syscall::shm_open:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(\"%S\", 0x%X, 0x%X)\t\t = %d %s%d\n",probefunc,
- self->arg0 ? copyinstr(self->arg0) : "[NULL]",self->arg1,self->arg2,(int)arg0,
- self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- }
-
- /* print 3 args, arg0 as a string, already copied (due to pid weirdness) */
- syscall::execve:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- /* For some reason execve:return always reports pid = 0, so print stored value */
- OPT_printid ? printf("%5d/0x%x: ", self->execve_self_pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(\"%S\", 0x%X, 0x%X)\t\t = %d %s%d\n",probefunc,
- self->arg0_str,self->arg1,self->arg2,(int)arg0,
- self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- self->arg0_str = 0;
- self->execve_self_pid = 0;
- }
-
- /* print 3 args, arg1 as a string, for read/write variant */
- syscall::write:return,
- syscall::write_nocancel:return,
- syscall::read:return,
- syscall::read_nocancel:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(0x%X, \"%S\" (0x%X), 0x%X)\t\t = %d %s%d\n",probefunc,self->arg0,
- (arg0 == -1 || self->arg1 == 0) ? "" : stringof(copyin(self->arg1, arg0 < 1024 ? arg0 : 1024)), self->arg1, self->arg2,(int)arg0,
- self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- }
-
- /* print 3 args, arg1 as a string */
- syscall::mkdirat:return,
- syscall::unlinkat:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(0x%X, \"%S\", 0x%X)\t\t = %d %s%d\n",probefunc,self->arg0,
- copyinstr(self->arg1),self->arg2,(int)arg0,
- self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- }
-
- /* print 3 args, arg0 and arg2 as strings */
- syscall::symlinkat:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(\"%S\", 0x%X, \"%S\")\t\t = %d %s%d\n",probefunc,
- copyinstr(self->arg0), self->arg1, copyinstr(self->arg2), (int)arg0,
- self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- }
-
-
- /* print 2 args, arg0 and arg1 as strings */
- syscall::rename:return,
- syscall::symlink:return,
- syscall::link:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(\"%S\", \"%S\")\t\t = %d %s%d\n",probefunc,
- copyinstr(self->arg0), copyinstr(self->arg1),
- (int)arg0,self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- }
-
- /* print 0 arg output */
- syscall::*fork:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s()\t\t = %d %s%d\n",probefunc,
- (int)arg0,self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- }
-
- /* Some processes seem to close a huge number of file descriptors they
- * never opened as a precautionary measure, which floods the trace, so
- * hide EBADF. */
- syscall::close:return,
- syscall::close_nocancel:return
- /self->start &&
- (OPT_filtercommon && arg0 == -1 && errno == 9)/
- {
- self->start = 0;
- self->vstart = 0;
-
- OPT_counts == 1 ? @CloseBadFDCounts[pid] = count() : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- }
-
- /* print 1 decimal arg output */
- syscall::close:return,
- syscall::close_nocancel:return,
- syscall::fchdir:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(%d)\t\t = %d %s%d\n",probefunc,(int)self->arg0,
- (int)arg0,self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- }
-
- /* print 1 string arg output */
- syscall::chdir:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(\"%S\")\t\t = %d %s%d\n",probefunc,
- self->arg0 ? copyinstr(self->arg0) : "[NULL]",
- (int)arg0,self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- }
-
- /* print 2 arg output */
- syscall::utimes:return,
- syscall::munmap:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(0x%X, 0x%X)\t\t = %d %s%d\n",probefunc,self->arg0,
- self->arg1,(int)arg0,self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- }
-
- /* print pread/pwrite with 4 arguments */
- syscall::pread*:return,
- syscall::pwrite*:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(0x%X, \"%S\", 0x%X, 0x%X)\t\t = %d %s%d\n",probefunc,self->arg0,
- stringof(copyin(self->arg1,self->arg2 < 1024 ? self->arg2 : 1024)),self->arg2,self->arg3,(int)arg0,self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- self->arg3 = 0;
- }
-
- /* print 4 args, arg0 as string, arg1 as string, arg2 as decimal, arg3 as hex */
- syscall::listxattr:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(\"%S\", \"%S\", %u, 0x%X)\t\t = %d %s%d\n",probefunc,
- copyinstr(self->arg0), self->arg1 ? copyinstr(self->arg1) : "[NULL]", self->arg2, self->arg3, (int)arg0,
- self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- self->arg3 = 0;
- }
-
- /* print 4 args, arg0 as string, arg3 as decimal: int lstat64_extended(user_addr_t path, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size) */
- syscall::lstat64_extended:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(\"%S\", 0x%X, 0x%X, %u)\t\t = %d %s%d\n",probefunc,
- copyinstr(self->arg0), self->arg1,self->arg2,self->arg3,(int)arg0,
- self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- self->arg3 = 0;
- }
-
-
- /* print 4 args, arg0 as decimal FD, arg1 as string */
- syscall::openat:return,
- syscall::faccessat:return,
- syscall::fchmodat:return,
- syscall::readlinkat:return,
- syscall::fstatat:return,
- syscall::fstatat64:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(%d%s, \"%S\", 0x%X, 0x%X)\t\t = %d %s%d\n",probefunc,
- (int32_t)self->arg0, self->arg0 == -2 ? " (AT_FDCWD)" : "", copyinstr(self->arg1),self->arg2,self->arg3,(int)arg0,
- self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- self->arg3 = 0;
- }
-
- /* print 4 args, arg1 and arg3 as strings */
- syscall::renameat:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(0x%X, \"%S\", 0x%X, \"%S\")\t\t = %d %s%d\n",probefunc,
- self->arg0, copyinstr(self->arg1), self->arg2, copyinstr(self->arg3), (int)arg0,
- self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- self->arg3 = 0;
- }
-
- /* Apple: print the arguments passed to sysctl */
- syscall::sysctl:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- mib = copyin(self->arg0, self->arg1 * sizeof(int));
- mib1 = *(int *)mib;
- mib2 = *((int *)mib + 1);
-
- printf("%s(", probefunc);
-
- printf("[%s, ", (self->arg1 > 0) ? ((*(int *)mib > 0 && *(int *)mib < 9) ? sysctl_first[mib1] : "unknown") : 0);
-
- printf("%d, %d, %d, %d, %d] (%d), ",
- (self->arg1 > 1) ? *((int *)mib + 1) : 0,
- (self->arg1 > 2) ? *((int *)mib + 2) : 0,
- (self->arg1 > 3) ? *((int *)mib + 3) : 0,
- (self->arg1 > 4) ? *((int *)mib + 4) : 0,
- (self->arg1 > 5) ? *((int *)mib + 5) : 0,
- self->arg1);
-
- printf("0x%X, 0x%X, 0x%X, 0x%X)\t\t = %d %s%d\n",
- self->arg2, self->arg3, self->arg4, self->arg5,
- (int)arg0, self->code, (int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- self->arg3 = 0;
- self->arg4 = 0;
- self->arg5 = 0;
- }
-
- /* Apple: print the string provided to sysctlbyname */
- syscall::sysctlbyname:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(%s, 0x%X, 0x%X, 0x%X, 0x%X)\t\t = %d %s%d\n",probefunc,
- copyinstr(self->arg0),
- self->arg1,self->arg2,self->arg3,self->arg4,(int)arg0,self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- self->arg3 = 0;
- self->arg4 = 0;
- }
-
- /* print 5 arguments */
- syscall::kdebug_trace64:return,
- syscall::select:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(0x%X, 0x%X, 0x%X, 0x%X, 0x%X)\t\t = %d %s%d\n",probefunc,self->arg0,
- self->arg1,self->arg2,self->arg3,self->arg4,(int)arg0,self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- self->arg3 = 0;
- self->arg4 = 0;
- }
-
- /* print 5 args, arg1 as string */
- syscall::fchownat:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(0x%X, \"%S\", 0x%X, 0x%X, 0x%X)\t\t = %d %s%d\n",probefunc,
- self->arg0, copyinstr(self->arg1), self->arg2, self->arg3, self->arg4,
- (int)arg0,self->code,(int)errno);
-
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- self->arg3 = 0;
- self->arg4 = 0;
- }
- /* print 5 args, arg1 and arg3 as strings */
- syscall::linkat:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(0x%X, \"%S\", 0x%X, \"%S\", 0x%X)\t\t = %d %s%d\n",probefunc,
- self->arg0, copyinstr(self->arg1), self->arg2, self->arg3 ? copyinstr(self->arg3) : "", self->arg4,
- (int)arg0,self->code,(int)errno);
-
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- self->arg3 = 0;
- self->arg4 = 0;
- }
-
- /* getattrlistbulk has 5 unusual arguments: */
- syscall::getattrlistbulk:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- this->attrs = (struct attrlist*)(self->arg1 ? copyin(self->arg1, sizeof(struct attrlist)) : NULL);
- /* print main data */
- printf("%s(%d, 0x%X { .bitmapcount = %d, .reserved = 0x%x, .commonattr = 0x%x, .volattr = 0x%x, .dirattr = 0x%x, .fileattr = 0x%x, .forkattr = 0x%x }, 0x%X, 0x%X, 0x%X)\t\t = %d %s%d\n", probefunc,
- (int32_t)self->arg0,
- // attrlist
- self->arg1,
- this->attrs ? this->attrs->bitmapcount : 0,
- this->attrs ? this->attrs->reserved : 0,
- this->attrs ? this->attrs->commonattr : 0,
- this->attrs ? this->attrs->volattr : 0,
- this->attrs ? this->attrs->dirattr : 0,
- this->attrs ? this->attrs->fileattr : 0,
- this->attrs ? this->attrs->forkattr : 0,
- self->arg2,self->arg3,self->arg4,(int)arg0,self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- self->arg3 = 0;
- self->arg4 = 0;
- }
-
-
- /* getattrlistat has 6 arguments */
- syscall::getattrlistat:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(0x%X, \"%S\", 0x%X, 0x%X, 0x%X, 0x%X)\t\t = 0x%X %s%d\n",probefunc,self->arg0,
- copyinstr(self->arg1),self->arg2,self->arg3,self->arg4,self->arg5, arg0,self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- self->arg3 = 0;
- self->arg4 = 0;
- self->arg5 = 0;
- }
-
- /* fstat and fstat64 have 2 args: file descriptor and pointer */
- syscall::fstat:return,
- syscall::fstat64:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(%d, 0x%X)\t\t = %d %s%d\n",probefunc,self->arg0,
- self->arg1,(int)arg0,self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- }
-
- /* kill has 2 args that should be shown as decimal*/
- syscall::kill:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(%d, %d)\t\t = %d %s%d\n",probefunc,self->arg0,
- self->arg1,(int)arg0,self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- }
-
- /* mmap has 6 arguments */
- syscall::mmap:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(0x%X, 0x%X, 0x%X, 0x%X, 0x%X, 0x%X)\t\t = 0x%X %s%d\n",probefunc,self->arg0,
- self->arg1,self->arg2,self->arg3,self->arg4,self->arg5, arg0,self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- self->arg3 = 0;
- self->arg4 = 0;
- self->arg5 = 0;
- }
-
- /* posix_spawn has 6 arguments, most of them too complicated to print here,
- * but PID and path are the most useful for tracing anyway. */
- syscall::posix_spawn:return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(0x%X -> PID %d, \"%S\" (0x%X), 0x%X, 0x%X, 0x%X, 0x%X)\t\t = 0x%X %s%d\n", probefunc,
- self->arg0, ((self->arg0 != 0) ? *(pid_t*)copyin(self->arg0, sizeof(pid_t)) : -1),
- self->arg1_str, self->arg1,
- self->arg2,
- self->arg3,self->arg4,self->arg5, arg0,self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- self->arg3 = 0;
- self->arg4 = 0;
- self->arg5 = 0;
- self->arg1_str = 0;
- }
-
-
-
- /* print 3 arg output - default */
- syscall:::return
- /self->start/
- {
- /* calculate elapsed time */
- this->elapsed = timestamp - self->start;
- self->start = 0;
- this->cpu = vtimestamp - self->vstart;
- self->vstart = 0;
- self->code = errno == 0 ? "" : "Err#";
-
- /* print optional fields */
- /* OPT_printid ? printf("%5d/%d: ",pid,tid) : 1; */
- OPT_printid ? printf("%5d/0x%x: ",pid,tid) : 1;
- OPT_relative ? printf("%8d ",vtimestamp/1000) : 1;
- OPT_elapsed ? printf("%7d ",this->elapsed/1000) : 1;
- OPT_cpu ? printf("%6d ",this->cpu/1000) : 1;
-
- /* print main data */
- printf("%s(0x%X, 0x%X, 0x%X)\t\t = %d %s%d\n",probefunc,self->arg0,
- self->arg1,self->arg2,(int)arg0,self->code,(int)errno);
- OPT_stack ? ustack() : 1;
- OPT_stack ? trace("\n") : 1;
- self->arg0 = 0;
- self->arg1 = 0;
- self->arg2 = 0;
- }
-
- /* print counts */
- dtrace:::END
- {
- OPT_counts == 1 ? printf("\n%-32s %16s\n","CALL","COUNT") : 1;
- OPT_counts == 1 ? printa("%-32s %@16d\n",@Counts) : 1;
-
- (OPT_counts == 1 && OPT_filtercommon == 1) ? printf("\n%-7s %16s\n","PID","EBADF CLOSE() COUNT") : 1;
- (OPT_counts == 1 && OPT_filtercommon == 1) ? printa("%7d %@16d\n", @CloseBadFDCounts) : 1;
- }
-'
-
-### Run DTrace
-#if [ $opt_command -eq 1 ]; then
-# /usr/sbin/dtrace -x dynvarsize=$buf -x evaltime=postinit -n "$dtrace" \
-# -c "$command" >&2
-#else
-# /usr/sbin/dtrace -x dynvarsize=$buf -n "$dtrace" >&2
-#fi
-
-### Run DTrace (Mac OS X)
-# Redirect the output to stderr so that it doesn't mingle with
-# data going to the target's stdout
-if [ $opt_wait -eq 1 ]; then
- /usr/sbin/dtrace -w -x defaultargs -x dynvarsize=$buf -n "$dtrace" \
- -W "$wname" >&2
-elif [ $opt_command -eq 1 ]; then
- # Getting dtrace to run the command means it'll run as root, so instead:
- #
- # Create a subshell and get it to send SIGSTOP to itself, suspending the process.
- # When it wakes back up, it will exec the command, so the command will
- # take over the subshell's process & PID
- (:; bash -c 'kill -STOP $PPID' ; exec $command ) &
- # Remember the subshell's PID
- command_pid=$!
- echo Process for running command "$command" with PID $command_pid started and suspended. Launching dtrace, which will resume it:
- # Launch dtruss via sudo and pass the subshell's PID in. We've already enabled
- # OPT_command, so on startup, dtrace will resume the PID we passed in.
- # Note that we need -w as resuming processes is considered "destructive".
- /usr/bin/sudo /usr/sbin/dtrace -w -x dynvarsize=$buf -x evaltime=preinit -Z -n "$dtrace" \
- "$command_pid" >&2 || kill $command_pid
-
-else
- /usr/sbin/dtrace -x defaultargs -w -x dynvarsize=$buf -n "$dtrace" >&2
-fi
diff --git a/Scripts/Mac/notarize.sh b/Scripts/Mac/notarize.sh
deleted file mode 100755
index ca98cad00c..0000000000
--- a/Scripts/Mac/notarize.sh
+++ /dev/null
@@ -1,159 +0,0 @@
-#!/bin/bash
-
-# This file was sourced from https://github.com/microsoft/BuildXL/blob/8c2348ff04e6ca78726bb945fb2a0f6a55a5c7d6/Private/macOS/notarize.sh
-#
-# For detailed explanation see: https://developer.apple.com/documentation/security/notarizing_your_app_before_distribution/customizing_the_notarization_workflow
-
-usage() {
- cat < -p -k
- -id or --appleid # A valid Apple ID email address, account must have correct certificates available
- -p or --password # The password for the specified Apple ID or Apple One-Time password (to avoid 2FA)
- -k or --kext # The path to an already signed kernel extension .kext file
-EOM
- exit 0
-}
-
-declare arg_AppleId=""
-declare arg_Password=""
-declare arg_KextPath=""
-
-[ $# -eq 0 ] && { usage; }
-
-function parseArgs() {
- arg_Positional=()
- while [[ $# -gt 0 ]]; do
- cmd="$1"
- case $cmd in
- --help | -h)
- usage
- shift
- exit 0
- ;;
- --appleid | -id)
- arg_AppleId=$2
- shift
- ;;
- --password | -p)
- arg_Password="$2"
- shift
- ;;
- --kext | -k)
- arg_KextPath="$2"
- shift
- ;;
- *)
- arg_Positional+=("$1")
- shift
- ;;
- esac
- done
-}
-
-parseArgs "$@"
-
-if [[ -z $arg_AppleId ]]; then
- echo "[ERROR] Must supply valid / non-empty Apple ID!"
- exit 1
-fi
-
-if [[ -z $arg_Password ]]; then
- echo "[ERROR] Must supply valid / non-empty password!"
- exit 1
-fi
-
-if [[ ! -d "$arg_KextPath" ]]; then
- echo "[ERROR] Must supply valid / non-empty path to KEXT to notarize!"
- exit 1
-fi
-
-declare bundle_id=`/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" ${arg_KextPath}/Contents/Info.plist`
-
-if [[ -z $bundle_id ]]; then
- echo "[ERROR] No CFBundleIdentifier found in KEXT Info.plist!"
- exit 1
-fi
-
-echo "Notarizating $arg_KextPath"
-declare kext_zip="${arg_KextPath}.zip"
-
-if [[ -f "$kext_zip" ]]; then
- rm -f "$kext_zip"
-fi
-
-echo -e "Current state:\n"
-xcrun stapler validate -v "$arg_KextPath"
-
-if [[ $? -eq 0 ]]; then
- echo "$arg_KextPath already notarized and stapled, nothing to do!"
- exit 0
-fi
-
-set -e
-
-echo "Creating zip file..."
-ditto -c -k --rsrc --keepParent "$arg_KextPath" "$kext_zip"
-
-declare start_time=$(date +%s)
-
-declare output="/tmp/progress.xml"
-
-echo "Uploading zip to notarization service, please wait..."
-xcrun altool --notarize-app -t osx -f $kext_zip --primary-bundle-id $bundle_id -u $arg_AppleId -p $arg_Password --output-format xml | tee $output
-
-declare request_id=$(/usr/libexec/PlistBuddy -c "print :notarization-upload:RequestUUID" $output)
-
-echo "Checking notarization request validity..."
-if [[ $request_id =~ ^\{?[A-F0-9a-f]{8}-[A-F0-9a-f]{4}-[A-F0-9a-f]{4}-[A-F0-9a-f]{4}-[A-F0-9a-f]{12}\}?$ ]]; then
- declare attempts=5
-
- while :
- do
- echo "Waiting a bit before checking on notarization status again..."
-
- sleep 20
- xcrun altool --notarization-info $request_id -u $arg_AppleId -p $arg_Password --output-format xml | tee $output
-
- declare status=$(/usr/libexec/PlistBuddy -c "print :notarization-info:Status" $output)
- echo "Status: $status"
-
- if [[ -z $status ]]; then
- echo "Left attempts: $attempts"
-
- if (($attempts <= 0)); then
- break
- fi
-
- ((attempts--))
- else
- if [[ $status != "in progress" ]]; then
- break
- fi
- fi
- done
-
- declare end_time=$(date +%s)
- echo -e "Completed in $(($end_time-$start_time)) seconds\n"
-
- if [[ "$status" != "success" ]]; then
- echo "Error notarizing, exiting..." >&2
- exit 1
- else
- declare url=$(/usr/libexec/PlistBuddy -c "print :notarization-info:LogFileURL" $output)
-
- if [ "$url" ]; then
- curl $url
- fi
-
- # Staple the ticket to the kext
- xcrun stapler staple "$arg_KextPath"
-
- echo -e "State after notarization:\n"
- xcrun stapler validate -v "$arg_KextPath"
- echo -e "Stapler exit code: $? (must be zero on success!)\n"
- fi
-else
- echo "Invalid request id found in 'altool' output, aborting!" >&2
- exit 1
-fi
\ No newline at end of file