]> git.ipfire.org Git - thirdparty/open-vm-tools.git/log
thirdparty/open-vm-tools.git
8 years agoRemove dead FileMacos_IsOnExternalDevice function.
Oliver Kurth [Fri, 15 Sep 2017 18:23:49 +0000 (11:23 -0700)] 
Remove dead FileMacos_IsOnExternalDevice function.

FileMacos_IsOnExternalDevice does not have any callers.

8 years agoCommon header file change; not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:49 +0000 (11:23 -0700)] 
Common header file change; not applicable to open-vm-tools.

8 years agoAdd MacOS 10.13 to guest os tables
Oliver Kurth [Fri, 15 Sep 2017 18:23:49 +0000 (11:23 -0700)] 
Add MacOS 10.13 to guest os tables

8 years agoAvoid loading resolutionSet when support for resolutionKMS available
Oliver Kurth [Fri, 15 Sep 2017 18:23:49 +0000 (11:23 -0700)] 
Avoid loading resolutionSet when support for resolutionKMS available

Loading resolutionSet with display NULL will cause a segmentation
fault in vmtoolsd user process. This change only avoids the
SEG fault. Still need to channel the resolution/topology request
to correct channel presenting the capabilities.

8 years agoCommon header file change; not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:49 +0000 (11:23 -0700)] 
Common header file change; not applicable to open-vm-tools.

8 years agoFormalize VThreadBase "Stable" and "Kernel" IDs
Oliver Kurth [Fri, 15 Sep 2017 18:23:49 +0000 (11:23 -0700)] 
Formalize VThreadBase "Stable" and "Kernel" IDs

Unrelated to open-vm-tools.

8 years agolib/file: Less variation on file lock waits
Oliver Kurth [Fri, 15 Sep 2017 18:23:48 +0000 (11:23 -0700)] 
lib/file: Less variation on file lock waits

The wait time are large enough that less variance will prevent too
frequent polling. This is important due to the randomized waiting now.

8 years agoRemove definition for "solaris12-64"
Oliver Kurth [Fri, 15 Sep 2017 18:23:48 +0000 (11:23 -0700)] 
Remove definition for "solaris12-64"

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:48 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:48 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoFix Atomic_SetBit64 being miscompiled when the bit argument is a constant.
Oliver Kurth [Fri, 15 Sep 2017 18:23:48 +0000 (11:23 -0700)] 
Fix Atomic_SetBit64 being miscompiled when the bit argument is a constant.

8 years agolib/include/sha1.h:
Oliver Kurth [Fri, 15 Sep 2017 18:23:48 +0000 (11:23 -0700)] 
lib/include/sha1.h:
  - Clean up - change unnamed struct to "struct SHA1-CTX" in SHA1_CTX typedef.

8 years agolib/thread: Prune a little more
Oliver Kurth [Fri, 15 Sep 2017 18:23:48 +0000 (11:23 -0700)] 
lib/thread: Prune a little more

Remove automatic VThread_SetName for unmanaged threads.

Other minor removals and tweaks:
- modify "safe" name in VThreadBase to use gettid or
  pthread_threadid_np if available
- Move lib/thread name computation to child thread to remove dependency
  on VThreadID in parent.
- Convert VThreadFreeID to VThreadFree (and avoid a lookup)
- Move VThreadBase_ForgetSelf to VThreadDestroyThread to
  make VThreadHostDestroyThread straightforward.
- The 'priority' field had become write-only after earlier cleanups
  to replace AdjustThreadPriority with SetThreadPriority. Remove it,
  and some dead comments mentioning it.
- Remove unused 'signalNestCount' atomic.
- Remove two unimplemented VThreadInt prototypes.
- Remove a vacuously-true ASSERT in VThreadHostExitThread()

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:48 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agolib/file: Add a comment on why sleeps for file locks are randomized
Oliver Kurth [Fri, 15 Sep 2017 18:23:48 +0000 (11:23 -0700)] 
lib/file: Add a comment on why sleeps for file locks are randomized

The randomization prevents lock cadence issues (thundering herds).

8 years agoHgfs OSX Server: Reinstate checkpoint synchronization and process session
Oliver Kurth [Fri, 15 Sep 2017 18:23:48 +0000 (11:23 -0700)] 
Hgfs OSX Server: Reinstate checkpoint synchronization and process session

First reinstate the server checkpoint synchronization routine by adding
it into the table the HGFS server session callback table which is returned
to the transports upon initialization. These transports will then call
into the HGFS server when asked by the HGFS server manager which receives
the check point synchronization calls.

When processing the synchronization request for the operation type -
freeze or thaw we must pass through the session information to the
activation and deactivation calls into the file system change notification
subsystem. These calls will require the session for register-unregister
any active threads generating events.  This change just plumbs through
the session as the argument. Follow on changes will make use of the
session argument passing it on to the event generating component.

Bonus here is that we can delete an unwarranted global from the HGFS server.
A to do comment is added to move the async globals into the HGFS server
session object as they should be a per HGFS  session and are useful only
on a per session basis. No session then no need for them to be around and
if the session does have asynchronous support then again will not be required.
For example, if the transport does not support this behavior no need to
check them.

