lib/rb-kqueue/native.rb in rb-kqueue-0.2.4 vs lib/rb-kqueue/native.rb in rb-kqueue-0.2.5
- old
+ new
@@ -11,16 +11,42 @@
# The C struct describing a kqueue event.
#
# @private
class KEvent < FFI::Struct
- layout(
- :ident, :uintptr_t,
- :filter, :int16,
- :flags, :uint16,
- :fflags, :uint32,
- :data, :intptr_t,
- :udata, :pointer)
+ if FFI::Platform::IS_FREEBSD
+ layout(
+ :ident, :uintptr_t,
+ :filter, :short,
+ :flags, :u_short,
+ :fflags, :u_int,
+ :data, :intptr_t,
+ :udata, :pointer)
+ elsif FFI::Platform::IS_NETBSD
+ layout(
+ :ident, :uintptr_t,
+ :filter, :uint32_t,
+ :flags, :uint32_t,
+ :fflags, :uint32_t,
+ :data, :int64_t,
+ :udata, :pointer)
+ elsif FFI::Platform::IS_OPENBSD
+ layout(
+ :ident, :__uintptr_t,
+ :filter, :short,
+ :flags, :u_short,
+ :fflags, :u_int,
+ :data, :quad_t,
+ :udata, :pointer)
+ else
+ layout(
+ :ident, :uintptr_t,
+ :filter, :int16,
+ :flags, :uint16,
+ :fflags, :uint32,
+ :data, :intptr_t,
+ :udata, :pointer)
+ end
end
# The C struct describing a timeout.
#
# @private