syscalls-map 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.rdoc +49 -0
- data/Rakefile +1 -0
- data/lib/syscalls-map.rb +30 -0
- data/lib/syscalls-map/version.rb +3 -0
- data/syscalls-map.gemspec +20 -0
- metadata +56 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
= Syscalls::BY_NAME, Syscalls::BY_NUMBER
|
2
|
+
|
3
|
+
== About
|
4
|
+
|
5
|
+
Parses /usr/include/asm/unistd_*.h at require-time
|
6
|
+
and creates two hash-constants; Syscalls::BY_NAME, Syscalls::BY_NUMBER.
|
7
|
+
|
8
|
+
== Installation
|
9
|
+
|
10
|
+
gem install syscalls-map
|
11
|
+
|
12
|
+
|
13
|
+
== Usage
|
14
|
+
|
15
|
+
require 'syscalls-map'
|
16
|
+
|
17
|
+
puts Syscalls::BY_NAME['open'] #=> 2
|
18
|
+
puts Syscalls::BY_NUMBER[2] #=> 'open'
|
19
|
+
|
20
|
+
|
21
|
+
== Disclaimer
|
22
|
+
|
23
|
+
* This is not portable.
|
24
|
+
* It will work on most Linuxes and bail out with "FileNotFound" otherwise.
|
25
|
+
* unistd_*.h might not match your running kernel.
|
26
|
+
|
27
|
+
|
28
|
+
== License (MIT)
|
29
|
+
|
30
|
+
Copyright (C) 2011 by moe@busyloop.net
|
31
|
+
|
32
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
33
|
+
of this software and associated documentation files (the "Software"), to deal
|
34
|
+
in the Software without restriction, including without limitation the rights
|
35
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
36
|
+
copies of the Software, and to permit persons to whom the Software is
|
37
|
+
furnished to do so, subject to the following conditions:
|
38
|
+
|
39
|
+
The above copyright notice and this permission notice shall be included in
|
40
|
+
all copies or substantial portions of the Software.
|
41
|
+
|
42
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
43
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
44
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
45
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
46
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
47
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
48
|
+
THE SOFTWARE.
|
49
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/syscalls-map.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "syscalls-map/version"
|
2
|
+
|
3
|
+
# Copyright (C) 2011 by moe@busyloop.net
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
module Syscalls
|
24
|
+
BY_NAME = Hash[*File.read( \
|
25
|
+
"/usr/include/asm/unistd_#{['x'].pack('p').size*8}.h"). \
|
26
|
+
scan(/^#define __NR_([^ \t]+)[ \t]+(\d+)$/m).flatten]. \
|
27
|
+
inject({}) { |h, (k,v)| h[k] = v.to_i; h }
|
28
|
+
|
29
|
+
BY_NUMBER = BY_NAME.invert
|
30
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "syscalls-map/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "syscalls-map"
|
7
|
+
s.version = Syscalls::VERSION
|
8
|
+
s.authors = ["Moe"]
|
9
|
+
s.email = ["moe@busyloop.net"]
|
10
|
+
s.homepage = "https://github.com/busyloop/syscalls-map"
|
11
|
+
s.summary = %q{Parses /usr/include/asm/unistd_*.h at require-time
|
12
|
+
and creates two hash-constants; Syscalls::BY_NAME, Syscalls::BY_NUMBER.}
|
13
|
+
s.description = %q{Parses /usr/include/asm/unistd_*.h at require-time
|
14
|
+
and creates two hash-constants; Syscalls::BY_NAME, Syscalls::BY_NUMBER.}
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: syscalls-map
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Moe
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-09 00:00:00.000000000Z
|
13
|
+
dependencies: []
|
14
|
+
description: ! 'Parses /usr/include/asm/unistd_*.h at require-time
|
15
|
+
|
16
|
+
and creates two hash-constants; Syscalls::BY_NAME, Syscalls::BY_NUMBER.'
|
17
|
+
email:
|
18
|
+
- moe@busyloop.net
|
19
|
+
executables: []
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- .gitignore
|
24
|
+
- Gemfile
|
25
|
+
- README.rdoc
|
26
|
+
- Rakefile
|
27
|
+
- lib/syscalls-map.rb
|
28
|
+
- lib/syscalls-map/version.rb
|
29
|
+
- syscalls-map.gemspec
|
30
|
+
homepage: https://github.com/busyloop/syscalls-map
|
31
|
+
licenses: []
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirements: []
|
49
|
+
rubyforge_project:
|
50
|
+
rubygems_version: 1.8.10
|
51
|
+
signing_key:
|
52
|
+
specification_version: 3
|
53
|
+
summary: Parses /usr/include/asm/unistd_*.h at require-time and creates two hash-constants;
|
54
|
+
Syscalls::BY_NAME, Syscalls::BY_NUMBER.
|
55
|
+
test_files: []
|
56
|
+
has_rdoc:
|