Skip to content

Commit

Permalink
Change the struct member data to int64_t
Browse files Browse the repository at this point in the history
It also changed in FreeBSD 12 from intptr_t to an int64_T
  • Loading branch information
meanphil authored and gregschmit committed Jul 25, 2023
1 parent 6c583d8 commit f6d54d1
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions lib/rb-kqueue/native.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,28 @@ module Native
# @private
class KEvent < FFI::Struct
if FFI::Platform::IS_FREEBSD
# The FFI gem incorrectly determines the freebsd version, by ignoring
# the decimal place
freebsd_version = RbConfig::CONFIG['host_os'].gsub(/[^\d.]/, '').to_f

fields = [
:ident, :uintptr_t,
:filter, :short,
:flags, :u_short,
:fflags, :u_int,
:data, :intptr_t,
:udata, :pointer ]

# The FFI gem incorrectly determines the freebsd version, by ignoring
# the decimal place
freebsd_version = RbConfig::CONFIG['host_os'].gsub(/[^\d.]/, '').to_f
:fflags, :u_int ]

if freebsd_version >= 12.0
fields.push(:ext, [ :u_int64_t, 4 ])
fields.push(
:data, :int64_t,
:udata, :pointer,
:ext, [ :u_int64_t, 4 ])
else
# FreeBSD 11 has no ext member, and uses intptr_t for
# data member
fields.push(
:data, :intptr_t,
:udata, :pointer
)
end

layout(*fields)
Expand Down

0 comments on commit f6d54d1

Please sign in to comment.