Skip to content

Commit

Permalink
Move Solaris flock struct to ffi platform files. #4162
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Sep 20, 2016
1 parent f8da225 commit 01030ab
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 10 deletions.
12 changes: 2 additions & 10 deletions core/src/main/ruby/jruby/kernel/file.rb
Expand Up @@ -184,20 +184,12 @@ def wincode
if defined?(::FFI)

require 'ffi/platform/x86_64-solaris/fcntl'
require 'ffi/platform/x86_64-solaris/fcntl-flock'

module Fcntl
extend FFI::Library
ffi_lib 'c'
attach_function :fcntl, [:short, :short, :varargs], :int
class Flock < FFI::Struct
self.size = 44
layout :l_type, :short, 0,
:l_whence, :short, 2,
:l_start, :off_t, 4,
:l_len, :off_t, 12,
:l_sysid, :int, 20,
:l_pid, :int, 24,
:l_pad, :int, 28
end
end

class File
Expand Down
17 changes: 17 additions & 0 deletions lib/ruby/stdlib/ffi/platform/fcntl-flock.rb.ffi
@@ -0,0 +1,17 @@
module Fcntl
class Flock < FFI::Struct
@@@
struct do |s|
s.name 'struct flock'
s.include 'fcntl.h'
s.field :l_type, :short
s.field :l_whence, :short
s.field :l_start, :off_t
s.field :l_len, :off_t
s.field :l_sysid, :int
s.field :l_pid, :int
s.field :l_pad, :int
end
@@@
end
end
16 changes: 16 additions & 0 deletions lib/ruby/stdlib/ffi/platform/x86_64-solaris/fcntl-flock.rb
@@ -0,0 +1,16 @@
module Fcntl
class Flock < FFI::Struct
self.size = 44
layout :l_type, :short, 0,
:l_whence, :short, 2,
:l_start, :off_t, 4,
:l_len, :off_t, 12,
:l_sysid, :int, 20,
:l_pid, :int, 24,
:l_pad, :int, 28




end
end

0 comments on commit 01030ab

Please sign in to comment.