open-vm-tools 10.0.5
|
00001 /********************************************************* 00002 * Copyright (C) 2008-2015 VMware, Inc. All rights reserved. 00003 * 00004 * This program is free software; you can redistribute it and/or modify it 00005 * under the terms of the GNU Lesser General Public License as published 00006 * by the Free Software Foundation version 2.1 and no later version. 00007 * 00008 * This program is distributed in the hope that it will be useful, but 00009 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00010 * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public 00011 * License for more details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public License 00014 * along with this program; if not, write to the Free Software Foundation, Inc., 00015 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 00016 * 00017 *********************************************************/ 00018 00019 #ifndef _VMWARE_TOOLS_UTILS_H_ 00020 #define _VMWARE_TOOLS_UTILS_H_ 00021 00037 #define VMTOOLS_GUEST_SERVICE "vmsvc" 00038 #define VMTOOLS_USER_SERVICE "vmusr" 00039 00040 #if defined(__cplusplus) 00041 # define VMTOOLS_EXTERN_C extern "C" 00042 #else 00043 # define VMTOOLS_EXTERN_C 00044 #endif 00045 00046 #include <glib.h> 00047 #if defined(G_PLATFORM_WIN32) 00048 # include <windows.h> 00049 #else 00050 # include <signal.h> 00051 # include <sys/time.h> 00052 #endif 00053 00054 00055 /* Work around a glib limitation: it doesn't set G_INLINE_FUNC on Win32. */ 00056 #if defined(G_PLATFORM_WIN32) 00057 # if defined(G_INLINE_FUNC) 00058 # undef G_INLINE_FUNC 00059 # endif 00060 # define G_INLINE_FUNC static __inline 00061 #endif 00062 00063 00076 #if defined(G_PLATFORM_WIN32) 00077 # define VMTOOLS_GET_FILENAME_LOCAL(path, err) (gchar *) (path) 00078 #else 00079 # define VMTOOLS_GET_FILENAME_LOCAL(path, err) g_filename_from_utf8((path), \ 00080 -1, \ 00081 NULL, \ 00082 NULL, \ 00083 (err)) 00084 #endif 00085 00092 #if defined(G_PLATFORM_WIN32) 00093 # define VMTOOLS_RELEASE_FILENAME_LOCAL(path) (void) (path) 00094 #else 00095 # define VMTOOLS_RELEASE_FILENAME_LOCAL(path) g_free(path) 00096 #endif 00097 00099 #define VMTOOLS_WRAP_ARRAY(a) VMTools_WrapArray((a), sizeof *(a), G_N_ELEMENTS(a)) 00100 00101 00102 G_BEGIN_DECLS 00103 00104 void 00105 vm_free(void *ptr); 00106 00107 gboolean 00108 VMTools_LoadConfig(const gchar *path, 00109 GKeyFileFlags flags, 00110 GKeyFile **config, 00111 time_t *mtime); 00112 00113 gboolean 00114 VMTools_WriteConfig(const gchar *path, 00115 GKeyFile *config, 00116 GError **err); 00117 00118 gboolean 00119 VMTools_ChangeLogFilePath(const gchar *delimiter, 00120 const gchar *appendString, 00121 const gchar *domain, 00122 GKeyFile *conf); 00123 00124 #if defined(G_PLATFORM_WIN32) 00125 00126 gboolean 00127 VMTools_AttachConsole(void); 00128 00129 GSource * 00130 VMTools_NewHandleSource(HANDLE h); 00131 00132 #else 00133 00135 typedef gboolean (*SignalSourceCb)(const siginfo_t *, gpointer); 00136 00137 GSource * 00138 VMTools_NewSignalSource(int signum); 00139 00140 gchar * 00141 VMTools_GetLibdir(void); 00142 00143 #endif 00144 00145 GSource * 00146 VMTools_CreateTimer(gint timeout); 00147 00148 void 00149 VMTools_SetGuestSDKMode(void); 00150 00151 void 00152 VMTools_AcquireLogStateLock(void); 00153 00154 void 00155 VMTools_ReleaseLogStateLock(void); 00156 00157 void 00158 VMTools_StopLogging(void); 00159 00160 void 00161 VMTools_RestartLogging(void); 00162 00163 void 00164 VMTools_SuspendLogIO(void); 00165 00166 void 00167 VMTools_ResumeLogIO(void); 00168 00169 GArray * 00170 VMTools_WrapArray(gconstpointer data, 00171 guint elemSize, 00172 guint count); 00173 00174 G_END_DECLS 00175 00178 #endif /* _VMWARE_TOOLS_UTILS_H_ */ 00179