8 years agoImprove a comment
Oliver Kurth [Fri, 15 Sep 2017 18:23:47 +0000 (11:23 -0700)] 
Improve a comment

8 years agoClarify a comment. Spell out the units.
Oliver Kurth [Fri, 15 Sep 2017 18:23:47 +0000 (11:23 -0700)] 
Clarify a comment. Spell out the units.

8 years agolib/file: Use MIN macro
Oliver Kurth [Fri, 15 Sep 2017 18:23:47 +0000 (11:23 -0700)] 
lib/file: Use MIN macro

8 years agolib/file: consistant usage of msec
Oliver Kurth [Fri, 15 Sep 2017 18:23:47 +0000 (11:23 -0700)] 
lib/file: consistant usage of msec

We now want msec to be at the end, to be consistant with our current
usage.

8 years agolib/lock: msec consistancy
Oliver Kurth [Fri, 15 Sep 2017 18:23:47 +0000 (11:23 -0700)] 
lib/lock: msec consistancy

We want the "msec" at the end of variables. This improves readability
and is consistant with the usage elsewhere.

8 years agolib/file: FileLockSleeper issues
Oliver Kurth [Fri, 15 Sep 2017 18:23:47 +0000 (11:23 -0700)] 
lib/file: FileLockSleeper issues

While waiting for a contended file lock, FileLockSleeper was using
fixed values for how long to sleep between attempts. This can lead to
a "thundering herd" of waiters - several waiters all on the same
cadence. Randomize waiting to avoid any cadence.

Waiting for a lock should wait no longer than the specified time. Fix
This.

8 years agoFixing the UTF-8 locale dependency in CAF.
Oliver Kurth [Fri, 15 Sep 2017 18:23:47 +0000 (11:23 -0700)] 
Fixing the UTF-8 locale dependency in CAF.

CAF currently has hard dependency on UTF-8 locale which is
resulting in Tools and CAF failures in environments without
UTF-8 support.  Modify the existing code to fallback to
ANSI C locale if UTF-8 is not found.

8 years agoVThreadID: widen to uint64
Oliver Kurth [Fri, 15 Sep 2017 18:23:47 +0000 (11:23 -0700)] 
VThreadID: widen to uint64

Convert VThreadID to uint64.

8 years agoTimeUtil_GetTimeOfDay reports incorrect time on Windows
Oliver Kurth [Fri, 15 Sep 2017 18:23:46 +0000 (11:23 -0700)] 
TimeUtil_GetTimeOfDay reports incorrect time on Windows

The conversion from FILETIME to Unix time was off.

8 years agoUnify mapping tables between VMX and VIM guest OS keys
Oliver Kurth [Fri, 15 Sep 2017 18:23:46 +0000 (11:23 -0700)] 
Unify mapping tables between VMX and VIM guest OS keys

There are multiple places that maintain their own tables
mapping VMX guest OS keys to or from VIM guest OS keys.
Unify them to make the situation a bit less cumbersome.

Put the mapping table into guest_os_tables.h.
The different sites use the mappings in different ways (some
code wants the VIM guest OS keys as strings, whereas other
code wants them as enum identifiers), so use preprocessor
macros to extract the data.

8 years agoSave errno after kill() fails, restore the saved errno after logging the error.
Oliver Kurth [Fri, 15 Sep 2017 18:23:46 +0000 (11:23 -0700)] 
Save errno after kill() fails, restore the saved errno after logging the error.

8 years agoFix error introduced in strutil.c
Oliver Kurth [Fri, 15 Sep 2017 18:23:46 +0000 (11:23 -0700)] 
Fix error introduced in strutil.c

8 years agotimeutil.c code cleanup.
Oliver Kurth [Fri, 15 Sep 2017 18:23:46 +0000 (11:23 -0700)] 
timeutil.c code cleanup.

8 years agoThe check for overflow in StrUtil_SafeStrcat needs work.
Oliver Kurth [Fri, 15 Sep 2017 18:23:46 +0000 (11:23 -0700)] 
The check for overflow in StrUtil_SafeStrcat needs work.

Might as well avoid protential overflow while also checking for
"insane" string lengths.

8 years agoCommon source file changes that are not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:46 +0000 (11:23 -0700)] 
Common source file changes that are not applicable to open-vm-tools.

8 years agoRemove obsolete product version definitions
Oliver Kurth [Fri, 15 Sep 2017 18:23:46 +0000 (11:23 -0700)] 
Remove obsolete product version definitions

8 years agoDon't call FreeLibrary with NULL.
Oliver Kurth [Fri, 15 Sep 2017 18:23:46 +0000 (11:23 -0700)] 
Don't call FreeLibrary with NULL.

According to the documentation and annotations of FreeLibrary, NULL is
not a legal value to pass. All other calls to FreeLibrary are
correctly handled.

