summaryrefslogtreecommitdiffhomepage
path: root/uapi_bsd.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-22 18:33:50 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-22 18:35:52 +0200
commitb4cef2524f3b2be11f905c4114e2e747a8101160 (patch)
tree3bd95e4ce54c72edc8cbf5d0eb9cf7202048bebd /uapi_bsd.go
parent7038de95e119147245741c04feab25b833b615e9 (diff)
Fix integer conversions
Diffstat (limited to 'uapi_bsd.go')
-rw-r--r--uapi_bsd.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/uapi_bsd.go b/uapi_bsd.go
index e949918..b2a7644 100644
--- a/uapi_bsd.go
+++ b/uapi_bsd.go
@@ -15,6 +15,7 @@ import (
"net"
"os"
"path"
+ "unsafe"
)
const (
@@ -101,11 +102,13 @@ func UAPIListen(name string, file *os.File) (net.Listener, error) {
go func(l *UAPIListener) {
event := unix.Kevent_t{
- Ident: uint64(uapi.keventFd),
Filter: unix.EVFILT_VNODE,
Flags: unix.EV_ADD | unix.EV_ENABLE | unix.EV_ONESHOT,
Fflags: unix.NOTE_WRITE,
}
+ // Allow this assignment to work with both the 32-bit and 64-bit version
+ // of the above struct. If you know another way, please submit a patch.
+ *(*uintptr)(unsafe.Pointer(&event.Ident)) = uintptr(uapi.keventFd)
events := make([]unix.Kevent_t, 1)
n := 1
var kerr error