mincore 0.0.5 → 0.0.6.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mincore.rb +31 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db489c0707b162e276f08bcf675b39fdacfceeec
|
4
|
+
data.tar.gz: 95148fc52b82a6bd2797dc5c2c1a1731296d1d57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51eb94fe5fdd795fc6f9eac3645539a178dfd741edf1a618d888db6c2acdcda031c695b62f470b65ccde9505f37cc43f60f4a2e28d604aa186e0ef5c9a459cf2
|
7
|
+
data.tar.gz: ef6fe92b26a7f839a00328219a17c0dd7a5b05fcde3e52ac099f026f9d49768dd4c596c3c14bba84573de6c8028f6365a3d83352f97378e8bfc956e76a8be953
|
data/lib/mincore.rb
CHANGED
@@ -3,11 +3,10 @@ require 'inline'
|
|
3
3
|
# The File mincore extension
|
4
4
|
class File
|
5
5
|
|
6
|
-
# get pagesize (4096 on Intel)
|
7
6
|
inline do |builder|
|
8
7
|
builder.include("<unistd.h>")
|
9
8
|
builder.c_raw_singleton "
|
10
|
-
static VALUE
|
9
|
+
static VALUE _PAGESIZE(int argc, VALUE *argv, VALUE self) {
|
11
10
|
int size = getpagesize();
|
12
11
|
return rb_int_new(size);
|
13
12
|
}
|
@@ -157,14 +156,41 @@ C_CODE
|
|
157
156
|
# Arguments:
|
158
157
|
# filename: (String)
|
159
158
|
# count: (Int)
|
159
|
+
#
|
160
160
|
def self.cachedel(filename, count=1)
|
161
161
|
self._cachedel(filename, count)
|
162
162
|
end
|
163
|
+
|
164
|
+
# Returns page cache status for a given file.
|
165
|
+
# Status is provided as a boolean array of size
|
166
|
+
# ( filesize + PAGESIZE -1 ) / PAGESIZE
|
167
|
+
#
|
168
|
+
# Example:
|
169
|
+
# >> File.mincore("/path/to/important/file")
|
170
|
+
# => [true, true, true....]
|
171
|
+
#
|
172
|
+
# Arguments:
|
173
|
+
# filename: (String)
|
174
|
+
#
|
175
|
+
def self.mincore(*args)
|
176
|
+
self._mincore(*args)
|
177
|
+
end
|
163
178
|
|
164
|
-
#
|
165
|
-
|
166
|
-
|
179
|
+
# get system pagesize (4096 on Intel)
|
180
|
+
#
|
181
|
+
# Example:
|
182
|
+
# >> File.PAGESIZE
|
183
|
+
# => 4096
|
184
|
+
def self.PAGESIZE
|
185
|
+
self._PAGESIZE
|
167
186
|
end
|
168
187
|
|
188
|
+
|
189
|
+
|
190
|
+
#this should work: http://stackoverflow.com/questions/13408136/how-can-i-dynamically-define-an-alias-method-for-a-class-method
|
191
|
+
#class << self
|
192
|
+
# alias_method :mincore, :_mincore
|
193
|
+
#end
|
194
|
+
|
169
195
|
end
|
170
196
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mincore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reda NOUSHI
|
@@ -60,12 +60,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
60
|
version: '0'
|
61
61
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
62
|
requirements:
|
63
|
-
- - '
|
63
|
+
- - '>'
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
65
|
+
version: 1.3.1
|
66
66
|
requirements: []
|
67
67
|
rubyforge_project:
|
68
|
-
rubygems_version: 2.
|
68
|
+
rubygems_version: 2.0.3
|
69
69
|
signing_key:
|
70
70
|
specification_version: 4
|
71
71
|
summary: Ruby bindings for Linux cache manipulation
|