/*********************************************************
- * Copyright (C) 2008-2019 VMware, Inc. All rights reserved.
+ * Copyright (C) 2008-2020 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
GSource *
VMTools_CreateTimer(gint timeout);
-void
-VMTools_SetGuestSDKMode(void);
-
void
VMTools_AcquireLogStateLock(void);
################################################################################
-### Copyright (C) 2007-2018 VMware, Inc. All rights reserved.
+### Copyright (C) 2007-2018,2020 VMware, Inc. All rights reserved.
###
### This program is free software; you can redistribute it and/or modify
### it under the terms of version 2 of the GNU General Public License as
AM_CFLAGS += -I$(top_srcdir)/include
libguestlib_la_LIBADD =
-libguestlib_la_LIBADD += @VMTOOLS_LIBS@
+libguestlib_la_LIBADD += ../lib/backdoor/libBackdoor.la
+libguestlib_la_LIBADD += ../lib/dataMap/libDataMap.la
+libguestlib_la_LIBADD += ../lib/dynxdr/libDynxdr.la
+libguestlib_la_LIBADD += ../lib/err/libErr.la
+libguestlib_la_LIBADD += ../lib/hashMap/libHashMap.la
+libguestlib_la_LIBADD += ../lib/message/libMessage.la
+libguestlib_la_LIBADD += ../lib/misc/libMisc.la
+libguestlib_la_LIBADD += ../lib/rpcOut/libRpcOut.la
+libguestlib_la_LIBADD += ../lib/string/libString.la
+libguestlib_la_LIBADD += ../lib/unicode/libUnicode.la
+libguestlib_la_LIBADD += ../lib/vmCheck/libVmCheck.la
+libguestlib_la_LIBADD += ../lib/vmSignal/libVmSignal.la
libguestlib_la_LIBADD += @XDR_LIBS@
+libguestlib_rpcchanneldir = $(top_srcdir)/lib/rpcChannel
+
libguestlib_la_SOURCES =
libguestlib_la_SOURCES += guestlibV3_xdr.c
libguestlib_la_SOURCES += guestlibIoctl_xdr.c
+libguestlib_la_SOURCES += guestSDKLog.c
libguestlib_la_SOURCES += vmGuestLib.c
+libguestlib_la_SOURCES += $(libguestlib_rpcchanneldir)/bdoorChannel.c
+libguestlib_la_SOURCES += $(libguestlib_rpcchanneldir)/rpcChannel.c
+libguestlib_la_SOURCES += $(libguestlib_rpcchanneldir)/glib_stubs.c
+if HAVE_VSOCK
+libguestlib_la_SOURCES += $(libguestlib_rpcchanneldir)/vsockChannel.c
+libguestlib_la_SOURCES += $(libguestlib_rpcchanneldir)/simpleSocket.c
+endif
libguestlib_la_LDFLAGS =
+libguestlib_la_LDFLAGS += -Wl,-ldl
+libguestlib_la_LDFLAGS += -Wl,-lrt
# We require GCC, so we're fine passing compiler-specific flags.
# Needed for OS's that don't link shared libraries against libc by default, e.g. FreeBSD
libguestlib_la_LDFLAGS += -Wl,-lc
libguestlib_la_CPPFLAGS =
libguestlib_la_CPPFLAGS += -DVMTOOLS_USE_GLIB
+libguestlib_la_CPPFLAGS += -DUSE_RPCI_ONLY
libguestlib_la_CPPFLAGS += @GLIB2_CPPFLAGS@
libguestlib_la_CPPFLAGS += @XDR_CPPFLAGS@
/*********************************************************
- * Copyright (C) 2013-2016,2019 VMware, Inc. All rights reserved.
+ * Copyright (C) 2013-2015,2020 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
/*
*-----------------------------------------------------------------------------
*
- * GuestSDK_Debug --
+ * Debug --
*
* Log debug messages.
*
* None.
*
* Side effects:
- * Death.
+ * Stderr.
*
*-----------------------------------------------------------------------------
*/
void
-GuestSDK_Debug(const char *fmt, ...)
+Debug(const char *fmt, ...)
{
#ifdef VMX86_LOG /* only do logging on OBJ builds */
va_list args;
/*
*-----------------------------------------------------------------------------
*
- * GuestSDK_Log --
+ * Log --
*
* Log messages.
*
* None.
*
* Side effects:
- * Death.
+ * Stderr.
*
*-----------------------------------------------------------------------------
*/
void
-GuestSDK_Log(const char *fmt, ...)
+Log(const char *fmt, ...)
{
#ifdef VMX86_LOG /* only do logging on OBJ builds */
va_list args;
/*
*-----------------------------------------------------------------------------
*
- * GuestSDK_Warning --
+ * Warning --
*
* Log warning messages.
*
* None.
*
* Side effects:
- * Death.
+ * Stderr.
*
*-----------------------------------------------------------------------------
*/
void
-GuestSDK_Warning(const char *fmt, ...)
+Warning(const char *fmt, ...)
{
#ifdef VMX86_LOG /* only do logging on OBJ builds */
va_list args;
/*
*-----------------------------------------------------------------------------
*
- * GuestSDK_Panic --
+ * Panic --
*
* Panic. Apps have to implement this for themselves.
*
*/
void
-GuestSDK_Panic(const char *fmt, ...) // IN
+Panic(const char *fmt, ...) // IN
{
va_list args;
char buffer[1024];
################################################################################
-### Copyright (C) 2008-2019 VMware, Inc. All rights reserved.
+### Copyright (C) 2008-2020 VMware, Inc. All rights reserved.
###
### This program is free software; you can redistribute it and/or modify
### it under the terms of version 2 of the GNU General Public License as
libvmtools_la_SOURCES += vmtoolsConfig.c
libvmtools_la_SOURCES += vmtoolsLog.c
libvmtools_la_SOURCES += vmxLogger.c
-libvmtools_la_SOURCES += guestSDKLog.c
# Recompile the stub for Log_* functions, but not Log() itself (see -DNO_LOG_STUB).
libvmtools_la_SOURCES += $(top_srcdir)/lib/stubs/stub-log.c
/*********************************************************
- * Copyright (C) 2010-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 2010-2016,2020 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
gchar const *format,
...) PRINTF_DECL(2, 3);
-void
-GuestSDK_Debug(const char *fmt, ...);
-
-void
-GuestSDK_Log(const char *fmt, ...);
-
-void
-GuestSDK_Warning(const char *fmt, ...);
-
-void
-GuestSDK_Panic(const char *fmt, ...);
-
#endif /* _VMTOOLSINT_H_ */
static gint gMaxCacheEntries = DEFAULT_MAX_CACHE_ENTRIES;
static gboolean gEnableCoreDump = TRUE;
static gboolean gLogEnabled = FALSE;
-static gboolean gGuestSDKMode = FALSE;
static guint gPanicCount = 0;
static LogHandler *gDefaultData;
static LogHandler *gErrorData;
}
-/**
- * Called if vmtools lib is used along with Guestlib SDK.
- */
-
-void
-VMTools_SetGuestSDKMode(void)
-{
- gGuestSDKMode = TRUE;
-}
-
-
/**
* Logs a message using the G_LOG_LEVEL_DEBUG level.
*
{
va_list args;
va_start(args, fmt);
- if (gGuestSDKMode) {
- GuestSDK_Debug(fmt, args);
- } else {
- /*
- * Preserve errno/lastError.
- * This keeps compatibility with bora/lib Log(), preventing
- * Log() calls in bora/lib code from clobbering errno/lastError.
- */
- WITH_ERRNO(err, VMToolsLogWrapper(G_LOG_LEVEL_DEBUG, fmt, args));
- }
+ /*
+ * Preserve errno/lastError.
+ * This keeps compatibility with bora/lib Log(), preventing
+ * Log() calls in bora/lib code from clobbering errno/lastError.
+ */
+ WITH_ERRNO(err, VMToolsLogWrapper(G_LOG_LEVEL_DEBUG, fmt, args));
va_end(args);
}
{
va_list args;
va_start(args, fmt);
- if (gGuestSDKMode) {
- GuestSDK_Log(fmt, args);
- } else {
- /*
- * Preserve errno/lastError.
- * This keeps compatibility with bora/lib Log(), preventing
- * Log() calls in bora/lib code from clobbering errno/lastError.
- */
- WITH_ERRNO(err, VMToolsLogWrapper(G_LOG_LEVEL_INFO, fmt, args));
- }
+ /*
+ * Preserve errno/lastError.
+ * This keeps compatibility with bora/lib Log(), preventing
+ * Log() calls in bora/lib code from clobbering errno/lastError.
+ */
+ WITH_ERRNO(err, VMToolsLogWrapper(G_LOG_LEVEL_INFO, fmt, args));
va_end(args);
}
va_start(args, fmt);
- if (gGuestSDKMode) {
- GuestSDK_Panic(fmt, args);
- } else {
- if (gPanicCount == 0) {
- char *msg = Str_Vasprintf(NULL, fmt, args);
- if (msg != NULL) {
- g_log(gLogDomain, G_LOG_LEVEL_ERROR, "%s", msg);
- free(msg);
- }
- /*
- * In case an user-installed custom handler doesn't panic on error,
- * force a core dump. Also force a dump in the recursive case.
- */
- VMToolsLogPanic();
- } else if (gPanicCount == 1) {
- /*
- * Use a stack allocated string since we're in a recursive panic, so
- * probably already in a weird state.
- */
- gchar msg[1024];
- Str_Vsnprintf(msg, sizeof msg, fmt, args);
- fprintf(stderr, "Recursive panic: %s\n", msg);
- VMToolsLogPanic();
- } else {
- fprintf(stderr, "Recursive panic, giving up.\n");
- exit(-1);
+ if (gPanicCount == 0) {
+ char *msg = Str_Vasprintf(NULL, fmt, args);
+ if (msg != NULL) {
+ g_log(gLogDomain, G_LOG_LEVEL_ERROR, "%s", msg);
+ free(msg);
}
+ /*
+ * In case an user-installed custom handler doesn't panic on error,
+ * force a core dump. Also force a dump in the recursive case.
+ */
+ VMToolsLogPanic();
+ } else if (gPanicCount == 1) {
+ /*
+ * Use a stack allocated string since we're in a recursive panic, so
+ * probably already in a weird state.
+ */
+ gchar msg[1024];
+ Str_Vsnprintf(msg, sizeof msg, fmt, args);
+ fprintf(stderr, "Recursive panic: %s\n", msg);
+ VMToolsLogPanic();
+ } else {
+ fprintf(stderr, "Recursive panic, giving up.\n");
+ exit(-1);
}
va_end(args);
while (1) ; // avoid compiler warning
{
va_list args;
va_start(args, fmt);
- if (gGuestSDKMode) {
- GuestSDK_Warning(fmt, args);
- } else {
- /*
- * Preserve errno/lastError.
- * This keeps compatibility with bora/lib Log(), preventing
- * Log() calls in bora/lib code from clobbering errno/lastError.
- */
- WITH_ERRNO(err, VMToolsLogWrapper(G_LOG_LEVEL_WARNING, fmt, args));
- }
+ /*
+ * Preserve errno/lastError.
+ * This keeps compatibility with bora/lib Log(), preventing
+ * Log() calls in bora/lib code from clobbering errno/lastError.
+ */
+ WITH_ERRNO(err, VMToolsLogWrapper(G_LOG_LEVEL_WARNING, fmt, args));
va_end(args);
}
{
va_list args;
va_start(args, fmt);
- if (gGuestSDKMode) {
- GuestSDK_Warning(fmt, args);
- } else {
- WITH_ERRNO(err,
- VmwareLogWrapper(TO_HOST, G_LOG_LEVEL_WARNING, fmt, args));
- }
+ WITH_ERRNO(err,
+ VmwareLogWrapper(TO_HOST, G_LOG_LEVEL_WARNING, fmt, args));
va_end(args);
}
{
va_list args;
va_start(args, fmt);
- if (gGuestSDKMode) {
- GuestSDK_Warning(fmt, args);
- } else {
- WITH_ERRNO(err,
- VmwareLogWrapper(IN_GUEST, G_LOG_LEVEL_WARNING, fmt, args));
- }
+ WITH_ERRNO(err,
+ VmwareLogWrapper(IN_GUEST, G_LOG_LEVEL_WARNING, fmt, args));
va_end(args);
}