[vbox-dev] NetBSD patch 0012: Add NetBSD support for parsing command line in RTLogDefaultInit()

Kamil Rytarowski n54 at gmx.com
Sun Aug 7 11:21:28 GMT 2016


Add NetBSD support for parsing command line in RTLogDefaultInit()

Reuse already existing FreeBSD code and adapt for NetBSD.

This patch is MIT-licensed.

Author: Kamil Rytarowski
-------------- next part --------------
Add NetBSD support for parsing command line in RTLogDefaultInit()

Reuse already existing FreeBSD code and adapt for NetBSD.

This patch is MIT-licensed.

Author: Kamil Rytarowski

Index: src/VBox/Runtime/VBox/log-vbox.cpp
===================================================================
--- src/VBox/Runtime/VBox/log-vbox.cpp	(wersja 63022)
+++ src/VBox/Runtime/VBox/log-vbox.cpp	(kopia robocza)
@@ -131,10 +131,12 @@
 #  include <iprt/win/windows.h>
 # elif defined(RT_OS_LINUX)
 #  include <unistd.h>
-# elif defined(RT_OS_FREEBSD)
+# elif defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD)
 #  include <sys/param.h>
 #  include <sys/sysctl.h>
-#  include <sys/user.h>
+#  if defined(RT_OS_FREEBSD)
+#    include <sys/user.h>
+#  endif
 #  include <stdlib.h>
 #  include <unistd.h>
 # elif defined(RT_OS_HAIKU)
@@ -647,13 +649,20 @@
             RTLogLoggerEx(pLogger, 0, ~0U, "Commandline: %.64s\n", info.args);
         }
 
-#  elif defined(RT_OS_FREEBSD)
+#  elif defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD)
         /* Retrieve the required length first */
         int aiName[4];
+#  if defined(RT_OS_FREEBSD)
         aiName[0] = CTL_KERN;
         aiName[1] = KERN_PROC;
         aiName[2] = KERN_PROC_ARGS;     /* Introduced in FreeBSD 4.0 */
         aiName[3] = getpid();
+#  elif defined(RT_OS_NETBSD)
+        aiName[0] = CTL_KERN;
+        aiName[1] = KERN_PROC_ARGS;
+        aiName[2] = getpid();
+        aiName[3] = KERN_PROC_ARGV;
+#  endif
         size_t cchArgs = 0;
         int rcBSD = sysctl(aiName, RT_ELEMENTS(aiName), NULL, &cchArgs, NULL, 0);
         if (cchArgs > 0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20160807/acbe5a15/attachment.sig>


More information about the vbox-dev mailing list