summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-07-17 20:10:11 -0700
committerMartin Jansa <Martin.Jansa@gmail.com>2017-07-24 18:58:51 +0200
commit94670cce6b0aa7c9aa59715b967d2bc28bc122a5 (patch)
tree1c6e9e778d8f9a2f76ea940d2e4b21a0510a27ed /meta-oe/recipes-support
parent4022026b7ed9eb2e521c3c47b06f12cfb721dabf (diff)
downloadmeta-openembedded-94670cce6b0aa7c9aa59715b967d2bc28bc122a5.tar.gz
open-vm-tools: Fix build with musl
Use SPDX format for LICENSES Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-support')
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools/0001-Remove-assumptions-about-glibc-being-only-libc-imple.patch45
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools/0002-include-poll.h-instead-of-obsolete-sys-poll.h.patch24
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools/0003-Rename-poll.h-to-vm_poll.h.patch756
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools/0004-Add-Wno-incompatible-pointer-types-and-Wno-error-add.patch31
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools/0005-Use-configure-test-for-struct-timespec.patch45
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools/0006-Fix-definition-of-ALLPERMS-and-ACCESSPERMS.patch58
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools/0007-Use-configure-to-test-for-feature-instead-of-platfor.patch144
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools/0008-use-posix-strerror_r-unless-gnu.patch30
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools/0009-Add-support-for-building-with-system-libtirpc.patch342
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools/0010-gnu-ucontext.patch65
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools/0011-Use-configure-test-for-sys-stat.h-include.patch25
-rw-r--r--meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.1.5.bb25
12 files changed, 1584 insertions, 6 deletions
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0001-Remove-assumptions-about-glibc-being-only-libc-imple.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0001-Remove-assumptions-about-glibc-being-only-libc-imple.patch
new file mode 100644
index 000000000..9773b4a94
--- /dev/null
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0001-Remove-assumptions-about-glibc-being-only-libc-imple.patch
@@ -0,0 +1,45 @@
1From a0983d84185f04c4e40778fe951fde4439894882 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 16 Jul 2017 07:37:03 -0700
4Subject: [PATCH 01/11] Remove assumptions about glibc being only libc
5 implementation on linux
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 open-vm-tools/lib/file/fileIOPosix.c | 2 +-
10 open-vm-tools/lib/include/vm_basic_defs.h | 2 ++
11 2 files changed, 3 insertions(+), 1 deletion(-)
12
13Index: open-vm-tools/lib/file/fileIOPosix.c
14===================================================================
15--- open-vm-tools.orig/lib/file/fileIOPosix.c
16+++ open-vm-tools/lib/file/fileIOPosix.c
17@@ -205,7 +205,7 @@ static AlignedPool alignedPool;
18 * are not available in any header file.
19 */
20
21-#if defined(__linux__) && !defined(__ANDROID__)
22+#if defined(__linux__) && defined(__GLIBC__)
23 #if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
24 /*
25 * We want preadv/pwritev. But due to FOB=64, the symbols are -64.
26Index: open-vm-tools/lib/include/vm_basic_defs.h
27===================================================================
28--- open-vm-tools.orig/lib/include/vm_basic_defs.h
29+++ open-vm-tools/lib/include/vm_basic_defs.h
30@@ -571,6 +571,7 @@ typedef int pid_t;
31 #if defined __linux__ && !defined __KERNEL__ && !defined MODULE && \
32 !defined VMM && !defined FROBOS && !defined __ANDROID__
33 #include <features.h>
34+#if __GLIBC__
35 #if __GLIBC_PREREQ(2, 1) && !defined GLIBC_VERSION_21
36 #define GLIBC_VERSION_21
37 #endif
38@@ -590,6 +591,7 @@ typedef int pid_t;
39 #define GLIBC_VERSION_212
40 #endif
41 #endif
42+#endif
43
44 /*
45 * Convenience definitions of unicode characters.
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0002-include-poll.h-instead-of-obsolete-sys-poll.h.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0002-include-poll.h-instead-of-obsolete-sys-poll.h.patch
new file mode 100644
index 000000000..d26bf2dd3
--- /dev/null
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0002-include-poll.h-instead-of-obsolete-sys-poll.h.patch
@@ -0,0 +1,24 @@
1From d44c7c9de7380ad7b284231bd5b5c99b5c19758d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 16 Jul 2017 07:37:59 -0700
4Subject: [PATCH 02/11] include poll.h instead of obsolete sys/poll.h
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 open-vm-tools/lib/asyncsocket/asyncSocketInt.h | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11Index: open-vm-tools/lib/asyncsocket/asyncSocketInt.h
12===================================================================
13--- open-vm-tools.orig/lib/asyncsocket/asyncSocketInt.h
14+++ open-vm-tools/lib/asyncsocket/asyncSocketInt.h
15@@ -71,8 +71,8 @@
16 #else
17 #include <stddef.h>
18 #include <ctype.h>
19+#include <poll.h>
20 #include <sys/types.h>
21-#include <sys/poll.h>
22 #include <sys/socket.h>
23 #include <sys/un.h>
24 #include <netdb.h>
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0003-Rename-poll.h-to-vm_poll.h.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0003-Rename-poll.h-to-vm_poll.h.patch
new file mode 100644
index 000000000..8641778d0
--- /dev/null
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0003-Rename-poll.h-to-vm_poll.h.patch
@@ -0,0 +1,756 @@
1From 687fca20b3417ac885b6961e6fe1126d4a3fe7a4 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Tue, 17 Nov 2015 10:57:31 +0000
4Subject: [PATCH 03/11] Rename poll.h to vm_poll.h
5
6musl libc's system headers pulls in open-vm-tools' poll.h. To avoid this
7we rename poll.h to vm_poll.h.
8
9Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
10---
11 open-vm-tools/lib/asyncsocket/asyncsocket.c | 2 +-
12 open-vm-tools/lib/hgfsServer/hgfsServer.c | 2 +-
13 open-vm-tools/lib/include/asyncsocket.h | 2 +-
14 open-vm-tools/lib/include/pollImpl.h | 2 +-
15 open-vm-tools/lib/include/{poll.h => vm_poll.h} | 0
16 open-vm-tools/lib/rpcIn/rpcin.c | 2 +-
17 open-vm-tools/services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c | 2 +-
18 7 files changed, 6 insertions(+), 6 deletions(-)
19 rename open-vm-tools/lib/include/{poll.h => vm_poll.h} (100%)
20
21Index: open-vm-tools/lib/asyncsocket/asyncsocket.c
22===================================================================
23--- open-vm-tools.orig/lib/asyncsocket/asyncsocket.c
24+++ open-vm-tools/lib/asyncsocket/asyncsocket.c
25@@ -52,7 +52,7 @@
26 #include "vmware.h"
27 #include "asyncsocket.h"
28 #include "asyncSocketInt.h"
29-#include "poll.h"
30+#include "vm_poll.h"
31 #include "log.h"
32 #include "err.h"
33 #include "hostinfo.h"
34Index: open-vm-tools/lib/hgfsServer/hgfsServer.c
35===================================================================
36--- open-vm-tools.orig/lib/hgfsServer/hgfsServer.c
37+++ open-vm-tools/lib/hgfsServer/hgfsServer.c
38@@ -48,7 +48,7 @@
39 #include "hgfsServerOplock.h"
40 #include "hgfsDirNotify.h"
41 #include "userlock.h"
42-#include "poll.h"
43+#include "vm_poll.h"
44 #include "mutexRankLib.h"
45 #include "vm_basic_asm.h"
46 #include "unicodeOperations.h"
47Index: open-vm-tools/lib/include/asyncsocket.h
48===================================================================
49--- open-vm-tools.orig/lib/include/asyncsocket.h
50+++ open-vm-tools/lib/include/asyncsocket.h
51@@ -129,7 +129,7 @@ typedef struct AsyncSocket AsyncSocket;
52 * Or the client can specify its favorite poll class and locking behavior.
53 * Use of IVmdbPoll is only supported for regular sockets and for Attach.
54 */
55-#include "poll.h"
56+#include "vm_poll.h"
57 struct IVmdbPoll;
58 typedef struct AsyncSocketPollParams {
59 int flags; /* Default 0, only POLL_FLAG_NO_BULL is valid */
60Index: open-vm-tools/lib/include/poll.h
61===================================================================
62--- open-vm-tools.orig/lib/include/poll.h
63+++ /dev/null
64@@ -1,324 +0,0 @@
65-/*********************************************************
66- * Copyright (C) 1998-2016 VMware, Inc. All rights reserved.
67- *
68- * This program is free software; you can redistribute it and/or modify it
69- * under the terms of the GNU Lesser General Public License as published
70- * by the Free Software Foundation version 2.1 and no later version.
71- *
72- * This program is distributed in the hope that it will be useful, but
73- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
74- * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
75- * License for more details.
76- *
77- * You should have received a copy of the GNU Lesser General Public License
78- * along with this program; if not, write to the Free Software Foundation, Inc.,
79- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
80- *
81- *********************************************************/
82-
83-/*********************************************************
84- * The contents of this file are subject to the terms of the Common
85- * Development and Distribution License (the "License") version 1.0
86- * and no later version. You may not use this file except in
87- * compliance with the License.
88- *
89- * You can obtain a copy of the License at
90- * http://www.opensource.org/licenses/cddl1.php
91- *
92- * See the License for the specific language governing permissions
93- * and limitations under the License.
94- *
95- *********************************************************/
96-
97-
98-#ifndef _POLL_H_
99-#define _POLL_H_
100-
101-#define INCLUDE_ALLOW_USERLEVEL
102-#define INCLUDE_ALLOW_VMCORE
103-#include "includeCheck.h"
104-
105-#include "vm_basic_types.h"
106-#include "vm_basic_defs.h"
107-#include "vmware.h"
108-#include "userlock.h"
109-
110-#ifdef _WIN32
111-#define HZ 100
112-#elif defined linux
113-#include <asm/param.h>
114-#elif __APPLE__
115-#include <TargetConditionals.h>
116-/*
117- * Old SDKs don't define TARGET_OS_IPHONE at all.
118- * New ones define it to 0 on Mac OS X, 1 on iOS.
119- */
120-#if !defined(TARGET_OS_IPHONE) || TARGET_OS_IPHONE == 0
121-#include <sys/kernel.h>
122-#endif
123-#include <sys/poll.h>
124-#define HZ 100
125-#endif
126-#ifdef __ANDROID__
127-/*
128- * <poll.h> of android should be included, but its name is same
129- * with this file. So its content is put here to avoid conflict.
130- */
131-#include <asm/poll.h>
132-#define HZ 100
133-typedef unsigned int nfds_t;
134-int poll(struct pollfd *, nfds_t, long);
135-#endif
136-
137-
138-/*
139- * Poll event types: each type has a different reason for firing,
140- * or condition that must be met before firing.
141- */
142-
143-typedef enum {
144- /*
145- * Actual Poll queue types against which you can register callbacks.
146- */
147- POLL_VIRTUALREALTIME = -1, /* Negative because it doesn't have its own Q */
148- POLL_VTIME = 0,
149- POLL_REALTIME,
150- POLL_DEVICE,
151- POLL_MAIN_LOOP,
152- POLL_NUM_QUEUES
153-} PollEventType;
154-
155-
156-/*
157- * Classes of events
158- *
159- * These are the predefined classes. More can be declared
160- * with Poll_AllocClass().
161- */
162-
163-typedef enum PollClass {
164- POLL_CLASS_MAIN,
165- POLL_CLASS_PAUSE,
166- POLL_CLASS_IPC,
167- POLL_CLASS_CPT,
168- POLL_CLASS_MKS,
169- POLL_FIXED_CLASSES,
170- POLL_MAX_CLASSES = 320 /* Size enum to maximum */
171-} PollClass;
172-
173-
174-/*
175- * Each callback is registered in a set of classes
176- */
177-
178-typedef struct PollClassSet {
179- /* Type is uintptr_t to give best 32/64-bit code. */
180-#define _POLL_ELEMSIZE (sizeof (uintptr_t) * 8)
181- uintptr_t bits[CEILING(POLL_MAX_CLASSES, _POLL_ELEMSIZE)];
182-} PollClassSet;
183-
184-/* An empty PollClassSet. */
185-static INLINE PollClassSet
186-PollClassSet_Empty(void)
187-{
188- PollClassSet set = { { 0 } };
189- return set;
190-}
191-
192-/* A PollClassSet with the single member. */
193-static INLINE PollClassSet
194-PollClassSet_Singleton(PollClass c)
195-{
196- PollClassSet s = PollClassSet_Empty();
197-
198- ASSERT_ON_COMPILE(sizeof s.bits[0] * 8 == _POLL_ELEMSIZE); /* Size correct */
199- ASSERT_ON_COMPILE((_POLL_ELEMSIZE & (_POLL_ELEMSIZE - 1)) == 0); /* power of 2 */
200- ASSERT_ON_COMPILE(POLL_MAX_CLASSES <= ARRAYSIZE(s.bits) * _POLL_ELEMSIZE);
201- ASSERT(c < POLL_MAX_CLASSES);
202-
203- s.bits[c / _POLL_ELEMSIZE] = CONST3264U(1) << (c % _POLL_ELEMSIZE);
204- return s;
205-}
206-
207-/* Combine two PollClassSets. */
208-static INLINE PollClassSet
209-PollClassSet_Union(PollClassSet lhs, PollClassSet rhs)
210-{
211- PollClassSet u;
212- unsigned i;
213-
214- for (i = 0; i < ARRAYSIZE(u.bits); i++) {
215- u.bits[i] = lhs.bits[i] | rhs.bits[i];
216- }
217- return u;
218-}
219-
220-/* Add single class to PollClassSet. */
221-static INLINE PollClassSet
222-PollClassSet_Include(PollClassSet set, PollClass c)
223-{
224- return PollClassSet_Union(set, PollClassSet_Singleton(c));
225-}
226-
227-
228-#define POLL_CS_MAIN PollClassSet_Singleton(POLL_CLASS_MAIN)
229-#define POLL_CS_PAUSE PollClassSet_Union(POLL_CS_MAIN, \
230- PollClassSet_Singleton(POLL_CLASS_PAUSE))
231-#define POLL_CS_CPT PollClassSet_Union(POLL_CS_PAUSE, \
232- PollClassSet_Singleton(POLL_CLASS_CPT))
233-#define POLL_CS_IPC PollClassSet_Union(POLL_CS_CPT, \
234- PollClassSet_Singleton(POLL_CLASS_IPC))
235-#define POLL_CS_VMDB POLL_CS_PAUSE /* POLL_CLASS_VMDB is retired */
236-#define POLL_CS_MKS PollClassSet_Singleton(POLL_CLASS_MKS)
237-/*
238- * DANGER. You don't need POLL_CS_ALWAYS. Really. So don't use it.
239- */
240-#define POLL_CS_ALWAYS PollClassSet_Union(POLL_CS_CPT, POLL_CS_IPC)
241-
242-/*
243- * Poll class-set taxonomy:
244- * POLL_CS_MAIN
245- * - Unless you NEED another class, use POLL_CS_MAIN.
246- * POLL_CS_PAUSE
247- * - For callbacks that must occur even if the guest is paused.
248- * Most VMDB or Foundry commands are in this category.
249- * POLL_CS_CPT
250- * - Only for callbacks which can trigger intermediate Checkpoint
251- * transitions.
252- * The ONLY such callback is Migrate.
253- * POLL_CS_IPC
254- * - Only for callbacks which can contain Msg_(Post|Hint|Question)
255- * responses, and for signal handlers (why)?
256- * Vigor, VMDB, and Foundry can contain Msg_* responses.
257- * POLL_CS_MKS
258- * - Callback runs in MKS thread.
259- * POLL_CS_ALWAYS
260- * - Only for events that must be processed immediately.
261- * The ONLY such callback is OvhdMemVmxSizeCheck.
262- */
263-
264-
265-/*
266- * Poll_Callback flags
267- */
268-
269-#define POLL_FLAG_PERIODIC 0x01 // keep after firing
270-#define POLL_FLAG_REMOVE_AT_POWEROFF 0x02 // self-explanatory
271-#define POLL_FLAG_READ 0x04 // device is ready for reading
272-#define POLL_FLAG_WRITE 0x08 // device is ready for writing
273-#define POLL_FLAG_SOCKET 0x10 // device is a Windows socket
274-#define POLL_FLAG_NO_BULL 0x20 // callback does its own locking
275-#define POLL_FLAG_WINSOCK 0x40 // Winsock style write events
276-#define POLL_FLAG_FD 0x80 // device is a Windows file descriptor.
277-#define POLL_FLAG_ACCEPT_INVALID_FDS 0x100 // For broken 3rd party libs, e.g. curl
278-#define POLL_FLAG_THUNK_TO_WND 0x200 // thunk callback to window message loop
279-
280-
281-/*
282- * Advisory minimum time period.
283- * Users that want the fastest running real-time poll
284- * should use TICKS_TO_USECS(1).
285- */
286-
287-#define TICKS_TO_USECS(_x) ((_x) * (1000000 / HZ))
288-#define USECS_TO_TICKS(_x) ((_x) / (1000000 / HZ))
289-
290-
291-typedef void (*PollerFunction)(void *clientData);
292-typedef void (*PollerFireWrapper)(PollerFunction func,
293- void *funcData,
294- void *wrapperData);
295-typedef Bool (*PollerErrorFn)(const char *errorStr);
296-
297-/*
298- * Initialisers:
299- *
300- * For the sake of convenience, we declare the initialisers
301- * for custom implmentations here, even though the actual
302- * implementations are distinct from the core poll code.
303- */
304-
305-typedef struct PollOptions {
306- Bool locked; // Use internal MXUser for locking
307- Bool allowFullQueue; // Don't assert when device event queue is full.
308- VThreadID windowsMsgThread; // thread that processes Windows messages
309- PollerFireWrapper fireWrapperFn; // optional; may be useful for stats
310- void *fireWrapperData; // optional
311- PollerErrorFn errorFn; // optional; called upon unrecoverable error
312-} PollOptions;
313-
314-
315-void Poll_InitDefault(void);
316-void Poll_InitDefaultEx(const PollOptions *opts);
317-void Poll_InitGtk(void); // On top of glib for Linux
318-void Poll_InitCF(void); // On top of CoreFoundation for OSX
319-
320-
321-/*
322- * Functions
323- */
324-int Poll_SocketPair(Bool vmci, Bool stream, int fds[2]);
325-void Poll_Loop(Bool loop, Bool *exit, PollClass c);
326-void Poll_LoopTimeout(Bool loop, Bool *exit, PollClass c, int timeout);
327-Bool Poll_LockingEnabled(void);
328-void Poll_Exit(void);
329-
330-
331-/*
332- * Poll_Callback adds a callback regardless of whether an identical one exists.
333- *
334- * Likewise, Poll_CallbackRemove removes exactly one callback.
335- */
336-
337-VMwareStatus Poll_Callback(PollClassSet classSet,
338- int flags,
339- PollerFunction f,
340- void *clientData,
341- PollEventType type,
342- PollDevHandle info, // fd/microsec delay
343- MXUserRecLock *lck);
344-Bool Poll_CallbackRemove(PollClassSet classSet,
345- int flags,
346- PollerFunction f,
347- void *clientData,
348- PollEventType type);
349-Bool Poll_CallbackRemoveOneByCB(PollClassSet classSet,
350- int flags,
351- PollerFunction f,
352- PollEventType type,
353- void **clientData);
354-
355-void Poll_NotifyChange(PollClassSet classSet);
356-
357-/*
358- * Wrappers for Poll_Callback and Poll_CallbackRemove that present
359- * simpler subsets of those interfaces.
360- */
361-
362-VMwareStatus Poll_CB_Device(PollerFunction f,
363- void *clientData,
364- PollDevHandle device,
365- Bool periodic);
366-
367-Bool Poll_CB_DeviceRemove(PollerFunction f,
368- void *clientData,
369- Bool periodic);
370-
371-
372-VMwareStatus Poll_CB_RTime(PollerFunction f,
373- void *clientData,
374- int delay, // microseconds
375- Bool periodic,
376- MXUserRecLock *lock);
377-
378-Bool Poll_CB_RTimeRemove(PollerFunction f,
379- void *clientData,
380- Bool periodic);
381-
382-
383-#ifdef _WIN32
384-void Poll_SetWindowMessageRecipient(HWND hWnd, UINT msg, Bool alwaysThunk);
385-Bool Poll_FireWndCallback(void *lparam);
386-#endif
387-
388-#endif // _POLL_H_
389Index: open-vm-tools/lib/include/pollImpl.h
390===================================================================
391--- open-vm-tools.orig/lib/include/pollImpl.h
392+++ open-vm-tools/lib/include/pollImpl.h
393@@ -44,7 +44,7 @@
394 #define INCLUDE_ALLOW_USERLEVEL
395 #include "includeCheck.h"
396
397-#include "poll.h"
398+#include "vm_poll.h"
399
400 /*
401 * PollImpl:
402Index: open-vm-tools/lib/include/vm_poll.h
403===================================================================
404--- /dev/null
405+++ open-vm-tools/lib/include/vm_poll.h
406@@ -0,0 +1,324 @@
407+/*********************************************************
408+ * Copyright (C) 1998-2016 VMware, Inc. All rights reserved.
409+ *
410+ * This program is free software; you can redistribute it and/or modify it
411+ * under the terms of the GNU Lesser General Public License as published
412+ * by the Free Software Foundation version 2.1 and no later version.
413+ *
414+ * This program is distributed in the hope that it will be useful, but
415+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
416+ * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public
417+ * License for more details.
418+ *
419+ * You should have received a copy of the GNU Lesser General Public License
420+ * along with this program; if not, write to the Free Software Foundation, Inc.,
421+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
422+ *
423+ *********************************************************/
424+
425+/*********************************************************
426+ * The contents of this file are subject to the terms of the Common
427+ * Development and Distribution License (the "License") version 1.0
428+ * and no later version. You may not use this file except in
429+ * compliance with the License.
430+ *
431+ * You can obtain a copy of the License at
432+ * http://www.opensource.org/licenses/cddl1.php
433+ *
434+ * See the License for the specific language governing permissions
435+ * and limitations under the License.
436+ *
437+ *********************************************************/
438+
439+
440+#ifndef _POLL_H_
441+#define _POLL_H_
442+
443+#define INCLUDE_ALLOW_USERLEVEL
444+#define INCLUDE_ALLOW_VMCORE
445+#include "includeCheck.h"
446+
447+#include "vm_basic_types.h"
448+#include "vm_basic_defs.h"
449+#include "vmware.h"
450+#include "userlock.h"
451+
452+#ifdef _WIN32
453+#define HZ 100
454+#elif defined linux
455+#include <asm/param.h>
456+#elif __APPLE__
457+#include <TargetConditionals.h>
458+/*
459+ * Old SDKs don't define TARGET_OS_IPHONE at all.
460+ * New ones define it to 0 on Mac OS X, 1 on iOS.
461+ */
462+#if !defined(TARGET_OS_IPHONE) || TARGET_OS_IPHONE == 0
463+#include <sys/kernel.h>
464+#endif
465+#include <sys/poll.h>
466+#define HZ 100
467+#endif
468+#ifdef __ANDROID__
469+/*
470+ * <poll.h> of android should be included, but its name is same
471+ * with this file. So its content is put here to avoid conflict.
472+ */
473+#include <asm/poll.h>
474+#define HZ 100
475+typedef unsigned int nfds_t;
476+int poll(struct pollfd *, nfds_t, long);
477+#endif
478+
479+
480+/*
481+ * Poll event types: each type has a different reason for firing,
482+ * or condition that must be met before firing.
483+ */
484+
485+typedef enum {
486+ /*
487+ * Actual Poll queue types against which you can register callbacks.
488+ */
489+ POLL_VIRTUALREALTIME = -1, /* Negative because it doesn't have its own Q */
490+ POLL_VTIME = 0,
491+ POLL_REALTIME,
492+ POLL_DEVICE,
493+ POLL_MAIN_LOOP,
494+ POLL_NUM_QUEUES
495+} PollEventType;
496+
497+
498+/*
499+ * Classes of events
500+ *
501+ * These are the predefined classes. More can be declared
502+ * with Poll_AllocClass().
503+ */
504+
505+typedef enum PollClass {
506+ POLL_CLASS_MAIN,
507+ POLL_CLASS_PAUSE,
508+ POLL_CLASS_IPC,
509+ POLL_CLASS_CPT,
510+ POLL_CLASS_MKS,
511+ POLL_FIXED_CLASSES,
512+ POLL_MAX_CLASSES = 320 /* Size enum to maximum */
513+} PollClass;
514+
515+
516+/*
517+ * Each callback is registered in a set of classes
518+ */
519+
520+typedef struct PollClassSet {
521+ /* Type is uintptr_t to give best 32/64-bit code. */
522+#define _POLL_ELEMSIZE (sizeof (uintptr_t) * 8)
523+ uintptr_t bits[CEILING(POLL_MAX_CLASSES, _POLL_ELEMSIZE)];
524+} PollClassSet;
525+
526+/* An empty PollClassSet. */
527+static INLINE PollClassSet
528+PollClassSet_Empty(void)
529+{
530+ PollClassSet set = { { 0 } };
531+ return set;
532+}
533+
534+/* A PollClassSet with the single member. */
535+static INLINE PollClassSet
536+PollClassSet_Singleton(PollClass c)
537+{
538+ PollClassSet s = PollClassSet_Empty();
539+
540+ ASSERT_ON_COMPILE(sizeof s.bits[0] * 8 == _POLL_ELEMSIZE); /* Size correct */
541+ ASSERT_ON_COMPILE((_POLL_ELEMSIZE & (_POLL_ELEMSIZE - 1)) == 0); /* power of 2 */
542+ ASSERT_ON_COMPILE(POLL_MAX_CLASSES <= ARRAYSIZE(s.bits) * _POLL_ELEMSIZE);
543+ ASSERT(c < POLL_MAX_CLASSES);
544+
545+ s.bits[c / _POLL_ELEMSIZE] = CONST3264U(1) << (c % _POLL_ELEMSIZE);
546+ return s;
547+}
548+
549+/* Combine two PollClassSets. */
550+static INLINE PollClassSet
551+PollClassSet_Union(PollClassSet lhs, PollClassSet rhs)
552+{
553+ PollClassSet u;
554+ unsigned i;
555+
556+ for (i = 0; i < ARRAYSIZE(u.bits); i++) {
557+ u.bits[i] = lhs.bits[i] | rhs.bits[i];
558+ }
559+ return u;
560+}
561+
562+/* Add single class to PollClassSet. */
563+static INLINE PollClassSet
564+PollClassSet_Include(PollClassSet set, PollClass c)
565+{
566+ return PollClassSet_Union(set, PollClassSet_Singleton(c));
567+}
568+
569+
570+#define POLL_CS_MAIN PollClassSet_Singleton(POLL_CLASS_MAIN)
571+#define POLL_CS_PAUSE PollClassSet_Union(POLL_CS_MAIN, \
572+ PollClassSet_Singleton(POLL_CLASS_PAUSE))
573+#define POLL_CS_CPT PollClassSet_Union(POLL_CS_PAUSE, \
574+ PollClassSet_Singleton(POLL_CLASS_CPT))
575+#define POLL_CS_IPC PollClassSet_Union(POLL_CS_CPT, \
576+ PollClassSet_Singleton(POLL_CLASS_IPC))
577+#define POLL_CS_VMDB POLL_CS_PAUSE /* POLL_CLASS_VMDB is retired */
578+#define POLL_CS_MKS PollClassSet_Singleton(POLL_CLASS_MKS)
579+/*
580+ * DANGER. You don't need POLL_CS_ALWAYS. Really. So don't use it.
581+ */
582+#define POLL_CS_ALWAYS PollClassSet_Union(POLL_CS_CPT, POLL_CS_IPC)
583+
584+/*
585+ * Poll class-set taxonomy:
586+ * POLL_CS_MAIN
587+ * - Unless you NEED another class, use POLL_CS_MAIN.
588+ * POLL_CS_PAUSE
589+ * - For callbacks that must occur even if the guest is paused.
590+ * Most VMDB or Foundry commands are in this category.
591+ * POLL_CS_CPT
592+ * - Only for callbacks which can trigger intermediate Checkpoint
593+ * transitions.
594+ * The ONLY such callback is Migrate.
595+ * POLL_CS_IPC
596+ * - Only for callbacks which can contain Msg_(Post|Hint|Question)
597+ * responses, and for signal handlers (why)?
598+ * Vigor, VMDB, and Foundry can contain Msg_* responses.
599+ * POLL_CS_MKS
600+ * - Callback runs in MKS thread.
601+ * POLL_CS_ALWAYS
602+ * - Only for events that must be processed immediately.
603+ * The ONLY such callback is OvhdMemVmxSizeCheck.
604+ */
605+
606+
607+/*
608+ * Poll_Callback flags
609+ */
610+
611+#define POLL_FLAG_PERIODIC 0x01 // keep after firing
612+#define POLL_FLAG_REMOVE_AT_POWEROFF 0x02 // self-explanatory
613+#define POLL_FLAG_READ 0x04 // device is ready for reading
614+#define POLL_FLAG_WRITE 0x08 // device is ready for writing
615+#define POLL_FLAG_SOCKET 0x10 // device is a Windows socket
616+#define POLL_FLAG_NO_BULL 0x20 // callback does its own locking
617+#define POLL_FLAG_WINSOCK 0x40 // Winsock style write events
618+#define POLL_FLAG_FD 0x80 // device is a Windows file descriptor.
619+#define POLL_FLAG_ACCEPT_INVALID_FDS 0x100 // For broken 3rd party libs, e.g. curl
620+#define POLL_FLAG_THUNK_TO_WND 0x200 // thunk callback to window message loop
621+
622+
623+/*
624+ * Advisory minimum time period.
625+ * Users that want the fastest running real-time poll
626+ * should use TICKS_TO_USECS(1).
627+ */
628+
629+#define TICKS_TO_USECS(_x) ((_x) * (1000000 / HZ))
630+#define USECS_TO_TICKS(_x) ((_x) / (1000000 / HZ))
631+
632+
633+typedef void (*PollerFunction)(void *clientData);
634+typedef void (*PollerFireWrapper)(PollerFunction func,
635+ void *funcData,
636+ void *wrapperData);
637+typedef Bool (*PollerErrorFn)(const char *errorStr);
638+
639+/*
640+ * Initialisers:
641+ *
642+ * For the sake of convenience, we declare the initialisers
643+ * for custom implmentations here, even though the actual
644+ * implementations are distinct from the core poll code.
645+ */
646+
647+typedef struct PollOptions {
648+ Bool locked; // Use internal MXUser for locking
649+ Bool allowFullQueue; // Don't assert when device event queue is full.
650+ VThreadID windowsMsgThread; // thread that processes Windows messages
651+ PollerFireWrapper fireWrapperFn; // optional; may be useful for stats
652+ void *fireWrapperData; // optional
653+ PollerErrorFn errorFn; // optional; called upon unrecoverable error
654+} PollOptions;
655+
656+
657+void Poll_InitDefault(void);
658+void Poll_InitDefaultEx(const PollOptions *opts);
659+void Poll_InitGtk(void); // On top of glib for Linux
660+void Poll_InitCF(void); // On top of CoreFoundation for OSX
661+
662+
663+/*
664+ * Functions
665+ */
666+int Poll_SocketPair(Bool vmci, Bool stream, int fds[2]);
667+void Poll_Loop(Bool loop, Bool *exit, PollClass c);
668+void Poll_LoopTimeout(Bool loop, Bool *exit, PollClass c, int timeout);
669+Bool Poll_LockingEnabled(void);
670+void Poll_Exit(void);
671+
672+
673+/*
674+ * Poll_Callback adds a callback regardless of whether an identical one exists.
675+ *
676+ * Likewise, Poll_CallbackRemove removes exactly one callback.
677+ */
678+
679+VMwareStatus Poll_Callback(PollClassSet classSet,
680+ int flags,
681+ PollerFunction f,
682+ void *clientData,
683+ PollEventType type,
684+ PollDevHandle info, // fd/microsec delay
685+ MXUserRecLock *lck);
686+Bool Poll_CallbackRemove(PollClassSet classSet,
687+ int flags,
688+ PollerFunction f,
689+ void *clientData,
690+ PollEventType type);
691+Bool Poll_CallbackRemoveOneByCB(PollClassSet classSet,
692+ int flags,
693+ PollerFunction f,
694+ PollEventType type,
695+ void **clientData);
696+
697+void Poll_NotifyChange(PollClassSet classSet);
698+
699+/*
700+ * Wrappers for Poll_Callback and Poll_CallbackRemove that present
701+ * simpler subsets of those interfaces.
702+ */
703+
704+VMwareStatus Poll_CB_Device(PollerFunction f,
705+ void *clientData,
706+ PollDevHandle device,
707+ Bool periodic);
708+
709+Bool Poll_CB_DeviceRemove(PollerFunction f,
710+ void *clientData,
711+ Bool periodic);
712+
713+
714+VMwareStatus Poll_CB_RTime(PollerFunction f,
715+ void *clientData,
716+ int delay, // microseconds
717+ Bool periodic,
718+ MXUserRecLock *lock);
719+
720+Bool Poll_CB_RTimeRemove(PollerFunction f,
721+ void *clientData,
722+ Bool periodic);
723+
724+
725+#ifdef _WIN32
726+void Poll_SetWindowMessageRecipient(HWND hWnd, UINT msg, Bool alwaysThunk);
727+Bool Poll_FireWndCallback(void *lparam);
728+#endif
729+
730+#endif // _POLL_H_
731Index: open-vm-tools/lib/rpcIn/rpcin.c
732===================================================================
733--- open-vm-tools.orig/lib/rpcIn/rpcin.c
734+++ open-vm-tools/lib/rpcIn/rpcin.c
735@@ -57,7 +57,7 @@
736
737 #if defined(VMTOOLS_USE_VSOCKET)
738 # include <glib.h>
739-# include "poll.h"
740+# include "vm_poll.h"
741 # include "asyncsocket.h"
742 # include "vmci_defs.h"
743 #include "dataMap.h"
744Index: open-vm-tools/services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c
745===================================================================
746--- open-vm-tools.orig/services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c
747+++ open-vm-tools/services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c
748@@ -48,7 +48,7 @@
749 #include "rpcout.h"
750 #include "rabbitmqProxyConst.h"
751 #include "vm_basic_types.h"
752-#include "poll.h"
753+#include "vm_poll.h"
754 #ifdef OPEN_VM_TOOLS
755 #include "vmci_sockets.h"
756 #include "sslDirect.h"
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0004-Add-Wno-incompatible-pointer-types-and-Wno-error-add.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0004-Add-Wno-incompatible-pointer-types-and-Wno-error-add.patch
new file mode 100644
index 000000000..010516761
--- /dev/null
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0004-Add-Wno-incompatible-pointer-types-and-Wno-error-add.patch
@@ -0,0 +1,31 @@
1From cdb0b3c898c6b6b6c8259d9ddb8b00163ac5e419 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 16 Jul 2017 09:43:18 -0700
4Subject: [PATCH 04/11] Add -Wno-incompatible-pointer-types and
5 -Wno-error=address
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 open-vm-tools/lib/dynxdr/Makefile.am | 2 +-
10 open-vm-tools/lib/file/Makefile.am | 1 +
11 2 files changed, 2 insertions(+), 1 deletion(-)
12
13Index: open-vm-tools/lib/dynxdr/Makefile.am
14===================================================================
15--- open-vm-tools.orig/lib/dynxdr/Makefile.am
16+++ open-vm-tools/lib/dynxdr/Makefile.am
17@@ -20,4 +20,4 @@ noinst_LTLIBRARIES = libDynxdr.la
18 libDynxdr_la_SOURCES =
19 libDynxdr_la_SOURCES += dynxdr.c
20 libDynxdr_la_SOURCES += xdrutil.c
21-
22+libDynxdr_la_CPPFLAGS = -Wno-incompatible-pointer-types
23Index: open-vm-tools/lib/file/Makefile.am
24===================================================================
25--- open-vm-tools.orig/lib/file/Makefile.am
26+++ open-vm-tools/lib/file/Makefile.am
27@@ -27,3 +27,4 @@ libFile_la_SOURCES += fileLockPrimitive.
28 libFile_la_SOURCES += fileLockPosix.c
29 libFile_la_SOURCES += fileTempPosix.c
30 libFile_la_SOURCES += fileTemp.c
31+libFile_la_CPPFLAGS = -Wno-error=address
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0005-Use-configure-test-for-struct-timespec.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0005-Use-configure-test-for-struct-timespec.patch
new file mode 100644
index 000000000..f02d00f84
--- /dev/null
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0005-Use-configure-test-for-struct-timespec.patch
@@ -0,0 +1,45 @@
1From bf1eafb07297711baf9320b1edcca8a3376f117d Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Wed, 18 Nov 2015 09:03:00 +0000
4Subject: [PATCH 05/11] Use configure test for struct timespec
5
6Use the configure script to test for struct time spec instead of trying
7to keep track of what platforms has it.
8
9Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
10---
11 open-vm-tools/configure.ac | 1 +
12 open-vm-tools/lib/include/hgfsUtil.h | 8 +-------
13 2 files changed, 2 insertions(+), 7 deletions(-)
14
15Index: open-vm-tools/configure.ac
16===================================================================
17--- open-vm-tools.orig/configure.ac
18+++ open-vm-tools/configure.ac
19@@ -1127,6 +1127,7 @@ AC_TYPE_OFF_T
20 AC_TYPE_PID_T
21 AC_TYPE_SIZE_T
22 AC_CHECK_MEMBERS([struct stat.st_rdev])
23+AC_CHECK_MEMBERS([struct timespec.tv_sec],[],[],[[#include <time.h>]])
24 AC_HEADER_TIME
25 AC_STRUCT_TM
26 AC_C_VOLATILE
27Index: open-vm-tools/lib/include/hgfsUtil.h
28===================================================================
29--- open-vm-tools.orig/lib/include/hgfsUtil.h
30+++ open-vm-tools/lib/include/hgfsUtil.h
31@@ -53,13 +53,7 @@
32 # include <time.h>
33 # endif
34 # include "vm_basic_types.h"
35-# if !defined _STRUCT_TIMESPEC && \
36- !defined _TIMESPEC_DECLARED && \
37- !defined __timespec_defined && \
38- !defined sun && \
39- !defined __FreeBSD__ && \
40- !__APPLE__ && \
41- !defined _WIN32
42+# if !defined HAVE_STRUCT_TIMESPEC_TV_SEC
43 struct timespec {
44 time_t tv_sec;
45 long tv_nsec;
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0006-Fix-definition-of-ALLPERMS-and-ACCESSPERMS.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0006-Fix-definition-of-ALLPERMS-and-ACCESSPERMS.patch
new file mode 100644
index 000000000..d1f4eff9b
--- /dev/null
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0006-Fix-definition-of-ALLPERMS-and-ACCESSPERMS.patch
@@ -0,0 +1,58 @@
1From 31ae6f42458f90d4994a4ad8e2b7673691612c36 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Wed, 18 Nov 2015 09:10:14 +0000
4Subject: [PATCH 06/11] Fix definition of ALLPERMS and ACCESSPERMS
5
6The ALLPERMS and ACCESSPERMS defines are not specified in POSIX so
7assume it is not there instead of testing for specific implementations.
8
9This is needed for musl libc.
10
11Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
12---
13 open-vm-tools/lib/hgfsServer/hgfsServerLinux.c | 8 +++++---
14 open-vm-tools/services/plugins/dndcp/dnd/dndLinux.c | 3 +--
15 2 files changed, 6 insertions(+), 5 deletions(-)
16
17Index: open-vm-tools/lib/hgfsServer/hgfsServerLinux.c
18===================================================================
19--- open-vm-tools.orig/lib/hgfsServer/hgfsServerLinux.c
20+++ open-vm-tools/lib/hgfsServer/hgfsServerLinux.c
21@@ -107,11 +107,13 @@ typedef struct DirectoryEntry {
22 #endif
23
24 /*
25- * ALLPERMS (mode 07777) and ACCESSPERMS (mode 0777) are not defined in the
26- * Solaris version of <sys/stat.h>.
27+ * ALLPERMS (mode 07777) and ACCESSPERMS (mode 0777) are not specified in
28+ * POSIX.
29 */
30-#ifdef sun
31+#ifndef ACCESSPERMS
32 # define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO)
33+#endif
34+#ifndef ALLPERMS
35 # define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)
36 #endif
37
38Index: open-vm-tools/services/plugins/dndcp/dnd/dndLinux.c
39===================================================================
40--- open-vm-tools.orig/services/plugins/dndcp/dnd/dndLinux.c
41+++ open-vm-tools/services/plugins/dndcp/dnd/dndLinux.c
42@@ -51,7 +51,7 @@
43
44 #define DND_ROOTDIR_PERMS (S_IRWXU | S_IRWXG | S_IRWXO)
45 #define DND_STAGINGDIR_PERMS (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
46-#ifdef sun
47+#ifndef ACCESSPERMS
48 #define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO)
49 #endif
50 #ifdef __ANDROID__
51@@ -60,7 +60,6 @@
52 */
53 #define NO_SETMNTENT
54 #define NO_ENDMNTENT
55-#define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO)
56 #endif
57
58
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0007-Use-configure-to-test-for-feature-instead-of-platfor.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0007-Use-configure-to-test-for-feature-instead-of-platfor.patch
new file mode 100644
index 000000000..5adf9b0f9
--- /dev/null
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0007-Use-configure-to-test-for-feature-instead-of-platfor.patch
@@ -0,0 +1,144 @@
1From 6cc1c22cc30320f56da552a76bd956db8f255b6a Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Wed, 18 Nov 2015 10:05:07 +0000
4Subject: [PATCH 07/11] Use configure to test for feature instead of platform
5
6Test for various functions instead of trying to keep track of what
7platform and what version of the given platform has support for what.
8
9This should make it easier to port to currently unknown platforms and
10will solve the issue if a platform add support for a missing feature in
11the future.
12
13The features we test for are:
14- getifaddrs
15- getauxval
16- issetugid
17- __secure_getenv
18
19This is needed for musl libc.
20
21Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
22---
23 open-vm-tools/configure.ac | 4 ++++
24 open-vm-tools/lib/misc/idLinux.c | 30 ++++++++++++++----------------
25 open-vm-tools/lib/nicInfo/nicInfoPosix.c | 8 ++++++--
26 3 files changed, 24 insertions(+), 18 deletions(-)
27
28Index: open-vm-tools/configure.ac
29===================================================================
30--- open-vm-tools.orig/configure.ac
31+++ open-vm-tools/configure.ac
32@@ -798,6 +798,7 @@ AC_CHECK_FUNCS(
33
34 AC_CHECK_FUNCS([ecvt])
35 AC_CHECK_FUNCS([fcvt])
36+AC_CHECK_FUNCS([getifaddrs getauxval issetugid __secure_getenv])
37
38 AC_CHECK_FUNC([mkdtemp], [have_mkdtemp=yes])
39
40@@ -1063,10 +1064,13 @@ AC_PATH_PROG(
41 ###
42
43 AC_CHECK_HEADERS([crypt.h])
44+AC_CHECK_HEADERS([ifaddrs.h])
45 AC_CHECK_HEADERS([inttypes.h])
46 AC_CHECK_HEADERS([stdint.h])
47 AC_CHECK_HEADERS([stdlib.h])
48 AC_CHECK_HEADERS([wchar.h])
49+AC_CHECK_HEADERS([net/if.h])
50+AC_CHECK_HEADERS([sys/auxv.h])
51 AC_CHECK_HEADERS([sys/inttypes.h])
52 AC_CHECK_HEADERS([sys/io.h])
53 AC_CHECK_HEADERS([sys/param.h]) # Required to make the sys/user.h check work correctly on FreeBSD
54Index: open-vm-tools/lib/misc/idLinux.c
55===================================================================
56--- open-vm-tools.orig/lib/misc/idLinux.c
57+++ open-vm-tools/lib/misc/idLinux.c
58@@ -27,12 +27,9 @@
59 #include <sys/syscall.h>
60 #include <string.h>
61 #include <unistd.h>
62-#ifdef __linux__
63-#if defined(__GLIBC__) && \
64- (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
65+#ifdef HAVE_SYS_AUXV_H
66 #include <sys/auxv.h>
67 #endif
68-#endif
69 #ifdef __APPLE__
70 #include <sys/socket.h>
71 #include <TargetConditionals.h>
72@@ -997,31 +994,32 @@ Id_EndSuperUser(uid_t uid) // IN:
73 static Bool
74 IdIsSetUGid(void)
75 {
76-#if defined(__ANDROID__)
77- /* Android does not have a secure_getenv, so be conservative. */
78- return TRUE;
79-#else
80 /*
81 * We use __secure_getenv, which returns NULL if the binary is
82- * setuid or setgid. Alternatives include,
83+ * setuid or setgid, when issetugid or getauxval(AT_SECURE) is not
84+ * available. Alternatives include,
85 *
86- * a) getauxval(AT_SECURE); not available until glibc 2.16.
87- * b) __libc_enable_secure; may not be exported.
88+ * a) issetugid(); not (yet?) available in glibc.
89+ * b) getauxval(AT_SECURE); not available until glibc 2.16.
90+ * c) __libc_enable_secure; may not be exported.
91 *
92- * Use (a) when we are based on glibc 2.16, or newer.
93+ * Use (b) when we are based on glibc 2.16, or newer.
94 */
95
96-#if defined(__GLIBC__) && \
97- (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16))
98+#if HAVE_ISSETUGID
99+ return issetugid();
100+#elif HAVE_GETAUXVAL
101 return getauxval(AT_SECURE) != 0;
102-#else
103+#elif HAVE___SECURE_GETENV
104 static const char envName[] = "VMW_SETUGID_TEST";
105
106 if (setenv(envName, "1", TRUE) == -1) {
107 return TRUE; /* Conservative */
108 }
109 return __secure_getenv(envName) == NULL;
110-#endif
111+#else
112+ /* Android does not have a secure_getenv, so be conservative. */
113+ return TRUE;
114 #endif
115 }
116 #endif
117Index: open-vm-tools/lib/nicInfo/nicInfoPosix.c
118===================================================================
119--- open-vm-tools.orig/lib/nicInfo/nicInfoPosix.c
120+++ open-vm-tools/lib/nicInfo/nicInfoPosix.c
121@@ -34,9 +34,13 @@
122 #include <sys/socket.h>
123 #include <sys/stat.h>
124 #include <errno.h>
125-#if defined(__FreeBSD__) || defined(__APPLE__)
126+#if HAVE_SYS_SYSCTL_H
127 # include <sys/sysctl.h>
128+#endif
129+#if HAVE_IFADDRS_H
130 # include <ifaddrs.h>
131+#endif
132+#if HAVE_NET_IF_H
133 # include <net/if.h>
134 #endif
135 #ifndef NO_DNET
136@@ -348,7 +352,7 @@ GuestInfoGetNicInfo(NicInfoV3 *nicInfo)
137 *
138 ******************************************************************************
139 */
140-#if defined(__FreeBSD__) || defined(__APPLE__) || defined(USERWORLD)
141+#if defined(NO_DNET) && defined(HAVE_GETIFADDRS)
142
143 char *
144 GuestInfoGetPrimaryIP(void)
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0008-use-posix-strerror_r-unless-gnu.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0008-use-posix-strerror_r-unless-gnu.patch
new file mode 100644
index 000000000..3d1291c9f
--- /dev/null
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0008-use-posix-strerror_r-unless-gnu.patch
@@ -0,0 +1,30 @@
1From d4d1e7146ca2698089f6bd532f2fb8b9c1134ca7 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Mon, 2 Jan 2017 14:39:27 +0000
4Subject: [PATCH 08/11] use posix strerror_r unless gnu
5
6---
7 open-vm-tools/lib/err/errPosix.c | 8 +++++---
8 1 file changed, 5 insertions(+), 3 deletions(-)
9
10Index: open-vm-tools/lib/err/errPosix.c
11===================================================================
12--- open-vm-tools.orig/lib/err/errPosix.c
13+++ open-vm-tools/lib/err/errPosix.c
14@@ -63,11 +63,13 @@ ErrErrno2String(Err_Number errorNumber,
15 {
16 char *p;
17
18-#if defined(linux) && !defined(N_PLAT_NLM) && !defined(__ANDROID__)
19+#if defined(__GLIBC__)
20 p = strerror_r(errorNumber, buf, bufSize);
21 #else
22- p = strerror(errorNumber);
23-#endif
24+ if (strerror_r(errorNumber, buf, bufSize) != 0)
25+ snprintf(buf, bufSize, "unknown error %i", errorNumber);
26+ p = buf;
27+#endif /* defined __GLIBC__ */
28 ASSERT(p != NULL);
29 return p;
30 }
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0009-Add-support-for-building-with-system-libtirpc.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0009-Add-support-for-building-with-system-libtirpc.patch
new file mode 100644
index 000000000..2bee5ac82
--- /dev/null
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0009-Add-support-for-building-with-system-libtirpc.patch
@@ -0,0 +1,342 @@
1From 5ae6c662fefa621f4600559e299a7d97c2254e69 Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Sun, 16 Jul 2017 10:20:10 -0700
4Subject: [PATCH 1/3] Add support for building with system libtirpc
5
6Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8
9---
10 open-vm-tools/configure.ac | 14 ++++++++++++++
11 open-vm-tools/lib/dynxdr/Makefile.am | 8 ++++++--
12 open-vm-tools/lib/err/errPosix.c | 1 +
13 open-vm-tools/lib/guestRpc/Makefile.am | 6 ++++++
14 open-vm-tools/lib/misc/Makefile.am | 1 +
15 open-vm-tools/lib/netUtil/Makefile.am | 4 ++++
16 open-vm-tools/lib/nicInfo/Makefile.am | 2 ++
17 open-vm-tools/lib/rpcChannel/Makefile.am | 4 ++++
18 open-vm-tools/lib/slashProc/Makefile.am | 4 ++++
19 open-vm-tools/lib/string/bsd_output_shared.c | 2 +-
20 open-vm-tools/libguestlib/Makefile.am | 2 ++
21 open-vm-tools/rpctool/Makefile.am | 3 +++
22 open-vm-tools/rpctool/rpctool.c | 2 ++
23 open-vm-tools/services/plugins/dndcp/Makefile.am | 2 ++
24 open-vm-tools/services/plugins/guestInfo/Makefile.am | 1 +
25 open-vm-tools/services/plugins/resolutionSet/Makefile.am | 2 ++
26 open-vm-tools/services/plugins/vix/Makefile.am | 2 ++
27 open-vm-tools/services/plugins/vmbackup/Makefile.am | 2 ++
28 open-vm-tools/toolbox/Makefile.am | 2 ++
29 19 files changed, 61 insertions(+), 3 deletions(-)
30
31Index: open-vm-tools/configure.ac
32===================================================================
33--- open-vm-tools.orig/configure.ac
34+++ open-vm-tools/configure.ac
35@@ -405,6 +405,20 @@ AC_VMW_CHECK_LIB([fuse],
36 AC_MSG_WARN([Fuse is missing, vmblock-fuse/vmhgfs-fuse will be disabled.])])
37
38 #
39+# Check for libtirpc
40+#
41+AC_VMW_CHECK_LIB([libtirpc],
42+ [LIBTIRPC],
43+ [libtirpc],
44+ [],
45+ [],
46+ [rpc/xdr.h],
47+ [xdr_void],
48+ [have_libtirpc=yes],
49+ [have_libtitirpc=no;
50+ AC_MSG_WARN([libtirpc is missing.])])
51+
52+#
53 # Check for PAM.
54 #
55 AC_ARG_WITH([pam],
56Index: open-vm-tools/lib/dynxdr/Makefile.am
57===================================================================
58--- open-vm-tools.orig/lib/dynxdr/Makefile.am
59+++ open-vm-tools/lib/dynxdr/Makefile.am
60@@ -17,7 +17,11 @@
61
62 noinst_LTLIBRARIES = libDynxdr.la
63
64-libDynxdr_la_SOURCES =
65+libDynxdr_la_SOURCES =
66 libDynxdr_la_SOURCES += dynxdr.c
67 libDynxdr_la_SOURCES += xdrutil.c
68-libDynxdr_la_CPPFLAGS = -Wno-incompatible-pointer-types
69+libDynxdr_la_CPPFLAGS = @LIBTIRPC_CPPFLAGS@ -Wno-incompatible-pointer-types
70+
71+libDynxdr_la_LIBADD =
72+libDynxdr_la_LIBADD += @LIBTIRPC_LIBS@
73+
74Index: open-vm-tools/lib/err/errPosix.c
75===================================================================
76--- open-vm-tools.orig/lib/err/errPosix.c
77+++ open-vm-tools/lib/err/errPosix.c
78@@ -31,6 +31,7 @@
79 #include <errno.h>
80 #include <string.h>
81 #include <locale.h>
82+#include <stdio.h>
83
84 #include "vmware.h"
85 #include "errInt.h"
86Index: open-vm-tools/lib/guestRpc/Makefile.am
87===================================================================
88--- open-vm-tools.orig/lib/guestRpc/Makefile.am
89+++ open-vm-tools/lib/guestRpc/Makefile.am
90@@ -20,6 +20,12 @@ noinst_LTLIBRARIES = libGuestRpc.la
91 libGuestRpc_la_SOURCES =
92 libGuestRpc_la_SOURCES += nicinfo_xdr.c
93
94+libGuestRpc_la_CPPFLAGS =
95+libGuestRpc_la_CPPFLAGS += @LIBTIRPC_CPPFLAGS@
96+
97+libGuestRpc_la_LIBADD =
98+libGuestRpc_la_LIBADD += @LIBTIRPC_LIBS@
99+
100 # XXX: Autoreconf complains about this and recommends using AM_CFLAGS instead.
101 # Problem is, $(CFLAGS) is appended to the compiler command line after AM_CFLAGS
102 # and after libGuestRpc_la_CFLAGS, so "-Wall -Werror" will override this flag.
103Index: open-vm-tools/lib/misc/Makefile.am
104===================================================================
105--- open-vm-tools.orig/lib/misc/Makefile.am
106+++ open-vm-tools/lib/misc/Makefile.am
107@@ -52,4 +52,5 @@ libMisc_la_SOURCES += utilMem.c
108 libMisc_la_SOURCES += vmstdio.c
109 libMisc_la_SOURCES += strutil.c
110 libMisc_la_SOURCES += vthreadBase.c
111+libMisc_la_CPPFLAGS = -Wno-error=int-conversion
112
113Index: open-vm-tools/lib/netUtil/Makefile.am
114===================================================================
115--- open-vm-tools.orig/lib/netUtil/Makefile.am
116+++ open-vm-tools/lib/netUtil/Makefile.am
117@@ -20,3 +20,7 @@ noinst_LTLIBRARIES = libNetUtil.la
118 libNetUtil_la_SOURCES =
119 libNetUtil_la_SOURCES += netUtilLinux.c
120
121+libNetUtil_la_CPPFLAGS =
122+libNetUtil_la_CPPFLAGS += @LIBTIRPC_CPPFLAGS@
123+
124+libNetUtil_la_LIBADD = @LIBTIRPC_LIBS@
125Index: open-vm-tools/lib/nicInfo/Makefile.am
126===================================================================
127--- open-vm-tools.orig/lib/nicInfo/Makefile.am
128+++ open-vm-tools/lib/nicInfo/Makefile.am
129@@ -25,12 +25,14 @@ libNicInfo_la_SOURCES += nicInfoPosix.c
130
131 libNicInfo_la_CPPFLAGS =
132 libNicInfo_la_CPPFLAGS += @GLIB2_CPPFLAGS@
133+libNicInfo_la_CPPFLAGS += @LIBTIRPC_CPPFLAGS@
134
135 AM_CFLAGS = $(DNET_CPPFLAGS)
136 if USE_SLASH_PROC
137 AM_CFLAGS += -DUSE_SLASH_PROC
138 endif
139 libNicInfo_la_LIBADD =
140+libNicInfo_la_LIBADD += @LIBTIRPC_LIBS@
141 if HAVE_DNET
142 libNicInfo_la_LIBADD += @DNET_LIBS@
143 endif
144Index: open-vm-tools/lib/rpcChannel/Makefile.am
145===================================================================
146--- open-vm-tools.orig/lib/rpcChannel/Makefile.am
147+++ open-vm-tools/lib/rpcChannel/Makefile.am
148@@ -27,3 +27,7 @@ endif
149
150 libRpcChannel_la_CPPFLAGS =
151 libRpcChannel_la_CPPFLAGS += @VMTOOLS_CPPFLAGS@
152+libRpcChannel_la_CPPFLAGS += @LIBTIRPC_CPPFLAGS@
153+
154+libRpcChannel_la_LIBADD =
155+libRpcChannel_la_LIBADD += @LIBTIRPC_LIBS@
156Index: open-vm-tools/lib/slashProc/Makefile.am
157===================================================================
158--- open-vm-tools.orig/lib/slashProc/Makefile.am
159+++ open-vm-tools/lib/slashProc/Makefile.am
160@@ -22,6 +22,10 @@ libSlashProc_la_SOURCES += net.c
161
162 libSlashProc_la_CPPFLAGS =
163 libSlashProc_la_CPPFLAGS += @GLIB2_CPPFLAGS@
164+libSlashProc_la_CPPFLAGS += @LIBTIRPC_CPPFLAGS@
165+
166+libSlashProc_la_LIBADD =
167+libSlashProc_la_LIBADD += @LIBTIRPC_LIBS@
168
169 AM_CFLAGS = $(DNET_CPPFLAGS)
170
171Index: open-vm-tools/lib/string/bsd_output_shared.c
172===================================================================
173--- open-vm-tools.orig/lib/string/bsd_output_shared.c
174+++ open-vm-tools/lib/string/bsd_output_shared.c
175@@ -38,7 +38,7 @@
176 //#include <sys/cdefs.h>
177
178 #if !defined(STR_NO_WIN32_LIBS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__ANDROID__)
179-
180+#define _GNU_SOURCE
181 #include <stdio.h>
182 #include <stdlib.h>
183 #ifndef _WIN32
184Index: open-vm-tools/libguestlib/Makefile.am
185===================================================================
186--- open-vm-tools.orig/libguestlib/Makefile.am
187+++ open-vm-tools/libguestlib/Makefile.am
188@@ -22,6 +22,7 @@ AM_CFLAGS += -I$(top_srcdir)/include
189
190 libguestlib_la_LIBADD =
191 libguestlib_la_LIBADD += @VMTOOLS_LIBS@
192+libguestlib_la_LIBADD += @LIBTIRPC_LIBS@
193
194 libguestlib_la_SOURCES =
195 libguestlib_la_SOURCES += guestlibV3_xdr.c
196@@ -56,6 +57,7 @@ CFLAGS += -Wno-unused
197 libguestlib_la_CPPFLAGS =
198 libguestlib_la_CPPFLAGS += -DVMTOOLS_USE_GLIB
199 libguestlib_la_CPPFLAGS += @GLIB2_CPPFLAGS@
200+libguestlib_la_CPPFLAGS += @LIBTIRPC_CPPFLAGS@
201
202 EXTRA_DIST = vmguestlib.pc.in
203
204Index: open-vm-tools/rpctool/Makefile.am
205===================================================================
206--- open-vm-tools.orig/rpctool/Makefile.am
207+++ open-vm-tools/rpctool/Makefile.am
208@@ -17,10 +17,13 @@
209
210 bin_PROGRAMS = vmware-rpctool
211
212+vmware_rpctool_CFLAGS= @LIBTIRPC_LIBS@
213+
214 vmware_rpctool_SOURCES =
215 vmware_rpctool_SOURCES += rpctool.c
216
217 vmware_rpctool_LDADD =
218+vmware_rpctool_LDADD += @LIBTIRPC_LIBS@
219 vmware_rpctool_LDADD += ../lib/rpcOut/libRpcOut.la
220 vmware_rpctool_LDADD += ../lib/message/libMessage.la
221 vmware_rpctool_LDADD += ../lib/backdoor/libBackdoor.la
222Index: open-vm-tools/rpctool/rpctool.c
223===================================================================
224--- open-vm-tools.orig/rpctool/rpctool.c
225+++ open-vm-tools/rpctool/rpctool.c
226@@ -23,6 +23,8 @@
227 */
228
229 #ifndef _WIN32
230+#define _GNU_SOURCE
231+#include <signal.h>
232 #include "sigPosixRegs.h"
233 #include <errno.h>
234 #include <stdint.h>
235Index: open-vm-tools/services/plugins/dndcp/Makefile.am
236===================================================================
237--- open-vm-tools.orig/services/plugins/dndcp/Makefile.am
238+++ open-vm-tools/services/plugins/dndcp/Makefile.am
239@@ -23,6 +23,7 @@ plugin_LTLIBRARIES = libdndcp.la
240 libdndcp_la_CPPFLAGS =
241 libdndcp_la_CPPFLAGS += @GTK_CPPFLAGS@
242 libdndcp_la_CPPFLAGS += @PLUGIN_CPPFLAGS@
243+libdndcp_la_CPPFLAGS += @LIBTIRPC_CPPFLAGS@
244 libdndcp_la_CPPFLAGS += -I$(top_srcdir)/services/plugins/dndcp/dnd
245 libdndcp_la_CPPFLAGS += -I$(top_srcdir)/services/plugins/dndcp/dndGuest
246 libdndcp_la_CPPFLAGS += -I$(top_srcdir)/services/plugins/dndcp/stringxx
247@@ -44,6 +45,7 @@ libdndcp_la_LIBADD += @GTK_LIBS@
248 libdndcp_la_LIBADD += @GTKMM_LIBS@
249 libdndcp_la_LIBADD += @VMTOOLS_LIBS@
250 libdndcp_la_LIBADD += @HGFS_LIBS@
251+libdndcp_la_LIBADD += @LIBTIRPC_LIBS@
252 libdndcp_la_LIBADD += $(top_builddir)/lib/hgfsUri/hgfsUriPosix.lo
253
254 libdndcp_la_SOURCES =
255Index: open-vm-tools/services/plugins/guestInfo/Makefile.am
256===================================================================
257--- open-vm-tools.orig/services/plugins/guestInfo/Makefile.am
258+++ open-vm-tools/services/plugins/guestInfo/Makefile.am
259@@ -22,6 +22,7 @@ plugin_LTLIBRARIES = libguestInfo.la
260
261 libguestInfo_la_CPPFLAGS =
262 libguestInfo_la_CPPFLAGS += @PLUGIN_CPPFLAGS@
263+libguestInfo_la_CPPFLAGS += @LIBTIRPC_CPPFLAGS@
264
265 libguestInfo_la_LDFLAGS =
266 libguestInfo_la_LDFLAGS += @PLUGIN_LDFLAGS@
267Index: open-vm-tools/services/plugins/resolutionSet/Makefile.am
268===================================================================
269--- open-vm-tools.orig/services/plugins/resolutionSet/Makefile.am
270+++ open-vm-tools/services/plugins/resolutionSet/Makefile.am
271@@ -21,6 +21,7 @@ plugin_LTLIBRARIES = libresolutionSet.la
272 libresolutionSet_la_CPPFLAGS =
273 libresolutionSet_la_CPPFLAGS += @GTK_CPPFLAGS@
274 libresolutionSet_la_CPPFLAGS += @PLUGIN_CPPFLAGS@
275+libresolutionSet_la_CPPFLAGS += @LIBTIRPC_CPPFLAGS@
276 libresolutionSet_la_CPPFLAGS += -DRESOLUTION_X11
277
278 libresolutionSet_la_LDFLAGS =
279@@ -30,6 +31,7 @@ libresolutionSet_la_LIBADD =
280 libresolutionSet_la_LIBADD += @COMMON_XLIBS@
281 libresolutionSet_la_LIBADD += @GTK_LIBS@
282 libresolutionSet_la_LIBADD += @VMTOOLS_LIBS@
283+libresolutionSet_la_LIBADD += @LIBTIRPC_LIBS@
284
285 libresolutionSet_la_SOURCES =
286 libresolutionSet_la_SOURCES += libvmwarectrl.c
287Index: open-vm-tools/services/plugins/vix/Makefile.am
288===================================================================
289--- open-vm-tools.orig/services/plugins/vix/Makefile.am
290+++ open-vm-tools/services/plugins/vix/Makefile.am
291@@ -20,6 +20,7 @@ plugin_LTLIBRARIES = libvix.la
292
293 libvix_la_CPPFLAGS =
294 libvix_la_CPPFLAGS += @PLUGIN_CPPFLAGS@
295+libvix_la_CPPFLAGS += @LIBTIRPC_CPPFLAGS@
296 libvix_la_CPPFLAGS += -I$(top_srcdir)/vgauth/public
297
298 libvix_la_LDFLAGS =
299@@ -29,6 +30,7 @@ libvix_la_LIBADD =
300 libvix_la_LIBADD += @VIX_LIBADD@
301 libvix_la_LIBADD += @VMTOOLS_LIBS@
302 libvix_la_LIBADD += @HGFS_LIBS@
303+libvix_la_LIBADD += @LIBTIRPC_LIBS@
304 libvix_la_LIBADD += $(top_builddir)/lib/auth/libAuth.la
305 libvix_la_LIBADD += $(top_builddir)/lib/foundryMsg/libFoundryMsg.la
306 libvix_la_LIBADD += $(top_builddir)/lib/impersonate/libImpersonate.la
307Index: open-vm-tools/services/plugins/vmbackup/Makefile.am
308===================================================================
309--- open-vm-tools.orig/services/plugins/vmbackup/Makefile.am
310+++ open-vm-tools/services/plugins/vmbackup/Makefile.am
311@@ -20,6 +20,7 @@ plugin_LTLIBRARIES = libvmbackup.la
312
313 libvmbackup_la_CPPFLAGS =
314 libvmbackup_la_CPPFLAGS += @PLUGIN_CPPFLAGS@
315+libvmbackup_la_CPPFLAGS += @LIBTIRPC_CPPFLAGS@
316
317 libvmbackup_la_LDFLAGS =
318 libvmbackup_la_LDFLAGS += @PLUGIN_LDFLAGS@
319@@ -27,6 +28,7 @@ libvmbackup_la_LDFLAGS += @PLUGIN_LDFLAG
320 libvmbackup_la_LIBADD =
321 libvmbackup_la_LIBADD += @GOBJECT_LIBS@
322 libvmbackup_la_LIBADD += @VMTOOLS_LIBS@
323+libvmbackup_la_LIBADD += @LIBTIRPC_LIBS@
324
325 libvmbackup_la_SOURCES =
326 libvmbackup_la_SOURCES += nullProvider.c
327Index: open-vm-tools/toolbox/Makefile.am
328===================================================================
329--- open-vm-tools.orig/toolbox/Makefile.am
330+++ open-vm-tools/toolbox/Makefile.am
331@@ -20,9 +20,11 @@ bin_PROGRAMS = vmware-toolbox-cmd
332 vmware_toolbox_cmd_LDADD =
333 vmware_toolbox_cmd_LDADD += ../libguestlib/libguestlib.la
334 vmware_toolbox_cmd_LDADD += @VMTOOLS_LIBS@
335+vmware_toolbox_cmd_LDADD += @LIBTIRPC_LIBS@
336
337 vmware_toolbox_cmd_CPPFLAGS =
338 vmware_toolbox_cmd_CPPFLAGS += @VMTOOLS_CPPFLAGS@
339+vmware_toolbox_cmd_CPPFLAGS += @LIBTIRPC_CPPFLAGS@
340
341 vmware_toolbox_cmd_SOURCES =
342 vmware_toolbox_cmd_SOURCES += toolbox-cmd.c
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0010-gnu-ucontext.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0010-gnu-ucontext.patch
new file mode 100644
index 000000000..c9beac1fc
--- /dev/null
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0010-gnu-ucontext.patch
@@ -0,0 +1,65 @@
1From 27442e2dd287d393d7b3f8bf164a887affef84df Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Wed, 18 Nov 2015 10:27:51 +0000
4Subject: [PATCH 10/11] gnu-ucontext
5
6---
7 open-vm-tools/lib/include/sigPosixRegs.h | 24 ++++++++++++------------
8 1 file changed, 12 insertions(+), 12 deletions(-)
9
10Index: open-vm-tools/lib/include/sigPosixRegs.h
11===================================================================
12--- open-vm-tools.orig/lib/include/sigPosixRegs.h
13+++ open-vm-tools/lib/include/sigPosixRegs.h
14@@ -33,7 +33,7 @@
15 #include "includeCheck.h"
16
17
18-#if __linux__ // We need the REG_foo offsets in the gregset_t;
19+#if defined(__GLIBC__) // We need the REG_foo offsets in the gregset_t;
20 # define _GNU_SOURCE // _GNU_SOURCE maps to __USE_GNU
21
22 /* And, the REG_foo definitions conflict with our own in x86.h */
23@@ -73,7 +73,7 @@
24 #include <sys/ucontext.h>
25 #endif
26
27-#if __linux__
28+#if defined(__GLIBC__)
29 # if defined(__x86_64__)
30 # undef REG_RAX
31 # undef REG_RBX
32@@ -199,7 +199,7 @@
33 #define SC_ESP(uc) ((unsigned long) (uc)->uc_mcontext.mc_esp)
34 #define SC_EIP(uc) ((unsigned long) (uc)->uc_mcontext.mc_eip)
35 #endif
36-#elif defined (sun)
37+#elif !defined (__GLIBC__)
38 #ifdef __x86_64__
39 #define SC_EAX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_RAX])
40 #define SC_EBX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_RBX])
41@@ -219,15 +219,15 @@
42 #define SC_R14(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_R14])
43 #define SC_R15(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_R15])
44 #else
45-#define SC_EAX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[EAX])
46-#define SC_EBX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[EBX])
47-#define SC_ECX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[ECX])
48-#define SC_EDX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[EDX])
49-#define SC_EDI(uc) ((unsigned long) (uc)->uc_mcontext.gregs[EDI])
50-#define SC_ESI(uc) ((unsigned long) (uc)->uc_mcontext.gregs[ESI])
51-#define SC_EBP(uc) ((unsigned long) (uc)->uc_mcontext.gregs[EBP])
52-#define SC_ESP(uc) ((unsigned long) (uc)->uc_mcontext.gregs[ESP])
53-#define SC_EIP(uc) ((unsigned long) (uc)->uc_mcontext.gregs[EIP])
54+#define SC_EAX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_EAX])
55+#define SC_EBX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_EBX])
56+#define SC_ECX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_ECX])
57+#define SC_EDX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_EDX])
58+#define SC_EDI(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_EDI])
59+#define SC_ESI(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_ESI])
60+#define SC_EBP(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_EBP])
61+#define SC_ESP(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_ESP])
62+#define SC_EIP(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_EIP])
63 #endif
64 #elif defined(ANDROID_X86)
65 #define SC_EAX(uc) ((unsigned long) (uc)->uc_mcontext.eax)
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0011-Use-configure-test-for-sys-stat.h-include.patch b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0011-Use-configure-test-for-sys-stat.h-include.patch
new file mode 100644
index 000000000..78722390e
--- /dev/null
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools/0011-Use-configure-test-for-sys-stat.h-include.patch
@@ -0,0 +1,25 @@
1From 95c6184d9ff70a47c41768850923a96de9e544aa Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Wed, 18 Nov 2015 10:41:01 +0000
4Subject: [PATCH 11/11] Use configure test for sys/stat.h include
5
6This is needed for musl libc.
7
8Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
9---
10 open-vm-tools/services/plugins/vix/vixTools.c | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13Index: open-vm-tools/services/plugins/vix/vixTools.c
14===================================================================
15--- open-vm-tools.orig/services/plugins/vix/vixTools.c
16+++ open-vm-tools/services/plugins/vix/vixTools.c
17@@ -66,7 +66,7 @@
18 #include <unistd.h>
19 #endif
20
21-#if defined(sun) || defined(__FreeBSD__) || defined(__APPLE__)
22+#ifdef HAVE_SYS_STAT_H
23 #include <sys/stat.h>
24 #endif
25
diff --git a/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.1.5.bb b/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.1.5.bb
index 5f93eb4ac..f7746c8e3 100644
--- a/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.1.5.bb
+++ b/meta-oe/recipes-support/open-vm-tools/open-vm-tools_10.1.5.bb
@@ -13,26 +13,39 @@ SUMMARY = "Tools to enhance VMWare guest integration and performance"
13HOMEPAGE = "https://github.com/vmware/open-vm-tools" 13HOMEPAGE = "https://github.com/vmware/open-vm-tools"
14SECTION = "vmware-tools" 14SECTION = "vmware-tools"
15 15
16LICENSE = "LGPLv2.1 & GPLv2 & BSD & CDDLv1" 16LICENSE = "LGPL-2.0 & GPL-2.0 & BSD & CDDL-1.0"
17LIC_FILES_CHKSUM = "file://LICENSE;md5=b66ba4cb4fc017682c95efc300410e79" 17LIC_FILES_CHKSUM = "file://LICENSE;md5=b66ba4cb4fc017682c95efc300410e79"
18LICENSE_modules/freebsd/vmblock = "BSD" 18LICENSE_modules/freebsd/vmblock = "BSD"
19LICENSE_modules/freebsd/vmmemctl = "GPLv2" 19LICENSE_modules/freebsd/vmmemctl = "GPL-2.0"
20LICENSE_modules/freebsd/vmxnet = "GPLv2" 20LICENSE_modules/freebsd/vmxnet = "GPL-2.0"
21LICENSE_modules/linux = "GPLv2" 21LICENSE_modules/linux = "GPL-2.0"
22LICENSE_modules/solaris = "CDDLv1" 22LICENSE_modules/solaris = "CDDL-1.0"
23 23
24SRC_URI = "git://github.com/vmware/open-vm-tools.git;protocol=https \ 24SRC_URI = "git://github.com/vmware/open-vm-tools.git;protocol=https \
25 file://tools.conf \ 25 file://tools.conf \
26 file://vmtoolsd.service \ 26 file://vmtoolsd.service \
27 file://0001-configure.ac-don-t-use-dnet-config.patch \ 27 file://0001-configure.ac-don-t-use-dnet-config.patch \
28 file://0002-add-include-sys-sysmacros.h.patch \ 28 file://0002-add-include-sys-sysmacros.h.patch \
29 file://0001-Remove-assumptions-about-glibc-being-only-libc-imple.patch \
30 file://0002-include-poll.h-instead-of-obsolete-sys-poll.h.patch \
31 file://0003-Rename-poll.h-to-vm_poll.h.patch \
32 file://0004-Add-Wno-incompatible-pointer-types-and-Wno-error-add.patch \
33 file://0005-Use-configure-test-for-struct-timespec.patch \
34 file://0006-Fix-definition-of-ALLPERMS-and-ACCESSPERMS.patch \
35 file://0007-Use-configure-to-test-for-feature-instead-of-platfor.patch \
36 file://0008-use-posix-strerror_r-unless-gnu.patch \
37 file://0011-Use-configure-test-for-sys-stat.h-include.patch \
38 "
39SRC_URI_append_libc-musl = "\
40 file://0009-Add-support-for-building-with-system-libtirpc.patch \
41 file://0010-gnu-ucontext.patch \
29 " 42 "
30
31SRCREV = "854c0bb374612f7e633b448ca273f970f154458b" 43SRCREV = "854c0bb374612f7e633b448ca273f970f154458b"
32 44
33S = "${WORKDIR}/git/open-vm-tools" 45S = "${WORKDIR}/git/open-vm-tools"
34 46
35DEPENDS = "glib-2.0 glib-2.0-native util-linux libdnet procps" 47DEPENDS = "glib-2.0 glib-2.0-native util-linux libdnet procps"
48DEPENDS_append_libc-musl = " libtirpc"
36 49
37# open-vm-tools is supported only on x86. 50# open-vm-tools is supported only on x86.
38COMPATIBLE_HOST = '(x86_64.*|i.86.*)-linux' 51COMPATIBLE_HOST = '(x86_64.*|i.86.*)-linux'