trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From geor...@apache.org
Subject svn commit: r910626 - /incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_defs.cc
Date Tue, 16 Feb 2010 18:00:35 GMT
Author: georgep
Date: Tue Feb 16 18:00:35 2010
New Revision: 910626

URL: http://svn.apache.org/viewvc?rev=910626&view=rev
Log:
TS-2: os_detection.diff patch
Author: Geoff G.
Review: George P.

Modified:
    incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_defs.cc

Modified: incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_defs.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/branches/dev/libinktomi%2B%2B/ink_defs.cc?rev=910626&r1=910625&r2=910626&view=diff
==============================================================================
--- incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_defs.cc (original)
+++ incubator/trafficserver/traffic/branches/dev/libinktomi++/ink_defs.cc Tue Feb 16 18:00:35
2010
@@ -31,7 +31,7 @@
 #include "inktomi++.h"
 #include "ink_unused.h"
 #include "ink_platform.h"
-#if (HOST_OS == linux) || (HOST_OS == freebsd)
+#if (HOST_OS == linux) || (HOST_OS == freebsd) || (HOST_OS == darwin)
 #include <sys/types.h>
 #include <sys/param.h>
 #include <sys/sysctl.h>
@@ -49,16 +49,22 @@
 {
   *name = 0;
   *release = 0;
-#if (HOST_OS == freebsd)
+#if (HOST_OS == freebsd) || (HOST_OS == darwin)
   int mib[2];
+  size_t len = namelen;
   mib[0] = CTL_KERN;
   mib[1] = KERN_OSTYPE;
-  if (sysctl(mib, 2, name, (size_t *) & namelen, NULL, 0) == -1)
+
+  if (sysctl(mib, 2, name, &len, NULL, 0) == -1)
     return -1;
+
+  len = releaselen;
   mib[0] = CTL_KERN;
   mib[1] = KERN_OSRELEASE;
-  if (sysctl(mib, 2, release, (size_t *) & releaselen, NULL, 0) == -1)
+
+  if (sysctl(mib, 2, release, &len, NULL, 0) == -1)
     return -1;
+
   return 0;
 #elif (HOST_OS == linux)
   struct utsname buf;



Mime
View raw message