summaryrefslogtreecommitdiffstats
path: root/mmap.rd
blob: ac109df71998b208b5f3f784e40e1aac9795d66a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
=begin
= Mmap

((<Download|URL:ftp://moulon.inra.fr/pub/ruby/>))

The Mmap class implement memory-mapped file objects

=== WARNING
((*The variables $' and $` are not available with gsub! and sub!*))

== SuperClass

Object

== Included Modules

* Comparable
* Enumerable

== Class Methods

--- lockall(flag)
      disable paging of all pages mapped. ((|flag|)) can be 
      ((|Mmap::MCL_CURRENT|)) or ((|Mmap::MCL_FUTURE|))

--- new(file, [mode [, protection [, options]]])
      create a new object

        : ((|file|))
            Pathname of the file, if ((|nil|)) is given an anonymous map
            is created ((|Mmanp::MAP_ANON|))

        : ((|mode|))
            Mode to open the file, it can be "r", "w" or "rw"

        : ((|protection|))
            specify the nature of the mapping

               : ((|Mmap::MAP_SHARED|))
                   Creates a mapping that's shared with all other processes 
                   mapping the same areas of the file. 
                   The default value is ((|Mmap::MAP_SHARED|))

               : ((|Mmap::MAP_PRIVATE|))
                   Creates a private copy-on-write mapping, so changes to the
                   contents of the mmap object will be private to this process

        : ((|options|))
            Hash. If one of the options ((|length|)) or ((|offset|))
            is specified it will not possible to modify the size of
            the mapped file.

               : ((|length|))
                   Maps ((|length|)) bytes from the file

               : ((|offset|))
                   The mapping begin at ((|offset|))

               : ((|advice|))
                   The type of the access (see #madvise)


--- unlockall
     reenable paging

== Methods

--- extend(count)
     add ((|count|)) bytes to the file (i.e. pre-extend the file) 

--- madvise(advice)
     ((|advice|)) can have the value ((|Mmap::MADV_NORMAL|)),
     ((|Mmap::MADV_RANDOM|)), ((|Mmap::MADV_SEQUENTIAL|)),
     ((|Mmap::MADV_WILLNEED|)), ((|Mmap::MADV_DONTNEED|))

--- mprotect(mode)
     change the mode, value must be "r", "w" or "rw"

--- mlock
     disable paging

--- msync
--- flush
     flush the file

--- munlock
     reenable paging

--- munmap
     terminate the association

=== Other methods with the same syntax than the methods of ((|String|))

self == other 

self > other 

self >= other 

self < other 

self <= other 

self === other 

self << other 

self =~ other 

self[nth] 

self[start..last] 

self[start, length] 

self[nth] = val 

self[start..last] = val 

self[start, len] = val 

self <=> other 

<<(other) 

casecmp(other)   >= 1.7.1

concat(other) 

capitalize! 

chop! 

chomp!([rs]) 

count(o1 [, o2, ...])

crypt(salt) 

delete!(str) 

downcase! 

each_byte {|char|...} 

each([rs]) {|line|...} 

each_line([rs]) {|line|...} 

empty? 

freeze 

frozen 

gsub!(pattern, replace) 

gsub!(pattern) {...}

include?(other) 

index(substr[, pos]) 

insert(index, str) >= 1.7.1

length 

reverse! 

rindex(substr[, pos]) 

scan(pattern) 

scan(pattern) {...} 

size 

slice

slice!

split([sep[, limit]]) 

squeeze!([str]) 

strip! 

sub!(pattern, replace) 

sub!(pattern) {...} 

sum([bits]) 

swapcase! 

tr!(search, replace) 

tr_s!(search, replace) 

upcase! 

=end