prometheus-client-mmap 1.1.0-x86_64-linux → 1.1.1-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/fast_mmaped_file_rs/Cargo.lock +211 -150
- data/ext/fast_mmaped_file_rs/Cargo.toml +5 -5
- data/ext/fast_mmaped_file_rs/src/error.rs +0 -8
- data/ext/fast_mmaped_file_rs/src/mmap/inner.rs +13 -38
- data/ext/fast_mmaped_file_rs/src/mmap.rs +5 -71
- data/lib/2.7/fast_mmaped_file_rs.so +0 -0
- data/lib/3.0/fast_mmaped_file_rs.so +0 -0
- data/lib/3.1/fast_mmaped_file_rs.so +0 -0
- data/lib/3.2/fast_mmaped_file_rs.so +0 -0
- data/lib/3.3/fast_mmaped_file_rs.so +0 -0
- data/lib/prometheus/client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 914e6d4dd4b7a3ce68941dc640e7ba7ed87a78d1d1ec573dd4b87297ea88613d
|
4
|
+
data.tar.gz: ff0ca2b67792a69ac2ca7b6266957bd9ecac0fcdb926bd423fbd6df3bff3ff7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e71add028d67ee00704589757a872fcbbfc8168fb7485626edda7a58a912bc7226965c05b1cb3889c3877836142346f6f58908483e6918ecf48417bca7bfd6fd
|
7
|
+
data.tar.gz: dda3bee0d645a344fe34751dbbabc4678aef1e89cf376a5135bdc3ea1d9869c83b192c6cabd1ebd317f37b6d676cae10c0456bfbfc1e72c990b75eb95e05ed5a
|
@@ -4,24 +4,31 @@ version = 3
|
|
4
4
|
|
5
5
|
[[package]]
|
6
6
|
name = "ahash"
|
7
|
-
version = "0.8.
|
7
|
+
version = "0.8.7"
|
8
8
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
9
|
-
checksum = "
|
9
|
+
checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01"
|
10
10
|
dependencies = [
|
11
11
|
"cfg-if",
|
12
12
|
"once_cell",
|
13
13
|
"version_check",
|
14
|
+
"zerocopy",
|
14
15
|
]
|
15
16
|
|
16
17
|
[[package]]
|
17
18
|
name = "aho-corasick"
|
18
|
-
version = "
|
19
|
+
version = "1.1.2"
|
19
20
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
20
|
-
checksum = "
|
21
|
+
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
|
21
22
|
dependencies = [
|
22
23
|
"memchr",
|
23
24
|
]
|
24
25
|
|
26
|
+
[[package]]
|
27
|
+
name = "allocator-api2"
|
28
|
+
version = "0.2.16"
|
29
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
30
|
+
checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
|
31
|
+
|
25
32
|
[[package]]
|
26
33
|
name = "autocfg"
|
27
34
|
version = "1.1.0"
|
@@ -30,11 +37,11 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
|
30
37
|
|
31
38
|
[[package]]
|
32
39
|
name = "bindgen"
|
33
|
-
version = "0.69.
|
40
|
+
version = "0.69.2"
|
34
41
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
35
|
-
checksum = "
|
42
|
+
checksum = "a4c69fae65a523209d34240b60abe0c42d33d1045d445c0839d8a4894a736e2d"
|
36
43
|
dependencies = [
|
37
|
-
"bitflags 2.
|
44
|
+
"bitflags 2.4.2",
|
38
45
|
"cexpr",
|
39
46
|
"clang-sys",
|
40
47
|
"lazy_static",
|
@@ -56,9 +63,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|
56
63
|
|
57
64
|
[[package]]
|
58
65
|
name = "bitflags"
|
59
|
-
version = "2.
|
66
|
+
version = "2.4.2"
|
60
67
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
61
|
-
checksum = "
|
68
|
+
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
|
62
69
|
|
63
70
|
[[package]]
|
64
71
|
name = "block-buffer"
|
@@ -71,21 +78,15 @@ dependencies = [
|
|
71
78
|
|
72
79
|
[[package]]
|
73
80
|
name = "bstr"
|
74
|
-
version = "1.
|
81
|
+
version = "1.9.0"
|
75
82
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
76
|
-
checksum = "
|
83
|
+
checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc"
|
77
84
|
dependencies = [
|
78
85
|
"memchr",
|
79
86
|
"regex-automata",
|
80
87
|
"serde",
|
81
88
|
]
|
82
89
|
|
83
|
-
[[package]]
|
84
|
-
name = "cc"
|
85
|
-
version = "1.0.79"
|
86
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
87
|
-
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
|
88
|
-
|
89
90
|
[[package]]
|
90
91
|
name = "cexpr"
|
91
92
|
version = "0.6.0"
|
@@ -103,9 +104,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
103
104
|
|
104
105
|
[[package]]
|
105
106
|
name = "clang-sys"
|
106
|
-
version = "1.
|
107
|
+
version = "1.7.0"
|
107
108
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
108
|
-
checksum = "
|
109
|
+
checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1"
|
109
110
|
dependencies = [
|
110
111
|
"glob",
|
111
112
|
"libc",
|
@@ -114,9 +115,9 @@ dependencies = [
|
|
114
115
|
|
115
116
|
[[package]]
|
116
117
|
name = "cpufeatures"
|
117
|
-
version = "0.2.
|
118
|
+
version = "0.2.12"
|
118
119
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
119
|
-
checksum = "
|
120
|
+
checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504"
|
120
121
|
dependencies = [
|
121
122
|
"libc",
|
122
123
|
]
|
@@ -143,23 +144,12 @@ dependencies = [
|
|
143
144
|
|
144
145
|
[[package]]
|
145
146
|
name = "errno"
|
146
|
-
version = "0.3.
|
147
|
+
version = "0.3.8"
|
147
148
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
148
|
-
checksum = "
|
149
|
+
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
|
149
150
|
dependencies = [
|
150
|
-
"errno-dragonfly",
|
151
|
-
"libc",
|
152
|
-
"windows-sys",
|
153
|
-
]
|
154
|
-
|
155
|
-
[[package]]
|
156
|
-
name = "errno-dragonfly"
|
157
|
-
version = "0.1.2"
|
158
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
159
|
-
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
|
160
|
-
dependencies = [
|
161
|
-
"cc",
|
162
151
|
"libc",
|
152
|
+
"windows-sys 0.52.0",
|
163
153
|
]
|
164
154
|
|
165
155
|
[[package]]
|
@@ -186,9 +176,9 @@ dependencies = [
|
|
186
176
|
|
187
177
|
[[package]]
|
188
178
|
name = "fastrand"
|
189
|
-
version = "2.0.
|
179
|
+
version = "2.0.1"
|
190
180
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
191
|
-
checksum = "
|
181
|
+
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
|
192
182
|
|
193
183
|
[[package]]
|
194
184
|
name = "generic-array"
|
@@ -202,9 +192,9 @@ dependencies = [
|
|
202
192
|
|
203
193
|
[[package]]
|
204
194
|
name = "getrandom"
|
205
|
-
version = "0.2.
|
195
|
+
version = "0.2.12"
|
206
196
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
207
|
-
checksum = "
|
197
|
+
checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
|
208
198
|
dependencies = [
|
209
199
|
"cfg-if",
|
210
200
|
"libc",
|
@@ -219,24 +209,25 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
|
219
209
|
|
220
210
|
[[package]]
|
221
211
|
name = "hashbrown"
|
222
|
-
version = "0.
|
212
|
+
version = "0.14.3"
|
223
213
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
224
|
-
checksum = "
|
214
|
+
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
|
225
215
|
dependencies = [
|
226
216
|
"ahash",
|
217
|
+
"allocator-api2",
|
227
218
|
]
|
228
219
|
|
229
220
|
[[package]]
|
230
221
|
name = "indoc"
|
231
|
-
version = "2.0.
|
222
|
+
version = "2.0.4"
|
232
223
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
233
|
-
checksum = "
|
224
|
+
checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8"
|
234
225
|
|
235
226
|
[[package]]
|
236
227
|
name = "itoa"
|
237
|
-
version = "1.0.
|
228
|
+
version = "1.0.10"
|
238
229
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
239
|
-
checksum = "
|
230
|
+
checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
|
240
231
|
|
241
232
|
[[package]]
|
242
233
|
name = "lazy_static"
|
@@ -252,31 +243,31 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
|
252
243
|
|
253
244
|
[[package]]
|
254
245
|
name = "libc"
|
255
|
-
version = "0.2.
|
246
|
+
version = "0.2.152"
|
256
247
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
257
|
-
checksum = "
|
248
|
+
checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"
|
258
249
|
|
259
250
|
[[package]]
|
260
251
|
name = "libloading"
|
261
|
-
version = "0.
|
252
|
+
version = "0.8.1"
|
262
253
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
263
|
-
checksum = "
|
254
|
+
checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161"
|
264
255
|
dependencies = [
|
265
256
|
"cfg-if",
|
266
|
-
"
|
257
|
+
"windows-sys 0.48.0",
|
267
258
|
]
|
268
259
|
|
269
260
|
[[package]]
|
270
261
|
name = "linux-raw-sys"
|
271
|
-
version = "0.4.
|
262
|
+
version = "0.4.13"
|
272
263
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
273
|
-
checksum = "
|
264
|
+
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
|
274
265
|
|
275
266
|
[[package]]
|
276
267
|
name = "magnus"
|
277
|
-
version = "0.6.
|
268
|
+
version = "0.6.2"
|
278
269
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
279
|
-
checksum = "
|
270
|
+
checksum = "4778544796676e8428e9c622460ebf284bea52d8b10db3aeb449d8b5e61b3a13"
|
280
271
|
dependencies = [
|
281
272
|
"magnus-macros",
|
282
273
|
"rb-sys",
|
@@ -297,15 +288,15 @@ dependencies = [
|
|
297
288
|
|
298
289
|
[[package]]
|
299
290
|
name = "memchr"
|
300
|
-
version = "2.
|
291
|
+
version = "2.7.1"
|
301
292
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
302
|
-
checksum = "
|
293
|
+
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
|
303
294
|
|
304
295
|
[[package]]
|
305
296
|
name = "memmap2"
|
306
|
-
version = "0.
|
297
|
+
version = "0.9.3"
|
307
298
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
308
|
-
checksum = "
|
299
|
+
checksum = "45fd3a57831bf88bc63f8cebc0cf956116276e97fef3966103e96416209f7c92"
|
309
300
|
dependencies = [
|
310
301
|
"libc",
|
311
302
|
]
|
@@ -351,9 +342,9 @@ dependencies = [
|
|
351
342
|
|
352
343
|
[[package]]
|
353
344
|
name = "once_cell"
|
354
|
-
version = "1.
|
345
|
+
version = "1.19.0"
|
355
346
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
356
|
-
checksum = "
|
347
|
+
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
357
348
|
|
358
349
|
[[package]]
|
359
350
|
name = "peeking_take_while"
|
@@ -375,18 +366,18 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
|
375
366
|
|
376
367
|
[[package]]
|
377
368
|
name = "proc-macro2"
|
378
|
-
version = "1.0.
|
369
|
+
version = "1.0.78"
|
379
370
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
380
|
-
checksum = "
|
371
|
+
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
|
381
372
|
dependencies = [
|
382
373
|
"unicode-ident",
|
383
374
|
]
|
384
375
|
|
385
376
|
[[package]]
|
386
377
|
name = "quote"
|
387
|
-
version = "1.0.
|
378
|
+
version = "1.0.35"
|
388
379
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
389
|
-
checksum = "
|
380
|
+
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
|
390
381
|
dependencies = [
|
391
382
|
"proc-macro2",
|
392
383
|
]
|
@@ -423,18 +414,18 @@ dependencies = [
|
|
423
414
|
|
424
415
|
[[package]]
|
425
416
|
name = "rb-sys"
|
426
|
-
version = "0.9.
|
417
|
+
version = "0.9.87"
|
427
418
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
428
|
-
checksum = "
|
419
|
+
checksum = "225103e3d69bbfe8831f9fd0d2461335f3a9dd06aa6e88bcb6d6970383494d06"
|
429
420
|
dependencies = [
|
430
421
|
"rb-sys-build",
|
431
422
|
]
|
432
423
|
|
433
424
|
[[package]]
|
434
425
|
name = "rb-sys-build"
|
435
|
-
version = "0.9.
|
426
|
+
version = "0.9.87"
|
436
427
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
437
|
-
checksum = "
|
428
|
+
checksum = "bacce8095a5167d5ede618bbd9353e9d9e2f32ddaf54be911106f0ee6baacf09"
|
438
429
|
dependencies = [
|
439
430
|
"bindgen",
|
440
431
|
"lazy_static",
|
@@ -453,35 +444,41 @@ checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb"
|
|
453
444
|
|
454
445
|
[[package]]
|
455
446
|
name = "redox_syscall"
|
456
|
-
version = "0.
|
447
|
+
version = "0.4.1"
|
457
448
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
458
|
-
checksum = "
|
449
|
+
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
|
459
450
|
dependencies = [
|
460
451
|
"bitflags 1.3.2",
|
461
452
|
]
|
462
453
|
|
463
454
|
[[package]]
|
464
455
|
name = "regex"
|
465
|
-
version = "1.
|
456
|
+
version = "1.10.3"
|
466
457
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
467
|
-
checksum = "
|
458
|
+
checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
|
468
459
|
dependencies = [
|
469
460
|
"aho-corasick",
|
470
461
|
"memchr",
|
462
|
+
"regex-automata",
|
471
463
|
"regex-syntax",
|
472
464
|
]
|
473
465
|
|
474
466
|
[[package]]
|
475
467
|
name = "regex-automata"
|
476
|
-
version = "0.
|
468
|
+
version = "0.4.4"
|
477
469
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
478
|
-
checksum = "
|
470
|
+
checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a"
|
471
|
+
dependencies = [
|
472
|
+
"aho-corasick",
|
473
|
+
"memchr",
|
474
|
+
"regex-syntax",
|
475
|
+
]
|
479
476
|
|
480
477
|
[[package]]
|
481
478
|
name = "regex-syntax"
|
482
|
-
version = "0.
|
479
|
+
version = "0.8.2"
|
483
480
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
484
|
-
checksum = "
|
481
|
+
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
|
485
482
|
|
486
483
|
[[package]]
|
487
484
|
name = "rustc-hash"
|
@@ -491,43 +488,43 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
|
491
488
|
|
492
489
|
[[package]]
|
493
490
|
name = "rustix"
|
494
|
-
version = "0.38.
|
491
|
+
version = "0.38.30"
|
495
492
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
496
|
-
checksum = "
|
493
|
+
checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca"
|
497
494
|
dependencies = [
|
498
|
-
"bitflags 2.
|
495
|
+
"bitflags 2.4.2",
|
499
496
|
"errno",
|
500
497
|
"libc",
|
501
498
|
"linux-raw-sys",
|
502
|
-
"windows-sys",
|
499
|
+
"windows-sys 0.52.0",
|
503
500
|
]
|
504
501
|
|
505
502
|
[[package]]
|
506
503
|
name = "ryu"
|
507
|
-
version = "1.0.
|
504
|
+
version = "1.0.16"
|
508
505
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
509
|
-
checksum = "
|
506
|
+
checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c"
|
510
507
|
|
511
508
|
[[package]]
|
512
509
|
name = "seq-macro"
|
513
|
-
version = "0.3.
|
510
|
+
version = "0.3.5"
|
514
511
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
515
|
-
checksum = "
|
512
|
+
checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4"
|
516
513
|
|
517
514
|
[[package]]
|
518
515
|
name = "serde"
|
519
|
-
version = "1.0.
|
516
|
+
version = "1.0.195"
|
520
517
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
521
|
-
checksum = "
|
518
|
+
checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02"
|
522
519
|
dependencies = [
|
523
520
|
"serde_derive",
|
524
521
|
]
|
525
522
|
|
526
523
|
[[package]]
|
527
524
|
name = "serde_derive"
|
528
|
-
version = "1.0.
|
525
|
+
version = "1.0.195"
|
529
526
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
530
|
-
checksum = "
|
527
|
+
checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c"
|
531
528
|
dependencies = [
|
532
529
|
"proc-macro2",
|
533
530
|
"quote",
|
@@ -536,9 +533,9 @@ dependencies = [
|
|
536
533
|
|
537
534
|
[[package]]
|
538
535
|
name = "serde_json"
|
539
|
-
version = "1.0.
|
536
|
+
version = "1.0.111"
|
540
537
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
541
|
-
checksum = "
|
538
|
+
checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4"
|
542
539
|
dependencies = [
|
543
540
|
"itoa",
|
544
541
|
"ryu",
|
@@ -547,9 +544,9 @@ dependencies = [
|
|
547
544
|
|
548
545
|
[[package]]
|
549
546
|
name = "sha2"
|
550
|
-
version = "0.10.
|
547
|
+
version = "0.10.8"
|
551
548
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
552
|
-
checksum = "
|
549
|
+
checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
|
553
550
|
dependencies = [
|
554
551
|
"cfg-if",
|
555
552
|
"cpufeatures",
|
@@ -564,24 +561,24 @@ checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
|
|
564
561
|
|
565
562
|
[[package]]
|
566
563
|
name = "shlex"
|
567
|
-
version = "1.
|
564
|
+
version = "1.3.0"
|
568
565
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
569
|
-
checksum = "
|
566
|
+
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
570
567
|
|
571
568
|
[[package]]
|
572
569
|
name = "smallvec"
|
573
|
-
version = "1.
|
570
|
+
version = "1.13.1"
|
574
571
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
575
|
-
checksum = "
|
572
|
+
checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
|
576
573
|
dependencies = [
|
577
574
|
"serde",
|
578
575
|
]
|
579
576
|
|
580
577
|
[[package]]
|
581
578
|
name = "syn"
|
582
|
-
version = "2.0.
|
579
|
+
version = "2.0.48"
|
583
580
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
584
|
-
checksum = "
|
581
|
+
checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
|
585
582
|
dependencies = [
|
586
583
|
"proc-macro2",
|
587
584
|
"quote",
|
@@ -590,31 +587,31 @@ dependencies = [
|
|
590
587
|
|
591
588
|
[[package]]
|
592
589
|
name = "tempfile"
|
593
|
-
version = "3.
|
590
|
+
version = "3.9.0"
|
594
591
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
595
|
-
checksum = "
|
592
|
+
checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa"
|
596
593
|
dependencies = [
|
597
594
|
"cfg-if",
|
598
595
|
"fastrand",
|
599
596
|
"redox_syscall",
|
600
597
|
"rustix",
|
601
|
-
"windows-sys",
|
598
|
+
"windows-sys 0.52.0",
|
602
599
|
]
|
603
600
|
|
604
601
|
[[package]]
|
605
602
|
name = "thiserror"
|
606
|
-
version = "1.0.
|
603
|
+
version = "1.0.56"
|
607
604
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
608
|
-
checksum = "
|
605
|
+
checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad"
|
609
606
|
dependencies = [
|
610
607
|
"thiserror-impl",
|
611
608
|
]
|
612
609
|
|
613
610
|
[[package]]
|
614
611
|
name = "thiserror-impl"
|
615
|
-
version = "1.0.
|
612
|
+
version = "1.0.56"
|
616
613
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
617
|
-
checksum = "
|
614
|
+
checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471"
|
618
615
|
dependencies = [
|
619
616
|
"proc-macro2",
|
620
617
|
"quote",
|
@@ -623,15 +620,15 @@ dependencies = [
|
|
623
620
|
|
624
621
|
[[package]]
|
625
622
|
name = "typenum"
|
626
|
-
version = "1.
|
623
|
+
version = "1.17.0"
|
627
624
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
628
|
-
checksum = "
|
625
|
+
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
629
626
|
|
630
627
|
[[package]]
|
631
628
|
name = "unicode-ident"
|
632
|
-
version = "1.0.
|
629
|
+
version = "1.0.12"
|
633
630
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
634
|
-
checksum = "
|
631
|
+
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
635
632
|
|
636
633
|
[[package]]
|
637
634
|
name = "version_check"
|
@@ -646,89 +643,153 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
646
643
|
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
647
644
|
|
648
645
|
[[package]]
|
649
|
-
name = "
|
650
|
-
version = "0.
|
646
|
+
name = "windows-sys"
|
647
|
+
version = "0.48.0"
|
651
648
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
652
|
-
checksum = "
|
649
|
+
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
653
650
|
dependencies = [
|
654
|
-
"
|
655
|
-
"winapi-x86_64-pc-windows-gnu",
|
651
|
+
"windows-targets 0.48.5",
|
656
652
|
]
|
657
653
|
|
658
654
|
[[package]]
|
659
|
-
name = "
|
660
|
-
version = "0.
|
661
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
662
|
-
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
663
|
-
|
664
|
-
[[package]]
|
665
|
-
name = "winapi-x86_64-pc-windows-gnu"
|
666
|
-
version = "0.4.0"
|
655
|
+
name = "windows-sys"
|
656
|
+
version = "0.52.0"
|
667
657
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
668
|
-
checksum = "
|
658
|
+
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
659
|
+
dependencies = [
|
660
|
+
"windows-targets 0.52.0",
|
661
|
+
]
|
669
662
|
|
670
663
|
[[package]]
|
671
|
-
name = "windows-
|
672
|
-
version = "0.48.
|
664
|
+
name = "windows-targets"
|
665
|
+
version = "0.48.5"
|
673
666
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
674
|
-
checksum = "
|
667
|
+
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
675
668
|
dependencies = [
|
676
|
-
"
|
669
|
+
"windows_aarch64_gnullvm 0.48.5",
|
670
|
+
"windows_aarch64_msvc 0.48.5",
|
671
|
+
"windows_i686_gnu 0.48.5",
|
672
|
+
"windows_i686_msvc 0.48.5",
|
673
|
+
"windows_x86_64_gnu 0.48.5",
|
674
|
+
"windows_x86_64_gnullvm 0.48.5",
|
675
|
+
"windows_x86_64_msvc 0.48.5",
|
677
676
|
]
|
678
677
|
|
679
678
|
[[package]]
|
680
679
|
name = "windows-targets"
|
681
|
-
version = "0.
|
680
|
+
version = "0.52.0"
|
682
681
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
683
|
-
checksum = "
|
682
|
+
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
|
684
683
|
dependencies = [
|
685
|
-
"windows_aarch64_gnullvm",
|
686
|
-
"windows_aarch64_msvc",
|
687
|
-
"windows_i686_gnu",
|
688
|
-
"windows_i686_msvc",
|
689
|
-
"windows_x86_64_gnu",
|
690
|
-
"windows_x86_64_gnullvm",
|
691
|
-
"windows_x86_64_msvc",
|
684
|
+
"windows_aarch64_gnullvm 0.52.0",
|
685
|
+
"windows_aarch64_msvc 0.52.0",
|
686
|
+
"windows_i686_gnu 0.52.0",
|
687
|
+
"windows_i686_msvc 0.52.0",
|
688
|
+
"windows_x86_64_gnu 0.52.0",
|
689
|
+
"windows_x86_64_gnullvm 0.52.0",
|
690
|
+
"windows_x86_64_msvc 0.52.0",
|
692
691
|
]
|
693
692
|
|
694
693
|
[[package]]
|
695
694
|
name = "windows_aarch64_gnullvm"
|
696
|
-
version = "0.48.
|
695
|
+
version = "0.48.5"
|
696
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
697
|
+
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
698
|
+
|
699
|
+
[[package]]
|
700
|
+
name = "windows_aarch64_gnullvm"
|
701
|
+
version = "0.52.0"
|
697
702
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
698
|
-
checksum = "
|
703
|
+
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
|
699
704
|
|
700
705
|
[[package]]
|
701
706
|
name = "windows_aarch64_msvc"
|
702
|
-
version = "0.48.
|
707
|
+
version = "0.48.5"
|
708
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
709
|
+
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
710
|
+
|
711
|
+
[[package]]
|
712
|
+
name = "windows_aarch64_msvc"
|
713
|
+
version = "0.52.0"
|
703
714
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
704
|
-
checksum = "
|
715
|
+
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
|
705
716
|
|
706
717
|
[[package]]
|
707
718
|
name = "windows_i686_gnu"
|
708
|
-
version = "0.48.
|
719
|
+
version = "0.48.5"
|
720
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
721
|
+
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
722
|
+
|
723
|
+
[[package]]
|
724
|
+
name = "windows_i686_gnu"
|
725
|
+
version = "0.52.0"
|
709
726
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
710
|
-
checksum = "
|
727
|
+
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
|
711
728
|
|
712
729
|
[[package]]
|
713
730
|
name = "windows_i686_msvc"
|
714
|
-
version = "0.48.
|
731
|
+
version = "0.48.5"
|
732
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
733
|
+
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
734
|
+
|
735
|
+
[[package]]
|
736
|
+
name = "windows_i686_msvc"
|
737
|
+
version = "0.52.0"
|
715
738
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
716
|
-
checksum = "
|
739
|
+
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
|
717
740
|
|
718
741
|
[[package]]
|
719
742
|
name = "windows_x86_64_gnu"
|
720
|
-
version = "0.48.
|
743
|
+
version = "0.48.5"
|
721
744
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
722
|
-
checksum = "
|
745
|
+
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
746
|
+
|
747
|
+
[[package]]
|
748
|
+
name = "windows_x86_64_gnu"
|
749
|
+
version = "0.52.0"
|
750
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
751
|
+
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
|
723
752
|
|
724
753
|
[[package]]
|
725
754
|
name = "windows_x86_64_gnullvm"
|
726
|
-
version = "0.48.
|
755
|
+
version = "0.48.5"
|
727
756
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
728
|
-
checksum = "
|
757
|
+
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
758
|
+
|
759
|
+
[[package]]
|
760
|
+
name = "windows_x86_64_gnullvm"
|
761
|
+
version = "0.52.0"
|
762
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
763
|
+
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
|
729
764
|
|
730
765
|
[[package]]
|
731
766
|
name = "windows_x86_64_msvc"
|
732
|
-
version = "0.48.
|
767
|
+
version = "0.48.5"
|
768
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
769
|
+
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
770
|
+
|
771
|
+
[[package]]
|
772
|
+
name = "windows_x86_64_msvc"
|
773
|
+
version = "0.52.0"
|
774
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
775
|
+
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
|
776
|
+
|
777
|
+
[[package]]
|
778
|
+
name = "zerocopy"
|
779
|
+
version = "0.7.32"
|
780
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
781
|
+
checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be"
|
782
|
+
dependencies = [
|
783
|
+
"zerocopy-derive",
|
784
|
+
]
|
785
|
+
|
786
|
+
[[package]]
|
787
|
+
name = "zerocopy-derive"
|
788
|
+
version = "0.7.32"
|
733
789
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
734
|
-
checksum = "
|
790
|
+
checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
|
791
|
+
dependencies = [
|
792
|
+
"proc-macro2",
|
793
|
+
"quote",
|
794
|
+
"syn",
|
795
|
+
]
|
@@ -6,26 +6,26 @@ edition = "2021"
|
|
6
6
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
7
7
|
|
8
8
|
[dependencies]
|
9
|
-
hashbrown = "0.
|
9
|
+
hashbrown = "0.14"
|
10
10
|
libc = "0.2"
|
11
11
|
magnus = { version = "0.6", features = ["rb-sys"] }
|
12
|
-
memmap2 = "0.
|
12
|
+
memmap2 = "0.9"
|
13
13
|
# v0.26 cannot be built on CentOS 7 https://github.com/nix-rust/nix/issues/1972
|
14
14
|
nix = { version = "0.25", features = ["mman"] } # mman used for MsFlags
|
15
|
-
rb-sys = "0.9
|
15
|
+
rb-sys = { version = "0.9", features = ["stable-api-compiled-fallback"] }
|
16
16
|
serde = { version = "1.0", features = ["derive"] }
|
17
17
|
serde_json = { version = "1.0", features = ["raw_value"] }
|
18
18
|
smallvec = { version = "1.10", features = ["serde"] }
|
19
19
|
thiserror = "1.0"
|
20
20
|
|
21
21
|
[dev-dependencies]
|
22
|
-
bstr = "1.
|
22
|
+
bstr = "1.9"
|
23
23
|
indoc = "2.0"
|
24
24
|
# We need the `embed` feature to run tests, but this triggers failures when building as a Gem.
|
25
25
|
magnus = { version = "0.6", features = ["rb-sys","embed"] }
|
26
26
|
rand = "0.8"
|
27
27
|
sha2 = "0.10"
|
28
|
-
tempfile = "3.
|
28
|
+
tempfile = "3.9"
|
29
29
|
|
30
30
|
[build-dependencies]
|
31
31
|
rb-sys-env = "0.1"
|
@@ -100,13 +100,6 @@ pub enum MmapError {
|
|
100
100
|
/// No mmap open.
|
101
101
|
#[error("unmapped file")]
|
102
102
|
UnmappedFile,
|
103
|
-
/// File length changed by another process.
|
104
|
-
#[error("size of {path} {len} does not match previous size {expected_len}. Another process may have modified it.")]
|
105
|
-
UnexpectedFileLength {
|
106
|
-
path: String,
|
107
|
-
len: usize,
|
108
|
-
expected_len: usize,
|
109
|
-
},
|
110
103
|
/// A custom error message with `strerror(3)` appended.
|
111
104
|
#[error("{0}")]
|
112
105
|
WithErrno(String),
|
@@ -169,7 +162,6 @@ impl MmapError {
|
|
169
162
|
MmapError::Other(_) => RubyError::Arg,
|
170
163
|
MmapError::PromParsing(_) => RubyError::PromParsing,
|
171
164
|
MmapError::UnmappedFile => RubyError::Io,
|
172
|
-
MmapError::UnexpectedFileLength { .. } => RubyError::Runtime,
|
173
165
|
MmapError::WithErrno(_) => RubyError::Io,
|
174
166
|
}
|
175
167
|
}
|
@@ -5,7 +5,7 @@ use std::fs::File;
|
|
5
5
|
use std::mem::size_of;
|
6
6
|
use std::ops::Range;
|
7
7
|
use std::os::unix::prelude::{AsRawFd, RawFd};
|
8
|
-
use std::path::
|
8
|
+
use std::path::PathBuf;
|
9
9
|
|
10
10
|
use crate::error::{MmapError, RubyError};
|
11
11
|
use crate::raw_entry::RawEntry;
|
@@ -34,8 +34,6 @@ pub(super) struct InnerMmap {
|
|
34
34
|
///
|
35
35
|
/// Equivalent to `i_mm->t->real` in the C implementation.
|
36
36
|
len: usize,
|
37
|
-
/// The length of the file being mmapped at the time of mapping.
|
38
|
-
file_len: usize,
|
39
37
|
}
|
40
38
|
|
41
39
|
impl InnerMmap {
|
@@ -43,12 +41,19 @@ impl InnerMmap {
|
|
43
41
|
/// Use when mmapping a file for the first time. When re-mapping a file
|
44
42
|
/// after expanding it the `reestablish` function should be used.
|
45
43
|
pub fn new(path: PathBuf, file: File) -> Result<Self> {
|
46
|
-
let
|
44
|
+
let stat = file.metadata().map_err(|e| {
|
45
|
+
MmapError::legacy(
|
46
|
+
format!("Can't stat {}: {e}", path.display()),
|
47
|
+
RubyError::Arg,
|
48
|
+
)
|
49
|
+
})?;
|
50
|
+
|
51
|
+
let file_size = util::cast_chk::<_, usize>(stat.len(), "file length")?;
|
47
52
|
|
48
53
|
// We need to ensure the underlying file descriptor is at least a page size.
|
49
54
|
// Otherwise, we could get a SIGBUS error if mmap() attempts to read or write
|
50
55
|
// past the file.
|
51
|
-
let reserve_size = Self::next_page_boundary(
|
56
|
+
let reserve_size = Self::next_page_boundary(file_size)?;
|
52
57
|
|
53
58
|
// Cast: no-op.
|
54
59
|
Self::reserve_mmap_file_bytes(file.as_raw_fd(), reserve_size as off_t).map_err(|e| {
|
@@ -62,23 +67,21 @@ impl InnerMmap {
|
|
62
67
|
})?;
|
63
68
|
|
64
69
|
// Ensure we always have space for the header.
|
65
|
-
let map_len =
|
70
|
+
let map_len = file_size.max(HEADER_SIZE);
|
66
71
|
|
67
72
|
// SAFETY: There is the possibility of UB if the file is modified outside of
|
68
73
|
// this program.
|
69
74
|
let map = unsafe { MmapOptions::new().len(map_len).map_mut(&file) }.map_err(|e| {
|
70
75
|
MmapError::legacy(format!("mmap failed ({}): {e}", errno()), RubyError::Arg)
|
71
76
|
})?;
|
72
|
-
let file_len = util::cast_chk::<_, usize>(reserve_size, "file length")?;
|
73
77
|
|
74
|
-
let len =
|
78
|
+
let len = file_size;
|
75
79
|
|
76
80
|
Ok(Self {
|
77
81
|
file,
|
78
82
|
path,
|
79
83
|
map,
|
80
84
|
len,
|
81
|
-
file_len,
|
82
85
|
})
|
83
86
|
}
|
84
87
|
|
@@ -94,14 +97,12 @@ impl InnerMmap {
|
|
94
97
|
// to the old length at this point if closing the file. Matching C implementation
|
95
98
|
// for now.
|
96
99
|
let len = map_len;
|
97
|
-
let file_len = get_file_len(&path, &file)?;
|
98
100
|
|
99
101
|
Ok(Self {
|
100
102
|
file,
|
101
103
|
path,
|
102
104
|
map,
|
103
105
|
len,
|
104
|
-
file_len,
|
105
106
|
})
|
106
107
|
}
|
107
108
|
|
@@ -185,7 +186,7 @@ impl InnerMmap {
|
|
185
186
|
self.len
|
186
187
|
}
|
187
188
|
|
188
|
-
/// The total length in bytes of the mmapped
|
189
|
+
/// The total length in bytes of the mmapped file.
|
189
190
|
///
|
190
191
|
/// Equivalent to `i_mm->t->len` in the C implementation.
|
191
192
|
#[inline]
|
@@ -193,21 +194,6 @@ impl InnerMmap {
|
|
193
194
|
self.map.len()
|
194
195
|
}
|
195
196
|
|
196
|
-
/// `stat` the mmapped file and return its length.
|
197
|
-
pub fn check_file_len(&self) -> Result<usize> {
|
198
|
-
get_file_len(&self.path, &self.file)
|
199
|
-
}
|
200
|
-
|
201
|
-
/// The length of the file at the time it was mmapped.
|
202
|
-
pub fn file_len(&self) -> usize {
|
203
|
-
self.file_len
|
204
|
-
}
|
205
|
-
|
206
|
-
/// The path of the mmapped file.
|
207
|
-
pub fn path(&self) -> String {
|
208
|
-
self.path.to_string_lossy().to_string()
|
209
|
-
}
|
210
|
-
|
211
197
|
/// Update the length of the mmap considered to be written.
|
212
198
|
pub fn set_len(&mut self, len: usize) {
|
213
199
|
self.len = len;
|
@@ -326,17 +312,6 @@ impl InnerMmap {
|
|
326
312
|
}
|
327
313
|
}
|
328
314
|
|
329
|
-
fn get_file_len(path: &Path, file: &File) -> Result<usize> {
|
330
|
-
let stat = file.metadata().map_err(|e| {
|
331
|
-
MmapError::legacy(
|
332
|
-
format!("Can't stat {}: {e}", path.display()),
|
333
|
-
RubyError::Arg,
|
334
|
-
)
|
335
|
-
})?;
|
336
|
-
|
337
|
-
util::cast_chk::<_, usize>(stat.len(), "file length")
|
338
|
-
}
|
339
|
-
|
340
315
|
#[cfg(test)]
|
341
316
|
mod test {
|
342
317
|
use nix::unistd::{self, SysconfVar};
|
@@ -441,49 +441,17 @@ impl MmapedFile {
|
|
441
441
|
}
|
442
442
|
|
443
443
|
/// Check that the mmap is large enough to contain the value to be added,
|
444
|
-
/// and expand it to fit if necessary.
|
445
|
-
/// has been resized by another process.
|
444
|
+
/// and expand it to fit if necessary.
|
446
445
|
fn check_expand(&self, rb_self: Obj<Self>, key_len: usize) -> magnus::error::Result<()> {
|
447
446
|
// CAST: no-op on 32-bit, widening on 64-bit.
|
448
447
|
let used = self.inner(|inner| inner.load_used())? as usize;
|
449
448
|
let entry_len = RawEntry::calc_total_len(key_len)?;
|
450
|
-
let required_len = used.add_chk(entry_len)?;
|
451
|
-
let mut target_cap = self.capacity();
|
452
449
|
|
453
|
-
let mut needs_resize = false;
|
454
450
|
// We need the mmapped region to contain at least one byte beyond the
|
455
|
-
// written data to create a NUL-terminated C string. Validate that
|
456
|
-
// new length does not exactly match the length of the mmap.
|
457
|
-
|
458
|
-
|
459
|
-
target_cap = required_len + 1;
|
460
|
-
}
|
461
|
-
|
462
|
-
let (current_file_len, original_file_len) =
|
463
|
-
self.inner(|inner| Ok((inner.check_file_len()?, inner.file_len())))?;
|
464
|
-
|
465
|
-
let file_modified = current_file_len != original_file_len;
|
466
|
-
if file_modified {
|
467
|
-
// Ensure our new capacity is at least as large as the actual file.
|
468
|
-
// Erroring out without first resizing the mmap would leave us stuck
|
469
|
-
// in a bad state.
|
470
|
-
target_cap = current_file_len
|
471
|
-
}
|
472
|
-
|
473
|
-
if needs_resize {
|
474
|
-
self.expand_to_fit(rb_self, target_cap)?;
|
475
|
-
}
|
476
|
-
|
477
|
-
if file_modified {
|
478
|
-
// Return an error so the caller is alerted that there were concurrent writes to the
|
479
|
-
// file.
|
480
|
-
let path = self.inner(|inner| Ok(inner.path()))?;
|
481
|
-
return Err(MmapError::UnexpectedFileLength {
|
482
|
-
path,
|
483
|
-
len: current_file_len,
|
484
|
-
expected_len: original_file_len,
|
485
|
-
}
|
486
|
-
.into());
|
451
|
+
// written data to create a NUL- terminated C string. Validate that
|
452
|
+
// new length does not exactly match or exceed the length of the mmap.
|
453
|
+
while self.capacity() <= used.add_chk(entry_len)? {
|
454
|
+
self.expand_to_fit(rb_self, self.capacity().mul_chk(2)?)?;
|
487
455
|
}
|
488
456
|
|
489
457
|
Ok(())
|
@@ -684,7 +652,6 @@ mod test {
|
|
684
652
|
use super::*;
|
685
653
|
use crate::raw_entry::RawEntry;
|
686
654
|
use crate::testhelper::TestFile;
|
687
|
-
use std::os::unix::prelude::AsRawFd;
|
688
655
|
|
689
656
|
/// Create a wrapped MmapedFile object.
|
690
657
|
fn create_obj() -> Obj<MmapedFile> {
|
@@ -914,37 +881,4 @@ mod test {
|
|
914
881
|
// Validate that we have expanded the mmap, ensuring a trailing NUL.
|
915
882
|
assert!(rs_self.capacity() > current_cap);
|
916
883
|
}
|
917
|
-
|
918
|
-
#[test]
|
919
|
-
fn test_detect_external_resize() {
|
920
|
-
let _cleanup = unsafe { magnus::embed::init() };
|
921
|
-
let ruby = magnus::Ruby::get().unwrap();
|
922
|
-
crate::init(&ruby).unwrap();
|
923
|
-
|
924
|
-
let TestFile {
|
925
|
-
file,
|
926
|
-
path,
|
927
|
-
dir: _dir,
|
928
|
-
} = TestFile::new(&[0u8; 8]);
|
929
|
-
|
930
|
-
let path_str = path.display().to_string();
|
931
|
-
let rpath = RString::new(&path_str);
|
932
|
-
|
933
|
-
// Object created successfully
|
934
|
-
let result: std::result::Result<Obj<MmapedFile>, Error> =
|
935
|
-
eval!("FastMmapedFileRs.new(path)", path = rpath);
|
936
|
-
assert!(result.is_ok());
|
937
|
-
let obj = result.unwrap();
|
938
|
-
|
939
|
-
let rs_self = &*obj;
|
940
|
-
|
941
|
-
let file_len = 1 << 32;
|
942
|
-
nix::unistd::ftruncate(file.as_raw_fd(), file_len).unwrap();
|
943
|
-
|
944
|
-
// We error when the file is externally modified.
|
945
|
-
assert!(rs_self.check_expand(obj, 512).is_err());
|
946
|
-
|
947
|
-
// We updated the object to use the new size.
|
948
|
-
assert_eq!(rs_self.capacity(), file_len as usize);
|
949
|
-
}
|
950
884
|
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prometheus-client-mmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- Tobias Schmidt
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2024-01-
|
14
|
+
date: 2024-01-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rb_sys
|