aboutsummaryrefslogtreecommitdiffstats
path: root/main/open-vm-tools/0009-Rename-poll.h-to-vm_poll.h.patch
blob: 0a4e22f3e1bb386e2d781e50070022bb562d4624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
From 6accc22a50c51ab720a8b29740ccd928e6fb7f1e Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Tue, 17 Nov 2015 10:57:31 +0000
Subject: [PATCH 09/11] Rename poll.h to vm_poll.h

musl libc's system headers pulls in open-vm-tools' poll.h. To avoid this
we rename poll.h to vm_poll.h.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
---
 open-vm-tools/lib/asyncsocket/asyncsocket.c        |   2 +-
 open-vm-tools/lib/hgfsServer/hgfsServer.c          |   2 +-
 open-vm-tools/lib/include/asyncsocket.h            |   2 +-
 open-vm-tools/lib/include/poll.h                   | 324 ---------------------
 open-vm-tools/lib/include/pollImpl.h               |   2 +-
 open-vm-tools/lib/include/vm_poll.h                | 324 +++++++++++++++++++++
 open-vm-tools/lib/rpcIn/rpcin.c                    |   2 +-
 .../plugins/grabbitmqProxy/grabbitmqProxyPlugin.c  |   2 +-
 8 files changed, 330 insertions(+), 330 deletions(-)
 delete mode 100644 open-vm-tools/lib/include/poll.h
 create mode 100644 open-vm-tools/lib/include/vm_poll.h

diff --git a/open-vm-tools/lib/asyncsocket/asyncsocket.c b/open-vm-tools/lib/asyncsocket/asyncsocket.c
index 05f217a..a24e356 100644
--- a/open-vm-tools/lib/asyncsocket/asyncsocket.c
+++ b/open-vm-tools/lib/asyncsocket/asyncsocket.c
@@ -52,7 +52,7 @@
 #include "vmware.h"
 #include "asyncsocket.h"
 #include "asyncSocketInt.h"
-#include "poll.h"
+#include "vm_poll.h"
 #include "log.h"
 #include "err.h"
 #include "hostinfo.h"
diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c b/open-vm-tools/lib/hgfsServer/hgfsServer.c
index 0939655..147b9e8 100644
--- a/open-vm-tools/lib/hgfsServer/hgfsServer.c
+++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c
@@ -48,7 +48,7 @@
 #include "hgfsServerOplock.h"
 #include "hgfsDirNotify.h"
 #include "userlock.h"
-#include "poll.h"
+#include "vm_poll.h"
 #include "mutexRankLib.h"
 #include "vm_basic_asm.h"
 #include "unicodeOperations.h"
diff --git a/open-vm-tools/lib/include/asyncsocket.h b/open-vm-tools/lib/include/asyncsocket.h
index 9d41a72..b9024d3 100644
--- a/open-vm-tools/lib/include/asyncsocket.h
+++ b/open-vm-tools/lib/include/asyncsocket.h
@@ -125,7 +125,7 @@ typedef struct AsyncSocket AsyncSocket;
  * Or the client can specify its favorite poll class and locking behavior.
  * Use of IVmdbPoll is only supported for regular sockets and for Attach.
  */
