systemd-journal 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17f43d104aba0ce7b017388964e8dc82a8552ad2
4
- data.tar.gz: 22fa6ea7f4c044f1d1e27e81b388dc390ee02066
3
+ metadata.gz: 72e715f4febf59e80e5b3ee18156f408e896001c
4
+ data.tar.gz: 9dc1f0c4921b88568469259e56db12c5db850e78
5
5
  SHA512:
6
- metadata.gz: 63fda69b863ca386c990331a565ff787b3b09ca3e14db6bfb3276bc0b291f726a2b0fb89d2d6431ea2147d86cbe548fd01f92cd91af255e5490cbcc30170969b
7
- data.tar.gz: 3455916da4baede72a14514ee20702b4451b1391e746a5e0cbc7db087fefda64d8f29533e4b41585273a37e91f98a4e5638232afb1d97803876d36b6db3f69da
6
+ metadata.gz: 7528d93f609d6e9abcb39fd52cb1b9572760ac2d09cd8ada74ae1ec18722fd4829a6625996d10757f7d5180e951af8e3e6db5e42dbb21f1665adb32fa4972aeb
7
+ data.tar.gz: 1466d24d65ab955ecea3b833d054df7b97a20456d26f54d33b1e564d9496bcfc1c5dba8be9c8c624c2789db49dec5b36139aae831527c3b9f93ea73a595480f2
@@ -2,6 +2,8 @@ language: ruby
2
2
  rvm:
3
3
  - 2.1.2
4
4
  - 1.9.3
5
+ - jruby-19mode
6
+
5
7
  before_script:
6
8
  - export PREV_DIR=$(pwd)
7
9
  - sudo apt-get update -qq
@@ -2,14 +2,23 @@ require 'ffi'
2
2
 
3
3
  # @private
4
4
  class FFI::MemoryPointer
5
- # monkey patch a read_size_t and write_size_t method onto FFI::MemoryPointer
6
- p = FFI::MemoryPointer.new(:size_t, 1)
7
- w = case p.size
8
- when 4 then :uint32
9
- when 8 then :uint64
10
- else raise RuntimeError.new("unsupported size_t width: #{p.size}")
11
- end
12
-
13
- alias_method :read_size_t, :"read_#{w}" unless p.respond_to?(:read_size_t)
14
- alias_method :write_size_t, :"write_#{w}" unless p.respond_to?(:write_size_t)
5
+ # monkey patch a read_size_t and write_size_t method onto FFI::MemoryPointer.
6
+ # see https://github.com/ffi/ffi/issues/118
7
+ def self.monkey_patch_type_i_need!(which)
8
+ return if self.respond_to?("read_#{which}")
9
+
10
+ type = FFI.find_type(which)
11
+ type, _ = FFI::TypeDefs.find do |(name, t)|
12
+ method_defined?("read_#{name}") if t == type
13
+ end
14
+
15
+ raise RuntimeError, "Unable to patch in reader/writer for #{which}" if type.nil?
16
+
17
+ alias_method "read_#{which}", "read_#{type}"
18
+ alias_method "write_#{which}", "write_#{type}"
19
+ end
20
+ end
21
+
22
+ [:size_t, :uint64, :uint32].each do |type|
23
+ FFI::MemoryPointer.monkey_patch_type_i_need!(type)
15
24
  end
@@ -282,7 +282,7 @@ module Systemd
282
282
  end
283
283
 
284
284
  def string_from_out_ptr(p, len)
285
- p.read_pointer.read_string_length(len)
285
+ p.read_pointer.read_string(len)
286
286
  end
287
287
 
288
288
  # some sd_journal_* functions return strings that we're expected to free
@@ -1,6 +1,6 @@
1
1
  module Systemd
2
2
  class Journal
3
3
  # The version of the systemd-journal gem.
4
- VERSION = '1.2.1'
4
+ VERSION = '1.2.2'
5
5
  end
6
6
  end
@@ -1,6 +1,8 @@
1
1
  module Systemd
2
2
  class Journal
3
3
  module Waitable
4
+ IS_JRUBY = (RUBY_ENGINE == 'jruby')
5
+
4
6
  # Block until the journal is changed.
5
7
  # @param timeout_usec [Integer] maximum number of microseconds to wait
6
8
  # or `-1` to wait indefinitely.
@@ -14,7 +16,7 @@ module Systemd
14
16
  # @return [Symbol] :append new entries were appened to the journal.
15
17
  # @return [Symbol] :invalidate journal files were added/removed/rotated.
16
18
  def wait(timeout_usec = -1, opts = {})
17
- if opts[:select]
19
+ if opts[:select] && !IS_JRUBY
18
20
  wait_select(timeout_usec)
19
21
  else
20
22
  rc = Native.sd_journal_wait(@ptr, timeout_usec)
@@ -359,9 +359,16 @@ RSpec.describe Systemd::Journal do
359
359
  end
360
360
 
361
361
  it 'can use select' do
362
+ pending "not available on JRUBY" if Systemd::Journal::IS_JRUBY
362
363
  expect(Systemd::Journal::Native).to_not receive(:sd_journal_wait)
363
364
  j.wait(1, select: true)
364
365
  end
366
+
367
+ it 'ignores request to use select on JRuby' do
368
+ pending "not necessary on MRI" unless Systemd::Journal::IS_JRUBY
369
+ expect(Systemd::Journal::Native).to receive(:sd_journal_wait)
370
+ j.wait(1, select: true)
371
+ end
365
372
  end
366
373
 
367
374
  describe 'wait_select_reliable?' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: systemd-journal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Ledbetter
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-20 00:00:00.000000000 Z
12
+ date: 2014-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi