win32-mmap 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +3 -2
- data/README +39 -40
- data/Rakefile +5 -5
- data/lib/win32/mmap.rb +392 -397
- data/lib/win32/windows/constants.rb +34 -0
- data/lib/win32/windows/functions.rb +50 -0
- data/lib/win32/windows/structs.rb +28 -0
- data/test/test_win32_mmap.rb +96 -96
- data/win32-mmap.gemspec +2 -4
- metadata +45 -50
data/CHANGES
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
+
== 0.3.0 - 10-Apr-2013
|
2
|
+
* Converted code to use FFI.
|
3
|
+
|
1
4
|
== 0.2.4 - 28-Apr-2010
|
2
5
|
* The Rakefile was refactored. It now handles gem creation, building and
|
3
6
|
cleanup.
|
4
7
|
* Inline code was removed from the gemspec.
|
5
|
-
* Removed the doc directory from the repository. The information that was
|
6
|
-
there is already covered in the README.
|
7
8
|
|
8
9
|
== 0.2.3 - 12-Aug-2009
|
9
10
|
* Changed license to Artistic 2.0.
|
data/README
CHANGED
@@ -1,65 +1,64 @@
|
|
1
1
|
= Description
|
2
|
-
|
2
|
+
This package provides a Ruby interface for memory mapped I/O on MS Windows.
|
3
3
|
|
4
4
|
= Prerequisites
|
5
|
-
|
6
|
-
windows-pr, 0.5.5 or later.
|
5
|
+
windows-pr, 0.5.5 or later.
|
7
6
|
|
8
7
|
= Installation
|
9
|
-
|
8
|
+
gem install win32-mmap
|
10
9
|
|
11
10
|
= Synopsis
|
12
|
-
|
13
|
-
|
11
|
+
require 'win32/mmap'
|
12
|
+
include Win32
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
map1 = MMap.new(:file => "C:\\test.map", :size => 1024)
|
15
|
+
map1.foo = 'hello'
|
16
|
+
map1.bar = 77
|
17
|
+
map1.close
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
map2 = MMap.new(:file => "C:\\test.map")
|
20
|
+
p map2.foo # 'hello'
|
21
|
+
p map2.bar # 77
|
22
|
+
map2.close
|
24
23
|
|
25
24
|
= About Memory Mapped Files under Windows
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
25
|
+
Under Windows, code and data are both repesented by pages of memory backed
|
26
|
+
by files on disk, code by executable image and data by system pagefile
|
27
|
+
(i.e. swapfile). These are called memory mapped files. Memory mapped files
|
28
|
+
can be used to provide a mechanism for shared memory between processes.
|
29
|
+
Different processes are able to share data backed by the same swapfile,
|
30
|
+
whether it's the system pagefile or a user-defined swapfile.
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
Windows has a tight security system that prevents processes from directly
|
33
|
+
sharing information among each other, but mapped memory files provide a
|
34
|
+
mechanism that works with the Windows security system by using a name that
|
35
|
+
all processes use to open the swapfile.
|
37
36
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
37
|
+
A shared section of the swapfile is translated into pages of memory that are
|
38
|
+
addressable by more than one process, Windows uses a system resource called a
|
39
|
+
prototype page table entry (PPTE) to enable more than one process to address
|
40
|
+
the same physical page of memory, thus multiple process can share the same
|
41
|
+
data without violating the Windows system security.
|
43
42
|
|
44
|
-
|
43
|
+
In short, memory mapped files provide shared memory under Windows.
|
45
44
|
|
46
|
-
|
47
|
-
|
45
|
+
(This explanation was largely borrowed from Roger Lee's Win32::MMF Perl
|
46
|
+
module.)
|
48
47
|
|
49
48
|
= Future Plans
|
50
|
-
|
49
|
+
Suggestions welcome.
|
51
50
|
|
52
51
|
= License
|
53
|
-
|
52
|
+
Artistic 2.0
|
54
53
|
|
55
54
|
= Copyright
|
56
|
-
|
55
|
+
(C) 2003-2013 Daniel J. Berger, All Rights Reserved
|
57
56
|
|
58
57
|
= Warranty
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
This package is provided "as is" and without any express or
|
59
|
+
implied warranties, including, without limitation, the implied
|
60
|
+
warranties of merchantability and fitness for a particular purpose.
|
62
61
|
|
63
62
|
= Authors
|
64
|
-
|
65
|
-
|
63
|
+
Daniel J. Berger
|
64
|
+
Park Heesob
|
data/Rakefile
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
require 'rake'
|
2
|
+
require 'rake/clean'
|
2
3
|
require 'rake/testtask'
|
3
4
|
|
4
|
-
|
5
|
-
desc 'Delete any gem files in the project.'
|
6
|
-
task :clean do
|
7
|
-
Dir['*.gem'].each{ |f| File.delete(f) }
|
8
|
-
end
|
5
|
+
CLEAN.include('**/*.gem')
|
9
6
|
|
7
|
+
namespace 'gem' do
|
10
8
|
desc 'Create the win32-mmap gem.'
|
11
9
|
task :create => [:clean] do
|
12
10
|
spec = eval(IO.read('win32-mmap.gemspec'))
|
@@ -41,3 +39,5 @@ Rake::TestTask.new do |t|
|
|
41
39
|
t.verbose = true
|
42
40
|
t.warning = true
|
43
41
|
end
|
42
|
+
|
43
|
+
task :default => :test
|