|
From: <sv...@va...> - 2015-04-01 12:15:58
|
Author: rhyskidd
Date: Wed Apr 1 13:15:49 2015
New Revision: 15056
Log:
Fix Darwin: -v does not show kernel version
bz#201435
Before:
== 590 tests, 237 stderr failures, 22 stdout failures, 0 stderrB failures, 0 stdoutB failures, 31 post failures ==
After:
== 590 tests, 237 stderr failures, 22 stdout failures, 0 stderrB failures, 0 stdoutB failures, 31 post failures ==
Modified:
trunk/NEWS
trunk/coregrind/m_libcproc.c
trunk/coregrind/m_main.c
trunk/include/pub_tool_libcproc.h
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Wed Apr 1 13:15:49 2015
@@ -62,6 +62,7 @@
116002 VG_(printf): Problems with justification of strings and integers
155125 avoid cutting away file:lineno after long function name
197259 Unsupported arch_prtctl PR_SET_GS option
+201435 Fix Darwin: -v does not show kernel version
211926 Avoid compilation warnings in valgrind.h with -pedantic
226609 Crediting upstream authors in man page
269360 s390x: Fix addressing mode selection for compare-and-swap
Modified: trunk/coregrind/m_libcproc.c
==============================================================================
--- trunk/coregrind/m_libcproc.c (original)
+++ trunk/coregrind/m_libcproc.c Wed Apr 1 13:15:49 2015
@@ -387,6 +387,18 @@
}
}
+Int VG_(sysctl)(Int *name, UInt namelen, void *oldp, SizeT *oldlenp, void *newp, SizeT newlen)
+{
+ SysRes res;
+# if defined(VGO_darwin)
+ res = VG_(do_syscall6)(__NR___sysctl,
+ name, namelen, oldp, oldlenp, newp, newlen);
+# else
+ res = VG_(mk_SysRes_Error)(VKI_ENOSYS);
+# endif
+ return sr_isError(res) ? -1 : sr_Res(res);
+}
+
/* ---------------------------------------------------------------------
Resource limits
------------------------------------------------------------------ */
Modified: trunk/coregrind/m_main.c
==============================================================================
--- trunk/coregrind/m_main.c (original)
+++ trunk/coregrind/m_main.c Wed Apr 1 13:15:49 2015
@@ -1444,7 +1444,9 @@
VG_(umsg)("\n");
if (VG_(clo_verbosity) > 1) {
+# if !defined(VGO_darwin)
SysRes fd;
+# endif
VexArch vex_arch;
VexArchInfo vex_archinfo;
if (!logging_to_fd)
@@ -1456,6 +1458,7 @@
* (HChar**) VG_(indexXA)( VG_(args_for_valgrind), i ));
}
+# if !defined(VGO_darwin)
VG_(message)(Vg_DebugMsg, "Contents of /proc/version:\n");
fd = VG_(open) ( "/proc/version", VKI_O_RDONLY, 0 );
if (sr_isError(fd)) {
@@ -1477,6 +1480,18 @@
VG_(message)(Vg_DebugMsg, "\n");
VG_(close)(fdno);
}
+# else
+ VG_(message)(Vg_DebugMsg, "Output from sysctl({CTL_KERN,KERN_VERSION}):\n");
+ /* Note: preferable to use sysctlbyname("kern.version", kernelVersion, &len, NULL, 0)
+ however that syscall is OS X 10.10+ only. */
+ Int mib[] = {CTL_KERN, KERN_VERSION};
+ SizeT len;
+ VG_(sysctl)(mib, sizeof(mib)/sizeof(Int), NULL, &len, NULL, 0);
+ HChar *kernelVersion = VG_(malloc)("main.pp.1", len);
+ VG_(sysctl)(mib, sizeof(mib)/sizeof(Int), kernelVersion, &len, NULL, 0);
+ VG_(message)(Vg_DebugMsg, " %s\n", kernelVersion);
+ VG_(free)( kernelVersion );
+# endif
VG_(machine_get_VexArchInfo)( &vex_arch, &vex_archinfo );
VG_(message)(
Modified: trunk/include/pub_tool_libcproc.h
==============================================================================
--- trunk/include/pub_tool_libcproc.h (original)
+++ trunk/include/pub_tool_libcproc.h Wed Apr 1 13:15:49 2015
@@ -59,6 +59,7 @@
extern Int VG_(system) ( const HChar* cmd );
extern Int VG_(fork) ( void);
extern void VG_(execv) ( const HChar* filename, HChar** argv );
+extern Int VG_(sysctl) ( Int *name, UInt namelen, void *oldp, SizeT *oldlenp, void *newp, SizeT newlen );
/* ---------------------------------------------------------------------
Resource limits and capabilities
|