8 years agoCommon header file change; not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:46 +0000 (11:23 -0700)] 
Common header file change; not applicable to open-vm-tools.

8 years agoCommon header file change; not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:45 +0000 (11:23 -0700)] 
Common header file change; not applicable to open-vm-tools.

8 years agoCommon header file change: not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:45 +0000 (11:23 -0700)] 
Common header file change: not applicable to open-vm-tools.

8 years agoRemove logic for unsupported versions of macOS.
Oliver Kurth [Fri, 15 Sep 2017 18:23:45 +0000 (11:23 -0700)] 
Remove logic for unsupported versions of macOS.

We no longer support macOS 10.4-10.7.  Remove the old logic that supported
these versions.

8 years agoCreate symlink for vmware-user
Oliver Kurth [Fri, 15 Sep 2017 18:23:45 +0000 (11:23 -0700)] 
Create symlink for vmware-user

When the vmtoolsd user daemon receives a SIGUSR2, it restarts itself
by executing 'vmware-user' and terminates. This is used on upgrades,
to make sure the current version of vmtoolsd is running.

In the tar installer, /usr/bin/vmware-user is a symlink to
vmware-user-suid-wrapper. Unfortunately, that symlink was not installed
by open-vm-tools.

Package maintainers should send this signal to the vmtoolsd user
process when open-vm-tools is updated.

8 years agoAsyncSocket:
Oliver Kurth [Fri, 15 Sep 2017 18:23:45 +0000 (11:23 -0700)] 
AsyncSocket:
  - Fix issue where the listening socket becomes bad and the callback
    function is invoked unexpectedly.
  - Change not directly applicable to open-vm-tools.

8 years agoerr.h: Add missing include
Oliver Kurth [Fri, 15 Sep 2017 18:23:45 +0000 (11:23 -0700)] 
err.h: Add missing include

err.h is missing any include that would provide a definition for DWORD.
Fix by including vm_basic_defs.h (which includes windows.h)

8 years agoCommon source file change: lib/include/strutil.[ch]
Oliver Kurth [Fri, 15 Sep 2017 18:23:45 +0000 (11:23 -0700)] 
Common source file change: lib/include/strutil.[ch]
  - Add function StrUtil_GetLastItem() and static functions StrUtilStrcmp(),
    StrUtilStrncmp(), StrUtilStrcasecmp(), StrUtilStrncasecmp(),
    StrUtilHasListItem() and StrUtilRemoveListItem().

8 years agoRemove N_PLAT_NLM (NetWare)
Oliver Kurth [Fri, 15 Sep 2017 18:23:45 +0000 (11:23 -0700)] 
Remove N_PLAT_NLM (NetWare)

Long ago, we supported NetWare. That's long since gone, but a few
of the macros have managed to survive fumigation since. This removes
all such macros.

8 years agoUpdate the open source license files for Tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:45 +0000 (11:23 -0700)] 
Update the open source license files for Tools.

8 years agoRevert previous commit.
Oliver Kurth [Fri, 15 Sep 2017 18:23:45 +0000 (11:23 -0700)] 
Revert previous commit.

8 years agolib/misc: StrUtil_SafeStrcat length overflow checking
Oliver Kurth [Fri, 15 Sep 2017 18:23:44 +0000 (11:23 -0700)] 
lib/misc: StrUtil_SafeStrcat length overflow checking

The check for overflow in StrUtil_SafeStrcat needs work.

Might as well avoid protential overflow while also checking for
"insane" string lengths.

8 years agolib/thread: Change VThread_CreateThread prototype
Oliver Kurth [Fri, 15 Sep 2017 18:23:44 +0000 (11:23 -0700)] 
lib/thread: Change VThread_CreateThread prototype

Change the VThread_CreateThread prototype from this:

VThreadID VThread_CreateThread(void (*fn)(void *), void *data,
                               VThread tid, const char *name);
to this:

Bool VThread_CreateThread(void (*fn)(void *), void *data,
                          const char *name, VThread *tid);

The new prototype returns essentially the same information, with
one important advancement: we can contractually guarantee the 'tid'
field is populated BEFORE the child thread starts. This neatly
avoids all sorts of interesting race conditions where the child
starts running before the CreateThread function passes back its
return value. This style of design is preferred by operating
systems (see Posix pthread_create, Win32 CreateThread).

8 years agoDon't try to use broken RPC channel
Oliver Kurth [Fri, 15 Sep 2017 18:23:44 +0000 (11:23 -0700)] 
Don't try to use broken RPC channel

Make sure RPC channel exists before trying to use it.

8 years agoCheck for Xen, VirtualPC etc., only if VMware not detected
Oliver Kurth [Fri, 15 Sep 2017 18:23:44 +0000 (11:23 -0700)] 
Check for Xen, VirtualPC etc., only if VMware not detected

This is a workaround to avoid random vmtoolsd crashes when running
on a VMware VM. This fix ensures that we check for Xen and VirtualPC only
if we haven't already detected a VMware hypervisor.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:44 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agostrutil.c: code clean up
Oliver Kurth [Fri, 15 Sep 2017 18:23:44 +0000 (11:23 -0700)] 
strutil.c: code clean up