-#include "poll.h"
+#include "vm_poll.h"
 struct IVmdbPoll;
 typedef struct AsyncSocketPollParams {
    int flags;               /* Default 0, only POLL_FLAG_NO_BULL is valid */
diff --git a/open-vm-tools/lib/include/poll.h b/open-vm-tools/lib/include/poll.h
deleted file mode 100644
index 834535c..0000000
--- a/open-vm-tools/lib/include/poll.h
+++ /dev/null
@@ -1,324 +0,0 @@
-/*********************************************************
- * Copyright (C) 1998-2015 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
- * by the Free Software Foundation version 2.1 and no later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
- *
- *********************************************************/
-
-/*********************************************************
- * The contents of this file are subject to the terms of the Common
- * Development and Distribution License (the "License") version 1.0
- * and no later version.  You may not use this file except in
- * compliance with the License.
- *
- * You can obtain a copy of the License at
- *         http://www.opensource.org/licenses/cddl1.php
- *
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- *********************************************************/
-
-
-#ifndef _POLL_H_
-#define _POLL_H_
-
-#define INCLUDE_ALLOW_USERLEVEL
-#define INCLUDE_ALLOW_VMCORE
-#include "includeCheck.h"
-
-#include "vm_basic_types.h"
-#include "vm_basic_defs.h"
-#include "vmware.h"
-#include "userlock.h"
-
-#ifdef _WIN32
-#define HZ 100
-#elif defined linux
-#include <asm/param.h>
-#elif __APPLE__
-#include <TargetConditionals.h>
-/*
- * Old SDKs don't define TARGET_OS_IPHONE at all.
- * New ones define it to 0 on Mac OS X, 1 on iOS.
- */
-#if !defined(TARGET_OS_IPHONE) || TARGET_OS_IPHONE == 0
-#include <sys/kernel.h>
-#endif
-#include <sys/poll.h>
-#define HZ 100
-#endif
-#ifdef __ANDROID__
-/*
- * <poll.h> of android should be included, but its name is same
- * with this file. So its content is put here to avoid conflict.
- */
-#include <asm/poll.h>
-#define HZ 100
-typedef unsigned int  nfds_t;
-int poll(struct pollfd *, nfds_t, long);
-#endif
-
-
-/*
- * Poll event types: each type has a different reason for firing,
- * or condition that must be met before firing.
- */
-
-typedef enum {
-   /*
-    * Actual Poll queue types against which you can register callbacks.
-    */
-   POLL_VIRTUALREALTIME = -1, /* Negative because it doesn't have its own Q */
-   POLL_VTIME = 0,
-   POLL_REALTIME,
-   POLL_DEVICE,
-   POLL_MAIN_LOOP,
-   POLL_NUM_QUEUES
-} PollEventType;
-
-
-/*
- * Classes of events
- *
- * These are the predefined classes.  More can be declared
- * with Poll_AllocClass().
- */
-
-typedef enum PollClass {
-   POLL_CLASS_MAIN,
-   POLL_CLASS_PAUSE,
-   POLL_CLASS_IPC,
-   POLL_CLASS_CPT,
-   POLL_CLASS_MKS,
-   POLL_FIXED_CLASSES,
-   POLL_MAX_CLASSES = 320 /* Size enum to maximum */
-} PollClass;
-
-
-/*
- * Each callback is registered in a set of classes
- */
-
-typedef struct PollClassSet {
-   /* Type is uintptr_t to give best 32/64-bit code. */
-#define _POLL_ELEMSIZE (sizeof (uintptr_t) * 8)
-   uintptr_t bits[CEILING(POLL_MAX_CLASSES, _POLL_ELEMSIZE)];
-} PollClassSet;
-
-/* An empty PollClassSet. */
-static INLINE PollClassSet
-PollClassSet_Empty(void)
-{
-   PollClassSet set = { { 0 } };
-   return set;
-}
-
-/* A PollClassSet with the single member. */
-static INLINE PollClassSet
-PollClassSet_Singleton(PollClass c)
-{
-   PollClassSet s = PollClassSet_Empty();
-
-   ASSERT_ON_COMPILE(sizeof s.bits[0] * 8 == _POLL_ELEMSIZE); /* Size correct */
-   ASSERT_ON_COMPILE((_POLL_ELEMSIZE & (_POLL_ELEMSIZE - 1)) == 0); /* power of 2 */
-   ASSERT_ON_COMPILE(POLL_MAX_CLASSES <= ARRAYSIZE(s.bits) * _POLL_ELEMSIZE);
-   ASSERT(c < POLL_MAX_CLASSES);
-
-   s.bits[c / _POLL_ELEMSIZE] = CONST3264U(1) << (c % _POLL_ELEMSIZE);
-   return s;
-}
-
-/* Combine two PollClassSets. */
-static INLINE PollClassSet
-PollClassSet_Union(PollClassSet lhs, PollClassSet rhs)
-{
-   PollClassSet u;
-   unsigned i;
-
-   for (i = 0; i < ARRAYSIZE(u.bits); i++) {
-      u.bits[i] = lhs.bits[i] | rhs.bits[i];
-   }
-   return u;
-}
-
-/* Add single class to PollClassSet. */
-static INLINE PollClassSet
-PollClassSet_Include(PollClassSet set, PollClass c)
-{
-   return PollClassSet_Union(set, PollClassSet_Singleton(c));
-}
-
-
-#define POLL_CS_MAIN    PollClassSet_Singleton(POLL_CLASS_MAIN)
-#define POLL_CS_PAUSE   PollClassSet_Union(POLL_CS_MAIN,            \
-                           PollClassSet_Singleton(POLL_CLASS_PAUSE))
-#define POLL_CS_CPT     PollClassSet_Union(POLL_CS_PAUSE,           \
-                           PollClassSet_Singleton(POLL_CLASS_CPT))
-#define POLL_CS_IPC     PollClassSet_Union(POLL_CS_CPT,             \
-                           PollClassSet_Singleton(POLL_CLASS_IPC))
-#define POLL_CS_VMDB    POLL_CS_PAUSE /* POLL_CLASS_VMDB is retired */
-#define POLL_CS_MKS	PollClassSet_Singleton(POLL_CLASS_MKS)
-/* 
- * DANGER.  You don't need POLL_CS_ALWAYS.  Really.  So don't use it.
- */
-#define POLL_CS_ALWAYS  PollClassSet_Union(POLL_CS_CPT, POLL_CS_IPC)
-
-/*
- * Poll class-set taxonomy:
- * POLL_CS_MAIN
- *    - Unless you NEED another class, use POLL_CS_MAIN.
- * POLL_CS_PAUSE
- *    - For callbacks that must occur even if the guest is paused.
- *      Most VMDB or Foundry commands are in this category.
- * POLL_CS_CPT
- *    - Only for callbacks which can trigger intermediate Checkpoint 
- *      transitions.
- *      The ONLY such callback is Migrate.
- * POLL_CS_IPC
- *    - Only for callbacks which can contain Msg_(Post|Hint|Question) 
- *      responses, and for signal handlers (why)?
- *      Vigor, VMDB, and Foundry can contain Msg_* responses.
- * POLL_CS_MKS
- *    - Callback runs in MKS thread.
- * POLL_CS_ALWAYS
- *    - Only for events that must be processed immediately.
- *      The ONLY such callback is OvhdMemVmxSizeCheck.
- */
-
-
-/*
- * Poll_Callback flags
- */
-
-#define POLL_FLAG_PERIODIC		0x01    // keep after firing
-#define POLL_FLAG_REMOVE_AT_POWEROFF	0x02  	// self-explanatory
-#define POLL_FLAG_READ			0x04	// device is ready for reading
-#define POLL_FLAG_WRITE			0x08	// device is ready for writing
-#define POLL_FLAG_SOCKET                0x10    // device is a Windows socket
-#define POLL_FLAG_NO_BULL               0x20    // callback does its own locking
-#define POLL_FLAG_WINSOCK               0x40    // Winsock style write events
-#define POLL_FLAG_FD                    0x80    // device is a Windows file descriptor.
-#define POLL_FLAG_ACCEPT_INVALID_FDS    0x100   // For broken 3rd party libs, e.g. curl
-#define POLL_FLAG_THUNK_TO_WND          0x200   // thunk callback to window message loop
-
-
-/*
- * Advisory minimum time period.
- * Users that want the fastest running real-time poll
- * should use TICKS_TO_USECS(1).
- */
-
-#define TICKS_TO_USECS(_x) ((_x) * (1000000 / HZ))
-#define USECS_TO_TICKS(_x) ((_x) / (1000000 / HZ))
-
-
-typedef void (*PollerFunction)(void *clientData);
-typedef void (*PollerFireWrapper)(PollerFunction func,
-                                  void *funcData,
-                                  void *wrapperData);
-typedef Bool (*PollerErrorFn)(const char *errorStr);
-
-/*
- * Initialisers:
- *
- *      For the sake of convenience, we declare the initialisers
- *      for custom implmentations here, even though the actual
- *      implementations are distinct from the core poll code.
- */
-
-typedef struct PollOptions {
-   Bool locked;           // Use internal MXUser for locking
-   Bool allowFullQueue;   // Don't assert when device event queue is full.
-   VThreadID windowsMsgThread;       // thread that processes Windows messages
-   PollerFireWrapper fireWrapperFn;  // optional; may be useful for stats
-   void *fireWrapperData; // optional
-   PollerErrorFn errorFn; // optional; called upon unrecoverable error
-} PollOptions;
-
-
-void Poll_InitDefault(void);
-void Poll_InitDefaultEx(const PollOptions *opts);
-void Poll_InitGtk(void); // On top of glib for Linux
-void Poll_InitCF(void);  // On top of CoreFoundation for OSX
-
-
-/*
- * Functions
- */
-int Poll_SocketPair(Bool vmci, Bool stream, int fds[2]);
-void Poll_Loop(Bool loop, Bool *exit, PollClass c);
-void Poll_LoopTimeout(Bool loop, Bool *exit, PollClass c, int timeout);
-Bool Poll_LockingEnabled(void);
-void Poll_Exit(void);
-
-
-/*
- * Poll_Callback adds a callback regardless of whether an identical one exists.
- *
- * Likewise, Poll_CallbackRemove removes exactly one callback.
- */
-
-VMwareStatus Poll_Callback(PollClassSet classSet,
-                           int flags,
-                           PollerFunction f,
-                           void *clientData,
-                           PollEventType type,
-                           PollDevHandle info, // fd/microsec delay
-                           MXUserRecLock *lck);
-Bool Poll_CallbackRemove(PollClassSet classSet,
-                         int flags,
-                         PollerFunction f,
-                         void *clientData,
-                         PollEventType type);
-Bool Poll_CallbackRemoveOneByCB(PollClassSet classSet,
-                                int flags,
-                                PollerFunction f,
-                                PollEventType type,
-                                void **clientData);
-
-void Poll_NotifyChange(PollClassSet classSet);
-
-/*
- * Wrappers for Poll_Callback and Poll_CallbackRemove that present
- * simpler subsets of those interfaces.
- */
-
-VMwareStatus Poll_CB_Device(PollerFunction f,
-                            void *clientData,
-                            PollDevHandle device,
-                            Bool periodic);
-
-Bool Poll_CB_DeviceRemove(PollerFunction f,
-                          void *clientData,
-                          Bool periodic);
-
-
-VMwareStatus Poll_CB_RTime(PollerFunction f,
-                           void *clientData,
-                           int delay,	// microseconds
-                           Bool periodic,
-                           MXUserRecLock *lock);
-
-Bool Poll_CB_RTimeRemove(PollerFunction f,
-                         void *clientData,
-                         Bool periodic);
-
-
-#ifdef _WIN32
-void Poll_SetWindowMessageRecipient(HWND hWnd, UINT msg, Bool alwaysThunk);
-Bool Poll_FireWndCallback(void *lparam);
-#endif
-
-#endif // _POLL_H_
diff --git a/open-vm-tools/lib/include/pollImpl.h b/open-vm-tools/lib/include/pollImpl.h
index 569c73d..e429f11 100644
--- a/open-vm-tools/lib/include/pollImpl.h
+++ b/open-vm-tools/lib/include/pollImpl.h
@@ -44,7 +44,7 @@
 #define INCLUDE_ALLOW_USERLEVEL
 #include "includeCheck.h"
 
-#include "poll.h"
+#include "vm_poll.h"
 
 /*
  * PollImpl:
diff --git a/open-vm-tools/lib/include/vm_poll.h b/open-vm-tools/lib/include/vm_poll.h
new file mode 100644
index 0000000..834535c
--- /dev/null
+++ b/open-vm-tools/lib/include/vm_poll.h
@@ -0,0 +1,324 @@
+/*********************************************************
+ * Copyright (C) 1998-2015 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
+ * by the Free Software Foundation version 2.1 and no later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
+ *
+ *********************************************************/
+
+/*********************************************************
+ * The contents of this file are subject to the terms of the Common
+ * Development and Distribution License (the "License") version 1.0
+ * and no later version.  You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at
+ *         http://www.opensource.org/licenses/cddl1.php
+ *
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ *********************************************************/
+
+
+#ifndef _POLL_H_
+#define _POLL_H_
+
+#define INCLUDE_ALLOW_USERLEVEL
+#define INCLUDE_ALLOW_VMCORE
+#include "includeCheck.h"
+
+#include "vm_basic_types.h"
+#include "vm_basic_defs.h"
+#include "vmware.h"
+#include "userlock.h"
+
+#ifdef _WIN32
+#define HZ 100
+#elif defined linux
+#include <asm/param.h>
+#elif __APPLE__
+#include <TargetConditionals.h>
+/*
+ * Old SDKs don't define TARGET_OS_IPHONE at all.
+ * New ones define it to 0 on Mac OS X, 1 on iOS.
+ */
+#if !defined(TARGET_OS_IPHONE) || TARGET_OS_IPHONE == 0
+#include <sys/kernel.h>
+#endif
+#include <sys/poll.h>
+#define HZ 100
+#endif
+#ifdef __ANDROID__
+/*
+ * <poll.h> of android should be included, but its name is same
+ * with this file. So its content is put here to avoid conflict.
+ */
+#include <asm/poll.h>
+#define HZ 100
+typedef unsigned int  nfds_t;
+int poll(struct pollfd *, nfds_t, long);
+#endif
+
+
+/*
+ * Poll event types: each type has a different reason for firing,
+ * or condition that must be met before firing.
+ */
+
+typedef enum {
+   /*
+    * Actual Poll queue types against which you can register callbacks.
+    */
+   POLL_VIRTUALREALTIME = -1, /* Negative because it doesn't have its own Q */
+   POLL_VTIME = 0,
+   POLL_REALTIME,
+   POLL_DEVICE,
+   POLL_MAIN_LOOP,
+   POLL_NUM_QUEUES
+} PollEventType;
+
+
+/*
+ * Classes of events
+ *
+ * These are the predefined classes.  More can be declared
+ * with Poll_AllocClass().
+ */
+
+typedef enum PollClass {
+   POLL_CLASS_MAIN,
+   POLL_CLASS_PAUSE,
+   POLL_CLASS_IPC,
+   POLL_CLASS_CPT,
+   POLL_CLASS_MKS,
+   POLL_FIXED_CLASSES,
+   POLL_MAX_CLASSES = 320 /* Size enum to maximum */
+} PollClass;
+
+
+/*
+ * Each callback is registered in a set of classes
+ */
+
+typedef struct PollClassSet {
+   /* Type is uintptr_t to give best 32/64-bit code. */
+#define _POLL_ELEMSIZE (sizeof (uintptr_t) * 8)
+   uintptr_t bits[CEILING(POLL_MAX_CLASSES, _POLL_ELEMSIZE)];
+} PollClassSet;
+
+/* An empty PollClassSet. */
+static INLINE PollClassSet
+PollClassSet_Empty(void)
+{
+   PollClassSet set = { { 0 } };
+   return set;
+}
+
+/* A PollClassSet with the single member. */
+static INLINE PollClassSet
+PollClassSet_Singleton(PollClass c)
+{
+   PollClassSet s = PollClassSet_Empty();
+
+   ASSERT_ON_COMPILE(sizeof s.bits[0] * 8 == _POLL_ELEMSIZE); /* Size correct */
+   ASSERT_ON_COMPILE((_POLL_ELEMSIZE & (_POLL_ELEMSIZE - 1)) == 0); /* power of 2 */
+   ASSERT_ON_COMPILE(POLL_MAX_CLASSES <= ARRAYSIZE(s.bits) * _POLL_ELEMSIZE);
+   ASSERT(c < POLL_MAX_CLASSES);
+
+   s.bits[c / _POLL_ELEMSIZE] = CONST3264U(1) << (c % _POLL_ELEMSIZE);
+   return s;
+}
+
+/* Combine two PollClassSets. */
+static INLINE PollClassSet
+PollClassSet_Union(PollClassSet lhs, PollClassSet rhs)
+{
+   PollClassSet u;
+   unsigned i;
+
+   for (i = 0; i < ARRAYSIZE(u.bits); i++) {
+      u.bits[i] = lhs.bits[i] | rhs.bits[i];
+   }
+   return u;
+}
+
+/* Add single class to PollClassSet. */
+static INLINE PollClassSet
+PollClassSet_Include(PollClassSet set, PollClass c)
+{
+   return PollClassSet_Union(set, PollClassSet_Singleton(c));
+}
+
+
+#define POLL_CS_MAIN    PollClassSet_Singleton(POLL_CLASS_MAIN)
+#define POLL_CS_PAUSE   PollClassSet_Union(POLL_CS_MAIN,            \
+                           PollClassSet_Singleton(POLL_CLASS_PAUSE))
+#define POLL_CS_CPT     PollClassSet_Union(POLL_CS_PAUSE,           \
+                           PollClassSet_Singleton(POLL_CLASS_CPT))
+#define POLL_CS_IPC     PollClassSet_Union(POLL_CS_CPT,             \
+                           PollClassSet_Singleton(POLL_CLASS_IPC))
+#define POLL_CS_VMDB    POLL_CS_PAUSE /* POLL_CLASS_VMDB is retired */
+#define POLL_CS_MKS	PollClassSet_Singleton(POLL_CLASS_MKS)
+/* 
+ * DANGER.  You don't need POLL_CS_ALWAYS.  Really.  So don't use it.
+ */
+#define POLL_CS_ALWAYS  PollClassSet_Union(POLL_CS_CPT, POLL_CS_IPC)
+
+/*
+ * Poll class-set taxonomy:
+ * POLL_CS_MAIN
+ *    - Unless you NEED another class, use POLL_CS_MAIN.
+ * POLL_CS_PAUSE
+ *    - For callbacks that must occur even if the guest is paused.
+ *      Most VMDB or Foundry commands are in this category.
+ * POLL_CS_CPT
+ *    - Only for callbacks which can trigger intermediate Checkpoint 
+ *      transitions.
+ *      The ONLY such callback is Migrate.
+ * POLL_CS_IPC
+ *    - Only for callbacks which can contain Msg_(Post|Hint|Question) 
+ *      responses, and for signal handlers (why)?
+ *      Vigor, VMDB, and Foundry can contain Msg_* responses.
+ * POLL_CS_MKS
+ *    - Callback runs in MKS thread.
+ * POLL_CS_ALWAYS
+ *    - Only for events that must be processed immediately.
+ *      The ONLY such callback is OvhdMemVmxSizeCheck.
+ */
+
+
+/*
+ * Poll_Callback flags
+ */
+
+#define POLL_FLAG_PERIODIC		0x01    // keep after firing
+#define POLL_FLAG_REMOVE_AT_POWEROFF	0x02  	// self-explanatory
+#define POLL_FLAG_READ			0x04	// device is ready for reading
+#define POLL_FLAG_WRITE			0x08	// device is ready for writing
+#define POLL_FLAG_SOCKET                0x10    // device is a Windows socket
+#define POLL_FLAG_NO_BULL               0x20    // callback does its own locking
+#define POLL_FLAG_WINSOCK               0x40    // Winsock style write events
+#define POLL_FLAG_FD                    0x80    // device is a Windows file descriptor.
+#define POLL_FLAG_ACCEPT_INVALID_FDS    0x100   // For broken 3rd party libs, e.g. curl
+#define POLL_FLAG_THUNK_TO_WND          0x200   // thunk callback to window message loop
+
+
+/*
+ * Advisory minimum time period.
+ * Users that want the fastest running real-time poll
+ * should use TICKS_TO_USECS(1).
+ */
+
+#define TICKS_TO_USECS(_x) ((_x) * (1000000 / HZ))
+#define USECS_TO_TICKS(_x) ((_x) / (1000000 / HZ))
+
+
+typedef void (*PollerFunction)(void *clientData);
+typedef void (*PollerFireWrapper)(PollerFunction func,
+                                  void *funcData,
+                                  void *wrapperData);
+typedef Bool (*PollerErrorFn)(const char *errorStr);
+
+/*
+ * Initialisers:
+ *
+ *      For the sake of convenience, we declare the initialisers
+ *      for custom implmentations here, even though the actual
+ *      implementations are distinct from the core poll code.
+ */
+
+typedef struct PollOptions {
+   Bool locked;           // Use internal MXUser for locking
+   Bool allowFullQueue;   // Don't assert when device event queue is full.
+   VThreadID windowsMsgThread;       // thread that processes Windows messages
+   PollerFireWrapper fireWrapperFn;  // optional; may be useful for stats
+   void *fireWrapperData; // optional
+   PollerErrorFn errorFn; // optional; called upon unrecoverable error
+} PollOptions;
+
+
+void Poll_InitDefault(void);
+void Poll_InitDefaultEx(const PollOptions *opts);
+void Poll_InitGtk(void); // On top of glib for Linux
+void Poll_InitCF(void);  // On top of CoreFoundation for OSX
+
+
+/*
+ * Functions
+ */
+int Poll_SocketPair(Bool vmci, Bool stream, int fds[2]);
+void Poll_Loop(Bool loop, Bool *exit, PollClass c);
+void Poll_LoopTimeout(Bool loop, Bool *exit, PollClass c, int timeout);
+Bool Poll_LockingEnabled(void);
+void Poll_Exit(void);
+
+
+/*
+ * Poll_Callback adds a callback regardless of whether an identical one exists.
+ *
+ * Likewise, Poll_CallbackRemove removes exactly one callback.
+ */
+
+VMwareStatus Poll_Callback(PollClassSet classSet,
+                           int flags,
+                           PollerFunction f,
+                           void *clientData,
+                           PollEventType type,
+                           PollDevHandle info, // fd/microsec delay
+                           MXUserRecLock *lck);
+Bool Poll_CallbackRemove(PollClassSet classSet,
+                         int flags,
+                         PollerFunction f,
+                         void *clientData,
+                         PollEventType type);
+Bool Poll_CallbackRemoveOneByCB(PollClassSet classSet,
+                                int flags,
+                                PollerFunction f,
+                                PollEventType type,
+                                void **clientData);
+
+void Poll_NotifyChange(PollClassSet classSet);
+
+/*
+ * Wrappers for Poll_Callback and Poll_CallbackRemove that present
+ * simpler subsets of those interfaces.
+ */
+
+VMwareStatus Poll_CB_Device(PollerFunction f,
+                            void *clientData,
+                            PollDevHandle device,
+                            Bool periodic);
+
+Bool Poll_CB_DeviceRemove(PollerFunction f,
+                          void *clientData,
+                          Bool periodic);
+
+
+VMwareStatus Poll_CB_RTime(PollerFunction f,
+                           void *clientData,
+                           int delay,	// microseconds
+                           Bool periodic,
+                           MXUserRecLock *lock);
+
+Bool Poll_CB_RTimeRemove(PollerFunction f,
+                         void *clientData,
+                         Bool periodic);
+
+
+#ifdef _WIN32
+void Poll_SetWindowMessageRecipient(HWND hWnd, UINT msg, Bool alwaysThunk);
+Bool Poll_FireWndCallback(void *lparam);
+#endif
+
+#endif // _POLL_H_
diff --git a/open-vm-tools/lib/rpcIn/rpcin.c b/open-vm-tools/lib/rpcIn/rpcin.c
index abe48e6..243a86f 100644
--- a/open-vm-tools/lib/rpcIn/rpcin.c
+++ b/open-vm-tools/lib/rpcIn/rpcin.c
@@ -57,7 +57,7 @@
 
 #if defined(VMTOOLS_USE_VSOCKET)
 #  include <glib.h>
-#  include "poll.h"
+#  include "vm_poll.h"
 #  include "asyncsocket.h"
 #  include "vmci_defs.h"
 #include "dataMap.h"
diff --git a/open-vm-tools/services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c b/open-vm-tools/services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c
index 9451dcc..3ebf6ba 100644
--- a/open-vm-tools/services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c
+++ b/open-vm-tools/services/plugins/grabbitmqProxy/grabbitmqProxyPlugin.c
@@ -48,7 +48,7 @@
 #include "rpcout.h"
 #include "rabbitmqProxyConst.h"
 #include "vm_basic_types.h"
-#include "poll.h"
+#include "vm_poll.h"
 #ifdef OPEN_VM_TOOLS
 #include "vmci_sockets.h"
 #include "sslDirect.h"
-- 
2.6.3