diff options
Diffstat (limited to '0001-Mono-Set-process-name.patch')
-rw-r--r-- | 0001-Mono-Set-process-name.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/0001-Mono-Set-process-name.patch b/0001-Mono-Set-process-name.patch new file mode 100644 index 000000000000..fea6bac6f6e4 --- /dev/null +++ b/0001-Mono-Set-process-name.patch @@ -0,0 +1,54 @@ +From e18adba54c6e04c6960faa3904814e9d065fb2ab Mon Sep 17 00:00:00 2001 +From: Lars <larsjohnsen@gmail.com> +Date: Thu, 3 Sep 2015 14:07:01 +0200 +Subject: [PATCH] Mono: Set process name + +--- + .../EnvironmentInfo/MonoRuntimeProvider.cs | 23 ++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/src/NzbDrone.Mono/EnvironmentInfo/MonoRuntimeProvider.cs b/src/NzbDrone.Mono/EnvironmentInfo/MonoRuntimeProvider.cs +index b9884df..f881923 100644 +--- a/src/NzbDrone.Mono/EnvironmentInfo/MonoRuntimeProvider.cs ++++ b/src/NzbDrone.Mono/EnvironmentInfo/MonoRuntimeProvider.cs +@@ -1,7 +1,10 @@ + using System; + using System.Reflection; ++using System.Text; ++using System.Runtime.InteropServices; + using NLog; + using NzbDrone.Common.EnvironmentInfo; ++using Mono.Unix.Native; + + namespace NzbDrone.Mono.EnvironmentInfo + { +@@ -13,6 +16,26 @@ public MonoRuntimeProvider(Common.IServiceProvider serviceProvider, Logger logge + :base(serviceProvider, logger) + { + _logger = logger; ++ unixSetProcessName("sonarr"); ++ } ++ ++ [DllImport ("libc")] //Linux ++ private static extern int prctl (int option, byte [] arg2, IntPtr arg3, IntPtr arg4, IntPtr arg5); ++ ++ public void unixSetProcessName (string name) ++ { ++ try { ++ var success = 0 == prctl(15 /* PR_SET_NAME */, Encoding.ASCII.GetBytes (name + "\0"), IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); ++ if (!success) ++ { ++ var error = Stdlib.GetLastError(); ++ throw new InvalidOperationException("prtctl call error: " + error); ++ } ++ } ++ catch (Exception ex) ++ { ++ _logger.ErrorException("Could not set process name, error: " + ex.Message, ex); ++ } + } + + public override string RuntimeVersion +-- +2.10.0 + |