8 years agoAtomic_CMPXCHG64: pass by value and remove gcc-2.96-isms
Oliver Kurth [Fri, 15 Sep 2017 18:23:44 +0000 (11:23 -0700)] 
Atomic_CMPXCHG64: pass by value and remove gcc-2.96-isms

8 years agoRevert the previous commit.
Oliver Kurth [Fri, 15 Sep 2017 18:23:44 +0000 (11:23 -0700)] 
Revert the previous commit.

8 years agoGet rid of convertutf and bsd_printf for all non-Windows Tools
Oliver Kurth [Fri, 15 Sep 2017 18:23:44 +0000 (11:23 -0700)] 
Get rid of convertutf and bsd_printf for all non-Windows Tools

Eliminate the use of convertutf8.c for all non-Windows Tools.

The MsgFmt_* functions are referenced in a few utilities
related to VMware Tools. This change replaces the MsgFmt_*
with a stub. This also affects the Windows version.

8 years agofileIO.h: Clean up some comments
Oliver Kurth [Fri, 15 Sep 2017 18:23:44 +0000 (11:23 -0700)] 
fileIO.h: Clean up some comments

Make the comment style consistent

8 years agolib/file: support POSIX O_CLOEXEC
Oliver Kurth [Fri, 15 Sep 2017 18:23:44 +0000 (11:23 -0700)] 
lib/file: support POSIX O_CLOEXEC

On POSIX systems add support for O_CLOEXEC - close the file descriptor
if the program does a variant of the exec system call.

8 years agoHgfs Server: Fix snapshot synchronization callback
Oliver Kurth [Fri, 15 Sep 2017 18:23:43 +0000 (11:23 -0700)] 
Hgfs Server: Fix snapshot synchronization callback

Currently when snapshots occur, the VMX calls the HGFS server
manager synchronization callback to notify the Hgfs server to
freeze or thaw the Hgfs file IO activity.  First, this Hgfs
server synchronization callback is called regardless of the
Hgfs Shared folders feature and server is enabled or not.
Consequently, the Hgfs server callback lamely uses a global
variable to track the server state just for this call and
returns without doing anything if not initialized.
Second, the HGFS server now requires the transport connection
in order to extract the Hgfs session as the file notification
component requires the session to allow its event generating
thread to callback to the server to register and unregister
through the transport which uses the PhysMem APIs.

This change fixes:
- call the Hgfs server only if Shared Folders and the server
  are enabled
- call through the channel manager and channel transport to
  the Hgfs server
- Hgfs server session callback table is extehded with a server
  quiesce callback.
- HgfsServerSessionQuiesce callback now replaces the old
  HgfsServer_Quiesce exported API.
- Make the quiesce callback use an enum to the thaw-freeze op
  instead of a bool
- remove the Hgfs server initialized global now it is not required

The tools implementation of the Hgfs server code does not use this
API and thus the guest Hgfs manager and transport channel do not
implement any code which will use the session quiesce callback.

8 years agoFreeBSD: Use the "dhclient" command to renew a DHCP IP address.
Oliver Kurth [Fri, 15 Sep 2017 18:23:43 +0000 (11:23 -0700)] 
FreeBSD: Use the "dhclient" command to renew a DHCP IP address.

On FreeBSD, "/etc/rc.d/netif" is sufficient to stop a network interface
when suspending a VM.  When resuming a VM, DHCP configured interfaces
must be restarted with "/etc/rc.d/dhclient".

This fix is courtesy of Steve Wills, maintainer of open-vm-tools on
FreeBSD, and Shuai Wang.

Pull request: https://github.com/vmware/open-vm-tools/pull/142

8 years agoAdd utilZero.h to open-vm-tools
Oliver Kurth [Fri, 15 Sep 2017 18:23:43 +0000 (11:23 -0700)] 
Add utilZero.h to open-vm-tools

8 years agoRemove memory zero related functions from util.h
Oliver Kurth [Fri, 15 Sep 2017 18:23:43 +0000 (11:23 -0700)] 
Remove memory zero related functions from util.h

Add a new header utilZero.h

8 years agoLog xmlsec1 version details
Oliver Kurth [Fri, 15 Sep 2017 18:23:43 +0000 (11:23 -0700)] 
Log xmlsec1 version details

For better debugging of open-vm-tools, log the xmlsec1 version info.

8 years agoHgfs Server: Fix a memory leak on server exit not destroying the shares
Oliver Kurth [Fri, 15 Sep 2017 18:23:43 +0000 (11:23 -0700)] 
Hgfs Server: Fix a memory leak on server exit not destroying the shares

This change fixes a memory leak on server exit not destroying the shares.
The list of shares is not destroyed and left.

Fix this at the Hgfs server tear down by calling the shares reset with an
empty list which will cause all shares to be treated as stale and so deleted.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:43 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoCnP formatted text doesn't keep text format in Fedora 25
Oliver Kurth [Fri, 15 Sep 2017 18:23:43 +0000 (11:23 -0700)] 
CnP formatted text doesn't keep text format in Fedora 25

