ffi-libc 0.1.0 → 0.1.1

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
- SHA1:
3
- metadata.gz: 8b34fc7cee6607ace19df65af88ddd4f84c9b9eb
4
- data.tar.gz: 872117aa89b9d0728ab50ebf9d299f88d0af3db5
2
+ SHA256:
3
+ metadata.gz: 0102b721ed989c2427b5531a522da0001f4dfda43cf1c295e8eda3071891e02d
4
+ data.tar.gz: 4e06ead22308e1fdb667d24defc2ea3a069d4737732b1ab046777b663a4d5e00
5
5
  SHA512:
6
- metadata.gz: fcf582bb0a029f134897796dda7eb570931da272ece724473e95a58b3650a3c5dbfa0439061f3277d2107e5b18e758333cf21200d75b51666ebc5ba50b33183e
7
- data.tar.gz: 5c456c33211162a7bd2662b5fbc94d4aea64bf9a0ca904cbe6dfd658817637ef0fe8a77ce67126fe5088bc532a99d066c06e4018b05cb45e942af603cdf3d97a
6
+ metadata.gz: 9c4a840ac2740ba51db453edc891b17db0fae22dfe5cebdf5598107b175377ba2436d1dfebbead02fec119bc10a39703b64fa74595467100c0ee35952871a303
7
+ data.tar.gz: beca1246d6d97ce653c508025f636c70c0dd19ffbd11ff4ffea569495b230f5d401819c89949607c5caa3b94baacc3be4b0c092933f1a2126ac13bfca8fd8fe5
@@ -0,0 +1,29 @@
1
+ name: CI
2
+
3
+ on: [ push, pull_request ]
4
+
5
+ jobs:
6
+ tests:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby:
12
+ - 2.4
13
+ - 2.5
14
+ - 2.6
15
+ - 2.7
16
+ - 3.0
17
+ - jruby
18
+ - truffleruby
19
+ name: Ruby ${{ matrix.ruby }}
20
+ steps:
21
+ - uses: actions/checkout@v2
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby }}
26
+ - name: Install dependencies
27
+ run: bundle install --jobs 4 --retry 3
28
+ - name: Run tests
29
+ run: bundle exec rake test
data/.gitignore CHANGED
@@ -1,4 +1,6 @@
1
- doc
2
- pkg
3
- .bundle
4
- .yardoc
1
+ /Gemfile.lock
2
+ /doc/
3
+ /pkg/
4
+ /.bundle
5
+ /.yardoc
6
+ /vendor/bundle
data/ChangeLog.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 0.1.1 / 2021-09-22
2
+
3
+ * Removed `sys_errlist` and `sys_nerr` variables, as they have been removed
4
+ from glibc (see:
5
+ https://sourceware.org/pipermail/libc-announce/2020/000029.html).
6
+ * Load `libc` via `FFI::Library::LIBC`.
7
+
1
8
  ### 0.1.0 / 2013-08-15
2
9
 
3
10
  * Require ffi ~> 1.0.
@@ -24,7 +31,7 @@
24
31
  * Skip `clearenv`, `memrchr`, `stdin`, `stdout` and `stderr` if they cannot
25
32
  be loaded (thanks FreneticEntropy and mephux).
26
33
  * The `libc` installed on OSX lacks these functions/global-variables.
27
- * Opt into [test.rubygems.org](http://test.rubygems.org/).
34
+ * Opt into `test.rubygems.org`.
28
35
 
29
36
  ### 0.0.4 / 2011-02-03
30
37
 
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'rake'
7
+ gem 'rubygems-tasks', '~> 0.2'
8
+ gem 'rspec', '~> 3.0'
9
+ gem 'kramdown'
10
+ gem 'yard', '~> 0.9'
11
+ end
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2013 Hal Brodigan
1
+ Copyright (c) 2010-2021 Hal Brodigan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # ffi-libc
2
2
 
3
+ [![CI](https://github.com/postmodern/ffi-libc/actions/workflows/ruby.yml/badge.svg)](https://github.com/postmodern/ffi-libc/actions/workflows/ruby.yml)
4
+ [![Code Climate](https://codeclimate.com/github/postmodern/ffi-libc.svg)](https://codeclimate.com/github/postmodern/ffi-libc)
5
+
3
6
  * [Source](https://github.com/postmodern/ffi-libc/)
4
7
  * [Issues](https://github.com/postmodern/ffi-libc/issues)
5
- * [Documentation](http://rubydoc.info/gems/ffi-libc)
6
- * [Email](postmodern.mod3 at gmail.com)
8
+ * [Documentation](https://rubydoc.info/gems/ffi-libc)
7
9
 
8
10
  ## Description
9
11
 
@@ -25,8 +27,8 @@ Useful Ruby FFI bindings for `libc`.
25
27
  * {FFI::LibC::RUsage}
26
28
  * Binds to common functions and global variables in `libc`:
27
29
  * `errno.h`:
28
- * `sys_errlist`
29
- * `sys_nerr`
30
+ * `sys_errlist` (BSD)
31
+ * `sys_nerr` (BSD)
30
32
  * `errno`
31
33
  * `unistd.h`:
32
34
  * `brk`
@@ -107,11 +109,25 @@ Useful Ruby FFI bindings for `libc`.
107
109
 
108
110
  ## Install
109
111
 
110
- $ gem install ffi-libc
112
+ ```shell
113
+ $ gem install ffi-libc
114
+ ```
115
+
116
+ ### gemspec
117
+
118
+ ```ruby
119
+ gem.add_dependency 'ffi-libc', '~> 0.1'
120
+ ```
121
+
122
+ ### Gemfile
123
+
124
+ ```ruby
125
+ gem 'ffi-libc', '~> 0.1'
126
+ ```
111
127
 
112
128
  ## License
113
129
 
114
- Copyright (c) 2010-2013 Hal Brodigan
130
+ Copyright (c) 2010-2021 Hal Brodigan
115
131
 
116
132
  See {file:LICENSE.txt} for license information.
117
133
 
data/Rakefile CHANGED
@@ -1,36 +1,13 @@
1
1
  require 'rubygems'
2
- require 'rake'
3
2
 
4
- begin
5
- gem 'rubygems-tasks', '~> 0.1'
6
- require 'rubygems/tasks'
3
+ require 'rubygems/tasks'
4
+ Gem::Tasks.new
7
5
 
8
- Gem::Tasks.new
9
- rescue LoadError => e
10
- STDERR.puts e.message
11
- STDERR.puts "Run `gem install rubygems-tasks` to install 'rubygems/tasks'."
12
- end
13
-
14
- begin
15
- gem 'rspec', '~> 2.4'
16
- require 'rspec/core/rake_task'
17
-
18
- RSpec::Core::RakeTask.new
19
- rescue LoadError => e
20
- task :spec do
21
- abort "Please run `gem install rspec` to install RSpec."
22
- end
23
- end
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new
24
8
  task :test => :spec
25
9
  task :default => :spec
26
10
 
27
- begin
28
- gem 'yard', '~> 0.8'
29
- require 'yard'
30
-
31
- YARD::Rake::YardocTask.new
32
- rescue LoadError => e
33
- task :yard do
34
- abort "Please run `gem install yard` to install YARD."
35
- end
36
- end
11
+ require 'yard'
12
+ YARD::Rake::YardocTask.new
13
+ task :doc => :yard
data/ffi-libc.gemspec CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |gem|
20
20
  gem.authors = Array(gemspec['authors'])
21
21
  gem.email = gemspec['email']
22
22
  gem.homepage = gemspec['homepage']
23
+ gem.metadata = gemspec['metadata'] if gemspec['metadata']
23
24
 
24
25
  glob = lambda { |patterns| gem.files & Dir[*patterns] }
25
26
 
data/gemspec.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: ffi-libc
2
- version: 0.1.0
2
+ version: 0.1.1
3
3
  summary: Useful FFI bindings for libc
4
4
  description: Useful Ruby FFI bindings for libc.
5
5
  license: MIT
@@ -8,10 +8,14 @@ email: postmodern.mod3@gmail.com
8
8
  homepage: https://github.com/postmodern/ffi-libc#redme
9
9
  has_yard: true
10
10
 
11
+ metadata:
12
+ documentation_uri: https://rubydoc.info/gems/ffi-libc
13
+ source_code_uri: https://github.com/postmodern/ffi-libc
14
+ bug_tracker_uri: https://github.com/postmodern/ffi-libc/issues
15
+ changelog_uri: https://github.com/postmodern/ffi-libc/blob/master/ChangeLog.md
16
+
11
17
  dependencies:
12
18
  ffi: ~> 1.0
13
19
 
14
20
  development_dependencies:
15
- rubygems-tasks: ~> 0.1
16
- rspec: ~> 2.4
17
- yard: ~> 0.8
21
+ bundler: ~> 2.0
data/lib/ffi/libc/libc.rb CHANGED
@@ -10,14 +10,17 @@ module FFI
10
10
  module LibC
11
11
  extend FFI::Library
12
12
 
13
- ffi_lib [FFI::CURRENT_PROCESS, 'c']
13
+ ffi_lib FFI::Library::LIBC
14
14
 
15
15
  # The NULL constant
16
16
  NULL = nil
17
17
 
18
18
  # errno.h
19
- attach_variable :sys_errlist, :pointer
20
- attach_variable :sys_nerr, :int
19
+ begin
20
+ attach_variable :sys_errlist, :pointer
21
+ attach_variable :sys_nerr, :int
22
+ rescue FFI::NotFoundError
23
+ end
21
24
  attach_variable :errno, :int
22
25
 
23
26
  def self.raise_error(error=self.errno)
data/spec/ifaddrs_spec.rb CHANGED
@@ -5,26 +5,26 @@ describe Ifaddrs do
5
5
  subject { LibC.each_ifaddr.first }
6
6
 
7
7
  it "should have a name" do
8
- subject.name.should_not be_empty
8
+ expect(subject.name).to_not be_empty
9
9
  end
10
10
 
11
11
  it "should have flags" do
12
- subject.flags.should be_kind_of(Integer)
12
+ expect(subject.flags).to be_kind_of(Integer)
13
13
  end
14
14
 
15
15
  it "should have an addr" do
16
- subject.addr.should be_kind_of(Sockaddr)
16
+ expect(subject.addr).to be_kind_of(Sockaddr)
17
17
  end
18
18
 
19
19
  it "should have an netmask" do
20
- subject.netmask.should be_kind_of(Sockaddr)
20
+ expect(subject.netmask).to be_kind_of(Sockaddr)
21
21
  end
22
22
 
23
23
  it "should have a broadcast addr" do
24
- subject.broadaddr.should be_kind_of(Sockaddr)
24
+ expect(subject.broadaddr).to be_kind_of(Sockaddr)
25
25
  end
26
26
 
27
27
  it "should have a destination addr" do
28
- subject.dstaddr.should be_kind_of(Sockaddr)
28
+ expect(subject.dstaddr).to be_kind_of(Sockaddr)
29
29
  end
30
30
  end
data/spec/libc_spec.rb CHANGED
@@ -5,7 +5,7 @@ describe FFI::LibC do
5
5
  describe "NULL" do
6
6
  subject { described_class::NULL }
7
7
 
8
- it { should == nil }
8
+ it { expect(subject).to be == nil }
9
9
  end
10
10
 
11
11
  describe "each_ifaddr" do
@@ -16,13 +16,13 @@ describe FFI::LibC do
16
16
  addrs << ifaddr
17
17
  end
18
18
 
19
- addrs.all? { |addr| addr.kind_of?(Ifaddrs) }.should be_true
19
+ expect(addrs).to all(be_kind_of(Ifaddrs))
20
20
  end
21
21
 
22
22
  context "when not given a block" do
23
23
  subject { described_class.each_ifaddr }
24
24
 
25
- it { should be_kind_of(Enumerable) }
25
+ it { expect(subject).to be_kind_of(Enumerable) }
26
26
  end
27
27
  end
28
28
 
@@ -30,7 +30,7 @@ describe FFI::LibC do
30
30
  subject { described_class.rusage }
31
31
 
32
32
  it "should be able to fetch its own memory usage" do
33
- subject[:ru_maxrss].should be > 4000
33
+ expect(subject[:ru_maxrss]).to be > 4000
34
34
  end
35
35
  end
36
36
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,5 @@
1
- gem 'rspec', '~> 2.4'
2
1
  require 'rspec'
3
-
4
2
  require 'ffi/libc'
3
+
5
4
  include FFI
6
5
  include FFI::LibC
metadata CHANGED
@@ -1,71 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-libc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-15 00:00:00.000000000 Z
11
+ date: 2021-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rubygems-tasks
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.1'
33
+ version: '2.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.1'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ~>
46
- - !ruby/object:Gem::Version
47
- version: '2.4'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: '2.4'
55
- - !ruby/object:Gem::Dependency
56
- name: yard
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: '0.8'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ~>
67
- - !ruby/object:Gem::Version
68
- version: '0.8'
40
+ version: '2.0'
69
41
  description: Useful Ruby FFI bindings for libc.
70
42
  email: postmodern.mod3@gmail.com
71
43
  executables: []
@@ -75,12 +47,12 @@ extra_rdoc_files:
75
47
  - LICENSE.txt
76
48
  - README.md
77
49
  files:
78
- - .gemtest
79
- - .gitignore
80
- - .rspec
81
- - .travis.yml
82
- - .yardopts
50
+ - ".github/workflows/ruby.yml"
51
+ - ".gitignore"
52
+ - ".rspec"
53
+ - ".yardopts"
83
54
  - ChangeLog.md
55
+ - Gemfile
84
56
  - LICENSE.txt
85
57
  - README.md
86
58
  - Rakefile
@@ -108,25 +80,28 @@ files:
108
80
  homepage: https://github.com/postmodern/ffi-libc#redme
109
81
  licenses:
110
82
  - MIT
111
- metadata: {}
112
- post_install_message:
83
+ metadata:
84
+ documentation_uri: https://rubydoc.info/gems/ffi-libc
85
+ source_code_uri: https://github.com/postmodern/ffi-libc
86
+ bug_tracker_uri: https://github.com/postmodern/ffi-libc/issues
87
+ changelog_uri: https://github.com/postmodern/ffi-libc/blob/master/ChangeLog.md
88
+ post_install_message:
113
89
  rdoc_options: []
114
90
  require_paths:
115
91
  - lib
116
92
  required_ruby_version: !ruby/object:Gem::Requirement
117
93
  requirements:
118
- - - '>='
94
+ - - ">="
119
95
  - !ruby/object:Gem::Version
120
96
  version: '0'
121
97
  required_rubygems_version: !ruby/object:Gem::Requirement
122
98
  requirements:
123
- - - '>='
99
+ - - ">="
124
100
  - !ruby/object:Gem::Version
125
101
  version: '0'
126
102
  requirements: []
127
- rubyforge_project:
128
- rubygems_version: 2.0.5
129
- signing_key:
103
+ rubygems_version: 3.2.22
104
+ signing_key:
130
105
  specification_version: 4
131
106
  summary: Useful FFI bindings for libc
132
107
  test_files: []
data/.gemtest DELETED
File without changes
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- language: ruby
2
- before_install:
3
- - gem install ffi rubygems-tasks rspec yard
4
- rvm:
5
- - 1.9.3
6
- - 2.0.0
7
- - jruby
8
- - rbx-18mode
9
- - rbx-19mode
10
- matrix:
11
- allow_failures:
12
- - rvm: rbx-18mode
13
- - rvm: rbx-19mode
14
- script: rake test