unix: add Poll function on Dragonfly

Tested with TestPoll extracted from syscall_linux_test.go. Once Poll is
supported on all OSes this test can be moved to syscall_unix_test.go.

Change-Id: I03f4396be2e190770abb219c1c5324ca55bcfa27
Reviewed-on: https://go-review.googlesource.com/73430
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/unix/types_dragonfly.go b/unix/types_dragonfly.go
index 80b2778..78ce32a 100644
--- a/unix/types_dragonfly.go
+++ b/unix/types_dragonfly.go
@@ -17,6 +17,7 @@
 #define KERNEL
 #include <dirent.h>
 #include <fcntl.h>
+#include <poll.h>
 #include <signal.h>
 #include <termios.h>
 #include <stdio.h>
@@ -247,3 +248,20 @@
 	AT_FDCWD            = C.AT_FDCWD
 	AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
 )
+
+// poll
+
+type PollFd C.struct_pollfd
+
+const (
+	POLLERR    = C.POLLERR
+	POLLHUP    = C.POLLHUP
+	POLLIN     = C.POLLIN
+	POLLNVAL   = C.POLLNVAL
+	POLLOUT    = C.POLLOUT
+	POLLPRI    = C.POLLPRI
+	POLLRDBAND = C.POLLRDBAND
+	POLLRDNORM = C.POLLRDNORM
+	POLLWRBAND = C.POLLWRBAND
+	POLLWRNORM = C.POLLWRNORM
+)