In Fedora24, the selection target name for rtf is text/richtext.
In Fedora25, the selection target name for rtf is changed to text/rtf,
which Tools did not support.

Add support for the new selection target name "text/rtf".

8 years agoSupport building open-vm-tools only for FreeBSD 10 and later.
Oliver Kurth [Fri, 15 Sep 2017 18:23:43 +0000 (11:23 -0700)] 
Support building open-vm-tools only for FreeBSD 10 and later.

Implemented a check for FreeBSD version and abort if the
detected version is less than 10.

8 years agoStop building open-vm-tools for LINUX systems with glibc < 2.12.
Oliver Kurth [Fri, 15 Sep 2017 18:23:43 +0000 (11:23 -0700)] 
Stop building open-vm-tools for LINUX systems with glibc < 2.12.

Implemented a check for glibc version and abort if the detected
version is lesser than 2.12 (This affects RHEL5 and older generations).

Implemented a config switch '--disable-glibc-check', which when specified,
will skip checking for compatible glibc version.

Modified the tools-pkg.make file to specify --disable-glibc-check
while executing "./configure" for open-vm-tools.

Note: glibc check is done only for Linux systems.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:43 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoHgfs Server: Remove the register share callback and usage part 2
Oliver Kurth [Fri, 15 Sep 2017 18:23:42 +0000 (11:23 -0700)] 
Hgfs Server: Remove the register share callback and usage part 2

Now the function is not being called at all it is time to remove
it along with the callback table entry for it.

8 years agoDynamic socket options API for async sockets
Oliver Kurth [Fri, 15 Sep 2017 18:23:42 +0000 (11:23 -0700)] 
Dynamic socket options API for async sockets
  lib/asyncsocket/asyncsocket.c:
  lib/asyncsocket/asyncSocketInterface.c:
  lib/asyncsocket/asyncSocketVTable.h:
  lib/include/asyncsocket.h:
  - Add AsyncTCPSocketSetOption(), AsyncTCPSocketGetOption() and
    AsyncSocket_EstablishMinBufferSizes functions.
  - Remove/deprecate specific option set functions to be subsumed
    by ->setOption().
    - ->useNodelay() (TCP_NODELAY), ->setTCPTimeouts (3x TCP_... options),
      ->setBufferSize (SO_{SND|RCV}BUF), ->setSendLowLatencyMode() (non-native
      option regarding buffering/callback behavior).

  lib/rpcIn/rpcin.c:
  services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c:
  - replace AsyncSocket_SetBufferSizes() calls with
    AsyncSocket_EstablishMinBufferSizes() calls.

Common header file change: not applicable to open-vm-tools.

8 years agoRemove BDOOR_CMD_FAS_GET_NVDIMM_FMT_CODE
Oliver Kurth [Fri, 15 Sep 2017 18:23:42 +0000 (11:23 -0700)] 
Remove BDOOR_CMD_FAS_GET_NVDIMM_FMT_CODE

Now that our guest FW can read the NVDIMM format interface
code (FIC) from the NVDIMM controllers MMIO space we have
no need for a backdoor call to do the same thing.  This
change removes the backdoor call for reading the FIC and
makes it's callers read the FIC from the NVDIMM controllers
MMIO space instead.

8 years agoHgfs Server: Remove the register share callback and usage
Oliver Kurth [Fri, 15 Sep 2017 18:23:42 +0000 (11:23 -0700)] 
Hgfs Server: Remove the register share callback and usage

Remove the register share callback and usage which is an HGFS server
libray function passed back to the VMX Hgfs server manager and policy
manager. This tracked shares as they were individually added and removed.
It carried with it VMDB behavior which was erroneous for the HGFS server
share tracking.

This API has been replaced by piggybacking on the Hgfs server InvalidateObjects
callback which informs the Hgfs server when the VMDB has finished updating
the Hgfs policy manager with shares and the Policy manager's list is complete.
At this point the Hgfs server can close any open handles on stale shares and
remove those stale shares and add new shares.

8 years agolib/misc/strutil.[ch]: New functions added; not applicable to open-vm-tools
Oliver Kurth [Fri, 15 Sep 2017 18:23:42 +0000 (11:23 -0700)] 
lib/misc/strutil.[ch]:  New functions added; not applicable to open-vm-tools
  - Added functions StrUtil_GetNextItem, StrUtil_HasListItem,
          StrUtil_HasListItemCase, StrUtil_AppendListItem,
          StrUtil_RemoveListItem, StrUtil_RemoveListItemCase

8 years agoHgfs Server: Fix shares update for change notification
Oliver Kurth [Fri, 15 Sep 2017 18:23:42 +0000 (11:23 -0700)] 
Hgfs Server: Fix shares update for change notification

This change fixes UI updates of the shares which currently
update by a poorly designed algorithm which causes change
notification subscriptions to be deleted and not restored
and also unnecessary deactivation and activation of the
events generation.

