unix: expose solaris types needed for Event Ports
This work is in support of a cleanup of fsnotify/fsnotify#263
Change-Id: I2bc50036087a038c2aa8b6178687d1a870b9d1fd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/324629
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
diff --git a/unix/types_solaris.go b/unix/types_solaris.go
index 16adb0d..5360e5d 100644
--- a/unix/types_solaris.go
+++ b/unix/types_solaris.go
@@ -34,6 +34,7 @@
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/param.h>
+#include <sys/port.h>
#include <sys/resource.h>
#include <sys/select.h>
#include <sys/signal.h>
@@ -269,3 +270,33 @@
POLLWRBAND = C.POLLWRBAND
POLLWRNORM = C.POLLWRNORM
)
+
+// Event Ports
+
+type fileObj C.struct_file_obj
+
+type portEvent C.struct_port_event
+
+const (
+ PORT_SOURCE_AIO = C.PORT_SOURCE_AIO
+ PORT_SOURCE_TIMER = C.PORT_SOURCE_TIMER
+ PORT_SOURCE_USER = C.PORT_SOURCE_USER
+ PORT_SOURCE_FD = C.PORT_SOURCE_FD
+ PORT_SOURCE_ALERT = C.PORT_SOURCE_ALERT
+ PORT_SOURCE_MQ = C.PORT_SOURCE_MQ
+ PORT_SOURCE_FILE = C.PORT_SOURCE_FILE
+ PORT_ALERT_SET = C.PORT_ALERT_SET
+ PORT_ALERT_UPDATE = C.PORT_ALERT_UPDATE
+ PORT_ALERT_INVALID = C.PORT_ALERT_INVALID
+ FILE_ACCESS = C.FILE_ACCESS
+ FILE_MODIFIED = C.FILE_MODIFIED
+ FILE_ATTRIB = C.FILE_ATTRIB
+ FILE_TRUNC = C.FILE_TRUNC
+ FILE_NOFOLLOW = C.FILE_NOFOLLOW
+ FILE_DELETE = C.FILE_DELETE
+ FILE_RENAME_TO = C.FILE_RENAME_TO
+ FILE_RENAME_FROM = C.FILE_RENAME_FROM
+ UNMOUNTED = C.UNMOUNTED
+ MOUNTEDOVER = C.MOUNTEDOVER
+ FILE_EXCEPTION = C.FILE_EXCEPTION
+)
diff --git a/unix/ztypes_solaris_amd64.go b/unix/ztypes_solaris_amd64.go
index 85effef..ad4aad2 100644
--- a/unix/ztypes_solaris_amd64.go
+++ b/unix/ztypes_solaris_amd64.go
@@ -440,3 +440,43 @@
POLLWRBAND = 0x100
POLLWRNORM = 0x4
)
+
+type fileObj struct {
+ Atim Timespec
+ Mtim Timespec
+ Ctim Timespec
+ Pad [3]uint64
+ Name *int8
+}
+
+type portEvent struct {
+ Events int32
+ Source uint16
+ Pad uint16
+ Object uint64
+ User *byte
+}
+
+const (
+ PORT_SOURCE_AIO = 0x1
+ PORT_SOURCE_TIMER = 0x2
+ PORT_SOURCE_USER = 0x3
+ PORT_SOURCE_FD = 0x4
+ PORT_SOURCE_ALERT = 0x5
+ PORT_SOURCE_MQ = 0x6
+ PORT_SOURCE_FILE = 0x7
+ PORT_ALERT_SET = 0x1
+ PORT_ALERT_UPDATE = 0x2
+ PORT_ALERT_INVALID = 0x3
+ FILE_ACCESS = 0x1
+ FILE_MODIFIED = 0x2
+ FILE_ATTRIB = 0x4
+ FILE_TRUNC = 0x100000
+ FILE_NOFOLLOW = 0x10000000
+ FILE_DELETE = 0x10
+ FILE_RENAME_TO = 0x20
+ FILE_RENAME_FROM = 0x40
+ UNMOUNTED = 0x20000000
+ MOUNTEDOVER = 0x40000000
+ FILE_EXCEPTION = 0x60000070
+)