VMware, Inc [Wed, 24 Feb 2010 21:11:36 +0000 (13:11 -0800)]
VMCI: Fix signedness errors
When compiling with never compilers vmci causes the following errors
to be reported:
.../vmcrosstalk/common/vmciDs.c: In function "DsHandleMessage":
.../vmcrosstalk/common/vmciDs.c:211: warning: pointer targets in passing
argument 1 of "DsLookupAction" differ in signedness
Fix it by changing name in from int8[] to char[] and making DsHandleMessage
take size_t for "outSize" and "written".
VMware, Inc [Wed, 24 Feb 2010 21:06:05 +0000 (13:06 -0800)]
vmtoolsd: fix console handling on Win32.
The previous code required the user to instruct the code to attach to the
console manually, which was error-prone. It also had a bug where the help
wouldn't show up, since the code to attach to the console was called after
the help was shown.
This change does three things:
. auto-detects the help triggers in the command-line and attaches a console
as needed.
. make sure we have a console when command-line parsing fails, so that the
message is shown.
. attaches a console when configuring logging, whenever a log domain is
configured to output to the terminal.
As a result, the old "--console" command line option is not needed anymore.
VMware, Inc [Wed, 24 Feb 2010 21:03:30 +0000 (13:03 -0800)]
OVT: have configure check for presence of linux/unistd.h
Not everyone installs kernel-headers/linux-userspace-headers package
and without it compilation fails with a puzzling error. We better
check that the required header is present upfront.
VMware, Inc [Wed, 24 Feb 2010 21:03:06 +0000 (13:03 -0800)]
Revised version of cs 979736
cs 979736 included changes to lib/string to call GetReturnAddress()
that caused the linker to build differently. cs 979736 was
subsequently backed out for pr 483076. This is the same change
without the GetReturnAddress() calls. This change should not
introduce any functional differences whatsoever; it merely introduces
a new library function in lib/string that is currently not called.
The original description of cs 979736 is:
Add Str_Strerror, a thread safe version of strerror
strerror is not thread safe, it reuses the memory for the error
string on every call. strerror_r is thread safe, but requires
callers to manage their buffers. Add a new Str_Strerror function
that uses thread local storage to keep the error string. This
function is only present on GLIBC_VERSION_23 and later.
VMware, Inc [Wed, 20 Jan 2010 21:47:02 +0000 (13:47 -0800)]
Exclude pagemap from in-guest vm-support
Newer kernels, such as those included in Ubuntu 9.04
and 9.10, export a 'pagemap' node to the proc filesystem.
This node maps guest virtual to guest physical pages,
allowing address look-ups for the entire valid guest
virtual address space (including unmapped regions).
Thus, archiving the entire pagemap for each process/task
is prohibitively large (not to mention extremely slow) on
64-bit systems. More importantly, this information is
not terribly useful for our debugging. So, we exclude it
and vm-support in Ubuntu 9.x guests won't automatically
fill the guest disk. (See also PR 399587 for the
linux host vm-support fix for the same issue).
As the 'Collect support data...' button now runs this
script in-guest, this change is important. (Previously,
to trigger this problem, customers would have had to run
vm-support manually inside the guest.)
VMware, Inc [Wed, 20 Jan 2010 21:44:25 +0000 (13:44 -0800)]
PVSCSI: fix signedness compile warning
pvscsi_setup_msix() expects 'irq' argument to be an int but is being
passed unsigned int. Unsigned int is more proper type for IRQ number
so let's use it. This shuts off a compile warning with recent
compilers.
VMware, Inc [Wed, 20 Jan 2010 21:42:38 +0000 (13:42 -0800)]
Add guest kernel-mode support to vmci on Windows
* Added new IOCTLs to create/destroy datagram handles from
kernel-mode (the existing ones rely on a process context).
* Removed the old shared memory IOCTLs and code.
* Modified the guest driver to handle the new IOCTLs.
* Modified the host driver to fail gracefully when called from
kernel-mode (since not yet supported).
* Added kernel-mode vmcilib that wraps the IOCTLs. Interface
is exactly the same as if you linked against vmci directly.
* Added a kernel-mode version of crosstalktest for all of the
above. Note that it is built out of bora but will run in the
guest too; it will pass on the guest but fail in the host until
support is added.
VMware, Inc [Wed, 20 Jan 2010 21:41:43 +0000 (13:41 -0800)]
Fix VMware logo used on task bars and window decorations on Linux
CS #978067 updated design of VMware logo shown in "About" tab of
the toolbox program (Linux version) but neglected to update icon
used by desktop environment on window decorations and task bars.
Fix it.
VMware, Inc [Wed, 20 Jan 2010 21:37:07 +0000 (13:37 -0800)]
Add Str_Strerror, a thread safe version of strerror
strerror is not thread safe, it reuses the memory for the error
string on every call. strerror_r is thread safe, but requires
callers to manage their buffers. Add a new Str_Strerror function
that uses thread local storage to keep the error string. This
function is only present on GLIBC_VERSION_23 and later.
The change to vmm-link-vmm-to-static.make undefines GLIB_VERSION_23,
which was erroneously set.
VMware, Inc [Wed, 20 Jan 2010 21:35:53 +0000 (13:35 -0800)]
open-vm-tools: cleanup handling of GLIBC_VERSION_* macros.
Centralize the macros in CPPFLAGS instead of having variables for
individual libraries. This way everybody gets the correct flags for
the glibc available on the system.
VMware, Inc [Wed, 20 Jan 2010 21:32:20 +0000 (13:32 -0800)]
Use Solaris version number to decide MAC_VERSION to be used.
The earlier fix used devo_rev to choose the MAC_VERSION to be used in
mac_alloc(). That was a workaround for incomplete header files list in
toolchain. Moreover it did not serve the purpose as devo_rev came from
our header files itself and not as a runtime parameter from Solaris
kernel.
The header files for Opensolaris 2009.06 in toolchain have been restored . This change exploits the same. Some macros and structures have
changed in Opensolaris since Solaris 10. Depending on the version for
which the driver is being compiled, the right ones are used.
VMware, Inc [Wed, 20 Jan 2010 21:31:47 +0000 (13:31 -0800)]
Update tools logo and icons with the new design
We should be using official VMware logo in tools. Note that wireless
icon is not updated (was not provided) but since we do not user or
advertise this feature it should be OK.
VMware, Inc [Wed, 20 Jan 2010 21:31:35 +0000 (13:31 -0800)]
update to I18N encoding name cross reference table
Update the I18N name to encoding cross reference table with
some new names. Identify encodings that are supported by ICU
even if we don't support them in our stripped down ICU data
file. This doesn't actually add any encodings, but it makes
it easier should we decide to do so in the future.
Add new encodings that are needed for [361930], and change the
ICU data path to point to the new location in toolchain.
Also add some test code that can be enabled from Unicode_Init to
verify the entries in the xRef table match what is expected in
the ICU data file. Add a similar change to codeset to disable
getting the ICU data file from toolchain if a custom file is
being tested.
VMware, Inc [Wed, 20 Jan 2010 21:31:22 +0000 (13:31 -0800)]
Fix unitialized variable which can cause free of garbage
Fix packout to be NULL so that in the event of receiving
a search close request with a stale handle, the search
close handler does not call free on a garbage pointer value.
VMware, Inc [Wed, 20 Jan 2010 21:30:53 +0000 (13:30 -0800)]
Update copyright year to 2010
So that our copyright string is current. The year in stubbed-out
open_source_licenses.txt file is not changed as we expect the file
to be replaced soon.
VMware, Inc [Wed, 20 Jan 2010 21:30:24 +0000 (13:30 -0800)]
Switch to using a more generic loaded-module-list func
There is a not-very-generic loaded-module-list function
in lib/user (which is Linux-only). For other reasons,
I've written a more generic one in lib/coreDump
(checked in with a previous review, cn970593) that works
for Linux, Windows, and Mac.
Delete the old one, and hook up the one callsite to call the
new one.
VMware, Inc [Wed, 20 Jan 2010 21:30:07 +0000 (13:30 -0800)]
Fix VMCI compilation on 2.6.32 and later kernels.
This change fixes two compilation issues with the VMCI linux
module on some 2.6.32 and later kernels. First, we now include
compat_sched.h together with compat_wait.h, since linux/wait.h
apparently isn't selfcontained (thanks to Petr for pointing
this out). Also, we no longer include "pgtbl.h" for 2.6.0
kernels and later, since it isn't used for these kernels. Also
removed includes and macros used by pre 2.6.0 kernels, since
guest kernel drivers for these kernels are frozen.
VMware, Inc [Wed, 20 Jan 2010 21:29:59 +0000 (13:29 -0800)]
Unity/X11: Only toggle minimization when window is on same desktop.
This is a follow-on to bug 280354 / CLN 699915. While that CLN ignored
bogus iconify notices upon desktop change, as written it implied that all
windows were unminimized unless a state change indicated otherwise. With
an already-minimized window, it ended up triggering unminmize events upon
desktop change.
VMware, Inc [Wed, 20 Jan 2010 21:29:46 +0000 (13:29 -0800)]
resolutionX11.c: Add support for autofit via RandR >= 1.2.
The new WIP Linux guest drivers no longer support the VMWARE_CTRL X11
protocol extension but instead expose multiple displays via the RandR
(Resize and Rotate) extension as outputs LVDS1..LVDS<n>.
The requested topology is implemented using modes called
'autofit-WWWWxHHHH' generated as needed for each output.
VMware, Inc [Wed, 20 Jan 2010 21:28:53 +0000 (13:28 -0800)]
TimeSync: cleanup hanlding of the timesync loop state
We used to store current state of plugin/timeloop in timeSyncState;
unfortunately we were also using presence of 'timer' to infer whether
the loop is running which is confusing. Make 'state' the pimary source
of this information.
Also we should not stop timesync loop any time sync fails, let's treat
treat this as a transient condition and keep running.
VMware, Inc [Wed, 20 Jan 2010 21:28:17 +0000 (13:28 -0800)]
Try to auto-detect CUnit without having to define CUSTOM flags.
Like in other cases where there's no pkg-config or config scripts,
use a default to try to find the library. Add a new macro that does
that in a generic way and use it in other cases where that situation
occurs in configure.ac.
Bonus: remove libnotify detection code since none of the open-vm-tools
code uses libnotify.
VMware, Inc [Wed, 20 Jan 2010 21:27:24 +0000 (13:27 -0800)]
Rework the vmrpcdbg library to use CUnit.
CUnit provides nicer ways to track test failures than just logging or
using hard asserts. So use CUnit to run vmtoolsd-based test code.
This required a few changes:
. to be able to use CUnit, the vmtoolsd main loop needs to be run in
the context of a CUnit test. So the code in mainLoop.c was reorganized
a bit so that all code that touches plugin code is run in that context,
and execution of the main loop is done through the vmrpcdbg library
(which sets up the CUnit context) when running in debug mode.
. the interface of the vmrpcdbg library was cleaned up a little bit.
. test code was changed to use CUnit asserts instead of
ASSERT/g_assert/logs.
VMware, Inc [Wed, 20 Jan 2010 21:27:02 +0000 (13:27 -0800)]
Implementing support for V4 headers in the HGFS server.
Adding capability to pack/unpack V4 headers in the server and
to process V4 packets with legacy, V3 payload.
The change does not introduce support for any new type of operation
(except HGFS_OP_CREATE_SESSION_V4/HGFS_OP_DESTROY_SESSION_V4).
New types of operations and payload will be gradually added in the future.
VMware, Inc [Wed, 20 Jan 2010 21:25:26 +0000 (13:25 -0800)]
Fix Linux kernel modules build on 2.6.33-rc1
linux/utsrelease.h & friends moved from linux/ to generated/. Which
breaks all our sources, plus all our builders.
So there are two changes: (1) make sure our modules include
appropriate autoconf.h, and (2) update modconf to know that
utsrelease.h may live in different directory.
While I was in modconf I could not resist to remove some duplicated
code...
VMware, Inc [Wed, 20 Jan 2010 21:24:25 +0000 (13:24 -0800)]
Allow hgfsServer to use glib mutexes instead of bora/lib/lock.
This avoids having lib/lock and its dependencies having to be part of
open-vm-tools. To make sure vmware-user still works in open-vm-tools,
make sure the glib thread library is initialized, even though it's not used
by the non-open-vm-tools version.
This change only really affects the open-vm-tools build at the moment;
eventually we might want to clean up the regular tools build also, so
that we have one less dependency on bora.
VMware, Inc [Wed, 20 Jan 2010 21:23:58 +0000 (13:23 -0800)]
Hostinfo: Add OS name caching to POSIX impl.
While investigating PR 479137, we noticed that the
Hostinfo_GetOSName may end up holding up the Tools service for a while
on a heavily loaded host. My theory is that we're starved of either
CPU or disk, and this change brings the caching available in the Windows
implementation over to the POSIX side.
After the first invocation, we won't have to go to disk or fork any
other processes in order to identify the running operating system.
VMware, Inc [Wed, 20 Jan 2010 21:23:27 +0000 (13:23 -0800)]
Unicodify lib/system.
Make sure all code is Unicode-friendly, and change
System_SetProcessPrivilege's signature to not depend on the TSTR mutable type
so that we catch mismatches at compile time. Also do some minor cleanup (like
getting rid of obsolete code).
VMware, Inc [Wed, 20 Jan 2010 21:21:34 +0000 (13:21 -0800)]
Remove bogus error checks from af_vsock.c
With the new VMADDR_CID_ANY change, a datagram handle that is registered with VMCI will have a context
of invalid on the guest or hosted context id on the host. This means the error check in linux vsock
is no longer correct and was preventing sockets from working on the host. Just remove the checks since
it is really a bug if VMCI ever returns us a handle with bad values and VMCI_SUCCESS...
VMware, Inc [Wed, 20 Jan 2010 21:21:26 +0000 (13:21 -0800)]
VMCI Handle array should allocate mem atomic.
The VMCI handle arrays are usually appended to and copied
while holding spinlocks. As these operations may/will result
in memory being allocated, the memory allocations should be
atomic.
VMware, Inc [Thu, 17 Dec 2009 23:01:29 +0000 (15:01 -0800)]
vmtoolsd: do not store VMX options with the rest of config
VMX options are not persistent in the sense that they are not stored
in tools config file in GOS but rather [re]transmitted from host at
startup, resume, etc, or when they are changed. When we reload config
file (which we periodically do to switch to the latest and greatest
user-supplied settings) VMX options get flushed from memory so let's
not put them in key file in first place and instead require plugins
to store values relevant to their operation themselves.
The only user who did look up VMX option in key file - timeSync - has
already been changed to store value by itself.
VMware, Inc [Thu, 17 Dec 2009 23:00:56 +0000 (15:00 -0800)]
Timesync: fix backward sync when config file is reloaded
Reloading of tools configuration file causes purging of all options,
including ones that are sent via RPC by VMX. This causes issues with
timesync plugin, which 'forgets' that it is supposed to perform full
time synchronization when enabling time synchronization loop.
Solve the problem by storing value of TOOLSOPTION_SYNCTIME_STARTUP
in a private variabe instead of retrieving it from the config
dictionary.
VMware, Inc [Thu, 17 Dec 2009 23:00:31 +0000 (15:00 -0800)]
Modify the linux vsock code to work with VMADDR_CID_ANY
Previous to this change VMADDR_CID_ANY was directly mapped to a context id when it was recv'd from
userland. Change this behavior to store VMADDR_CID_ANY and to register datagram handlers as
any cid for:
1. The stream control channel under all conditions.
2. The datagram handler if it is being bound to VMADDR_CID_ANY.
VMware, Inc [Thu, 17 Dec 2009 23:00:06 +0000 (15:00 -0800)]
Add support for datagram handles with VMCI_FLAG_ANYCID_DG_HND.
In certain situations (e.g. vsock) ... we really want to register datagram handles that are not
tied to one specific context id. The goal is that these datagram handles will continue to be
able to send and recv datagrams after a cid change. Without this change clients would have to go
through and manually reregister all datagram handles.
VMware, Inc [Thu, 17 Dec 2009 22:58:54 +0000 (14:58 -0800)]
FreeBSD VMBLOCK: avoid crash when doing lookup in a subdirectory
When trying to reconstruct path to a vnode during lookup of a file
within subdirectory the driver gets confused and crashes the kernel.
This can be easily triggered by doing H->G DnD of a small directory.
Instead of trying to reconstruct it every time let's just store the
latest lookup that lead to discovery of the vnode (similar to how
Linux driver does this).
VMware, Inc [Thu, 17 Dec 2009 22:58:30 +0000 (14:58 -0800)]
Add support for delayed VMCI datagrams.
This builds on top of changes 960817 and 964769. Datagrams
can now be delivered in a delayed system context via
a worker thread, instead of directly. Although
the code is present for all platforms, this is only
enabled for Windows, since we want datagrams at PASSIVE
rather than DISPATCH level.
VMware, Inc [Thu, 17 Dec 2009 22:55:27 +0000 (14:55 -0800)]
Allow plugins to respond to registration errors.
This change adds a callback that plugins can register to be notified of
registration errors. Plugins can use this functionality to selectively
disable functionality based on the current state of the container where
they are running.
For example, if a plugin depends on a signal provided by another plugin,
but this other plugin fails to load for any reason, the first plugin is
notified that the signal connection failed, and can disable the
functionality that relied on that signal.
Plugins are never unloaded, though. So they should still be careful to not
crash even if registration errors happen.
VMware, Inc [Thu, 17 Dec 2009 22:55:03 +0000 (14:55 -0800)]
Fix open-vm-tools build issues.
. codeset.c is not compiled when using --without-icu, so we shouldn't
reference symbols implemented in that file in that case.
. gcc 4.3.2 complains about calling Panic() with a non-const format string.
. Ubuntu 9.10 complains about ignoring the return value of chdir.
VMware, Inc [Thu, 17 Dec 2009 22:52:21 +0000 (14:52 -0800)]
Make vmci, vsock, vmsync and vmnet use compat_mutex
In recent rt kernels (bug 490581 reports this for
2.6.31.4-rt14), old style mutex operations are no longer
supported (DECLARE_MUTEX, init_MUTEX are gone). Since we
already have a compat_mutex.h, convert vmci, vsock, vmsync and
vmmnet to use that instead. Since vmnet used an interruptible
version of down, compat_mutex_lock_interruptible has been
added to compat_mutex.h.
Another option would be to extend the current compat_semaphore
header, but since the new Linux mutex operations are there and
are specific for mutexes, we might as well move to these.
VMware, Inc [Thu, 17 Dec 2009 22:51:38 +0000 (14:51 -0800)]
Sample guest and host time multiple times.
This change adds a loop reading host and guest time. The read of
the guest is always bracketed by reads of the host and if those
two reads are more than 2ms apart, loop to try and get a more
accurate sample.
VMware, Inc [Thu, 17 Dec 2009 22:51:24 +0000 (14:51 -0800)]
DynXdr: Implement xdr_inline operation.
While working with SIGAR => XDR serialization, I ran into segfaults
when the rpcgen-generated code called xdr_inline, an operation which
we didn't implement.
VMware, Inc [Thu, 17 Dec 2009 22:51:09 +0000 (14:51 -0800)]
Add unrestricted local encoding support to tools
Tools needs to be able to use local encodings even if they are
not supported in our stripped down version of the ICU. In tools
builds accept any encoding as valid provided we recognize it
and it is the default local encoding. If the encoding is not
supported in our ICU, revert to using native OS conversions with
codesetOld.
VMware, Inc [Thu, 17 Dec 2009 21:50:33 +0000 (13:50 -0800)]
char is neither signed nor unsigned
As some of our code starts to be compiled on ARM, we need to improve
some elements of code cleanliness. This review deals with char being
neither signed nor unsigned in the gcc type system. (Confused? See
this link:)
http://www.trilithium.com/johan/2005/01/char-types/
This was initially found with gcc, but MSVC also makes the distinction.
VMware, Inc [Thu, 17 Dec 2009 21:47:07 +0000 (13:47 -0800)]
Factor out reading guest and host time from TimeSyncDoSync.
This change splits out reading guest and host time from the main
time sync loop. At the same time, it converts to using "diff" and
"interruptLag" to "gosError" and "apparentError". The polarity of
these two now match NTP/adjtime: positive values mean that time is
ahead, negative values mean that time is behind. The names match
TimeTracker.
This change shouldn't introduce any behavioral changes. The
change in how errors are represented makes some of the conditions
in the one time sync portion of the loop look a bit suspect, but
I'll address that later.
VMware, Inc [Thu, 17 Dec 2009 21:46:45 +0000 (13:46 -0800)]
Make timeSync use microseconds rather than seconds & microseconds.
A signed 64 bit value storing microseconds can represent up to
292471 years, so keeping a separate "seconds" value isn't
necessary (and complicates calculations).
VMware, Inc [Thu, 17 Dec 2009 21:45:52 +0000 (13:45 -0800)]
Configure core dump limit on POSIX automatically.
In this change:
. if core dumps are enabled in the config file, try to raise the core
rlimit for the process when logging is enabled; this can still fail
if the system is configured to now allow it, but it's better than
not getting core dumps because the default system setting is to set
the limit to 0.
. on POSIX systems, try to chdir to the user's home if trying to create
a core dump, but the current directory is not writable.
. don't enable the Win32 exception filter automatically when loading the
vmtools DLL; instead, do it when configuring logging and requesting
core dumps.
. avoid recursive log calls from CoreDump_CoreDump() on Win32; only Panic()
was incrementing the recursive panic count, it needs to be done in the
actual core dump function.
This change doesn't handle SIGSEGV on POSIX; that will still create a core
dump if the limit is set appropriately, but won't go through the code that
sees if the current directory is writable.
VMware, Inc [Thu, 17 Dec 2009 21:44:59 +0000 (13:44 -0800)]
Plumb SCM control signals through vmtoolsd in a generic way.
Instead of individually plumbing every possible control code the SCM
sends to services through vmtoolsd, provide a generic plumbing mechanism
and let plugins decide what they want to do.
The only remaining issue is that a few control codes are only sent after
some specific registration step (e.g., RegisterDeviceNotification); for
those cases, either we'll need to have vmtoolsd blindly register for all
possible control codes (which is not future proof since MS may add new
ones), or, when possible (such as in the device notification example),
let plugins do the registration themselves.
Change the two existing control messages (SESSION_CHANGE and SHUTDOWN) to
use the new mechanism, and fix all current usage sites.
VMware, Inc [Thu, 17 Dec 2009 21:43:15 +0000 (13:43 -0800)]
Detect nested VM support
Unless vmx.allowNested is set, VMX currently refuses to power on
if it finds the backdoor. With the recent addtion of dynamic
backdoor toggling, we can now test for the presence of that
feature and allow nested VMs to power on when it is found.