Currently, the UI updates the HGFS shares in the HGFS server
via the RegisterShare callback. This is done from HGFS VMX
policy code which handles updates from the UI and maintains
the HGFS shares. The UI calls the policy code for each share
to remove it until the list of shares is empty. It then calls
back for each share to add the existing shares back to the list.
Currently, the policy code calls the HGFS server RegisterShare
callback to delete the share as it removes them and then again
to add each one back in that added to the policy shares list.
Unfortunately, as the shares are removed any existing subscribers
for change notifications on the deleted share are also destroyed.
Furthermore, when the shares list is empty, the count of subscribers
will also be zero at this point causing a deactivation of the
file change event generator. Once, the shares are added back in
via the RegisterShare callback no event subscribers will be
restored as they are not tracked and the event generation
will also not be activated due to that reason.

The fix is to make the shares tracking be handled in the same
manner as the HGFS server does for open handles on shares.
The HGFS policy waits until the shares list updates are complete
as the UI is done updating the shares. The HGFS policy then calls
the HGFS server InvalidateObjects callback with the new complete
list of shares which may or may not be different from the previous
list. The HGFS server InvalidateObjects goes through its current list
of shares and searches for each share in the new list of shares and
if it fails to locate it, then closes all open handles on that share.
Once the list has been exhausted, all open handles remaining will be
on shares that still exist.

The same callback is now used for resetting the list of shares for
the current subscribers of change events and not the RegisterShare
callback which should be removed altogether.  We now make sure that
the reset of file change event shares only removes shares not found
on the new list thereby only removing subscribers on those stale shares.
All subscribers for shares remaining on the lists are not deleted,
remain intact and unaffected.  Furthermore, file system event
generation will also not be deactivated unless all subscribers
happen to be for shares that were deleted.

This change is the first part which as code to piggyback on the HGFS
server InvalidateObjects callback to compare any shares in its list
with the new list and delete shares not found.  The RegisterSharecallback
function code is deleted and temporarily is an empty callback.
This will be deleted along with the callback code from the HGFS
policy manager in a subsequent change.

Details:
HgfsServerRegisterShare - is gutted and just an empty function just
   logging that it is called.
HgfsServerCleanupDeletedFolders is effectively renamed to
   HgfsServerSharesDeleteStale w/o the lock acquistion/release.
HgfsServerSharesDeleteStale now free the share name as well as the
   share object to stop memory leak.
HgfsServerShareAddInternal is extracted from the old defunct
   HgfsServerRegisterShare w/o the lock acquisition/release.
HgfsServerShareAdd acquires and releases the lock and calls
   HgfsServerShareAddInternal
HgfsServerSharesReset is created and called from the
   HgfsServerInvalidateObjects
HgfsServerEnumerateSharedFolders now calls the new HgfsServerShareAdd
   for all shares which is used to initialize the shares on HGFS server
   start.
HgfsServerGetLocalNameInfo now does not get the Shared Folder handle
   from the VMX policy host, instead getting it from the existing
   HgfsServerGetShareHandle (the server maintained list of shares).
   This is only used for setting subscribers from the client when
   using handles and not path names.
HgfsServerSetDirWatchByName now uses the handle returned by the
   HgfsServerGetLocalNameInfo call.
markedForDeletion is now removed as holding stale state is not needed
   since stale shares are deleted and resources freed immediately.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:42 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoCommon header file change; not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:42 +0000 (11:23 -0700)] 
Common header file change; not applicable to open-vm-tools.

8 years agoCheck timeout setting for scsi device before setting
Oliver Kurth [Fri, 15 Sep 2017 18:23:42 +0000 (11:23 -0700)] 
Check timeout setting for scsi device before setting

The rule to set the timeout value for SCSI devices was too generic,
and caused error messages, when the timeout field was set
when it didn't exist. This is not harmful, but generates unnecessary
noise. This change adds a check if the timeout field exists.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:41 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoRemove convertutf and bsd_printf
Oliver Kurth [Fri, 15 Sep 2017 18:23:41 +0000 (11:23 -0700)] 
Remove convertutf and bsd_printf

The license for convertutf.c and convertutf.h does not
explicitly permit, or prohibit, modification of the files,
and restricts use to "products supporting the Unicode
Standard". This is a problem for distribution with Debian,
which complies to strict guidelines. See details at
https://github.com/vmware/open-vm-tools/issues/148
and
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823100

The code is not essential for open-vm-tools. It's needed by
code in bsd_printf.c and related code, which in turn is
needed by msgfmt.c and msgList.c. The latter code is not needed
for open-vm-tools, and can therefore be eliminated from
the open-vm-tools package.

When HAS_BSD_PRINTF isn't set, Str_Snprintf() and
Str_Vsnprintf will fall back to vsnprintf(), and
Str_Asprintf()/Str_Vasprintf() will fall back to
vasprintf(). Under Linux and FreeBSD these functions are
properly implemented, and support %ls and %S.

8 years agoRemove Linux kernel modules
Oliver Kurth [Fri, 15 Sep 2017 18:23:41 +0000 (11:23 -0700)] 
Remove Linux kernel modules

Remove Linux kernel modules from open-vm-tools.

8 years agooptimize clamped uadd functions
Oliver Kurth [Fri, 15 Sep 2017 18:23:41 +0000 (11:23 -0700)] 
optimize clamped uadd functions

For unsigned adds, if there's no overflow, the result will be larger
or equal than either source operand. Consequently, if there's an
overflow, the result will be smaller than both, and checking against
one source operand is sufficient. Found accidentally...
(With just one comparison, gcc is in fact able to figure out the
comparison is really the same as the add overflowing and will omit
the comparison. But it won't do this with two comparisons.)

8 years agoVThread_Init: remove VThreadID parameter
Oliver Kurth [Fri, 15 Sep 2017 18:23:41 +0000 (11:23 -0700)] 
VThread_Init: remove VThreadID parameter

With the removal of static VThreadIDs, there is no longer any need
to specify a specific VThreadID when initializing the VThread library.
We can simply auto-assign an ID instead.

Remove the VThreadID parameter from all callsites.
Remove all VTHREAD_xxx_ID macros (except VTHREAD_INVALID_ID).
Slightly adjust vthreadBase.c to "know" that VThreadIDs now start
at 1, not 5.

8 years agoChanges to guest_os.h for Solaris 11
Oliver Kurth [Fri, 15 Sep 2017 18:23:41 +0000 (11:23 -0700)] 
Changes to guest_os.h for Solaris 11

8 years agoReplace ASSERT_DEVEL(p) with DEVEL_ONLY(ASSERT(p))
Oliver Kurth [Fri, 15 Sep 2017 18:23:41 +0000 (11:23 -0700)] 
Replace ASSERT_DEVEL(p) with DEVEL_ONLY(ASSERT(p))

It wasn't clear when ASSERT_DEVEL was enabled: was
it for all VMX86_DEVEL builds or for the intersection of
VMX86_DEVEL and VMX86_DEBUG?

Replace ASSERT_DEVEL(p) with DEVEL_ONLY(ASSERT(p)) to make it
clear that it's the latter.

8 years agoInclude syncManifest.c in open-vm-tools only on Linux
Oliver Kurth [Fri, 15 Sep 2017 18:23:41 +0000 (11:23 -0700)] 
Include syncManifest.c in open-vm-tools only on Linux

The VMTools build includes syncManifest.c only on Linux
and not on other OSes such as FreeBSD.  The open-vm-tools
build needs to do the same.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:41 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoCommon header file change; not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:40 +0000 (11:23 -0700)] 
Common header file change; not applicable to open-vm-tools.

8 years agoVMCI: Reset datagram buffer pointer on dealloc
Oliver Kurth [Fri, 15 Sep 2017 18:23:40 +0000 (11:23 -0700)] 
VMCI: Reset datagram buffer pointer on dealloc

A customer was seeing a guest crash when unloading the VMCI
driver - but only when upgrading to a specific version of UEK.
It turns out, that a BH may run during module unload,
and attempt to deliver datagrams to the datagram buffer after
it has been deallocated. It turns out that the tasklet may not
have been scheduled yet, so add a tasklet_disable to guard against
this. Also, reset the datagram buffer pointer when the buffer is
deallocated to indicate that it is no longer there.

8 years agoHgfs Server: Fix a memory leak of the transport connection
Oliver Kurth [Fri, 15 Sep 2017 18:23:40 +0000 (11:23 -0700)] 
Hgfs Server: Fix a memory leak of the transport connection

This change fixes a memory leak of the transport connection object
which was not being released on the final reference removal when
the HGFS server is being torn down.

This separates the initialization and destruction of the transport
object into their own transport init and exit functions.  Added the
lock destruct and free call of the transport object to the exit
function that were previously missing.  Corrected or added some
missing logging for debugging.

Additionally, fixed the VMCI interface to correct its tear down
order of functions which relied on the transport not being deleted.
This involved moving the draining of out of band HGFS server requests
or replies to the guest from being called after the HGFS server
transport has been destroyed.  Now it is moved to the correct place,
where the sequence is now:
- disconnect the HGFS server (i.e., stop generating any new request/replies out of band,
- drain the existing out of band HGFS requests/replies
- close the VMCI transport and shared memory callbacks
- close and teardown the HGFS server session and transport
- teardown the VMCI channel itself

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:40 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:40 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoPort X11 resolutionSet off gtk
Oliver Kurth [Fri, 15 Sep 2017 18:23:40 +0000 (11:23 -0700)] 
Port X11 resolutionSet off gtk

Replaced gtk calls with XOpenDisplay to obtain X Display.
Also moved getting the display logic (XOpenDisplay) from
ResolutionToolkitInit to ResolutionBackendInit and
corresponding XCloseDisplay in ResolutionBackendCleanup.
ResolutionInfoX11Type is used as back-end specific handle
and canUseResolutionKMS bool variable to communicate to
loader about resolutionCheckForKMS.  Removed gtk header
from ResolutionX11.c and ResolutionRandR12.c.

8 years agoresolutionSet/resolutionKMS: Force load the vmwgfx kernel module
Oliver Kurth [Fri, 15 Sep 2017 18:23:40 +0000 (11:23 -0700)] 
resolutionSet/resolutionKMS: Force load the vmwgfx kernel module

When testing for resolutionKMS system support, make sure the vmwgfx kernel
module is loaded before trying to obtain an open file descriptor to it.
Otherwise both the resolutionKMS- and resolutionSet tests might fail.

8 years agoChanges to common source files; not applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:40 +0000 (11:23 -0700)] 
Changes to common source files; not applicable to open-vm-tools.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:40 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoGenerate backup manifest files for quiesced snapshots on Linux.
Oliver Kurth [Fri, 15 Sep 2017 18:23:40 +0000 (11:23 -0700)] 
Generate backup manifest files for quiesced snapshots on Linux.

After a successful quiesced snapshot of a Linux guest, the
snapshot is reported as not quiesced.  The underlying cause
is:

- a snapshot is identified as quiesced if and only if a backup
manifest file was provided for the snapshot; and

- backup manifest files are not provided for quiesced snapshots
on Linux.

To fix the problem, VMTools will generate backup manifest files
for quiesced snaphots taken on Linux, and VMX will accept and
store such files.  This change is for the VMTools side of the
change.  The VMX change defines a new VMBACKUP_EVENT value relied
on by the VMTools change.

Changes in this commit include:
- new source files syncManifest.h and syncManifest.c with code
to generate the manifest file, and updates to syncDriverOps.c
to invoke that code.
- a new "SyncDriver_GetAttr" interface in the syncDriver code,
used by the SyncManifest code to obtain the name of the backend
provider and whether or not it is capable of quiescing.
- makefile and configure boiler plate to add the two new source
files to open-vm-tools and tools-for-linux.
- a new tools.conf setting enableXmlManifest that specifies
whether VMTools generates backup manifests for Linux.  For now,
the default value of this setting will be false.

8 years agoAdd a generic interface for accepting backup manifest files.
Oliver Kurth [Fri, 15 Sep 2017 18:23:39 +0000 (11:23 -0700)] 
Add a generic interface for accepting backup manifest files.

The interface provided by VMX to allow VMTools to notify it that
there is a backup manifest file to be transferred from the guest
is specific to Windows guests.  A more generic interface is being
implemented to enable backup manifest files for Linux guests.  A
new vmbackup event is added for passing to vmx the guest's path
for the manifest file, along with code for handling the event.

8 years agoSpawn a new thread to handle deployPkg.deploy RPC
Oliver Kurth [Fri, 15 Sep 2017 18:23:39 +0000 (11:23 -0700)] 
Spawn a new thread to handle deployPkg.deploy RPC

Deploypkg takes some time to complete, so separating
it to a new thread helps guarantee that the main
tools thread can still respond to VMX ping/heartbeat
messages.

Before this change, the state changes on the vmx side are:
   ToolsDeployPkg_Begin
   ToolsDeployPkg begin finished
   ToolsDeployPkg finished copy
   deployPkg.deploy
   deployPkg.update.state 3    -- TOOLSDEPLOYPKG_DEPLOYING
   deployPkg.update.state 4 0  -- TOOLSDEPLOYPKG_RUNNING
   deployPkg.update.state 4 103 -- TOOLSDEPLOYPKG_RUNNING GUESTCUST_EVENT_ENABLE_NICS
   deployPkg.update.state 4 104  -- TOOLSDEPLOYPKG_RUNNING GUESTCUST_EVENT_QUERY_NICS
   ToolsDeployPkg finished deploy

   ToolsDeployPkg_Begin
   ToolsDeployPkg deploy state: 4
   deployPkg.update.state 5 0     -- TOOLSDEPLOYPKG_DONE

After this change, the state changes are:
   ToolsDeployPkg_Begin
   ToolsDeployPkg begin finished
   ToolsDeployPkg finished copy
   deployPkg.deploy
   deployPkg.update.state 3
   ToolsDeployPkg finished deploy

   deployPkg.update.state 4 0
   deployPkg.update.state 4 103
   deployPkg.update.state 4 104

   ToolsDeployPkg_Begin
   ToolsDeployPkg deploy state: 4
   deployPkg.update.state 5 0

There are no specific changes on vmx side.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:39 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoChange to shared header file unrelated to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:39 +0000 (11:23 -0700)] 
Change to shared header file unrelated to open-vm-tools.

8 years agoCommon source file changes; not directly applicable to open-vm-tools.
Oliver Kurth [Fri, 15 Sep 2017 18:23:39 +0000 (11:23 -0700)] 
Common source file changes; not directly applicable to open-vm-tools.

8 years agoLog output from network script
Oliver Kurth [Fri, 15 Sep 2017 18:23:39 +0000 (11:23 -0700)] 
Log output from network script

Log all output from the network script to help debugging.