Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0924a8361 | ||
|
|
e2665c6fc0 | ||
|
|
3c525fab6a | ||
|
|
e1557e6c7a | ||
|
|
b5784feabd | ||
|
|
a43c51b297 | ||
|
|
d86408b7b9 | ||
|
|
dca63da432 | ||
|
|
4a5aba16c9 | ||
|
|
7275935641 | ||
|
|
98410d0da5 | ||
|
|
9ccb8dfd47 | ||
|
|
05c9378b3f | ||
|
|
b322a77e99 | ||
|
|
5e02338e5e | ||
|
|
6a6d8806a4 | ||
|
|
77570e3965 | ||
|
|
60ef6d2896 | ||
|
|
669a8dba37 | ||
|
|
7c4f6e179b | ||
|
|
fba49b107d | ||
|
|
3d206f0fcf | ||
|
|
81e72e8e29 | ||
|
|
cffabb641f | ||
|
|
4972f5768c | ||
|
|
d81c2a5f33 | ||
|
|
a26ac7ebbc | ||
|
|
7ad786db2e | ||
|
|
abf83bc682 | ||
|
|
7c956d5cdf | ||
|
|
19d01b62ca | ||
|
|
9fc20f4f9d | ||
|
|
f95af7785b | ||
|
|
92ad0b5c8b | ||
|
|
6cf24fa437 | ||
|
|
b1ede2120a | ||
|
|
5b2119c639 | ||
|
|
929ab58a12 | ||
|
|
79414d45fb | ||
|
|
b8fcd322c6 | ||
|
|
d279ec2532 | ||
|
|
a221fc85ed | ||
|
|
1571907ea0 | ||
|
|
a06b68b917 | ||
|
|
7c0d160536 | ||
|
|
b2a250ce15 | ||
|
|
fa6815e14e | ||
|
|
a1ec0caed0 | ||
|
|
b8beda61a2 | ||
|
|
c9eabbf9b1 | ||
|
|
842fd1fbdf | ||
|
|
01358df34e | ||
|
|
2f6537dc7f | ||
|
|
6edbf70760 | ||
|
|
7fc1a8c5a0 | ||
|
|
8c702f8ddb | ||
|
|
63db10ef6f | ||
|
|
a2a28b8034 | ||
|
|
1e2876e016 | ||
|
|
dbb7337e49 | ||
|
|
fa60cd1369 | ||
|
|
4dfc487f96 | ||
|
|
ab524282e8 | ||
|
|
d1b3276b55 | ||
|
|
631eb3837e | ||
|
|
5632bbdcbd | ||
|
|
ba6ed445a3 | ||
|
|
ddf1bcf788 | ||
|
|
5da7fdb785 | ||
|
|
c039428627 | ||
|
|
61a59b53a5 | ||
|
|
babe90c90f | ||
|
|
9e3dfa96f7 | ||
|
|
d28314cb03 | ||
|
|
a8b6efea25 | ||
|
|
888effe4be | ||
|
|
15ae4e29e5 | ||
|
|
21fd252a62 | ||
|
|
76b9c13d1d | ||
|
|
85abb7cf2a | ||
|
|
7b9fc6fca0 | ||
|
|
693acc0114 | ||
|
|
b4568fc78a | ||
|
|
35e8ae3eb5 | ||
|
|
1e85b89aef | ||
|
|
e6a1b2ea95 | ||
|
|
1209dc2277 | ||
|
|
8203461120 | ||
|
|
0a2e51f9ae | ||
|
|
0132ed7544 | ||
|
|
45ae605332 | ||
|
|
9bcdd1537e | ||
|
|
f620e6ac73 | ||
|
|
a3704d4e87 | ||
|
|
33b7ff387c | ||
|
|
0ab885a685 | ||
|
|
679344a2b0 | ||
|
|
0b645d6319 | ||
|
|
69d5576832 | ||
|
|
2ab6767744 | ||
|
|
35e836c26d | ||
|
|
51da5c3dde | ||
|
|
35c2ee8716 | ||
|
|
069b30a2b3 | ||
|
|
6af021007a | ||
|
|
2854637385 | ||
|
|
d443e312ad | ||
|
|
6272ca609e | ||
|
|
d96cf3639a | ||
|
|
e2cf386765 | ||
|
|
a64b29485d | ||
|
|
64205345bc | ||
|
|
755b51a42c | ||
|
|
c52922e1d9 | ||
|
|
d2405b9b6b | ||
|
|
aabce8932a | ||
|
|
49876158cc | ||
|
|
02acb8fd3a | ||
|
|
61baabd8d5 | ||
|
|
a3fdc9cd82 | ||
|
|
091701f363 | ||
|
|
ff6419658b | ||
|
|
99a425d0f3 | ||
|
|
4c72a09b78 | ||
|
|
f2387daa83 | ||
|
|
c37d63e87a | ||
|
|
a4754e228f | ||
|
|
2189100383 | ||
|
|
8ef4f1dbad | ||
|
|
ffa0077041 | ||
|
|
c65e5087e8 | ||
|
|
78960ad57b | ||
|
|
0a2f78837d | ||
|
|
d4595dd94f | ||
|
|
9f3b410050 | ||
|
|
05833959e3 | ||
|
|
1973558b63 | ||
|
|
5267d3803f | ||
|
|
abb2ea7e3c | ||
|
|
92fb4f4f61 | ||
|
|
62ac1ab007 | ||
|
|
032619b82b | ||
|
|
6e1c3ff132 | ||
|
|
9e40b076dd | ||
|
|
2667c41235 | ||
|
|
595e725db4 | ||
|
|
a5d2df3473 | ||
|
|
f22bfe86b6 | ||
|
|
ae9764ea0a | ||
|
|
b8665b879b | ||
|
|
1067cfb34b | ||
|
|
3d56f607b7 | ||
|
|
b4772f6381 | ||
|
|
b0272252f7 | ||
|
|
475563e2e9 | ||
|
|
f558583493 | ||
|
|
c751d8a686 | ||
|
|
247e792bde | ||
|
|
4ad166235e | ||
|
|
a18c91d642 | ||
|
|
aae0ec2553 | ||
|
|
cf3323dba4 | ||
|
|
c81b5e5594 | ||
|
|
df55861838 | ||
|
|
b2061de2e7 | ||
|
|
6a6e911f12 | ||
|
|
42fbf064d1 | ||
|
|
805191c791 | ||
|
|
bb1de082ea | ||
|
|
4065b4f27e | ||
|
|
d7ae858745 | ||
|
|
ed29d634b3 | ||
|
|
7a550c8bbb | ||
|
|
f18c9da3e1 | ||
|
|
2f5edd03e6 | ||
|
|
1013cbeae2 | ||
|
|
6461f09f43 | ||
|
|
2a099d49d4 | ||
|
|
6f7c1a8ce6 | ||
|
|
f28e2ce7a4 | ||
|
|
ad25716a75 | ||
|
|
9eb97b5d94 | ||
|
|
450c88f368 | ||
|
|
843a4cdc07 | ||
|
|
b0e18f804d | ||
|
|
cb6933e346 | ||
|
|
18cb4a7d93 | ||
|
|
4a7a4e42db | ||
|
|
00a9d6b314 | ||
|
|
60250f50c2 | ||
|
|
f62d52a5ad | ||
|
|
837c063baf | ||
|
|
a7d6ca9770 | ||
|
|
4b262182d9 | ||
|
|
acd517c883 | ||
|
|
135998ed8d | ||
|
|
586a16ad79 | ||
|
|
b16d1c2713 | ||
|
|
b414605285 | ||
|
|
8bdd2d5ddd | ||
|
|
bfbb15f75d | ||
|
|
783b210db4 | ||
|
|
815a6f846a | ||
|
|
c2d8d4e648 | ||
|
|
2a1ea8c7d8 | ||
|
|
442e73ea09 | ||
|
|
a3df2777e8 | ||
|
|
6b44e4ea92 | ||
|
|
2bcd890d8a | ||
|
|
eb915a82a5 | ||
|
|
8fc959216c | ||
|
|
bdcd4b3df8 | ||
|
|
4e761eb7e2 | ||
|
|
ff3a3577f2 | ||
|
|
ced710fc83 | ||
|
|
f44c343292 | ||
|
|
87131a5fa6 | ||
|
|
9c39256a28 | ||
|
|
ef68deb3c2 | ||
|
|
1666ffbe1f | ||
|
|
02080f2686 | ||
|
|
6c65345edb | ||
|
|
f36eac9f68 | ||
|
|
d375595d5e | ||
|
|
c1f3020631 | ||
|
|
20618c713c | ||
|
|
89772ed827 | ||
|
|
e24d46004b | ||
|
|
efa162bcd7 | ||
|
|
3731580b6b | ||
|
|
992f9e23c7 | ||
|
|
8b33d813a3 | ||
|
|
8192625458 | ||
|
|
46ec6ad98e | ||
|
|
3a1d14259d | ||
|
|
156836bfe5 | ||
|
|
6fa8e4f7af | ||
|
|
efcd1bf394 | ||
|
|
79ffc3524d | ||
|
|
119ec91a5a | ||
|
|
0c35f54f0a | ||
|
|
df787764e3 | ||
|
|
21e39ec461 | ||
|
|
bd823c7fa3 | ||
|
|
8ad0cfa56c | ||
|
|
a6b3ce28a8 | ||
|
|
698e7cbba6 | ||
|
|
719b766586 | ||
|
|
3cd8baf616 | ||
|
|
ee220599b0 | ||
|
|
046654a70e | ||
|
|
5075e74366 | ||
|
|
aba2865c86 | ||
|
|
a1c85eebf4 | ||
|
|
295cbf297f | ||
|
|
d4cbd8140b | ||
|
|
1a93804645 | ||
|
|
85899e359e | ||
|
|
7d1ad6ca96 | ||
|
|
fe4b4806b3 | ||
|
|
0c4733c8d7 | ||
|
|
f49ff156ec | ||
|
|
789c94fece | ||
|
|
a9d5cfa99b | ||
|
|
fe1c096b18 | ||
|
|
effa707e9d | ||
|
|
95050f2683 | ||
|
|
ca913a5de0 | ||
|
|
a642947e04 | ||
|
|
bb7891f080 | ||
|
|
e875ff89ec | ||
|
|
bd8da0ca29 | ||
|
|
6b403f56a5 | ||
|
|
8bd01a07ae | ||
|
|
4c6d9bbd62 | ||
|
|
1a7765cb7c | ||
|
|
574ed6b0ce | ||
|
|
eeb0f1426c | ||
|
|
719db14ec7 | ||
|
|
6cb5cbb28f | ||
|
|
dd3b545d89 | ||
|
|
ee17e7af8d | ||
|
|
625bdaf3d1 | ||
|
|
451531f1c8 | ||
|
|
3e09a8c097 | ||
|
|
f110de4b23 | ||
|
|
8a7049d363 | ||
|
|
e342bedc83 | ||
|
|
fb4e0d400f | ||
|
|
8b242ef977 | ||
|
|
d7971f96b3 | ||
|
|
acfb4f7a44 | ||
|
|
4ffcec29af | ||
|
|
ae020e3d56 | ||
|
|
2db0d898f8 | ||
|
|
9578b67e0e | ||
|
|
a95ae56b30 | ||
|
|
cb625844bf | ||
|
|
8500ca4ae8 | ||
|
|
047b609335 | ||
|
|
6cdaa27703 | ||
|
|
37beb5e67e | ||
|
|
b53c7f2c0b | ||
|
|
b8eb2a7340 | ||
|
|
e81bd15e99 | ||
|
|
a3075ca4fe | ||
|
|
7da1cc3e90 | ||
|
|
6075f50663 | ||
|
|
4e55d557eb | ||
|
|
8df37363db | ||
|
|
bda9d74dad | ||
|
|
e2fa6aa158 | ||
|
|
16d206ee36 | ||
|
|
35bb021254 | ||
|
|
001e192575 | ||
|
|
3b1e65a32b | ||
|
|
14b198868f | ||
|
|
3f28d7d712 | ||
|
|
63f77698cf | ||
|
|
ae771ea77b | ||
|
|
0b21ef8d49 | ||
|
|
37d761ba29 | ||
|
|
f25e688e2a | ||
|
|
3bcc67d14f | ||
|
|
78bef6e1fe | ||
|
|
1a57af629c | ||
|
|
6761d10cc3 | ||
|
|
f3855a0930 | ||
|
|
08aed7e7dd | ||
|
|
79db037a4f | ||
|
|
93dda65354 | ||
|
|
4517fadb59 | ||
|
|
e82c1aedea | ||
|
|
2f9cdcd733 | ||
|
|
557222d1e0 | ||
|
|
fae5b1a19d | ||
|
|
b9656adbd9 | ||
|
|
b69636d377 | ||
|
|
e8771efda9 | ||
|
|
69017fa232 | ||
|
|
61b7e5916d | ||
|
|
45ccae89bb | ||
|
|
416c9ac2ef | ||
|
|
c30de7073c | ||
|
|
1078e30c5f | ||
|
|
cf6dcb7bf1 | ||
|
|
871fa12fec | ||
|
|
38ed6c6007 | ||
|
|
dc7a9d3a31 | ||
|
|
a6bf509810 | ||
|
|
b576fbc474 | ||
|
|
1797330e2e | ||
|
|
11b071a22b | ||
|
|
a26cab9dd6 | ||
|
|
4e012daee9 | ||
|
|
311a757cb1 | ||
|
|
86ca9b25e2 | ||
|
|
24da71e507 | ||
|
|
adc5a3217c | ||
|
|
b104f3cabc | ||
|
|
2a2954086a | ||
|
|
728e62523e | ||
|
|
b3fe4f31a2 | ||
|
|
4f19b4d0c1 | ||
|
|
38052fd702 | ||
|
|
7ef68cd5ec | ||
|
|
23f03e7965 | ||
|
|
45d83fb2d4 | ||
|
|
6740e1753d | ||
|
|
e3ef73dc2a | ||
|
|
af6d5c5932 | ||
|
|
feb032fd42 | ||
|
|
9b15dd288e | ||
|
|
4a45386e3c | ||
|
|
21aabab401 | ||
|
|
dff153ff24 | ||
|
|
d2b5a579dd | ||
|
|
9478d5a134 | ||
|
|
10dc57ab22 | ||
|
|
a83e36637a | ||
|
|
5860fa3d9c | ||
|
|
fa5d90069f | ||
|
|
ad7a6275ff | ||
|
|
a6fd237537 | ||
|
|
aa856b39f2 | ||
|
|
9f30dd03cd | ||
|
|
35fccd875a | ||
|
|
1dc89e2d02 | ||
|
|
e8c5b66ed2 | ||
|
|
b4079abed4 | ||
|
|
c81c7f51c3 | ||
|
|
b857928ba7 | ||
|
|
a7179e7570 | ||
|
|
488aecb3ab | ||
|
|
de6be8850f | ||
|
|
496375fc36 | ||
|
|
e9ae03787e | ||
|
|
47c51d0c78 | ||
|
|
71204f9632 | ||
|
|
c4c68f5d41 | ||
|
|
4916d79fbd | ||
|
|
65e4bce0e7 | ||
|
|
fad0b0d2a6 | ||
|
|
b59bb9b476 | ||
|
|
b2d393b990 | ||
|
|
9b0fd9f4d0 | ||
|
|
c0ea77f0e1 | ||
|
|
56fa48ffc1 | ||
|
|
a50aa29bde | ||
|
|
f7f68c654a | ||
|
|
cca3577503 | ||
|
|
3881f7850f | ||
|
|
47400870ae | ||
|
|
886a04c2c3 | ||
|
|
418de21d8f | ||
|
|
e6478cfd10 | ||
|
|
b099889a3a | ||
|
|
1193e96d02 | ||
|
|
62c8be28ee | ||
|
|
2eb9b19612 | ||
|
|
5f0119ca91 | ||
|
|
a2f2b6f5b1 | ||
|
|
a5d17f0b6c | ||
|
|
5bdd72bea7 | ||
|
|
88795f5cba | ||
|
|
64e1e7e207 | ||
|
|
ceeff6bf86 | ||
|
|
beb94c901e | ||
|
|
051cc3d2e6 | ||
|
|
aa9beaca77 | ||
|
|
0990dec3f5 | ||
|
|
34c288fe11 | ||
|
|
b571c9609d | ||
|
|
2e1bc942aa | ||
|
|
b76016a948 | ||
|
|
3c3e6cc1c7 | ||
|
|
66be30f7fc | ||
|
|
bb875603fb | ||
|
|
9a0ab2fbbf | ||
|
|
7f4cca11dc | ||
|
|
b95beeb595 | ||
|
|
9dfeda58ed | ||
|
|
c5e3d135ae | ||
|
|
d6e9cde595 | ||
|
|
98b3f52599 | ||
|
|
91cc2059f5 | ||
|
|
344e41c922 | ||
|
|
6ebb679f06 | ||
|
|
c42b163332 | ||
|
|
5b17909c4f | ||
|
|
e662f6835e | ||
|
|
0a82fe8447 | ||
|
|
d7fcb3c5a1 | ||
|
|
d2fde2f655 | ||
|
|
65ef543f8c | ||
|
|
53c43fcc84 | ||
|
|
f4ecc799c8 | ||
|
|
c9e1602f90 | ||
|
|
8eb19cc251 | ||
|
|
edc050cc57 | ||
|
|
948285de39 | ||
|
|
6b5b3ca414 | ||
|
|
d5915a167f | ||
|
|
6ca97da0fc | ||
|
|
d0bc4fff18 | ||
|
|
8b1cda7568 | ||
|
|
d364ede59c | ||
|
|
ef93125988 | ||
|
|
8013af6f3d | ||
|
|
52b2fbe970 | ||
|
|
4e17154060 | ||
|
|
a43b6922d1 | ||
|
|
eedec155ac | ||
|
|
be0d293354 | ||
|
|
21135471a6 | ||
|
|
79f089bdd9 | ||
|
|
2d391e62bd | ||
|
|
75a950cb93 | ||
|
|
93d951556b | ||
|
|
76784e4ece | ||
|
|
7a89e49859 | ||
|
|
068190a802 | ||
|
|
d616925835 | ||
|
|
795ea011ba | ||
|
|
da48a81290 | ||
|
|
c79389f032 | ||
|
|
7fdcada67b | ||
|
|
f6b76e50ad | ||
|
|
4491ee1805 | ||
|
|
5a38ccc253 | ||
|
|
d26453a3f8 | ||
|
|
ac011ebd7f | ||
|
|
823da54361 | ||
|
|
c275010fff | ||
|
|
0343fe9fa5 | ||
|
|
fa60049648 | ||
|
|
495ac8b79a | ||
|
|
7eadc5ee70 | ||
|
|
857dc5bacd | ||
|
|
6dc3f09cb9 | ||
|
|
b40a9ba5fd | ||
|
|
7e5ded2ad0 | ||
|
|
23325c135f | ||
|
|
a6fd2a46d1 | ||
|
|
55c81f2cd3 | ||
|
|
10bbeb6837 | ||
|
|
9c60292250 | ||
|
|
c4b788230c | ||
|
|
22172a4aa6 | ||
|
|
c556c57e5e | ||
|
|
834fa5870c | ||
|
|
3720de78c9 | ||
|
|
68a8d0b46d | ||
|
|
72e1b5de4d | ||
|
|
1af0a2c5ae | ||
|
|
eef9c6b0ee | ||
|
|
d697daa7a5 | ||
|
|
99ab4236af | ||
|
|
25e6d4d459 | ||
|
|
51f9bed3dd | ||
|
|
ae89958972 | ||
|
|
90916f16a5 | ||
|
|
26ef5132a6 | ||
|
|
d7aeb2ce5f | ||
|
|
50fa627b90 | ||
|
|
32e7b46a17 | ||
|
|
7da7d2aa8e | ||
|
|
98414aca7f | ||
|
|
440d28091b | ||
|
|
4db4b43417 | ||
|
|
38a5116728 | ||
|
|
56a802057e | ||
|
|
f41cc87088 | ||
|
|
e9bff7978a | ||
|
|
20c33fe6a8 | ||
|
|
e22146b07a | ||
|
|
6790d848c5 | ||
|
|
3204a03574 | ||
|
|
5009b43dc6 | ||
|
|
39feee8e3a | ||
|
|
1e25bdf780 | ||
|
|
d0949b7c5c | ||
|
|
bd46a2abf4 | ||
|
|
a1ae260e8a | ||
|
|
d7479107c7 | ||
|
|
e8e02f900c | ||
|
|
a84c964d37 | ||
|
|
75c50a1563 | ||
|
|
b9669829c8 | ||
|
|
7cd6a64d2f | ||
|
|
e88f6acb94 | ||
|
|
885f6b5ceb | ||
|
|
568c2e039b | ||
|
|
5dd15443ac | ||
|
|
4d3c4cfac7 | ||
|
|
9538088751 | ||
|
|
d1b5b63872 | ||
|
|
b7f9e9ae39 | ||
|
|
8deb9a4f1e | ||
|
|
65a7635793 | ||
|
|
d5a3b3f5ec | ||
|
|
c57e41c029 | ||
|
|
747b08bee0 | ||
|
|
ac84b1cd82 | ||
|
|
2e1979a21e | ||
|
|
87789fae0b | ||
|
|
78a62c0124 | ||
|
|
5460c10047 | ||
|
|
9f8885760b | ||
|
|
b8ba942ac2 | ||
|
|
2ff3fc1790 | ||
|
|
09c668f220 | ||
|
|
45a155bd0f | ||
|
|
1bf6d6f11e | ||
|
|
888e92eb57 | ||
|
|
39ced1afa1 | ||
|
|
73951abe7b | ||
|
|
e4b3a257ee | ||
|
|
4836ae32c7 | ||
|
|
5006eab552 | ||
|
|
aec8c57701 | ||
|
|
b0c06e904a | ||
|
|
43229e4f10 | ||
|
|
266d95066d | ||
|
|
2c5573e894 | ||
|
|
af0b50f83a | ||
|
|
f810510bb2 | ||
|
|
317464a386 | ||
|
|
0f15e025e6 | ||
|
|
e84ccc3f56 | ||
|
|
365cbf46a7 | ||
|
|
08ff606b0b | ||
|
|
63f606d3e3 | ||
|
|
7ac213079c | ||
|
|
b7567394e1 | ||
|
|
e33e0295bb | ||
|
|
41e6e05dee | ||
|
|
ad55fbaabb | ||
|
|
b28dbef59d | ||
|
|
3bcf108416 | ||
|
|
23b6173486 | ||
|
|
1b0968df46 | ||
|
|
febc3f63b2 | ||
|
|
0fb1aa0645 | ||
|
|
6add1b7217 | ||
|
|
ae2f5b7b2e | ||
|
|
5df070ba39 | ||
|
|
792afb4432 | ||
|
|
687210f155 | ||
|
|
ffbe36fc3e | ||
|
|
70ff26b454 | ||
|
|
28b5a6537d | ||
|
|
867816003e | ||
|
|
fbfdf513d2 | ||
|
|
95f943add6 | ||
|
|
a09bc5045b | ||
|
|
c7dc17fc0f | ||
|
|
c40d23b89f | ||
|
|
b93ccee451 | ||
|
|
5b351d073f | ||
|
|
7f0fae947a | ||
|
|
07b1326073 | ||
|
|
f0373f720f | ||
|
|
a7726cdf51 | ||
|
|
08ed44d722 | ||
|
|
0b26e389d8 | ||
|
|
1736fa4d22 | ||
|
|
b947049f85 | ||
|
|
36ca545286 | ||
|
|
1808618f5d | ||
|
|
64f6159646 | ||
|
|
cbd463175f | ||
|
|
e57a4db5d7 | ||
|
|
e3c0ea1cb4 | ||
|
|
f21dc38a6e | ||
|
|
fc731bc67f | ||
|
|
e0cd580aef | ||
|
|
22aab1ce94 | ||
|
|
0e5b813ef9 | ||
|
|
21aa1d4b91 | ||
|
|
2afa41f628 | ||
|
|
af072c26bc | ||
|
|
bdf531e38d | ||
|
|
b8e82d205b | ||
|
|
3119a3aeb5 | ||
|
|
2386e54182 | ||
|
|
9f9c78578f | ||
|
|
980bb3ae19 | ||
|
|
d56ded89c5 | ||
|
|
494ee2f1fc | ||
|
|
8759c1e14b | ||
|
|
6b0b04f1b2 | ||
|
|
a8c1253b6f | ||
|
|
acf3495eb8 | ||
|
|
4d8700786e | ||
|
|
596635fa0c | ||
|
|
fa48fb2d0f | ||
|
|
9630ded313 | ||
|
|
4512905961 | ||
|
|
fb4f7be22c | ||
|
|
9273d09dd4 | ||
|
|
a3a014294f | ||
|
|
b161cff5f9 | ||
|
|
f07dedf73f | ||
|
|
f00a8ad93c | ||
|
|
698b577413 | ||
|
|
183b90a625 | ||
|
|
a68b71ac02 | ||
|
|
fd0ca74763 | ||
|
|
1417648469 | ||
|
|
d4e7ffb38c | ||
|
|
362b3b02e6 | ||
|
|
b567d3694c | ||
|
|
366d5101d3 | ||
|
|
75d50e5de9 | ||
|
|
0c10f0e1c0 | ||
|
|
020092e08f | ||
|
|
1a255e3150 | ||
|
|
af7489886d | ||
|
|
91e77a0cfb | ||
|
|
32215e7889 | ||
|
|
45144fc79f | ||
|
|
5f8ee3815c | ||
|
|
992a610fe8 | ||
|
|
985430b4fc | ||
|
|
e725d737fb | ||
|
|
aba70df48f | ||
|
|
e968d9ac58 | ||
|
|
174eedce44 | ||
|
|
bcb7961f12 | ||
|
|
b91d8b289b | ||
|
|
cd6b3d558b | ||
|
|
f069d09ee0 | ||
|
|
0927a0dd24 | ||
|
|
978eadbad4 | ||
|
|
03406fcb6c | ||
|
|
cd0f710be9 | ||
|
|
c22d3684ba | ||
|
|
2ce29e032b | ||
|
|
a1aba4bf75 | ||
|
|
48d870aed1 | ||
|
|
a527c3e814 | ||
|
|
79ac57561f | ||
|
|
ddb508c0a2 | ||
|
|
91d0c758e5 | ||
|
|
06dd202a05 | ||
|
|
ccf8a651f3 | ||
|
|
d04f306931 | ||
|
|
f27083a4a8 | ||
|
|
f11a2d4dd7 | ||
|
|
77d3c6bff3 | ||
|
|
d25dc08932 | ||
|
|
78025c4a26 | ||
|
|
87321deb3f | ||
|
|
d5ca72e38b | ||
|
|
526cbb5cff | ||
|
|
d08f0552ee | ||
|
|
58a1d16ff6 | ||
|
|
cea7809cea | ||
|
|
f1f3cceb50 | ||
|
|
155c291006 | ||
|
|
48d54265ce | ||
|
|
f26e90be0c | ||
|
|
033578839b | ||
|
|
215b909c1f | ||
|
|
734cde7e38 | ||
|
|
68886de085 | ||
|
|
22a778c880 | ||
|
|
b7afac6bc2 | ||
|
|
975f51fe16 | ||
|
|
5fb4adba65 | ||
|
|
37dc2f13b4 | ||
|
|
43b22f17dc | ||
|
|
37559ca79f | ||
|
|
665e428435 | ||
|
|
9ec3294b97 | ||
|
|
085615af97 | ||
|
|
6cf6c36937 | ||
|
|
00362f2a94 | ||
|
|
12ce2c3925 | ||
|
|
c1718f9d86 | ||
|
|
6b297cd646 | ||
|
|
48e4d77099 | ||
|
|
5f89c1d4f7 | ||
|
|
cf860df599 | ||
|
|
8f745da159 | ||
|
|
8bf4c2e38c | ||
|
|
7d6744c739 | ||
|
|
43e736f79b | ||
|
|
4962c5526d | ||
|
|
c9fabc2ef0 | ||
|
|
1c2b5f5318 | ||
|
|
b7f2a1a217 | ||
|
|
aa6deff01e | ||
|
|
81095b1bd9 | ||
|
|
c4b4b6c06b | ||
|
|
276b460ea9 | ||
|
|
afd8c4e007 | ||
|
|
94fded4f4f | ||
|
|
61bb044156 | ||
|
|
e7864a2b70 | ||
|
|
6d5a911707 | ||
|
|
3c9e5271c6 | ||
|
|
24b67d5520 | ||
|
|
49d26a9658 | ||
|
|
a6b5d518a9 | ||
|
|
075ac34545 | ||
|
|
922ef86a3b | ||
|
|
85737e6745 | ||
|
|
ed92a3e8ed | ||
|
|
5a82940452 | ||
|
|
c6a26519a1 | ||
|
|
252981914f | ||
|
|
484a1ad67e | ||
|
|
908d3bdad9 | ||
|
|
91bc78a8b8 | ||
|
|
29d7f97c96 | ||
|
|
9e5cd2cb26 | ||
|
|
4d5911b4e4 | ||
|
|
220a0f0880 | ||
|
|
4a884343f5 | ||
|
|
7ff7536e2c | ||
|
|
b874c6f1fc | ||
|
|
54d01e363a | ||
|
|
834e8843de | ||
|
|
fd135f3e2d | ||
|
|
d98d1ad574 | ||
|
|
2391aefd82 | ||
|
|
123cc1a1bc | ||
|
|
5725088ff2 | ||
|
|
4fb39b6700 | ||
|
|
f5160ed0aa | ||
|
|
897c7bddf5 | ||
|
|
83478e6102 | ||
|
|
0f8b634cd5 | ||
|
|
9e3dca8bef | ||
|
|
b0ca3be2bb | ||
|
|
c5e6a6204c | ||
|
|
fba15850e5 | ||
|
|
0215324a66 | ||
|
|
7cb89a5a1c | ||
|
|
24cc0b984d | ||
|
|
5becb7c9c6 | ||
|
|
6f4f31f167 | ||
|
|
93e8534713 | ||
|
|
dd3ac97ffe | ||
|
|
9a3bd07e9f | ||
|
|
d509675592 | ||
|
|
12e4f31d94 | ||
|
|
ffafb434fb | ||
|
|
d715655f16 | ||
|
|
2c38caa176 | ||
|
|
4be2dd6ab9 | ||
|
|
5a4ab7c7d2 | ||
|
|
6600253046 | ||
|
|
0af7fe2cab | ||
|
|
7c1f9ef503 | ||
|
|
3ff56a6dde | ||
|
|
9967a53f4c | ||
|
|
bdecbd30df | ||
|
|
f0fab99d6f | ||
|
|
bebc7f8470 | ||
|
|
2753429c99 | ||
|
|
a56d4533b7 | ||
|
|
14d6abd8e9 | ||
|
|
59c9716f96 | ||
|
|
5f7789d329 | ||
|
|
572abee6f1 | ||
|
|
67fcbdf8a1 | ||
|
|
7c376398b1 | ||
|
|
16be742b08 | ||
|
|
f898a9e97d | ||
|
|
08f4e1335c | ||
|
|
53ad5627b7 | ||
|
|
157454ffa4 | ||
|
|
7759ec7c43 | ||
|
|
03fcc211de | ||
|
|
b5a879e1c2 | ||
|
|
ea36d4de17 | ||
|
|
1376d83363 | ||
|
|
f041990f2a | ||
|
|
4c7827588d | ||
|
|
794442b130 | ||
|
|
75dd230994 | ||
|
|
418c2e7931 | ||
|
|
d7fa44f4da | ||
|
|
05e6b97bed | ||
|
|
3ca6972ecd | ||
|
|
86b0de5c41 | ||
|
|
47c001dde6 | ||
|
|
f560531d5b | ||
|
|
7f88923b40 | ||
|
|
c50af0aeba | ||
|
|
216f168b2b | ||
|
|
cee3d67f50 | ||
|
|
bc0c22fabc | ||
|
|
7c80a65484 | ||
|
|
7a0e668560 | ||
|
|
1b83353dc3 | ||
|
|
74d9a35621 | ||
|
|
547c3405d4 | ||
|
|
763fd09416 | ||
|
|
8b8f05c86c | ||
|
|
6aa2285e32 | ||
|
|
306a5ccd2d | ||
|
|
c9931ddba5 | ||
|
|
f24c63a292 | ||
|
|
1e7ad894d2 | ||
|
|
9a0c0617f1 | ||
|
|
aefbc23451 | ||
|
|
97dcf95cc8 | ||
|
|
b375f5919e | ||
|
|
945a83d406 | ||
|
|
641780a9c6 | ||
|
|
74590f8345 | ||
|
|
0835f596b8 | ||
|
|
8f59c1ecae | ||
|
|
492d8d0961 | ||
|
|
1d9c8d61d8 | ||
|
|
0e8d469f82 | ||
|
|
fe359cbfc2 | ||
|
|
8edc3cd62c | ||
|
|
0cf2df84d4 | ||
|
|
2402f5a7a1 | ||
|
|
1221f7cd5e | ||
|
|
08c46f2b86 | ||
|
|
5705cec68e | ||
|
|
82528d2678 | ||
|
|
19bc83716c | ||
|
|
8ab33c18e4 | ||
|
|
8f8117f78e | ||
|
|
02fd76b97c | ||
|
|
cbda492909 | ||
|
|
0b643e930d | ||
|
|
d3356bf614 | ||
|
|
e8eeba7bee | ||
|
|
3307958bd0 | ||
|
|
e1dc979054 | ||
|
|
563ba7a3f0 | ||
|
|
43eb0ce3bf | ||
|
|
0a9377535b | ||
|
|
3f3f678a47 | ||
|
|
0c90370e6d | ||
|
|
8ea777a6a0 | ||
|
|
39a4a44d7d | ||
|
|
d0244bfc3d | ||
|
|
63e2a6d212 | ||
|
|
ca559819f7 | ||
|
|
d32f8641ed | ||
|
|
5e908a290c | ||
|
|
1c59567a7f | ||
|
|
d4bca53cd9 | ||
|
|
56eb7f7de4 | ||
|
|
2237131e15 | ||
|
|
b4eda14257 | ||
|
|
52df350fe5 | ||
|
|
4aa927d16d | ||
|
|
432c92d8df | ||
|
|
bdbf5eedae | ||
|
|
4bd7748362 | ||
|
|
cf61ad14cc | ||
|
|
4000cb7d34 | ||
|
|
f74af0e61d | ||
|
|
82c3158ad5 | ||
|
|
27a68a4d1b | ||
|
|
8ea18fa8d2 | ||
|
|
86555ae0f7 | ||
|
|
68b8b45cd5 | ||
|
|
1483f5aa9b | ||
|
|
89fdcbec8c | ||
|
|
8647addf93 | ||
|
|
a403816405 | ||
|
|
8bf433dc86 | ||
|
|
db41536454 | ||
|
|
b458b2999b | ||
|
|
3db0f1a284 | ||
|
|
17511df59b | ||
|
|
8d00493485 | ||
|
|
9ca5e8c547 | ||
|
|
71d452876e | ||
|
|
32e61ee295 | ||
|
|
1895e134a7 | ||
|
|
d54c9086c2 | ||
|
|
e7ccdeebc9 | ||
|
|
ee4bdf10ee | ||
|
|
c9ca3b7065 | ||
|
|
8a73cd1f9a | ||
|
|
71c0466c04 | ||
|
|
11dc4e59b3 | ||
|
|
f03af47a34 | ||
|
|
334a9789f1 | ||
|
|
6a5bac309e | ||
|
|
277e4dc203 | ||
|
|
7ac42ab7b3 | ||
|
|
d0f36eeda0 | ||
|
|
ac8b1df885 | ||
|
|
cb961d8c8e | ||
|
|
fe5d325107 | ||
|
|
92e8004705 | ||
|
|
350c6306b4 | ||
|
|
9a22457e8f | ||
|
|
1eb4baa5b8 | ||
|
|
3a26f61fb3 | ||
|
|
5ea3c3db15 | ||
|
|
f06d782f5a | ||
|
|
f8da33ae59 | ||
|
|
67732bacb1 | ||
|
|
a418a2d3fc | ||
|
|
5a3de81925 | ||
|
|
ec582cc7ad | ||
|
|
2248eaacac | ||
|
|
9894ce5fc4 | ||
|
|
7103367ad4 | ||
|
|
a8518cce95 | ||
|
|
8f59f131e5 | ||
|
|
aa139e2f02 | ||
|
|
de9bae21ef | ||
|
|
16e04ed944 | ||
|
|
6476c8e856 | ||
|
|
74fe15b360 | ||
|
|
eaa52719a3 | ||
|
|
70dac4b436 | ||
|
|
5dddf496ce | ||
|
|
4278c45c91 | ||
|
|
1d5aa37d68 | ||
|
|
cf1d49adbf | ||
|
|
5d8ea4b326 | ||
|
|
95274f1f8a | ||
|
|
7913d34d7c | ||
|
|
4434cebbb3 | ||
|
|
4bc5a8324d | ||
|
|
4fa3e23092 | ||
|
|
1071430875 | ||
|
|
b71c5849e3 | ||
|
|
f233c4c59d | ||
|
|
d1a21e0292 | ||
|
|
89ae353748 | ||
|
|
a5bc54f01e | ||
|
|
5ffdbae1f6 | ||
|
|
eb09fbce1e | ||
|
|
0676a9fc6b | ||
|
|
b466471a52 | ||
|
|
ae418eca24 | ||
|
|
a49b766860 | ||
|
|
8284544adb | ||
|
|
07b0d144ce | ||
|
|
1ccf2ca2f4 | ||
|
|
d0819d618e | ||
|
|
bf92000e2d | ||
|
|
81d5f05b6e | ||
|
|
9b564b525d | ||
|
|
f004073b54 | ||
|
|
96bb078577 | ||
|
|
1fabb89a41 | ||
|
|
4c52aa9faa | ||
|
|
561c69c285 | ||
|
|
89152f8e41 | ||
|
|
6248127c43 | ||
|
|
1a22445d30 | ||
|
|
eae0983d2d | ||
|
|
ada60d8003 | ||
|
|
b586d5b567 | ||
|
|
c2b93ff83f | ||
|
|
362786c58a | ||
|
|
e0cd3ad0de | ||
|
|
7f342020dc | ||
|
|
c7e502a07b | ||
|
|
e5d8a5eb85 | ||
|
|
eb15c456c9 | ||
|
|
678e67b58e | ||
|
|
b109977301 | ||
|
|
096c5fd5d2 | ||
|
|
7900b48bc7 | ||
|
|
dee378d76d | ||
|
|
688cdb05b4 | ||
|
|
1677efb9da | ||
|
|
2727a2cec0 | ||
|
|
b8a5da80c4 | ||
|
|
5517f3624d | ||
|
|
fb140a1bff | ||
|
|
63da66bb63 | ||
|
|
0bfccc55e2 | ||
|
|
8a86bca5ed | ||
|
|
c396fd91a0 | ||
|
|
119121c739 | ||
|
|
e16d3eb998 | ||
|
|
77d44bb7b4 | ||
|
|
1df8c129bc | ||
|
|
39b0f0dd73 | ||
|
|
eaa7a7bb93 | ||
|
|
b438bc5a0b | ||
|
|
a972503f57 | ||
|
|
3e39ea0b83 | ||
|
|
91f3689bf5 | ||
|
|
bb671d9016 | ||
|
|
156599ba2d | ||
|
|
b512dfe794 | ||
|
|
3fbdbf5084 | ||
|
|
a049f6295a | ||
|
|
f63bb9583d | ||
|
|
7cb42c9c36 | ||
|
|
2ff53060d2 | ||
|
|
babe3c7b29 | ||
|
|
09e435c8d4 | ||
|
|
1ddecf1958 | ||
|
|
ae67539c8b | ||
|
|
01495c674a | ||
|
|
58a03eca67 | ||
|
|
53d1acd598 | ||
|
|
501d775583 | ||
|
|
be6ce8a92a | ||
|
|
ae6f58690b | ||
|
|
a319327ffb | ||
|
|
32a2584e07 | ||
|
|
8627751ec6 | ||
|
|
0b2d0be35a | ||
|
|
a59e75a475 | ||
|
|
d67e66de72 | ||
|
|
ed2602ab99 | ||
|
|
20268d04c0 | ||
|
|
1bab4cd198 | ||
|
|
09a99fcd5f | ||
|
|
25d827d949 | ||
|
|
e5a8928290 | ||
|
|
8458baf6a9 | ||
|
|
7b48de68ce | ||
|
|
cf41c0b5ff | ||
|
|
55fa91ae53 | ||
|
|
8351a10b95 | ||
|
|
0ecc814c81 | ||
|
|
fbc0e2b834 | ||
|
|
8827aae83b | ||
|
|
46d9f31e94 | ||
|
|
df4d916007 | ||
|
|
31edc22ecc | ||
|
|
e01c92a5ef | ||
|
|
8526e04e7b | ||
|
|
97108845e2 | ||
|
|
fb66c1b58c | ||
|
|
4d4db9797f | ||
|
|
d32fd31588 | ||
|
|
56976ffb49 | ||
|
|
57b94eacaa | ||
|
|
6b47598998 | ||
|
|
4d1094e8be | ||
|
|
81e2d7272b | ||
|
|
bcc519fa7c | ||
|
|
a62801eb53 | ||
|
|
152fce5e2c | ||
|
|
fd7d51c353 | ||
|
|
f0c5f920d0 | ||
|
|
29900d4e6b | ||
|
|
611e11734c | ||
|
|
f3ee2d98af | ||
|
|
ccb76e5688 | ||
|
|
5100ef9f82 | ||
|
|
0b1b9edb28 | ||
|
|
9c927e9de9 | ||
|
|
1eff8564c7 | ||
|
|
416f277339 | ||
|
|
ef6f902372 | ||
|
|
2b22fffc78 | ||
|
|
2e88b06396 | ||
|
|
3d56be3788 | ||
|
|
93e7750699 | ||
|
|
46f4ebbe84 | ||
|
|
bcf1b384e3 | ||
|
|
4bfcf4654a | ||
|
|
ebfbb09109 | ||
|
|
074e28a46e | ||
|
|
a8b6596d23 | ||
|
|
d1ca1e665f | ||
|
|
20735a5354 | ||
|
|
72aa376237 | ||
|
|
8423b77f14 | ||
|
|
611959eee5 | ||
|
|
828ae842b9 | ||
|
|
f29a0b9351 | ||
|
|
cc0091f0f9 | ||
|
|
af035c1e1d | ||
|
|
e43dbd03f3 | ||
|
|
c4a5816ccd | ||
|
|
f61c37cec9 | ||
|
|
63acfe4b00 | ||
|
|
b9d7d55b2c | ||
|
|
ac36161694 | ||
|
|
473588c399 | ||
|
|
9fab26904f | ||
|
|
8636c3e003 | ||
|
|
bb16cf0f4f | ||
|
|
5f6e166bce | ||
|
|
761d7d2771 | ||
|
|
080d4579db | ||
|
|
c73b4ddfd9 | ||
|
|
c2aff4c744 |
@@ -0,0 +1,5 @@
|
||||
[codespell]
|
||||
quiet-level = 2
|
||||
count =
|
||||
skip = ./deps,./src/crc16_slottable.h,tmp*,./.git,./lcov-html
|
||||
ignore-words = ./.codespell/wordlist.txt
|
||||
@@ -0,0 +1 @@
|
||||
codespell==2.1.0
|
||||
@@ -0,0 +1,18 @@
|
||||
ake
|
||||
bale
|
||||
fle
|
||||
fo
|
||||
gameboy
|
||||
mutli
|
||||
nd
|
||||
nees
|
||||
oll
|
||||
optin
|
||||
ot
|
||||
smove
|
||||
te
|
||||
tre
|
||||
cancelability
|
||||
ist
|
||||
statics
|
||||
filetest
|
||||
@@ -0,0 +1,6 @@
|
||||
# We set commands.c's merge driver to `binary` so when it conflicts during a
|
||||
# merge git will leave the local version unmodified. This way our Makefile
|
||||
# will rebuild it based on src/commands/*.json before trying to compile it.
|
||||
# Otherwise the file gets modified and gets the same timestamp as the .json
|
||||
# files. So the Makefile doesn't attempt to rebuild it before compiling.
|
||||
src/commands.c merge=binary
|
||||
@@ -1,12 +1,17 @@
|
||||
---
|
||||
name: Crash report
|
||||
about: Submit a crash report
|
||||
title: '[CRASH]'
|
||||
title: '[CRASH] <short description>'
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Notice!
|
||||
- If a Redis module was involved, please open an issue in the module's repo instead!
|
||||
- If you're using docker on Apple M1, please make sure the image you're using was compiled for ARM!
|
||||
|
||||
|
||||
**Crash report**
|
||||
|
||||
Paste the complete crash log between the quotes below. Please include a few lines from the log preceding the crash report to provide some context.
|
||||
@@ -14,7 +19,7 @@ Paste the complete crash log between the quotes below. Please include a few line
|
||||
```
|
||||
```
|
||||
|
||||
**Aditional information**
|
||||
**Additional information**
|
||||
|
||||
1. OS distribution and version
|
||||
2. Steps to reproduce (if any)
|
||||
|
||||
@@ -14,8 +14,8 @@ Generally, questions about using Redis should be directed to the [community](htt
|
||||
* [the mailing list](https://groups.google.com/forum/#!forum/redis-db)
|
||||
* [the `redis` tag at StackOverflow](http://stackoverflow.com/questions/tagged/redis)
|
||||
* [/r/redis subreddit](http://www.reddit.com/r/redis)
|
||||
* [the irc channel #redis](http://webchat.freenode.net/?channels=redis) on freenode
|
||||
* [github discussions](https://github.com/redis/redis/discussions)
|
||||
|
||||
It is also possible that your question was already asked here, so please do a quick issues search before submitting. Lastly, if your question is about one of Redis' [clients](https://redis.io/clients), you may to contact your client's developers for help.
|
||||
|
||||
That said, please feel free to replace all this with your question :)
|
||||
That said, please feel free to replace all this with your question :)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
- package-ecosystem: pip
|
||||
directory: /.codespell
|
||||
schedule:
|
||||
interval: weekly
|
||||
+28
-12
@@ -7,36 +7,52 @@ jobs:
|
||||
test-ubuntu-latest:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: make
|
||||
# Fail build if there are warnings
|
||||
# build with TLS just for compilation coverage
|
||||
run: make REDIS_CFLAGS='-Werror' BUILD_TLS=yes
|
||||
- name: test
|
||||
run: |
|
||||
sudo apt-get install tcl8.6
|
||||
./runtest --verbose
|
||||
sudo apt-get install tcl8.6 tclx
|
||||
./runtest --verbose --tags -slow --dump-logs
|
||||
- name: module api test
|
||||
run: ./runtest-moduleapi --verbose
|
||||
run: ./runtest-moduleapi --verbose --dump-logs
|
||||
|
||||
build-ubuntu-old:
|
||||
runs-on: ubuntu-16.04
|
||||
test-sanitizer-address:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: make
|
||||
run: make SANITIZER=address REDIS_CFLAGS='-Werror'
|
||||
- name: testprep
|
||||
run: sudo apt-get install tcl8.6 tclx -y
|
||||
- name: test
|
||||
run: ./runtest --verbose --tags -slow --dump-logs
|
||||
- name: module api test
|
||||
run: ./runtest-moduleapi --verbose --dump-logs
|
||||
|
||||
build-debian-old:
|
||||
runs-on: ubuntu-latest
|
||||
container: debian:oldoldstable
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: make
|
||||
run: make REDIS_CFLAGS='-Werror'
|
||||
run: |
|
||||
apt-get update && apt-get install -y build-essential
|
||||
make REDIS_CFLAGS='-Werror'
|
||||
|
||||
build-macos-latest:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: make
|
||||
run: make REDIS_CFLAGS='-Werror'
|
||||
|
||||
build-32bit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: make
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install libc6-dev-i386
|
||||
@@ -45,7 +61,7 @@ jobs:
|
||||
build-libc-malloc:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: make
|
||||
run: make REDIS_CFLAGS='-Werror' MALLOC=libc
|
||||
|
||||
@@ -53,7 +69,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
container: centos:7
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: make
|
||||
run: |
|
||||
yum -y install gcc make
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
schedule:
|
||||
# run weekly new vulnerability was added to the database
|
||||
- cron: '0 0 * * 0'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name != 'schedule' || github.repository == 'redis/redis'
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'cpp' ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
+649
-131
@@ -7,302 +7,820 @@ on:
|
||||
- '[0-9].[0-9]'
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
skipjobs:
|
||||
description: 'jobs to skip (delete the ones you wanna keep, do not leave empty)'
|
||||
default: 'valgrind,sanitizer,tls,freebsd,macos,alpine,32bit,iothreads,ubuntu,centos,malloc'
|
||||
skiptests:
|
||||
description: 'tests to skip (delete the ones you wanna keep, do not leave empty)'
|
||||
default: 'redis,modules,sentinel,cluster,unittest'
|
||||
test_args:
|
||||
description: 'extra test arguments'
|
||||
default: ''
|
||||
cluster_test_args:
|
||||
description: 'extra cluster / sentinel test arguments'
|
||||
default: ''
|
||||
use_repo:
|
||||
description: 'repo owner and name'
|
||||
default: 'redis/redis'
|
||||
use_git_ref:
|
||||
description: 'git branch or sha to use'
|
||||
default: 'unstable'
|
||||
|
||||
|
||||
jobs:
|
||||
|
||||
test-ubuntu-jemalloc:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'redis/redis'
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'ubuntu')
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
echo "skipping: ${{github.event.inputs.skipjobs}} and ${{github.event.inputs.skiptests}}"
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: make REDIS_CFLAGS='-Werror -DREDIS_TEST'
|
||||
- name: testprep
|
||||
run: sudo apt-get install tcl8.6 tclx
|
||||
- name: test
|
||||
run: |
|
||||
sudo apt-get install tcl8.6
|
||||
./runtest --accurate --verbose --dump-logs
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: module api test
|
||||
run: ./runtest-moduleapi --verbose
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: sentinel tests
|
||||
run: ./runtest-sentinel
|
||||
if: true && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
run: ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
|
||||
- name: cluster tests
|
||||
run: ./runtest-cluster
|
||||
if: true && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
|
||||
- name: unittest
|
||||
run: ./src/redis-server test all
|
||||
if: true && !contains(github.event.inputs.skiptests, 'unittest')
|
||||
run: ./src/redis-server test all --accurate
|
||||
|
||||
test-ubuntu-libc-malloc:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'redis/redis'
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'malloc')
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: make
|
||||
run: make MALLOC=libc
|
||||
- name: test
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
sudo apt-get install tcl8.6
|
||||
./runtest --accurate --verbose --dump-logs
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: make MALLOC=libc REDIS_CFLAGS='-Werror'
|
||||
- name: testprep
|
||||
run: sudo apt-get install tcl8.6 tclx
|
||||
- name: test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: module api test
|
||||
run: ./runtest-moduleapi --verbose
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: sentinel tests
|
||||
run: ./runtest-sentinel
|
||||
if: true && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
run: ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
|
||||
- name: cluster tests
|
||||
run: ./runtest-cluster
|
||||
if: true && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
|
||||
|
||||
test-ubuntu-no-malloc-usable-size:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'redis/redis'
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'malloc')
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: make
|
||||
run: make MALLOC=libc CFLAGS=-DNO_MALLOC_USABLE_SIZE
|
||||
- name: test
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
sudo apt-get install tcl8.6
|
||||
./runtest --accurate --verbose --dump-logs
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: make MALLOC=libc CFLAGS=-DNO_MALLOC_USABLE_SIZE REDIS_CFLAGS='-Werror'
|
||||
- name: testprep
|
||||
run: sudo apt-get install tcl8.6 tclx
|
||||
- name: test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: module api test
|
||||
run: ./runtest-moduleapi --verbose
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: sentinel tests
|
||||
run: ./runtest-sentinel
|
||||
if: true && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
run: ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
|
||||
- name: cluster tests
|
||||
run: ./runtest-cluster
|
||||
if: true && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
|
||||
|
||||
test-ubuntu-32bit:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'redis/redis'
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, '32bit')
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install libc6-dev-i386
|
||||
make 32bit REDIS_CFLAGS='-Werror -DREDIS_TEST'
|
||||
- name: testprep
|
||||
run: sudo apt-get install tcl8.6 tclx
|
||||
- name: test
|
||||
run: |
|
||||
sudo apt-get install tcl8.6
|
||||
./runtest --accurate --verbose --dump-logs
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: module api test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: |
|
||||
make -C tests/modules 32bit # the script below doesn't have an argument, we must build manually ahead of time
|
||||
./runtest-moduleapi --verbose
|
||||
./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: sentinel tests
|
||||
run: ./runtest-sentinel
|
||||
if: true && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
run: ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
|
||||
- name: cluster tests
|
||||
run: ./runtest-cluster
|
||||
if: true && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
|
||||
- name: unittest
|
||||
run: ./src/redis-server test all
|
||||
if: true && !contains(github.event.inputs.skiptests, 'unittest')
|
||||
run: ./src/redis-server test all --accurate
|
||||
|
||||
test-ubuntu-tls:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'redis/redis'
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'tls')
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: |
|
||||
make BUILD_TLS=yes
|
||||
- name: test
|
||||
make BUILD_TLS=yes REDIS_CFLAGS='-Werror'
|
||||
- name: testprep
|
||||
run: |
|
||||
sudo apt-get install tcl8.6 tcl-tls
|
||||
sudo apt-get install tcl8.6 tclx tcl-tls
|
||||
./utils/gen-test-certs.sh
|
||||
./runtest --accurate --verbose --tls --dump-logs
|
||||
./runtest --accurate --verbose --dump-logs
|
||||
- name: test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: |
|
||||
./runtest --accurate --verbose --dump-logs --tls --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: module api test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: |
|
||||
./runtest-moduleapi --verbose --tls
|
||||
./runtest-moduleapi --verbose
|
||||
./runtest-moduleapi --verbose --dump-logs --tls --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: sentinel tests
|
||||
if: true && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
run: |
|
||||
./runtest-sentinel --tls
|
||||
./runtest-sentinel
|
||||
./runtest-sentinel --tls ${{github.event.inputs.cluster_test_args}}
|
||||
- name: cluster tests
|
||||
if: true && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
run: |
|
||||
./runtest-cluster --tls
|
||||
./runtest-cluster
|
||||
./runtest-cluster --tls ${{github.event.inputs.cluster_test_args}}
|
||||
|
||||
test-ubuntu-tls-no-tls:
|
||||
runs-on: ubuntu-latest
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'tls')
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: |
|
||||
make BUILD_TLS=yes REDIS_CFLAGS='-Werror'
|
||||
- name: testprep
|
||||
run: |
|
||||
sudo apt-get install tcl8.6 tclx tcl-tls
|
||||
./utils/gen-test-certs.sh
|
||||
- name: test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: |
|
||||
./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: module api test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: |
|
||||
./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: sentinel tests
|
||||
if: true && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
run: |
|
||||
./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
|
||||
- name: cluster tests
|
||||
if: true && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
run: |
|
||||
./runtest-cluster ${{github.event.inputs.cluster_test_args}}
|
||||
|
||||
test-ubuntu-io-threads:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'redis/redis'
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'iothreads')
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: |
|
||||
make
|
||||
make REDIS_CFLAGS='-Werror'
|
||||
- name: testprep
|
||||
run: sudo apt-get install tcl8.6 tclx
|
||||
- name: test
|
||||
run: |
|
||||
sudo apt-get install tcl8.6 tcl-tls
|
||||
./runtest --config io-threads 4 --config io-threads-do-reads yes --accurate --verbose --tags network --dump-logs
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: ./runtest --config io-threads 4 --config io-threads-do-reads yes --accurate --verbose --tags network --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: cluster tests
|
||||
run: |
|
||||
./runtest-cluster --config io-threads 4 --config io-threads-do-reads yes
|
||||
if: true && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
run: ./runtest-cluster --config io-threads 4 --config io-threads-do-reads yes ${{github.event.inputs.cluster_test_args}}
|
||||
|
||||
test-valgrind:
|
||||
test-valgrind-test:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'redis/redis'
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'valgrind') && !contains(github.event.inputs.skiptests, 'redis')
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: make valgrind REDIS_CFLAGS='-Werror -DREDIS_TEST'
|
||||
- name: test
|
||||
- name: testprep
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install tcl8.6 valgrind -y
|
||||
./runtest --valgrind --verbose --clients 1 --dump-logs
|
||||
sudo apt-get install tcl8.6 tclx valgrind -y
|
||||
- name: test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: ./runtest --valgrind --no-latency --verbose --clients 1 --timeout 2400 --dump-logs ${{github.event.inputs.test_args}}
|
||||
|
||||
test-valgrind-misc:
|
||||
runs-on: ubuntu-latest
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'valgrind') && !(contains(github.event.inputs.skiptests, 'modules') && contains(github.event.inputs.skiptests, 'unittest'))
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: make valgrind REDIS_CFLAGS='-Werror -DREDIS_TEST'
|
||||
- name: testprep
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install tcl8.6 tclx valgrind -y
|
||||
- name: module api test
|
||||
run: ./runtest-moduleapi --valgrind --no-latency --verbose --clients 1
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: ./runtest-moduleapi --valgrind --no-latency --verbose --clients 1 --timeout 2400 --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: unittest
|
||||
if: true && !contains(github.event.inputs.skiptests, 'unittest')
|
||||
run: |
|
||||
valgrind --track-origins=yes --suppressions=./src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full --log-file=err.txt ./src/redis-server test all
|
||||
if grep -q 0x err.txt; then cat err.txt; exit 1; fi
|
||||
|
||||
test-valgrind-no-malloc-usable-size:
|
||||
test-valgrind-no-malloc-usable-size-test:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'redis/redis'
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'valgrind') && !contains(github.event.inputs.skiptests, 'redis')
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: make valgrind CFLAGS="-DNO_MALLOC_USABLE_SIZE"
|
||||
- name: test
|
||||
run: make valgrind CFLAGS="-DNO_MALLOC_USABLE_SIZE -DREDIS_TEST" REDIS_CFLAGS='-Werror'
|
||||
- name: testprep
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install tcl8.6 valgrind -y
|
||||
./runtest --valgrind --verbose --clients 1 --dump-logs
|
||||
sudo apt-get install tcl8.6 tclx valgrind -y
|
||||
- name: test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: ./runtest --valgrind --no-latency --verbose --clients 1 --timeout 2400 --dump-logs ${{github.event.inputs.test_args}}
|
||||
|
||||
test-valgrind-no-malloc-usable-size-misc:
|
||||
runs-on: ubuntu-latest
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'valgrind') && !(contains(github.event.inputs.skiptests, 'modules') && contains(github.event.inputs.skiptests, 'unittest'))
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: make valgrind CFLAGS="-DNO_MALLOC_USABLE_SIZE -DREDIS_TEST" REDIS_CFLAGS='-Werror'
|
||||
- name: testprep
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install tcl8.6 tclx valgrind -y
|
||||
- name: module api test
|
||||
run: ./runtest-moduleapi --valgrind --no-latency --verbose --clients 1
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: ./runtest-moduleapi --valgrind --no-latency --verbose --clients 1 --timeout 2400 --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: unittest
|
||||
if: true && !contains(github.event.inputs.skiptests, 'unittest')
|
||||
run: |
|
||||
valgrind --track-origins=yes --suppressions=./src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full --log-file=err.txt ./src/redis-server test all
|
||||
if grep -q 0x err.txt; then cat err.txt; exit 1; fi
|
||||
|
||||
test-sanitizer-address:
|
||||
runs-on: ubuntu-latest
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'sanitizer')
|
||||
timeout-minutes: 14400
|
||||
strategy:
|
||||
matrix:
|
||||
compiler: [ gcc, clang ]
|
||||
env:
|
||||
CC: ${{ matrix.compiler }}
|
||||
steps:
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: make SANITIZER=address REDIS_CFLAGS='-DREDIS_TEST -Werror'
|
||||
- name: testprep
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install tcl8.6 tclx -y
|
||||
- name: test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: module api test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: sentinel tests
|
||||
if: true && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
run: ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
|
||||
- name: cluster tests
|
||||
if: true && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
|
||||
- name: unittest
|
||||
if: true && !contains(github.event.inputs.skiptests, 'unittest')
|
||||
run: ./src/redis-server test all
|
||||
|
||||
test-sanitizer-undefined:
|
||||
runs-on: ubuntu-latest
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'sanitizer')
|
||||
timeout-minutes: 14400
|
||||
strategy:
|
||||
matrix:
|
||||
compiler: [ gcc, clang ]
|
||||
env:
|
||||
CC: ${{ matrix.compiler }}
|
||||
steps:
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: make SANITIZER=undefined REDIS_CFLAGS='-DREDIS_TEST -Werror' LUA_DEBUG=yes # we (ab)use this flow to also check Lua C API violations
|
||||
- name: testprep
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install tcl8.6 tclx -y
|
||||
- name: test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: module api test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: sentinel tests
|
||||
if: true && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
run: ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
|
||||
- name: cluster tests
|
||||
if: true && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
|
||||
- name: unittest
|
||||
if: true && !contains(github.event.inputs.skiptests, 'unittest')
|
||||
run: ./src/redis-server test all --accurate
|
||||
|
||||
test-centos7-jemalloc:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'redis/redis'
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'centos')
|
||||
container: centos:7
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: |
|
||||
yum -y install gcc make
|
||||
make
|
||||
make REDIS_CFLAGS='-Werror'
|
||||
- name: testprep
|
||||
run: yum -y install which tcl tclx
|
||||
- name: test
|
||||
run: |
|
||||
yum -y install which tcl
|
||||
./runtest --accurate --verbose --dump-logs
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: module api test
|
||||
run: ./runtest-moduleapi --verbose
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: sentinel tests
|
||||
run: ./runtest-sentinel
|
||||
if: true && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
run: ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
|
||||
- name: cluster tests
|
||||
run: ./runtest-cluster
|
||||
if: true && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
|
||||
|
||||
test-centos7-tls:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'redis/redis'
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'tls')
|
||||
container: centos:7
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: |
|
||||
yum -y install centos-release-scl epel-release
|
||||
yum -y install devtoolset-7 openssl-devel openssl
|
||||
scl enable devtoolset-7 "make BUILD_TLS=yes"
|
||||
- name: test
|
||||
scl enable devtoolset-7 "make BUILD_TLS=yes REDIS_CFLAGS='-Werror'"
|
||||
- name: testprep
|
||||
run: |
|
||||
yum -y install tcl tcltls
|
||||
yum -y install tcl tcltls tclx
|
||||
./utils/gen-test-certs.sh
|
||||
./runtest --accurate --verbose --tls --dump-logs
|
||||
./runtest --accurate --verbose --dump-logs
|
||||
- name: test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: |
|
||||
./runtest --accurate --verbose --dump-logs --tls --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: module api test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: |
|
||||
./runtest-moduleapi --verbose --tls
|
||||
./runtest-moduleapi --verbose
|
||||
./runtest-moduleapi --verbose --dump-logs --tls --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: sentinel tests
|
||||
if: true && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
run: |
|
||||
./runtest-sentinel --tls
|
||||
./runtest-sentinel
|
||||
./runtest-sentinel --tls ${{github.event.inputs.cluster_test_args}}
|
||||
- name: cluster tests
|
||||
if: true && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
run: |
|
||||
./runtest-cluster --tls
|
||||
./runtest-cluster
|
||||
./runtest-cluster --tls ${{github.event.inputs.cluster_test_args}}
|
||||
|
||||
test-centos7-tls-no-tls:
|
||||
runs-on: ubuntu-latest
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'tls')
|
||||
container: centos:7
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: |
|
||||
yum -y install centos-release-scl epel-release
|
||||
yum -y install devtoolset-7 openssl-devel openssl
|
||||
scl enable devtoolset-7 "make BUILD_TLS=yes REDIS_CFLAGS='-Werror'"
|
||||
- name: testprep
|
||||
run: |
|
||||
yum -y install tcl tcltls tclx
|
||||
./utils/gen-test-certs.sh
|
||||
- name: test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: |
|
||||
./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: module api test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: |
|
||||
./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: sentinel tests
|
||||
if: true && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
run: |
|
||||
./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
|
||||
- name: cluster tests
|
||||
if: true && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
run: |
|
||||
./runtest-cluster ${{github.event.inputs.cluster_test_args}}
|
||||
|
||||
test-macos-latest:
|
||||
runs-on: macos-latest
|
||||
if: github.repository == 'redis/redis'
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'macos') && !(contains(github.event.inputs.skiptests, 'redis') && contains(github.event.inputs.skiptests, 'modules'))
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: make
|
||||
run: make
|
||||
- name: test
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
./runtest --accurate --verbose --no-latency --dump-logs
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: make REDIS_CFLAGS='-Werror'
|
||||
- name: test
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: ./runtest --accurate --verbose --no-latency --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: module api test
|
||||
run: ./runtest-moduleapi --verbose
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: ./runtest-moduleapi --verbose --no-latency --dump-logs ${{github.event.inputs.test_args}}
|
||||
|
||||
test-macos-latest-sentinel:
|
||||
runs-on: macos-latest
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'macos') && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: make REDIS_CFLAGS='-Werror'
|
||||
- name: sentinel tests
|
||||
run: ./runtest-sentinel
|
||||
if: true && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
run: ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
|
||||
|
||||
test-macos-latest-cluster:
|
||||
runs-on: macos-latest
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'macos') && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: make REDIS_CFLAGS='-Werror'
|
||||
- name: cluster tests
|
||||
run: ./runtest-cluster
|
||||
if: true && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
|
||||
|
||||
test-freebsd:
|
||||
runs-on: macos-latest
|
||||
if: github.repository == 'redis/redis'
|
||||
runs-on: macos-12
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'freebsd') && !(contains(github.event.inputs.skiptests, 'redis') && contains(github.event.inputs.skiptests, 'modules'))
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: test
|
||||
uses: vmactions/freebsd-vm@v0.1.2
|
||||
uses: vmactions/freebsd-vm@v0.3.0
|
||||
with:
|
||||
usesh: true
|
||||
sync: rsync
|
||||
prepare: pkg install -y bash gmake lang/tcl86
|
||||
copyback: false
|
||||
prepare: pkg install -y bash gmake lang/tcl86 lang/tclx
|
||||
run: >
|
||||
gmake &&
|
||||
./runtest --accurate --verbose --no-latency --dump-logs &&
|
||||
MAKE=gmake ./runtest-moduleapi --verbose &&
|
||||
./runtest-sentinel &&
|
||||
./runtest-cluster
|
||||
gmake || exit 1 ;
|
||||
if echo "${{github.event.inputs.skiptests}}" | grep -vq redis ; then ./runtest --verbose --timeout 2400 --no-latency --dump-logs ${{github.event.inputs.test_args}} || exit 1 ; fi ;
|
||||
if echo "${{github.event.inputs.skiptests}}" | grep -vq modules ; then MAKE=gmake ./runtest-moduleapi --verbose --timeout 2400 --no-latency --dump-logs ${{github.event.inputs.test_args}} || exit 1 ; fi ;
|
||||
|
||||
test-freebsd-sentinel:
|
||||
runs-on: macos-12
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'freebsd') && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: test
|
||||
uses: vmactions/freebsd-vm@v0.3.0
|
||||
with:
|
||||
usesh: true
|
||||
sync: rsync
|
||||
copyback: false
|
||||
prepare: pkg install -y bash gmake lang/tcl86 lang/tclx
|
||||
run: >
|
||||
gmake || exit 1 ;
|
||||
if echo "${{github.event.inputs.skiptests}}" | grep -vq sentinel ; then ./runtest-sentinel ${{github.event.inputs.cluster_test_args}} || exit 1 ; fi ;
|
||||
|
||||
test-freebsd-cluster:
|
||||
runs-on: macos-12
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'freebsd') && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: test
|
||||
uses: vmactions/freebsd-vm@v0.3.0
|
||||
with:
|
||||
usesh: true
|
||||
sync: rsync
|
||||
copyback: false
|
||||
prepare: pkg install -y bash gmake lang/tcl86 lang/tclx
|
||||
run: >
|
||||
gmake || exit 1 ;
|
||||
if echo "${{github.event.inputs.skiptests}}" | grep -vq cluster ; then ./runtest-cluster ${{github.event.inputs.cluster_test_args}} || exit 1 ; fi ;
|
||||
|
||||
test-alpine-jemalloc:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'redis/redis'
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'alpine')
|
||||
container: alpine:latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: |
|
||||
apk add build-base
|
||||
make REDIS_CFLAGS='-Werror'
|
||||
- name: testprep
|
||||
run: apk add tcl procps tclx
|
||||
- name: test
|
||||
run: |
|
||||
apk add tcl procps
|
||||
./runtest --accurate --verbose --dump-logs
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: module api test
|
||||
run: ./runtest-moduleapi --verbose
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: sentinel tests
|
||||
run: ./runtest-sentinel
|
||||
if: true && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
run: ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
|
||||
- name: cluster tests
|
||||
run: ./runtest-cluster
|
||||
if: true && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
|
||||
|
||||
test-alpine-libc-malloc:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'redis/redis'
|
||||
if: |
|
||||
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'redis/redis')) &&
|
||||
!contains(github.event.inputs.skipjobs, 'alpine')
|
||||
container: alpine:latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: prep
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |
|
||||
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
|
||||
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
- name: make
|
||||
run: |
|
||||
apk add build-base
|
||||
make REDIS_CFLAGS='-Werror' USE_JEMALLOC=no CFLAGS=-DUSE_MALLOC_USABLE_SIZE
|
||||
- name: testprep
|
||||
run: apk add tcl procps tclx
|
||||
- name: test
|
||||
run: |
|
||||
apk add tcl procps
|
||||
./runtest --accurate --verbose --dump-logs
|
||||
if: true && !contains(github.event.inputs.skiptests, 'redis')
|
||||
run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: module api test
|
||||
run: ./runtest-moduleapi --verbose
|
||||
if: true && !contains(github.event.inputs.skiptests, 'modules')
|
||||
run: ./runtest-moduleapi --verbose --dump-logs ${{github.event.inputs.test_args}}
|
||||
- name: sentinel tests
|
||||
run: ./runtest-sentinel
|
||||
if: true && !contains(github.event.inputs.skiptests, 'sentinel')
|
||||
run: ./runtest-sentinel ${{github.event.inputs.cluster_test_args}}
|
||||
- name: cluster tests
|
||||
run: ./runtest-cluster
|
||||
if: true && !contains(github.event.inputs.skiptests, 'cluster')
|
||||
run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
name: External Server Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
jobs:
|
||||
test-external-standalone:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name != 'schedule' || github.repository == 'redis/redis'
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build
|
||||
run: make REDIS_CFLAGS=-Werror
|
||||
- name: Start redis-server
|
||||
run: |
|
||||
./src/redis-server --daemonize yes --save "" --logfile external-redis.log \
|
||||
--enable-protected-configs yes --enable-debug-command yes --enable-module-command yes
|
||||
- name: Run external test
|
||||
run: |
|
||||
./runtest \
|
||||
--host 127.0.0.1 --port 6379 \
|
||||
--tags -slow
|
||||
- name: Archive redis log
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: test-external-redis-log
|
||||
path: external-redis.log
|
||||
|
||||
test-external-cluster:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name != 'schedule' || github.repository == 'redis/redis'
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build
|
||||
run: make REDIS_CFLAGS=-Werror
|
||||
- name: Start redis-server
|
||||
run: |
|
||||
./src/redis-server --cluster-enabled yes --daemonize yes --save "" --logfile external-redis.log \
|
||||
--enable-protected-configs yes --enable-debug-command yes --enable-module-command yes
|
||||
- name: Create a single node cluster
|
||||
run: ./src/redis-cli cluster addslots $(for slot in {0..16383}; do echo $slot; done); sleep 5
|
||||
- name: Run external test
|
||||
run: |
|
||||
./runtest \
|
||||
--host 127.0.0.1 --port 6379 \
|
||||
--cluster-mode \
|
||||
--tags -slow
|
||||
- name: Archive redis log
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: test-external-cluster-log
|
||||
path: external-redis.log
|
||||
|
||||
test-external-nodebug:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name != 'schedule' || github.repository == 'redis/redis'
|
||||
timeout-minutes: 14400
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build
|
||||
run: make REDIS_CFLAGS=-Werror
|
||||
- name: Start redis-server
|
||||
run: |
|
||||
./src/redis-server --daemonize yes --save "" --logfile external-redis.log
|
||||
- name: Run external test
|
||||
run: |
|
||||
./runtest \
|
||||
--host 127.0.0.1 --port 6379 \
|
||||
--tags "-slow -needs:debug"
|
||||
- name: Archive redis log
|
||||
if: ${{ failure() }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: test-external-redis-log
|
||||
path: external-redis.log
|
||||
@@ -0,0 +1,32 @@
|
||||
# A CI action that using codespell to check spell.
|
||||
# .github/.codespellrc is a config file.
|
||||
# .github/wordlist.txt is a list of words that will ignore word checks.
|
||||
# More details please check the following link:
|
||||
# https://github.com/codespell-project/codespell
|
||||
name: Spellcheck
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Spellcheck
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: pip cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||
restore-keys: ${{ runner.os }}-pip-
|
||||
|
||||
- name: Install prerequisites
|
||||
run: sudo pip install -r ./.codespell/requirements.txt
|
||||
|
||||
- name: Spell check
|
||||
run: codespell --config=./.codespell/.codespellrc
|
||||
+3
-1
@@ -16,7 +16,8 @@ doc-tools
|
||||
release
|
||||
misc/*
|
||||
src/release.h
|
||||
appendonly.aof
|
||||
appendonly.aof*
|
||||
appendonlydir
|
||||
SHORT_TERM_TODO
|
||||
release.h
|
||||
src/transfer.sh
|
||||
@@ -27,6 +28,7 @@ src/nodes.conf
|
||||
deps/lua/src/lua
|
||||
deps/lua/src/luac
|
||||
deps/lua/src/liblua.a
|
||||
deps/hdr_histogram/libhdrhistogram.a
|
||||
tests/tls/*
|
||||
.make-*
|
||||
.prerequisites
|
||||
|
||||
+897
-11
@@ -1,16 +1,902 @@
|
||||
Hello! This file is just a placeholder, since this is the "unstable" branch
|
||||
of Redis, the place where all the development happens.
|
||||
Redis 7.0 release notes
|
||||
=======================
|
||||
|
||||
There is no release notes for this branch, it gets forked into another branch
|
||||
every time there is a partial feature freeze in order to eventually create
|
||||
a new stable release.
|
||||
--------------------------------------------------------------------------------
|
||||
Upgrade urgency levels:
|
||||
|
||||
Usually "unstable" is stable enough for you to use it in development environments
|
||||
however you should never use it in production environments. It is possible
|
||||
to download the latest stable release here:
|
||||
LOW: No need to upgrade unless there are new features you want to use.
|
||||
MODERATE: Program an upgrade of the server, but it's not urgent.
|
||||
HIGH: There is a critical bug that may affect a subset of users. Upgrade!
|
||||
CRITICAL: There is a critical bug affecting MOST USERS. Upgrade ASAP.
|
||||
SECURITY: There are security fixes in the release.
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
http://download.redis.io/releases/redis-stable.tar.gz
|
||||
================================================================================
|
||||
Redis 7.0.6 Released Mon Dec 12 12:00:00 IST 2022
|
||||
================================================================================
|
||||
|
||||
More information is available at https://redis.io
|
||||
Upgrade urgency: MODERATE, Contains fixes for a few non-critical or unlikely bugs,
|
||||
and some dramatic optimizations to Geo, EVAL, and Sorted sets commands.
|
||||
|
||||
Potentially Breaking Bug Fixes for new Redis 7.0 features
|
||||
=======================================================
|
||||
|
||||
* RM_ResetDataset module API should not clear the functions (#11268)
|
||||
* RM_Call module API used with the "C" flag to run scripts, would now cause
|
||||
the commands in the script to check ACL with the designated user (#10966)
|
||||
|
||||
Performance and resource utilization improvements
|
||||
=================================================
|
||||
|
||||
* Geo commands speedups (#11535, #11522, #11552, #11579)
|
||||
* Fix EVAL command performance regression from Redis 7.0 (#11521, #11541)
|
||||
* Reduce EXPIRE commands performance regression from Redis 7.0 (#11602)
|
||||
* Optimize commands returning double values, mainly affecting zset commands (#11093)
|
||||
* Optimize Lua parsing of some command responses (#11556)
|
||||
* Optimize client memory usage tracking operation while client eviction is disabled (#11348)
|
||||
|
||||
Platform / toolchain support related improvements
|
||||
=================================================
|
||||
|
||||
* Fix compilation on Solaris (#11327)
|
||||
|
||||
Module API changes
|
||||
==================
|
||||
|
||||
* RM_SetContextUser, RM_SetModuleUserACLString, RM_GetModuleUserACLString (#10966)
|
||||
* Fix crash in CLIENT_CHANGE event, when the selected database is not 0 (#11500)
|
||||
|
||||
Changes in CLI tools
|
||||
====================
|
||||
|
||||
* redis-benchmark avoid aborting on NOPERM from CONFIG GET (#11096)
|
||||
|
||||
Bug Fixes
|
||||
=========
|
||||
|
||||
* Avoid hang of diskless replication fork child when parent crashes (#11463)
|
||||
* Fix crash with module API of list iterator and RM_ListDelete (#11383)
|
||||
* Fix TLS error handling to avoid connection drops on timeouts (#11563)
|
||||
* Fix runtime changes to cluster-announce-*-port to take effect on the local node too (#10745)
|
||||
* Fix sentinel function that compares hostnames if failed resolve (#11419)
|
||||
* Fix MIGRATE with AUTH set to "keys" is getting wrong key names leading to MOVED or ACL errors (#11253)
|
||||
|
||||
Fixes for issues in previous releases of Redis 7.0
|
||||
--------------------------------------------------
|
||||
|
||||
* Fix command line startup --sentinel problem (#11591)
|
||||
* Fis missing FCALL commands in monitor (#11510)
|
||||
* Fix CLUSTER SHARDS showing empty hostname (#11297)
|
||||
* Replica that asks for rdb-only could have missed the EOF and hang (#11296)
|
||||
|
||||
|
||||
================================================================================
|
||||
Redis 7.0.5 Released Wed Sep 21 20:00:00 IST 2022
|
||||
================================================================================
|
||||
|
||||
Upgrade urgency: SECURITY, contains fixes to security issues.
|
||||
|
||||
Security Fixes:
|
||||
* (CVE-2022-35951) Executing a XAUTOCLAIM command on a stream key in a specific
|
||||
state, with a specially crafted COUNT argument, may cause an integer overflow,
|
||||
a subsequent heap overflow, and potentially lead to remote code execution.
|
||||
The problem affects Redis versions 7.0.0 or newer
|
||||
[reported by Xion (SeungHyun Lee) of KAIST GoN].
|
||||
|
||||
Module API changes
|
||||
==================
|
||||
|
||||
* Fix RM_Call execution of scripts when used with M/W/S flags to properly
|
||||
handle script flags (#11159)
|
||||
* Fix RM_SetAbsExpire and RM_GetAbsExpire API registration (#11025, #8564)
|
||||
|
||||
Bug Fixes
|
||||
=========
|
||||
|
||||
* Fix a hang when eviction is combined with lazy-free and maxmemory-eviction-tenacity is set to 100 (#11237)
|
||||
* Fix a crash when a replica may attempt to set itself as its master as a result of a manual failover (#11263)
|
||||
* Fix a bug where a cluster-enabled replica node may permanently set its master's hostname to '?' (#10696)
|
||||
* Fix a crash when a Lua script returns a meta-table (#11032)
|
||||
|
||||
Fixes for issues in previous releases of Redis 7.0
|
||||
--------------------------------------------------
|
||||
|
||||
* Fix redis-cli to do DNS lookup before sending CLUSTER MEET (#11151)
|
||||
* Fix crash when a key is lazy expired during cluster key migration (#11176)
|
||||
* Fix AOF rewrite to fsync the old AOF file when a new one is created (#11004)
|
||||
* Fix some crashes involving a list containing entries larger than 1GB (#11242)
|
||||
* Correctly handle scripts with a non-read-only shebang on a cluster replica (#11223)
|
||||
* Fix memory leak when unloading a module (#11147)
|
||||
* Fix bug with scripts ignoring client tracking NOLOOP (#11052)
|
||||
* Fix client-side tracking breaking protocol when FLUSHDB / FLUSHALL / SWAPDB is used inside MULTI-EXEC (#11038)
|
||||
* Fix ACL: BITFIELD with GET and also SET / INCRBY can be executed with read-only key permission (#11086)
|
||||
* Fix missing sections for INFO ALL when also requesting a module info section (#11291)
|
||||
|
||||
|
||||
================================================================================
|
||||
Redis 7.0.4 Released Monday Jul 18 12:00:00 IST 2022
|
||||
================================================================================
|
||||
|
||||
Upgrade urgency: SECURITY, contains fixes to security issues.
|
||||
|
||||
Security Fixes:
|
||||
* (CVE-2022-31144) A specially crafted XAUTOCLAIM command on a stream
|
||||
key in a specific state may result with heap overflow, and potentially
|
||||
remote code execution. The problem affects Redis versions 7.0.0 or newer.
|
||||
|
||||
================================================================================
|
||||
Redis 7.0.3 Released Monday Jul 11 12:00:00 IST 2022
|
||||
================================================================================
|
||||
|
||||
Upgrade urgency: MODERATE, specifically if you're using a previous release of
|
||||
Redis 7.0, contains fixes for bugs in previous 7.0 releases.
|
||||
|
||||
|
||||
Performance and resource utilization improvements
|
||||
=================================================
|
||||
|
||||
* Optimize zset conversion on large ZRANGESTORE (#10789)
|
||||
* Optimize the performance of sending PING on large clusters (#10624)
|
||||
* Allow for faster restart of Redis in cluster mode (#10912)
|
||||
|
||||
INFO fields and introspection changes
|
||||
=====================================
|
||||
|
||||
* Add missing sharded pubsub keychannel count to CLIENT LIST (#10895)
|
||||
* Add missing pubsubshard_channels field in INFO STATS (#10929)
|
||||
|
||||
Module API changes
|
||||
==================
|
||||
|
||||
* Add RM_StringToULongLong and RM_CreateStringFromULongLong (#10889)
|
||||
* Add RM_SetClientNameById and RM_GetClientNameById (#10839)
|
||||
|
||||
Changes in CLI tools
|
||||
====================
|
||||
|
||||
* Add missing cluster-port support to redis-cli --cluster (#10344)
|
||||
|
||||
Other General Improvements
|
||||
==========================
|
||||
|
||||
* Account sharded pubsub channels memory consumption (#10925)
|
||||
* Allow ECHO in loading and stale modes (#10853)
|
||||
* Cluster: Throw -TRYAGAIN instead of -ASK on migrating nodes for multi-key
|
||||
commands when the node only has some of the keys (#9526)
|
||||
|
||||
Bug Fixes
|
||||
=========
|
||||
|
||||
* TLS: Notify clients on connection shutdown (#10931)
|
||||
* Fsync directory while persisting AOF manifest, RDB file, and config file (#10737)
|
||||
* Script that made modification will not break with unexpected NOREPLICAS error (#10855)
|
||||
* Cluster: Fix a bug where nodes may not acknowledge a CLUSTER FAILOVER TAKEOVER
|
||||
after a replica reboots (#10798)
|
||||
* Cluster: Fix crash during handshake and cluster shards call (#10942)
|
||||
|
||||
Fixes for issues in previous releases of Redis 7.0
|
||||
--------------------------------------------------
|
||||
|
||||
* TLS: Fix issues with large replies (#10909)
|
||||
* Correctly report the startup warning for vm.overcommit_memory (#10841)
|
||||
* redis-server command line allow passing config name and value in the same argument (#10866)
|
||||
* Support --save command line argument with no value for backwards compatibility (#10866)
|
||||
* Fix CLUSTER RESET command regression requiring an argument (#10898)
|
||||
|
||||
================================================================================
|
||||
Redis 7.0.2 Released Sunday Jun 12 12:00:00 IST 2022
|
||||
================================================================================
|
||||
|
||||
Upgrade urgency: MODERATE, specifically if you're using a previous release of
|
||||
Redis 7.0, contains fixes for bugs in previous 7.0 releases.
|
||||
|
||||
Bug Fixes
|
||||
=========
|
||||
|
||||
* Fixed SET and BITFIELD commands being wrongly marked movablekeys (#10837)
|
||||
Regression in 7.0 possibly resulting in excessive roundtrip from cluster clients.
|
||||
* Fix crash when /proc/sys/vm/overcommit_memory is inaccessible (#10848)
|
||||
Regression in 7.0.1 resulting in crash on startup on some configurations.
|
||||
|
||||
|
||||
================================================================================
|
||||
Redis 7.0.1 Released Wed Jun 8 12:00:00 IST 2022
|
||||
================================================================================
|
||||
|
||||
Upgrade urgency: MODERATE, specifically if you're using a previous release of
|
||||
Redis 7.0, contains some behavior changes for new 7.0 features and important
|
||||
fixes for bugs in previous 7.0 releases.
|
||||
|
||||
Improvements
|
||||
============
|
||||
|
||||
* Add warning for suspected slow system clocksource setting
|
||||
Add --check-system command line option. (#10636)
|
||||
* Allow read-only scripts (*_RO commands, and ones with `no-writes` flag)
|
||||
during CLIENT PAUSE WRITE (#10744)
|
||||
* Add `readonly` flag in COMMAND command for EVAL_RO, EVALSHA_RO and FCALL_RO (#10728)
|
||||
* redis-server command line arguments now accept one string with spaces
|
||||
for multi-arg configs (#10660)
|
||||
|
||||
Potentially Breaking Changes
|
||||
============================
|
||||
|
||||
* Omitting a config option value in command line argument no longer works (#10660)
|
||||
* Hide the `may_replicate` flag from the COMMAND command response (#10744)
|
||||
|
||||
Potentially Breaking Changes for new Redis 7.0 features
|
||||
-------------------------------------------------------
|
||||
|
||||
* Protocol: Sharded pubsub publish emits `smessage` instead of `message` (#10792)
|
||||
* CLUSTER SHARDS returns slots as RESP integers, not strings (#10683)
|
||||
* Block PFCOUNT and PUBLISH in read-only scripts (*_RO commands, and no-writes) (#10744)
|
||||
* Scripts that declare the `no-writes` flag are implicitly `allow-oom` too (#10699)
|
||||
|
||||
Changes in CLI tools
|
||||
====================
|
||||
|
||||
* redis-cli --bigkeys, --memkeys, --hotkeys, --scan. Finish nicely after Ctrl+C (#10736)
|
||||
|
||||
Platform / toolchain support related improvements
|
||||
=================================================
|
||||
|
||||
* Support tcp-keepalive config interval on MacOs (#10667)
|
||||
* Support RSS metrics on Haiku OS (#10687)
|
||||
|
||||
INFO fields and introspection changes
|
||||
=====================================
|
||||
|
||||
* Add isolated network metrics for replication. (#10062, #10810)
|
||||
|
||||
Module API changes
|
||||
==================
|
||||
|
||||
* Add two more new checks to RM_Call script mode (#10786)
|
||||
* Add new RM_Call flag to let Redis automatically refuse `deny-oom` commands (#10786)
|
||||
* Add module API RM_MallocUsableSize (#10795)
|
||||
* Add missing REDISMODULE_NOTIFY_NEW (#10688)
|
||||
* Fix cursor type in RedisModuleScanCursor to handle more than 2^31 elements (#10698)
|
||||
* Fix RM_Yield bugs and RM_Call("EVAL") OOM check bug (#10786)
|
||||
* Fix bugs in enum configs with overlapping bit flags (#10661)
|
||||
|
||||
Bug Fixes
|
||||
=========
|
||||
|
||||
* FLUSHALL correctly resets rdb_changes_since_last_save INFO field (#10691)
|
||||
* FLUSHDB is now propagated to replicas / AOF, even if the db is empty (#10691)
|
||||
* Replica fail and retry the PSYNC if the master is unresponsive (#10726)
|
||||
* Fix ZRANGESTORE crash when zset_max_listpack_entries is 0 (#10767)
|
||||
|
||||
Fixes for issues in previous releases of Redis 7.0
|
||||
--------------------------------------------------
|
||||
|
||||
* CONFIG REWRITE could cause a config change to be dropped for aliased configs (#10811)
|
||||
* CONFIG REWRITE would omit rename-command and include lines (#10761)
|
||||
NOTE: Affected users who used Redis 7.0.0 to rewrite their configuration file
|
||||
should review and fix the file.
|
||||
* Fix broken protocol after MISCONF (persistence) error (#10786)
|
||||
* Fix --save command line regression (#10690)
|
||||
* Fix possible regression around TLS config changes. re-load files even if the
|
||||
file name didn't change. (#10713)
|
||||
* Re-add SENTINEL SLAVES command, missing in redis 7.0 (#10723)
|
||||
* BZMPOP gets unblocked by non-key args and returns them (#10764)
|
||||
* Fix possible memory leak in XADD and XTRIM (#10753)
|
||||
|
||||
================================================================================
|
||||
Redis 7.0.0 GA Released Wed Apr 27 12:00:00 IST 2022
|
||||
================================================================================
|
||||
|
||||
Upgrade urgency: SECURITY, contains fixes to security issues.
|
||||
|
||||
Security Fixes:
|
||||
* (CVE-2022-24736) An attacker attempting to load a specially crafted Lua script
|
||||
can cause NULL pointer dereference which will result with a crash of the
|
||||
redis-server process. This issue affects all versions of Redis.
|
||||
[reported by Aviv Yahav].
|
||||
* (CVE-2022-24735) By exploiting weaknesses in the Lua script execution
|
||||
environment, an attacker with access to Redis can inject Lua code that will
|
||||
execute with the (potentially higher) privileges of another Redis user.
|
||||
[reported by Aviv Yahav].
|
||||
|
||||
|
||||
New Features
|
||||
============
|
||||
|
||||
* Keyspace event for new keys (#10512)
|
||||
|
||||
|
||||
Command replies that have been extended
|
||||
---------------------------------------
|
||||
|
||||
* COMMAND DOCS shows deprecated_since field in command args (#10545)
|
||||
* COMMAND DOCS shows module name where applicable (#10544)
|
||||
|
||||
|
||||
Potentially Breaking Changes
|
||||
============================
|
||||
|
||||
* Replicas panic when they fail writing persistence (#10504)
|
||||
* Prevent cross slot operations in functions and scripts with shebang (#10615)
|
||||
* Rephrased some error responses about invalid commands or args (#10612)
|
||||
* Lua scripts do not have access to the print() function (#10651)
|
||||
|
||||
|
||||
Performance and resource utilization improvements
|
||||
=================================================
|
||||
|
||||
* Speed optimization in streams (#10574)
|
||||
* Speed optimization in command execution pipeline (#10502)
|
||||
* Speed optimization in listpack encoded sorted (#10486)
|
||||
* Speed optimization in latency tracking at INFO (relevant for 7.0 RCs) (#10606)
|
||||
* Speed optimization when there are many replicas (relevant for 7.0 RCs) (#10588)
|
||||
|
||||
|
||||
New configuration options
|
||||
=========================
|
||||
|
||||
* Allow ignoring disk persistence errors on replicas (#10504)
|
||||
* Allow abort with panic when replica fails to execute a command sent by the master (#10504)
|
||||
* Allow configuring shutdown flags of SIGTERM and SIGINT (#10594)
|
||||
* Allow attaching an operating system-specific identifier to Redis sockets (#10349)
|
||||
|
||||
|
||||
Module API changes
|
||||
==================
|
||||
|
||||
* Add argument specifying ACL reason for module log entry (#10559)
|
||||
Breaking API compatibility with 7.0 RCs
|
||||
* Add the deprecated_since field in command args of COMMAND DOCS (#10545)
|
||||
Breaking API/ABI compatibility with 7.0 RCs
|
||||
* Add module API flag for using enum configs as bit flags (#10643)
|
||||
* Add RM_PublishMessageShard (#10543)
|
||||
* Add RM_MallocSizeString, RM_MallocSizeDict (#10542)
|
||||
* Add RM_TryAlloc (#10541)
|
||||
|
||||
|
||||
Bug Fixes
|
||||
=========
|
||||
|
||||
* Replica report disk persistence errors in PING (#10603)
|
||||
* Fixes around rejecting commands on replicas and AOF when they must be respected (#10603)
|
||||
* Durability fixes for appendfsync=always policy (#9678)
|
||||
|
||||
|
||||
Fixes for issues in previous release candidates of Redis 7.0
|
||||
------------------------------------------------------------
|
||||
|
||||
* Fix possible crash on CONFIG REWRITE (#10598)
|
||||
* Fix regression not aborting transaction on errors (#10612)
|
||||
* Fix auto-aof-rewrite-percentage based AOFRW trigger after restart (#10550)
|
||||
* Fix bugs when AOF enabled after startup, in case of failure before the first rewrite completes (#10616)
|
||||
* Fix RM_Yield module API bug processing future commands of the current client (#10573)
|
||||
|
||||
|
||||
================================================================================
|
||||
Redis 7.0 RC3 Released Tue Apr 5 12:00:00 IST 2022
|
||||
================================================================================
|
||||
|
||||
Upgrade urgency LOW: This is another Release Candidate of Redis 7.0.
|
||||
|
||||
New Features
|
||||
============
|
||||
|
||||
New administrative and introspection commands and command arguments
|
||||
-------------------------------------------------------------------
|
||||
|
||||
* CLUSTER SHARDS command deprecates CLUSTER SLOTS (#10293)
|
||||
|
||||
|
||||
Potentially Breaking Changes
|
||||
============================
|
||||
|
||||
* CONFIG GET response returned in a non-deterministic order.
|
||||
It's possible that a client was relying on configs order (#10323)
|
||||
* SORT / SORT_RO commands reject keys access patterns in GET and BY if ACL
|
||||
doesn't grant the command full keyspace access (#10340)
|
||||
* FUNCTION LOAD command introduced in 7.0-RC1 was stripped of the ENGINE, and
|
||||
NAME arguments which are now part of the script itself. The DESCRIPTION
|
||||
argument was completely removed (#10500)
|
||||
* Set disable-thp config to be immutable (#10409)
|
||||
|
||||
|
||||
Performance and resource utilization improvements
|
||||
=================================================
|
||||
|
||||
* Optimize performance and memory usage on replicas (#10413)
|
||||
* A faster and more robust code of zslRandomLevel using RAND_MAX (#5539)
|
||||
|
||||
|
||||
Changes in CLI tools
|
||||
====================
|
||||
|
||||
* redis-cli: Use exit code 1 on error (#10468)
|
||||
* redis-cli: Do DNS lookup before sending CLUSTER MEET (#10436)
|
||||
* redis-benchmark: Fix --cluster with IPv6. (#10393)
|
||||
* redis-cli: Better --json Unicode support and --quoted-json (#10286)
|
||||
|
||||
|
||||
INFO fields and introspection changes
|
||||
=====================================
|
||||
|
||||
* MEMORY STATS: Show cluster.links memory usage (#10302)
|
||||
|
||||
|
||||
Module API changes
|
||||
==================
|
||||
|
||||
* APIs for exposing module configs to config file and CONFIG command (#10285)
|
||||
* Add an event notifying about configuration changes (#10311)
|
||||
* Add API for redacting command arguments from SLOWLOG and MONITOR (#10425)
|
||||
* RM_Call: new flags for script mode compatibility, no writes, and error replies (#10372)
|
||||
|
||||
|
||||
Bug Fixes
|
||||
=========
|
||||
|
||||
* Sentinel: Fix no reconnect after auth-pass is changed (#10400)
|
||||
* Cluster: Fix race condition: Turn into replica on SETSLOT (#10489, #10381)
|
||||
* XREADGROUP: Unblock client when the stream key is deleted (#10306)
|
||||
|
||||
|
||||
Fixes for issue in previous release candidates of Redis 7.0
|
||||
-----------------------------------------------------------
|
||||
|
||||
* ACL DRYRUN does not validate the verified command args. (#10405)
|
||||
* ACL DRYRUN returns the tested common permission error (#10359)
|
||||
* Incorrect parsing of hostname information from nodes.conf (#10435)
|
||||
* BITSET and BITFIELD SET should propagate even if just length changed (#10459)
|
||||
* SHUTDOWN, Fix a possible crash when the shutdown was aborted (#10440)
|
||||
* Script should not allow may-replicate commands when client pause write (#10364)
|
||||
* Optimization tracking memory usage from i/o threads. (#10401)
|
||||
* Initialize help when using redis-cli help or redis-cli ? (#10382)
|
||||
* Dismiss COW of client output buffer now that it's dynamic (#10371)
|
||||
* Fix memory corruption when EVAL fails before being processed (#10519)
|
||||
|
||||
|
||||
================================================================================
|
||||
Redis 7.0 RC2 Released Mon Feb 28 12:00:00 IST 2022
|
||||
================================================================================
|
||||
|
||||
Upgrade urgency LOW: This is another Release Candidate of Redis 7.0.
|
||||
|
||||
New Features
|
||||
============
|
||||
|
||||
* Add stream consumer group lag tracking and reporting (#9127)
|
||||
* Add API for functions and eval Lua scripts to check ACL explicitly (#10220)
|
||||
|
||||
New user commands or command arguments
|
||||
--------------------------------------
|
||||
|
||||
* COMMAND GETKEYSANDFLAGS sub-command (#10237)
|
||||
* INFO command can take multiple section arguments (#6891)
|
||||
* XGROUP CREATE and SETID: new ENTRIESREAD optional argument (#9127)
|
||||
* XSETID new ENTRIESADDED and MAXDELETEDID optional arguments (#9127)
|
||||
|
||||
Command replies that have been extended
|
||||
---------------------------------------
|
||||
|
||||
* XINFO reports consumer group lag and a few other fields (#9127)
|
||||
* XAUTOCLAIM returns a new element with a list of deletes IDs (#10227)
|
||||
|
||||
Potentially Breaking Changes
|
||||
============================
|
||||
|
||||
* X[AUTO]CLAIM skips deleted entries instead of replying with Nil, and deletes
|
||||
them from the pending entry list (#10227)
|
||||
* Fix messed up error codes returned from EVAL scripts (#10218, #10329)
|
||||
* COMMAND INFO, Renames key-spec "CHANNEL" flag to be "NOT_KEY" (#10299)
|
||||
|
||||
Performance and resource utilization improvements
|
||||
=================================================
|
||||
|
||||
* Reduce system calls and small packets for client replies (#9934)
|
||||
* Reduce memory usage of stale clients (#9822)
|
||||
* Fix regression in Z[REV]RANGE commands (by-rank) introduced in Redis 6.2 (#10337)
|
||||
|
||||
Changes in CLI tools
|
||||
===================
|
||||
|
||||
* Adapt redis-check-aof tool for Multi Part AOF (#10061)
|
||||
* Enable redis-benchmark to use RESP3 protocol mode (#10335)
|
||||
|
||||
Platform / toolchain support related improvements
|
||||
=================================================
|
||||
|
||||
* Fix OpenSSL 3.0.x related issues (#10291)
|
||||
|
||||
INFO fields and introspection changes
|
||||
=====================================
|
||||
|
||||
* COMMAND INFO key-specs has new variable_flags flag (#10237, #10148)
|
||||
* INFO stats: add aof_rewrites and rdb_snapshots counters (#10178)
|
||||
* INFO stats: add reply_buffer_shrinks and reply_buffer_expends (#9822)
|
||||
* INFO modules: add no-implicit-signal-modified module option (#10284)
|
||||
|
||||
Module API changes
|
||||
==================
|
||||
|
||||
* Add RM_SetCommandInfo API to set command metadata for the new COMMAND
|
||||
introspection features and ACL key permissions (#10108)
|
||||
* Add RM_KeyAtPosWithFlags and RM_GetCommandKeysWithFlags APIs (#10237)
|
||||
* Add getchannels-api command flag and RM_IsChannelsPositionRequest,
|
||||
RM_ChannelAtPosWithFlags APIs (#10299)
|
||||
* Change RM_ACLCheckChannelPermissions and RM_ACLCheckKeyPermissions APIs
|
||||
(released in RC1) to take different flags (#10299)
|
||||
* Fix RM_SetModuleOptions flag collision. Bug in 7.0 RC1 header file, modules
|
||||
that used OPTIONS_HANDLE_REPL_ASYNC_LOAD will mess up key invalidations (#10284)
|
||||
|
||||
Bug Fixes
|
||||
=========
|
||||
|
||||
* Modules: Fix thread safety violation when a module thread adds an error reply,
|
||||
broken in 6.2 (#10278)
|
||||
* Lua: Fix Eval scripts active defrag, broken 7.0 in RC1 (#10271)
|
||||
* Fix geo search bounding box check causing missing results (#10018)
|
||||
* Lua: Add checks for min-slave-* configs when evaluating Lua scripts and
|
||||
Functions (#10160)
|
||||
* Modules: Prevent crashes and memory leaks when MODULE UNLOAD is used on module
|
||||
with a pending timer (#10187)
|
||||
* Fix error stats and failed command stats for blocked clients (#10309)
|
||||
* Lua/Modules: Fix missing and duplicate error stats for scripts and modules (#10329, #10278)
|
||||
* Check target node is a primary during cluster setslot (#10277)
|
||||
* Fix key deletion not to invalidate WATCH when used on a logically expired key (#10256)
|
||||
* Sentinel: return an error if configuration save fails (#10151)
|
||||
* Sentinel: fix a free-after-use issue re-registering Sentinels (#10333)
|
||||
|
||||
================================================================================
|
||||
Redis 7.0 RC1 Released Mon Jan 31 12:00:00 IST 2022
|
||||
================================================================================
|
||||
|
||||
Upgrade urgency LOW: This is the first Release Candidate of Redis 7.0.
|
||||
|
||||
Redis Release Candidate (RC) versions are early versions that are made available
|
||||
for early adopters in the community to test them. We do not consider
|
||||
them suitable for production environments.
|
||||
|
||||
Introduction to the Redis 7.0 release
|
||||
=====================================
|
||||
|
||||
Redis 7.0 includes several new user-facing features, significant performance
|
||||
optimizations, and many other improvements. It also includes changes that
|
||||
potentially break backwards compatibility with older versions. We urge users to
|
||||
review the release notes carefully before upgrading.
|
||||
|
||||
In particular, users should be aware of the following changes:
|
||||
|
||||
1. Redis 7 stores AOF as multiple files in a folder; see Multi-Part AOF below.
|
||||
2. Redis 7 uses a new version 10 format for RDB files, which is incompatible
|
||||
with older versions.
|
||||
3. Redis 7 converts ziplist encoded keys to listpacks on the fly when loading
|
||||
an older RDB format. Conversion applies to loading a file from disk or
|
||||
replicating from a Redis master and will slightly increase loading time.
|
||||
4. See sections about breaking changes mentioned below.
|
||||
|
||||
Here is a comprehensive list of changes in this release compared to 6.2.6.
|
||||
Each one includes the PR number that added it so that you can get more details
|
||||
at https://github.com/redis/redis/pull/<number>
|
||||
|
||||
New Features
|
||||
============
|
||||
|
||||
* Redis Functions: A new way to extend Redis with server-side scripts (#8693)
|
||||
see https://redis.io/topics/functions-intro
|
||||
* ACL: Fine-grained key-based permissions and allow users to support multiple
|
||||
sets of command rules with selectors (#9974)
|
||||
see https://redis.io/topics/acl#key-permissions and https://redis.io/topics/acl#selectors.
|
||||
* Cluster: Sharded (node-specific) Pub/Sub support (#8621)
|
||||
see https://redis.io/topics/pubsub#sharded-pubsub
|
||||
* First-class handling of sub-commands in most contexts (affecting ACL
|
||||
categories, INFO commandstats, etc.) (#9504, #10147)
|
||||
* Command metadata and documentation (#10104)
|
||||
see https://redis.io/commands/command-docs, https://redis.io/topics/command-tips
|
||||
* Command key-specs. A better way for clients to locate key arguments and their
|
||||
read/write purpose (#8324, #10122, #10167)
|
||||
see https://redis.io/topics/key-specs
|
||||
* Multi-Part AOF mechanism to avoid AOF rewrite overheads (#9788)
|
||||
* Cluster: Support for hostnames, instead of IP addresses only (#9530)
|
||||
* Improved management of memory consumed by network buffers, and an option to
|
||||
drop clients when total memory exceeds a limit (#8687)
|
||||
* Cluster: A mechanism for disconnecting cluster bus connections to prevent
|
||||
uncontrolled buffer growth (#9774)
|
||||
* AOF: Timestamp annotations and support for point-in-time recovery (#9326)
|
||||
* Lua: support Function flags in EVAL scripts (#10126)
|
||||
see https://redis.io/topics/eval-intro#eval-flags
|
||||
* Lua: Support RESP3 reply for Verbatim and Big-Number types (#9202)
|
||||
* Lua: Get Redis version via redis.REDIS_VERSION, redis.REDIS_VERSION_NUM (#10066)
|
||||
|
||||
New user commands or command arguments
|
||||
--------------------------------------
|
||||
|
||||
* ZMPOP, BZMPOP commands (#9484)
|
||||
* LMPOP, BLMPOP commands (#9373)
|
||||
* SINTERCARD, ZINTERCARD commands (#8946, #9425)
|
||||
* SPUBLISH, SSUBSCRIBE, SUNSUBSCRIBE, PUBSUB SHARDCHANNELS/SHARDNUMSUB (#8621)
|
||||
* EXPIRETIME and PEXPIRETIME commands (#8474)
|
||||
* EXPIRE command group supports NX/XX/GT/LT options (#2795)
|
||||
* SET command supports combining NX and GET flags (#8906)
|
||||
* BITPOS, BITCOUNT accepts BIT index (#9324)
|
||||
* EVAL_RO, EVALSHA_RO command variants, to run on read-only replicas (#8820)
|
||||
* SORT_RO command, to run on read-only replicas (#9299)
|
||||
* SHUTDOWN arguments: NOW, FORCE, ABORT (#9872)
|
||||
* FUNCTION *, FCALL, FCALL_RO - https://redis.io/commands/function-load
|
||||
* CONFIG SET/GET can handle multiple configs atomically, in one call (#9748, #9914)
|
||||
* QUIT promoted to be a proper command, HOST: and POST demoted (#9798)
|
||||
* XADD supports auto sequence number via <ms>-* (#9217)
|
||||
|
||||
New administrative and introspection commands and command arguments
|
||||
-------------------------------------------------------------------
|
||||
|
||||
* COMMAND DOCS (#9656, #10056, #10104)
|
||||
* COMMAND LIST (#9504)
|
||||
* COMMAND INFO accepts sub-commands as args, and no args too (#9504, #10056)
|
||||
* LATENCY HISTOGRAM (#9462)
|
||||
* CLUSTER LINKS (#9774)
|
||||
* CLUSTER DELSLOTSRANGE and CLUSTER ADDSLOTSRANGE (#9445)
|
||||
* CLIENT NO-EVICT (#8687)
|
||||
* ACL DRYRUN (#9974)
|
||||
* SLOWLOG GET supports passing in -1 to get all entries (#9018)
|
||||
|
||||
Command replies that have been extended
|
||||
---------------------------------------
|
||||
|
||||
* COMMAND and COMMAND INFO extended with tips, key-specs and sub-commands
|
||||
see https://redis.io/commands/command
|
||||
* ACL CAT, COMMAND LIST list sub-commands (#10127)
|
||||
* MODULE LIST reply includes path and args (#4848)
|
||||
* OBJECT ENCODING returns listpack instead of ziplist (#8887, #9366)
|
||||
* CLUSTER SLOTS hostname support (#9530)
|
||||
* COMMAND command: Added the `blocking` and `module` flags (#10104, #9656)
|
||||
|
||||
|
||||
Potentially Breaking Changes
|
||||
============================
|
||||
|
||||
* Modifying the bind parameter to a non-default value will no longer implicitly
|
||||
disable protected-mode (#9034)
|
||||
* Remove EVAL script verbatim replication, propagation, and deterministic
|
||||
execution logic (#9812)
|
||||
This has been deprecated and off by default since Redis 6 and is no longer
|
||||
supported.
|
||||
* ACL: pub/sub channels are blocked by default (acl-pubsub-default=resetchannels) (#10181)
|
||||
* SCRIPT LOAD and SCRIPT FLUSH are no longer propagated to replicas / AOF (#9812)
|
||||
* ACL: Declarations of duplicate ACL users in startup files and command line
|
||||
arguments will result in an error, whereas previously the last declaration
|
||||
would overwrite the others. (#9330)
|
||||
* Replication: TTLs are always replicated as absolute (not relative) millisecond
|
||||
timestamps (#8474)
|
||||
* Fixes in handling multi-key commands with expired keys on writable replicas (#9572)
|
||||
* CONFIG SET maxmemory returns before starting eviction (#10019)
|
||||
* AOF: The new Multi-Part mechanism stores data as a set of multiple files in a
|
||||
designated folder (#9788)
|
||||
* Remove STRALGO command, preserve LCS a standalone command which only works on
|
||||
keys (#9799)
|
||||
* Remove gopher protocol support (#9057)
|
||||
* MODULE and DEBUG commands disabled (protected) by default, for better security (#9920)
|
||||
* Snapshot-creating and other admin commands in MULTI/EXEC transactions are now
|
||||
rejected (#10015)
|
||||
* PING is now rejected with -MASTERDOWN when replica-serve-stale-data=no (#9757)
|
||||
* ACL GETUSER reply now uses ACL syntax for `keys` and `channels` (#9974)
|
||||
* COMMAND reply drops `random` and `sort-for-scripts` flags, which are now part
|
||||
of command tips (#10104)
|
||||
* LPOP/RPOP with count against non-existing list return null array (#10095)
|
||||
* INFO commandstats now shows the stats per sub-command (#9504)
|
||||
* ZPOPMIN/ZPOPMAX used to produce wrong replies when count is 0 with non-zset (#9711)
|
||||
* LPOP/RPOP used to produce wrong replies when count is 0 (#9692)
|
||||
* CONFIG GET bind now returns the current value in effect, even if the implicit
|
||||
default is in use (#9034)
|
||||
* CONFIG REWRITE now rewrites the list of modules to load (#4848)
|
||||
* Config: repl-diskless-sync is now set to yes by default (#10092)
|
||||
* When shutting down, Redis can optionally wait for replicas to catch up on the
|
||||
replication link (#9872)
|
||||
* Most CONFIG SET, REWRITE, RESETSTAT commands are now allowed during loading (#9878)
|
||||
* READONLY and READWRITE commands are now allowed when loading and on stale
|
||||
replicas (#7425)
|
||||
* Fix ACL category for SELECT, WAIT, ROLE, LASTSAVE, READONLY, READWRITE, ASKING (#9208)
|
||||
* RESET is now allowed even when on unauthenticated connections (#9798)
|
||||
* SCRIPT LOAD is now allowed on stale replicas (#10126)
|
||||
|
||||
|
||||
Security improvements
|
||||
=====================
|
||||
|
||||
* Sensitive configs and commands blocked (protected) by default (#9920)
|
||||
* Improve bind and protected-mode config handling (#9034)
|
||||
* Sentinel: avoid logging auth-pass value (#9652)
|
||||
* redis-cli: sensitive commands bypass the history file (#8895)
|
||||
|
||||
|
||||
Performance and resource utilization improvements
|
||||
=================================================
|
||||
|
||||
* Significant memory saving and latency improvements in cluster mode (#9356)
|
||||
* Significant memory savings in case of many hash or zset keys (#9228)
|
||||
* Replication backlog and replicas use one global shared replication buffer (#9166)
|
||||
* Significant reduction of copy-on-write memory overheads (#8974)
|
||||
* Free unused capacity in the cluster send buffer (#9255)
|
||||
* Memory efficiency, make full use of client struct memory for reply buffers (#8968)
|
||||
* Replace ziplist with listpack in Hash, List, Zset (#8887, #9366, #9740)
|
||||
* Add support for list type to store elements larger than 4GB (#9357)
|
||||
* Reuse temporary client objects for blocked clients by module (#9940)
|
||||
* Remove command argument count limit, dynamically grow argv buffer (#9528)
|
||||
* Optimize list type operations to seek from the nearest end (#9454)
|
||||
* Improvements in fsync to avoid large writes to disk (#9409)
|
||||
* BITSET and BITFIELD SET only propagated when the value actually changed (#9403)
|
||||
* Improve latency when a client is unblocked by module timer (#9593)
|
||||
|
||||
|
||||
Other General Improvements
|
||||
==========================
|
||||
|
||||
* Make partial sync possible after master reboot (#8015)
|
||||
* Always create a base AOF file when redis starts from empty (#10102)
|
||||
* Replica keep serving data during repl-diskless-load=swapdb for better
|
||||
availability (#9323)
|
||||
|
||||
|
||||
Changes in CLI tools
|
||||
====================
|
||||
* redis-cli --json, and -2 options (#9954)
|
||||
* redis-cli --scan, add sleep interval option (#3751)
|
||||
* redis-cli --replica optimization, skip RDB generation (#10044)
|
||||
* redis-cli --functions-rdb, generate RDB with Functions only (#9968)
|
||||
* redis-cli -X, take an arbitrary arg from stdin, extend --cluster call take -x (#9980)
|
||||
* redis-benchmark -x takes an argument from stdin (#9130)
|
||||
* redis-benchmark, Added URI support (#9314)
|
||||
* redis-cli monitor and pubsub can be aborted with Ctrl+C, keeping the cli alive (#9347)
|
||||
|
||||
|
||||
Platform / toolchain support related improvements
|
||||
=================================================
|
||||
|
||||
* Upgrade jemalloc 5.2.1 (#9623)
|
||||
* Fix RSS metrics on NetBSD and OpenBSD (#10116, #10149)
|
||||
* Check somaxconn system settings on macOS, FreeBSD and OpenBSD (#9972)
|
||||
* Better fsync on MacOS, improve power failure safety (#9545)
|
||||
|
||||
|
||||
New configuration options
|
||||
=========================
|
||||
|
||||
* CONFIG SET/GET can handle multiple configs in one call (#9748, #9914)
|
||||
* Support glob pattern matching for config include files (#8980)
|
||||
* appenddirname, folder where multi-part AOF files are stored (#9788)
|
||||
* shutdown-timeout, default 10 seconds (#9872)
|
||||
* maxmemory-clients, allows limiting the total memory usage by all clients (#8687)
|
||||
* cluster-port, can control the bind port of cluster bus (#9389)
|
||||
* bind-source-addr, configuration argument control IP of outgoing connections (#9142)
|
||||
* busy-reply-threshold, alias for the old lua-time-limit (#9963)
|
||||
* repl-diskless-sync-max-replicas, allows faster replication in some cases (#10092)
|
||||
* latency-tracking, enabled by default, and latency-tracking-info-percentiles (#9462)
|
||||
* cluster-announce-hostnameand cluster-preferred-endpoint-type (#9530)
|
||||
* cluster-allow-pubsubshard-when-down (#8621)
|
||||
* cluster-link-sendbuf-limit (#9774)
|
||||
* list-max-listpack-*, hash-max-listpack-*, zset-max-listpack-* as aliases for
|
||||
the old ziplist configs (#8887, #9366, #9740)
|
||||
|
||||
|
||||
INFO fields and introspection changes
|
||||
=====================================
|
||||
|
||||
* INFO: latencystats section (#9462)
|
||||
* INFO: total_active_defrag_time and current_active_defrag_time (#9377)
|
||||
* INFO: total_eviction_exceeded_time and current_eviction_exceeded_time (#9031)
|
||||
* INFO: evicted_clients (#8687)
|
||||
* INFO: mem_cluster_links, total_cluster_links_buffer_limit_exceeded (#9774)
|
||||
* INFO: current_cow_peak (#8974)
|
||||
* INFO: Remove aof_rewrite_buffer_length (#9788)
|
||||
* MEMORY STATS: Report slot to keys map size in in cluster mode (#10017)
|
||||
* INFO MEMORY: changes to separate memory usage of Functions and EVAL (#9780)
|
||||
* INFO MEMORY: Add mem_total_replication_buffers, change meaning of
|
||||
mem_clients_slaves (#9166)
|
||||
* CLIENT LIST: tot-mem, multi-mem (#8687)
|
||||
* CLIENT LIST, INFO: Show RESP version (#9508)
|
||||
* SENTINEL INFO: tilt_mode_since (#9000)
|
||||
* LATENCY: Track module-acquire-GIL latency (#9608)
|
||||
|
||||
|
||||
Module API changes
|
||||
==================
|
||||
|
||||
* Add API for replying with RESP3 types (#8521, #9639, #9632)
|
||||
* Add API for parsing RESP3 replies from RM_Call (#9202)
|
||||
* Add RM_Call '0' and '3' flags to control RESP version to be used (#9202)
|
||||
* Add Support for validating ACL explicitly (#9309, #9974)
|
||||
* Add missing list type functionality APIs (#8439)
|
||||
* Add API for yielding to Redis events during long busy jobs (#9963)
|
||||
* Add API for registering other file descriptors to the Redis event loop (#10001)
|
||||
* Enhance mem_usage/free_effort/unlink/copy and IO callbacks to have key name
|
||||
and DB index (#8999)
|
||||
* Enhance mem_usage callback to get the requested sample size (#9612)
|
||||
* RM_GetContextFlags: CTX_FLAGS_ASYNC_LOADING, CTX_FLAGS_RESP3 (#9323, #9202)
|
||||
* Mark APIs as non-experimental (#9983)
|
||||
* RM_CreateSubcommand (#9504)
|
||||
* RM_KeyExists (#9600)
|
||||
* RM_TrimStringAllocation (#9540)
|
||||
* RM_LoadDataTypeFromStringEncver (#9537)
|
||||
* RM_MonotonicMicroseconds (#10101)
|
||||
* Add ReplAsyncLoad event and deprecate the ReplBackup event (#9323)
|
||||
* Add RM_SetModuleOptions OPTIONS_HANDLE_REPL_ASYNC_LOAD flag (#9323)
|
||||
|
||||
|
||||
Bug Fixes
|
||||
=========
|
||||
|
||||
* Fix COMMAND GETKEYS on EVAL without keys (#9733)
|
||||
* Improve MEMORY USAGE with allocator overheads (#9095)
|
||||
* Unpause clients after manual failover ends instead of waiting for timed (#9676)
|
||||
* Lua: fix crash on a script call with many arguments, a regression in v6.2.6 (#9809)
|
||||
* Lua: Use all characters to calculate string hash to prevent hash collisions (#9449)
|
||||
* Prevent LCS from allocating temp memory over proto-max-bulk-len (#9817)
|
||||
* Tracking: Make invalidation messages always after command's reply (#9422)
|
||||
* Cluster: Hide empty replicas from CLUSTER SLOTS responses (#9287)
|
||||
* CLIENT KILL killed all clients when used with ID of 0 (#9853)
|
||||
* Fix bugs around lists with list-compress-depth (#9849, #9779)
|
||||
* Fix one in a blue moon LRU bug in RESTORE, RDB loading, and module API (#9279)
|
||||
* Reset lazyfreed_objects info field with RESETSTAT, test for stream lazyfree (#8934)
|
||||
* Fix RDB and list node compression for handling values larger than 4GB (#9776)
|
||||
* Fix a crash when adding elements larger than 2GB to a Set or Hash (#9916)
|
||||
* Diskless replication could not count as a change and skip next database SAVE (#9323)
|
||||
* Fix excessive stream trimming due to an overflow (#10068)
|
||||
* Safe and organized exit when receiving SIGTERM while loading (#10003)
|
||||
* Improve EXPIRE TTL overflow detection (#9839)
|
||||
* Add missed error counting for INFO errorstats (#9646)
|
||||
* DECRBY LLONG_MIN caused negation overflow (#9577)
|
||||
* Delay discarding cached master when full synchronization (#9398)
|
||||
* Fix Stream keyspace notification and persistence triggers in consumer
|
||||
creation and deletion (#9263)
|
||||
* Fix rank overflow in zset with more than 2B entries (#9249)
|
||||
* Avoid starting in check-aof / check-rdb / sentinel modes if only the folder
|
||||
name contains that name (#9215, #9176)
|
||||
* create the log file only after done parsing the entire config file (#6741)
|
||||
* redis-cli: Fix SCAN sleep interval for --bigkeys, --memkeys, --hotkeys (#9624)
|
||||
* redis-cli: Fix prompt to show the right DB num and transaction state after
|
||||
RESET (#9096)
|
||||
* Module API: fix possible propagation bugs in case a module calls CONFIG SET
|
||||
maxmemory outside a command (#10019, #9890)
|
||||
* Module API: carry through client RESP version to module blocked clients (#9634)
|
||||
* Module API: release clients blocked on module commands in cluster resharding
|
||||
and down state (#9483)
|
||||
* Sentinel: Fix availability after master reboot (#9438)
|
||||
* Sentinel: Fix memory leak with TLS (#9753)
|
||||
* Sentinel: Fix possible failover due to duplicate zero-port (#9240)
|
||||
* Sentinel: Fix issues with hostname support (#10146)
|
||||
* Sentinel: Fix election failures on certain container environments (#10197)
|
||||
|
||||
|
||||
Thanks to all the users and developers who made this release possible.
|
||||
We'll follow up with more RC releases, until the code looks production ready
|
||||
and we don't get reports of serious issues for a while.
|
||||
|
||||
A special thank you for the amount of work put into this release by:
|
||||
|
||||
- Guy Benoish
|
||||
- Meir Shpilraien
|
||||
- Oran Agra
|
||||
- Chen Yang
|
||||
- Zhu Binbin
|
||||
- Yoav Steinberg
|
||||
- sundb
|
||||
- Madelyn Olson
|
||||
- Yossi Gottlieb
|
||||
- Viktor Söderqvist
|
||||
- Wang Yuan
|
||||
- Harkrishn Patro
|
||||
- Nick Chun
|
||||
- Ozan Tezcan
|
||||
- Wen Hui
|
||||
- Huang Zhw
|
||||
- Nan Yan
|
||||
- Filipe Oliveira
|
||||
- Eduardo Semprebon
|
||||
- Yaacov Hazan
|
||||
- Itamar Haber
|
||||
- Zhao Zhao
|
||||
- Itay Perry
|
||||
- Moti Cohen
|
||||
- Ning Sun
|
||||
- zhugezy
|
||||
- Ran Shidlansik
|
||||
- menwen
|
||||
- Andy Pan
|
||||
|
||||
Happy hacking!
|
||||
|
||||
@@ -93,4 +93,4 @@ Community Impact Guidelines were inspired by Mozilla’s code of conduct
|
||||
enforcement ladder.
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
https://www.contributor-covenant.org/translations.
|
||||
https://www.contributor-covenant.org/translations.
|
||||
@@ -18,31 +18,13 @@ all the support in the mailing list.
|
||||
|
||||
There is also an active community of Redis users at Stack Overflow:
|
||||
|
||||
http://stackoverflow.com/questions/tagged/redis
|
||||
https://stackoverflow.com/questions/tagged/redis
|
||||
|
||||
# Reporting Security Bugs
|
||||
Issues and pull requests for documentation belong on the redis-doc repo:
|
||||
|
||||
*If you are reporting a security bug*, please contact the core team privately
|
||||
by emailing redis@redis.io. Your report will be acknowledged by a core team
|
||||
member and once the report has been reviewed you will receive a more detailed
|
||||
response including next steps.
|
||||
https://github.com/redis/redis-doc
|
||||
|
||||
If you do not receive a reply you can escalate to the Redis Google Group,
|
||||
linked above. Because this group is a public space please do not disclose the
|
||||
issue in detail, only say that you are trying to reach the core team for a
|
||||
security issue.
|
||||
|
||||
Redis follows a responsible disclosure process:
|
||||
|
||||
1. Reports are reviewed and analyzed privately
|
||||
2. Patches are prepared for supported versions of Redis
|
||||
3. Vendor lists are notified with an embargo date to reduce the public impact
|
||||
4. We push a fix release and your bug can be posted publicly with credit in
|
||||
release notes and the version history (and our thanks!)
|
||||
|
||||
Issues and pull requests for documentation belong on the redis-doc repo:
|
||||
|
||||
https://github.com/redis/redis-doc
|
||||
If you are reporting a security bug or vulnerability, see SECURITY.md.
|
||||
|
||||
# How to provide a patch for a new feature
|
||||
|
||||
@@ -56,10 +38,10 @@ Here you'll see if there is consensus about your idea.
|
||||
2. If in step 1 you get an acknowledgment from the project leaders, use the
|
||||
following procedure to submit a patch:
|
||||
|
||||
a. Fork Redis on github ( http://help.github.com/fork-a-repo/ )
|
||||
a. Fork Redis on github ( https://docs.github.com/en/github/getting-started-with-github/fork-a-repo )
|
||||
b. Create a topic branch (git checkout -b my_branch)
|
||||
c. Push to your branch (git push origin my_branch)
|
||||
d. Initiate a pull request on github ( https://help.github.com/articles/creating-a-pull-request/ )
|
||||
d. Initiate a pull request on github ( https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request )
|
||||
e. Done :)
|
||||
|
||||
3. Keep in mind that we are very overloaded, so issues and PRs sometimes wait
|
||||
@@ -16,7 +16,7 @@ Another good example is to think of Redis as a more complex version of memcached
|
||||
If you want to know more, this is a list of selected starting points:
|
||||
|
||||
* Introduction to Redis data types. https://redis.io/topics/data-types-intro
|
||||
* Try Redis directly inside your browser. http://try.redis.io
|
||||
* Try Redis directly inside your browser. https://try.redis.io
|
||||
* The full list of Redis commands. https://redis.io/commands
|
||||
* There is much more inside the official Redis documentation. https://redis.io/documentation
|
||||
|
||||
@@ -223,11 +223,12 @@ public discussion groups, you agree to release your code under the terms
|
||||
of the BSD license that you can find in the [COPYING][1] file included in the Redis
|
||||
source distribution.
|
||||
|
||||
Please see the [CONTRIBUTING][2] file in this source distribution for more
|
||||
information, including details on our process for security bugs/vulnerabilities.
|
||||
Please see the [CONTRIBUTING.md][2] file in this source distribution for more
|
||||
information. For security bugs and vulnerabilities, please see [SECURITY.md][3].
|
||||
|
||||
[1]: https://github.com/redis/redis/blob/unstable/COPYING
|
||||
[2]: https://github.com/redis/redis/blob/unstable/CONTRIBUTING
|
||||
[2]: https://github.com/redis/redis/blob/unstable/CONTRIBUTING.md
|
||||
[3]: https://github.com/redis/redis/blob/unstable/SECURITY.md
|
||||
|
||||
Redis internals
|
||||
===
|
||||
@@ -303,8 +304,8 @@ struct client {
|
||||
redisDb *db;
|
||||
int flags;
|
||||
list *reply;
|
||||
char buf[PROTO_REPLY_CHUNK_BYTES];
|
||||
// ... many other fields ...
|
||||
char buf[PROTO_REPLY_CHUNK_BYTES];
|
||||
}
|
||||
```
|
||||
The client structure defines a *connected client*:
|
||||
@@ -361,6 +362,12 @@ Inside server.c you can find code that handles other vital things of the Redis s
|
||||
* `performEvictions()` is called when a new write command should be performed but Redis is out of memory according to the `maxmemory` directive.
|
||||
* The global variable `redisCommandTable` defines all the Redis commands, specifying the name of the command, the function implementing the command, the number of arguments required, and other properties of each command.
|
||||
|
||||
commands.c
|
||||
---
|
||||
This file is auto generated by utils/generate-command-code.py, the content is based on the JSON files in the src/commands folder.
|
||||
These are meant to be the single source of truth about the Redis commands, and all the metadata about them.
|
||||
These JSON files are not meant to be used directly by anyone directly, instead that metadata can be obtained via the COMMAND command.
|
||||
|
||||
networking.c
|
||||
---
|
||||
|
||||
@@ -379,8 +386,8 @@ aof.c and rdb.c
|
||||
|
||||
As you can guess from the names, these files implement the RDB and AOF
|
||||
persistence for Redis. Redis uses a persistence model based on the `fork()`
|
||||
system call in order to create a thread with the same (shared) memory
|
||||
content of the main Redis thread. This secondary thread dumps the content
|
||||
system call in order to create a process with the same (shared) memory
|
||||
content of the main Redis process. This secondary process dumps the content
|
||||
of the memory on disk. This is used by `rdb.c` to create the snapshots
|
||||
on disk and by `aof.c` in order to perform the AOF rewrite when the
|
||||
append only file gets too big.
|
||||
@@ -442,18 +449,27 @@ This file also implements both the `SYNC` and `PSYNC` commands that are
|
||||
used in order to perform the first synchronization between masters and
|
||||
replicas, or to continue the replication after a disconnection.
|
||||
|
||||
Script
|
||||
---
|
||||
The script unit is compose of 3 units
|
||||
* `script.c` - integration of scripts with Redis (commands execution, set replication/resp, ..)
|
||||
* `script_lua.c` - responsible to execute Lua code, uses script.c to interact with Redis from within the Lua code.
|
||||
* `function_lua.c` - contains the Lua engine implementation, uses script_lua.c to execute the Lua code.
|
||||
* `functions.c` - Contains Redis Functions implementation (FUNCTION command), uses functions_lua.c if the function it wants to invoke needs the Lua engine.
|
||||
* `eval.c` - Contains the `eval` implementation using `script_lua.c` to invoke the Lua code.
|
||||
|
||||
|
||||
Other C files
|
||||
---
|
||||
|
||||
* `t_hash.c`, `t_list.c`, `t_set.c`, `t_string.c`, `t_zset.c` and `t_stream.c` contains the implementation of the Redis data types. They implement both an API to access a given data type, and the client command implementations for these data types.
|
||||
* `ae.c` implements the Redis event loop, it's a self contained library which is simple to read and understand.
|
||||
* `sds.c` is the Redis string library, check http://github.com/antirez/sds for more information.
|
||||
* `sds.c` is the Redis string library, check https://github.com/antirez/sds for more information.
|
||||
* `anet.c` is a library to use POSIX networking in a simpler way compared to the raw interface exposed by the kernel.
|
||||
* `dict.c` is an implementation of a non-blocking hash table which rehashes incrementally.
|
||||
* `scripting.c` implements Lua scripting. It is completely self-contained and isolated from the rest of the Redis implementation and is simple enough to understand if you are familiar with the Lua API.
|
||||
* `cluster.c` implements the Redis Cluster. Probably a good read only after being very familiar with the rest of the Redis code base. If you want to read `cluster.c` make sure to read the [Redis Cluster specification][3].
|
||||
* `cluster.c` implements the Redis Cluster. Probably a good read only after being very familiar with the rest of the Redis code base. If you want to read `cluster.c` make sure to read the [Redis Cluster specification][4].
|
||||
|
||||
[3]: https://redis.io/topics/cluster-spec
|
||||
[4]: https://redis.io/topics/cluster-spec
|
||||
|
||||
Anatomy of a Redis command
|
||||
---
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Redis is generally backwards compatible with very few exceptions, so we
|
||||
recommend users to always use the latest version to experience stability,
|
||||
performance and security.
|
||||
|
||||
We generally backport security issues to a single previous major version,
|
||||
unless this is not possible or feasible with a reasonable effort.
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 7.0.x | :white_check_mark: |
|
||||
| 6.2.x | :white_check_mark: |
|
||||
| 6.0.x | :white_check_mark: |
|
||||
| < 6.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you believe you’ve discovered a serious vulnerability, please contact the
|
||||
Redis core team at redis@redis.io. We will evaluate your report and if
|
||||
necessary issue a fix and an advisory. If the issue was previously undisclosed,
|
||||
we’ll also mention your name in the credits.
|
||||
|
||||
## Responsible Disclosure
|
||||
|
||||
In some cases, we may apply a responsible disclosure process to reported or
|
||||
otherwise discovered vulnerabilities. We will usually do that for a critical
|
||||
vulnerability, and only if we have a good reason to believe information about
|
||||
it is not yet public.
|
||||
|
||||
This process involves providing an early notification about the vulnerability,
|
||||
its impact and mitigations to a short list of vendors under a time-limited
|
||||
embargo on public disclosure.
|
||||
|
||||
Vendors on the list are individuals or organizations that maintain Redis
|
||||
distributions or provide Redis as a service, who have third party users who
|
||||
will benefit from the vendor’s ability to prepare for a new version or deploy a
|
||||
fix early.
|
||||
|
||||
If you believe you should be on the list, please contact us and we will
|
||||
consider your request based on the above criteria.
|
||||
Vendored
+13
-2
@@ -2,6 +2,8 @@
|
||||
|
||||
uname_S:= $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
||||
|
||||
LUA_DEBUG?=no
|
||||
|
||||
CCCOLOR="\033[34m"
|
||||
LINKCOLOR="\033[34;1m"
|
||||
SRCCOLOR="\033[33m"
|
||||
@@ -69,8 +71,13 @@ ifeq ($(uname_S),SunOS)
|
||||
LUA_CFLAGS= -D__C99FEATURES__=1
|
||||
endif
|
||||
|
||||
LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP $(CFLAGS)
|
||||
LUA_CFLAGS+= -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' -DLUA_USE_MKSTEMP $(CFLAGS)
|
||||
LUA_LDFLAGS+= $(LDFLAGS)
|
||||
ifeq ($(LUA_DEBUG),yes)
|
||||
LUA_CFLAGS+= -O0 -g -DLUA_USE_APICHECK
|
||||
else
|
||||
LUA_CFLAGS+= -O2
|
||||
endif
|
||||
# lua's Makefile defines AR="ar rcu", which is unusual, and makes it more
|
||||
# challenging to cross-compile lua (and redis). These defines make it easier
|
||||
# to fit redis into cross-compilation environments, which typically set AR.
|
||||
@@ -86,9 +93,13 @@ lua: .make-prerequisites
|
||||
JEMALLOC_CFLAGS= -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops $(CFLAGS)
|
||||
JEMALLOC_LDFLAGS= $(LDFLAGS)
|
||||
|
||||
ifneq ($(DEB_HOST_GNU_TYPE),)
|
||||
JEMALLOC_CONFIGURE_OPTS += --host=$(DEB_HOST_GNU_TYPE)
|
||||
endif
|
||||
|
||||
jemalloc: .make-prerequisites
|
||||
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
|
||||
cd jemalloc && ./configure --with-version=5.1.0-0-g0 --with-lg-quantum=3 --with-jemalloc-prefix=je_ CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)"
|
||||
cd jemalloc && ./configure --with-version=5.2.1-0-g0 --with-lg-quantum=3 --with-jemalloc-prefix=je_ CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" $(JEMALLOC_CONFIGURE_OPTS)
|
||||
cd jemalloc && $(MAKE) CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" lib/libjemalloc.a
|
||||
|
||||
.PHONY: jemalloc
|
||||
|
||||
Vendored
+25
@@ -5,6 +5,7 @@ should be provided by the operating system.
|
||||
* **hiredis** is the official C client library for Redis. It is used by redis-cli, redis-benchmark and Redis Sentinel. It is part of the Redis official ecosystem but is developed externally from the Redis repository, so we just upgrade it as needed.
|
||||
* **linenoise** is a readline replacement. It is developed by the same authors of Redis but is managed as a separated project and updated as needed.
|
||||
* **lua** is Lua 5.1 with minor changes for security and additional libraries.
|
||||
* **hdr_histogram** Used for per-command latency tracking histograms.
|
||||
|
||||
How to upgrade the above dependencies
|
||||
===
|
||||
@@ -41,6 +42,22 @@ the following additional steps:
|
||||
changed, otherwise you could just copy the old implementation if you are
|
||||
upgrading just to a similar version of Jemalloc.
|
||||
|
||||
#### Updating/upgrading jemalloc
|
||||
|
||||
The jemalloc directory is pulled as a subtree from the upstream jemalloc github repo. To update it you should run from the project root:
|
||||
|
||||
1. `git subtree pull --prefix deps/jemalloc https://github.com/jemalloc/jemalloc.git <version-tag> --squash`<br>
|
||||
This should hopefully merge the local changes into the new version.
|
||||
2. In case any conflicts arise (due to our changes) you'll need to resolve them and commit.
|
||||
3. Reconfigure jemalloc:<br>
|
||||
```sh
|
||||
rm deps/jemalloc/VERSION deps/jemalloc/configure
|
||||
cd deps/jemalloc
|
||||
./autogen.sh --with-version=<version-tag>-0-g0
|
||||
```
|
||||
4. Update jemalloc's version in `deps/Makefile`: search for "`--with-version=<old-version-tag>-0-g0`" and update it accordingly.
|
||||
5. Commit the changes (VERSION,configure,Makefile).
|
||||
|
||||
Hiredis
|
||||
---
|
||||
|
||||
@@ -79,4 +96,12 @@ and our version:
|
||||
2. We have the implementation source code, and directly link to the following external libraries: `lua_cjson.o`, `lua_struct.o`, `lua_cmsgpack.o` and `lua_bit.o`.
|
||||
3. There is a security fix in `ldo.c`, line 498: The check for `LUA_SIGNATURE[0]` is removed in order to avoid direct bytecode execution.
|
||||
|
||||
Hdr_Histogram
|
||||
---
|
||||
|
||||
Updated source can be found here: https://github.com/HdrHistogram/HdrHistogram_c
|
||||
We use a customized version based on master branch commit e4448cf6d1cd08fff519812d3b1e58bd5a94ac42.
|
||||
1. Compare all changes under /hdr_histogram directory to upstream master commit e4448cf6d1cd08fff519812d3b1e58bd5a94ac42
|
||||
2. Copy updated files from newer version onto files in /hdr_histogram.
|
||||
3. Apply the changes from 1 above to the updated files.
|
||||
|
||||
|
||||
Vendored
+10
-3
@@ -1,20 +1,27 @@
|
||||
STD=
|
||||
STD= -std=c99
|
||||
WARN= -Wall
|
||||
OPT= -Os
|
||||
|
||||
R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS)
|
||||
R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) -DHDR_MALLOC_INCLUDE=\"hdr_redis_malloc.h\"
|
||||
R_LDFLAGS= $(LDFLAGS)
|
||||
DEBUG= -g
|
||||
|
||||
R_CC=$(CC) $(R_CFLAGS)
|
||||
R_LD=$(CC) $(R_LDFLAGS)
|
||||
|
||||
hdr_histogram.o: hdr_histogram.h hdr_histogram.c
|
||||
AR= ar
|
||||
ARFLAGS= rcs
|
||||
|
||||
libhdrhistogram.a: hdr_histogram.o
|
||||
$(AR) $(ARFLAGS) $@ $+
|
||||
|
||||
hdr_histogram.o: hdr_histogram.h hdr_histogram.c
|
||||
|
||||
.c.o:
|
||||
$(R_CC) -c $<
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f *.a
|
||||
|
||||
|
||||
|
||||
Vendored
+73
-5
@@ -1,10 +1,78 @@
|
||||
HdrHistogram_c v0.11.0
|
||||
HdrHistogram_c: 'C' port of High Dynamic Range (HDR) Histogram
|
||||
|
||||
HdrHistogram
|
||||
----------------------------------------------
|
||||
|
||||
This port contains a subset of the 'C' version of High Dynamic Range (HDR) Histogram available at [github.com/HdrHistogram/HdrHistogram_c](https://github.com/HdrHistogram/HdrHistogram_c).
|
||||
[](https://gitter.im/HdrHistogram/HdrHistogram)
|
||||
|
||||
This port contains a subset of the functionality supported by the Java
|
||||
implementation. The current supported features are:
|
||||
|
||||
The code present on `hdr_histogram.c`, `hdr_histogram.h`, and `hdr_atomic.c` was Written by Gil Tene, Michael Barker,
|
||||
and Matt Warren, and released to the public domain, as explained at
|
||||
http://creativecommons.org/publicdomain/zero/1.0/.
|
||||
* Standard histogram with 64 bit counts (32/16 bit counts not supported)
|
||||
* All iterator types (all values, recorded, percentiles, linear, logarithmic)
|
||||
* Histogram serialisation (encoding version 1.2, decoding 1.0-1.2)
|
||||
* Reader/writer phaser and interval recorder
|
||||
|
||||
Features not supported, but planned
|
||||
|
||||
* Auto-resizing of histograms
|
||||
|
||||
Features unlikely to be implemented
|
||||
|
||||
* Double histograms
|
||||
* Atomic/Concurrent histograms
|
||||
* 16/32 bit histograms
|
||||
|
||||
# Simple Tutorial
|
||||
|
||||
## Recording values
|
||||
|
||||
```C
|
||||
#include <hdr_histogram.h>
|
||||
|
||||
struct hdr_histogram* histogram;
|
||||
|
||||
// Initialise the histogram
|
||||
hdr_init(
|
||||
1, // Minimum value
|
||||
INT64_C(3600000000), // Maximum value
|
||||
3, // Number of significant figures
|
||||
&histogram) // Pointer to initialise
|
||||
|
||||
// Record value
|
||||
hdr_record_value(
|
||||
histogram, // Histogram to record to
|
||||
value) // Value to record
|
||||
|
||||
// Record value n times
|
||||
hdr_record_values(
|
||||
histogram, // Histogram to record to
|
||||
value, // Value to record
|
||||
10) // Record value 10 times
|
||||
|
||||
// Record value with correction for co-ordinated omission.
|
||||
hdr_record_corrected_value(
|
||||
histogram, // Histogram to record to
|
||||
value, // Value to record
|
||||
1000) // Record with expected interval of 1000.
|
||||
|
||||
// Print out the values of the histogram
|
||||
hdr_percentiles_print(
|
||||
histogram,
|
||||
stdout, // File to write to
|
||||
5, // Granularity of printed values
|
||||
1.0, // Multiplier for results
|
||||
CLASSIC); // Format CLASSIC/CSV supported.
|
||||
```
|
||||
|
||||
## More examples
|
||||
|
||||
For more detailed examples of recording and logging results look at the
|
||||
[hdr_decoder](examples/hdr_decoder.c)
|
||||
and [hiccup](examples/hiccup.c)
|
||||
examples. You can run hiccup and decoder
|
||||
and pipe the results of one into the other.
|
||||
|
||||
```
|
||||
$ ./examples/hiccup | ./examples/hdr_decoder
|
||||
```
|
||||
|
||||
Vendored
+107
-33
@@ -14,8 +14,15 @@
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "hdr_histogram.h"
|
||||
#include "hdr_tests.h"
|
||||
#include "hdr_atomic.h"
|
||||
|
||||
#ifndef HDR_MALLOC_INCLUDE
|
||||
#define HDR_MALLOC_INCLUDE "hdr_malloc.h"
|
||||
#endif
|
||||
|
||||
#include HDR_MALLOC_INCLUDE
|
||||
|
||||
/* ###### ####### ## ## ## ## ######## ###### */
|
||||
/* ## ## ## ## ## ## ### ## ## ## ## */
|
||||
/* ## ## ## ## ## #### ## ## ## */
|
||||
@@ -215,6 +222,15 @@ int64_t hdr_size_of_equivalent_value_range(const struct hdr_histogram* h, int64_
|
||||
return INT64_C(1) << (h->unit_magnitude + adjusted_bucket);
|
||||
}
|
||||
|
||||
static int64_t size_of_equivalent_value_range_given_bucket_indices(
|
||||
const struct hdr_histogram *h,
|
||||
int32_t bucket_index,
|
||||
int32_t sub_bucket_index)
|
||||
{
|
||||
const int32_t adjusted_bucket = (sub_bucket_index >= h->sub_bucket_count) ? (bucket_index + 1) : bucket_index;
|
||||
return INT64_C(1) << (h->unit_magnitude + adjusted_bucket);
|
||||
}
|
||||
|
||||
static int64_t lowest_equivalent_value(const struct hdr_histogram* h, int64_t value)
|
||||
{
|
||||
int32_t bucket_index = get_bucket_index(h, value);
|
||||
@@ -222,6 +238,14 @@ static int64_t lowest_equivalent_value(const struct hdr_histogram* h, int64_t va
|
||||
return value_from_index(bucket_index, sub_bucket_index, h->unit_magnitude);
|
||||
}
|
||||
|
||||
static int64_t lowest_equivalent_value_given_bucket_indices(
|
||||
const struct hdr_histogram *h,
|
||||
int32_t bucket_index,
|
||||
int32_t sub_bucket_index)
|
||||
{
|
||||
return value_from_index(bucket_index, sub_bucket_index, h->unit_magnitude);
|
||||
}
|
||||
|
||||
int64_t hdr_next_non_equivalent_value(const struct hdr_histogram *h, int64_t value)
|
||||
{
|
||||
return lowest_equivalent_value(h, value) + hdr_size_of_equivalent_value_range(h, value);
|
||||
@@ -317,7 +341,7 @@ static int32_t buckets_needed_to_cover_value(int64_t value, int32_t sub_bucket_c
|
||||
/* ## ## ######## ## ## ####### ## ## ## */
|
||||
|
||||
int hdr_calculate_bucket_config(
|
||||
int64_t lowest_trackable_value,
|
||||
int64_t lowest_discernible_value,
|
||||
int64_t highest_trackable_value,
|
||||
int significant_figures,
|
||||
struct hdr_histogram_bucket_config* cfg)
|
||||
@@ -325,14 +349,14 @@ int hdr_calculate_bucket_config(
|
||||
int32_t sub_bucket_count_magnitude;
|
||||
int64_t largest_value_with_single_unit_resolution;
|
||||
|
||||
if (lowest_trackable_value < 1 ||
|
||||
if (lowest_discernible_value < 1 ||
|
||||
significant_figures < 1 || 5 < significant_figures ||
|
||||
lowest_trackable_value * 2 > highest_trackable_value)
|
||||
lowest_discernible_value * 2 > highest_trackable_value)
|
||||
{
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
cfg->lowest_trackable_value = lowest_trackable_value;
|
||||
cfg->lowest_discernible_value = lowest_discernible_value;
|
||||
cfg->significant_figures = significant_figures;
|
||||
cfg->highest_trackable_value = highest_trackable_value;
|
||||
|
||||
@@ -340,8 +364,13 @@ int hdr_calculate_bucket_config(
|
||||
sub_bucket_count_magnitude = (int32_t) ceil(log((double)largest_value_with_single_unit_resolution) / log(2));
|
||||
cfg->sub_bucket_half_count_magnitude = ((sub_bucket_count_magnitude > 1) ? sub_bucket_count_magnitude : 1) - 1;
|
||||
|
||||
cfg->unit_magnitude = (int32_t) floor(log((double)lowest_trackable_value) / log(2));
|
||||
double unit_magnitude = log((double)lowest_discernible_value) / log(2);
|
||||
if (INT32_MAX < unit_magnitude)
|
||||
{
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
cfg->unit_magnitude = (int32_t) unit_magnitude;
|
||||
cfg->sub_bucket_count = (int32_t) pow(2, (cfg->sub_bucket_half_count_magnitude + 1));
|
||||
cfg->sub_bucket_half_count = cfg->sub_bucket_count / 2;
|
||||
cfg->sub_bucket_mask = ((int64_t) cfg->sub_bucket_count - 1) << cfg->unit_magnitude;
|
||||
@@ -359,7 +388,7 @@ int hdr_calculate_bucket_config(
|
||||
|
||||
void hdr_init_preallocated(struct hdr_histogram* h, struct hdr_histogram_bucket_config* cfg)
|
||||
{
|
||||
h->lowest_trackable_value = cfg->lowest_trackable_value;
|
||||
h->lowest_discernible_value = cfg->lowest_discernible_value;
|
||||
h->highest_trackable_value = cfg->highest_trackable_value;
|
||||
h->unit_magnitude = (int32_t)cfg->unit_magnitude;
|
||||
h->significant_figures = (int32_t)cfg->significant_figures;
|
||||
@@ -377,7 +406,7 @@ void hdr_init_preallocated(struct hdr_histogram* h, struct hdr_histogram_bucket_
|
||||
}
|
||||
|
||||
int hdr_init(
|
||||
int64_t lowest_trackable_value,
|
||||
int64_t lowest_discernible_value,
|
||||
int64_t highest_trackable_value,
|
||||
int significant_figures,
|
||||
struct hdr_histogram** result)
|
||||
@@ -386,22 +415,22 @@ int hdr_init(
|
||||
struct hdr_histogram_bucket_config cfg;
|
||||
struct hdr_histogram* histogram;
|
||||
|
||||
int r = hdr_calculate_bucket_config(lowest_trackable_value, highest_trackable_value, significant_figures, &cfg);
|
||||
int r = hdr_calculate_bucket_config(lowest_discernible_value, highest_trackable_value, significant_figures, &cfg);
|
||||
if (r)
|
||||
{
|
||||
return r;
|
||||
}
|
||||
|
||||
counts = (int64_t*) calloc((size_t) cfg.counts_len, sizeof(int64_t));
|
||||
counts = (int64_t*) hdr_calloc((size_t) cfg.counts_len, sizeof(int64_t));
|
||||
if (!counts)
|
||||
{
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
histogram = (struct hdr_histogram*) calloc(1, sizeof(struct hdr_histogram));
|
||||
histogram = (struct hdr_histogram*) hdr_calloc(1, sizeof(struct hdr_histogram));
|
||||
if (!histogram)
|
||||
{
|
||||
free(counts);
|
||||
hdr_free(counts);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
@@ -416,8 +445,8 @@ int hdr_init(
|
||||
void hdr_close(struct hdr_histogram* h)
|
||||
{
|
||||
if (h) {
|
||||
free(h->counts);
|
||||
free(h);
|
||||
hdr_free(h->counts);
|
||||
hdr_free(h);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -637,31 +666,71 @@ int64_t hdr_min(const struct hdr_histogram* h)
|
||||
return non_zero_min(h);
|
||||
}
|
||||
|
||||
int64_t hdr_value_at_percentile(const struct hdr_histogram* h, double percentile)
|
||||
static int64_t get_value_from_idx_up_to_count(const struct hdr_histogram* h, int64_t count_at_percentile)
|
||||
{
|
||||
struct hdr_iter iter;
|
||||
int64_t total = 0;
|
||||
double requested_percentile = percentile < 100.0 ? percentile : 100.0;
|
||||
int64_t count_at_percentile =
|
||||
(int64_t) (((requested_percentile / 100) * h->total_count) + 0.5);
|
||||
count_at_percentile = count_at_percentile > 1 ? count_at_percentile : 1;
|
||||
int64_t count_to_idx = 0;
|
||||
|
||||
hdr_iter_init(&iter, h);
|
||||
|
||||
while (hdr_iter_next(&iter))
|
||||
count_at_percentile = 0 < count_at_percentile ? count_at_percentile : 1;
|
||||
for (int32_t idx = 0; idx < h->counts_len; idx++)
|
||||
{
|
||||
total += iter.count;
|
||||
|
||||
if (total >= count_at_percentile)
|
||||
count_to_idx += h->counts[idx];
|
||||
if (count_to_idx >= count_at_percentile)
|
||||
{
|
||||
int64_t value_from_index = iter.value;
|
||||
return highest_equivalent_value(h, value_from_index);
|
||||
return hdr_value_at_index(h, idx);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int64_t hdr_value_at_percentile(const struct hdr_histogram* h, double percentile)
|
||||
{
|
||||
double requested_percentile = percentile < 100.0 ? percentile : 100.0;
|
||||
int64_t count_at_percentile =
|
||||
(int64_t) (((requested_percentile / 100) * h->total_count) + 0.5);
|
||||
int64_t value_from_idx = get_value_from_idx_up_to_count(h, count_at_percentile);
|
||||
if (percentile == 0.0)
|
||||
{
|
||||
return lowest_equivalent_value(h, value_from_idx);
|
||||
}
|
||||
return highest_equivalent_value(h, value_from_idx);
|
||||
}
|
||||
|
||||
int hdr_value_at_percentiles(const struct hdr_histogram *h, const double *percentiles, int64_t *values, size_t length)
|
||||
{
|
||||
if (NULL == percentiles || NULL == values)
|
||||
{
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
struct hdr_iter iter;
|
||||
const int64_t total_count = h->total_count;
|
||||
// to avoid allocations we use the values array for intermediate computation
|
||||
// i.e. to store the expected cumulative count at each percentile
|
||||
for (size_t i = 0; i < length; i++)
|
||||
{
|
||||
const double requested_percentile = percentiles[i] < 100.0 ? percentiles[i] : 100.0;
|
||||
const int64_t count_at_percentile =
|
||||
(int64_t) (((requested_percentile / 100) * total_count) + 0.5);
|
||||
values[i] = count_at_percentile > 1 ? count_at_percentile : 1;
|
||||
}
|
||||
|
||||
hdr_iter_init(&iter, h);
|
||||
int64_t total = 0;
|
||||
size_t at_pos = 0;
|
||||
while (hdr_iter_next(&iter) && at_pos < length)
|
||||
{
|
||||
total += iter.count;
|
||||
while (at_pos < length && total >= values[at_pos])
|
||||
{
|
||||
values[at_pos] = highest_equivalent_value(h, iter.value);
|
||||
at_pos++;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
double hdr_mean(const struct hdr_histogram* h)
|
||||
{
|
||||
struct hdr_iter iter;
|
||||
@@ -751,11 +820,16 @@ static bool move_next(struct hdr_iter* iter)
|
||||
|
||||
iter->count = counts_get_normalised(iter->h, iter->counts_index);
|
||||
iter->cumulative_count += iter->count;
|
||||
|
||||
iter->value = hdr_value_at_index(iter->h, iter->counts_index);
|
||||
iter->highest_equivalent_value = highest_equivalent_value(iter->h, iter->value);
|
||||
iter->lowest_equivalent_value = lowest_equivalent_value(iter->h, iter->value);
|
||||
iter->median_equivalent_value = hdr_median_equivalent_value(iter->h, iter->value);
|
||||
const int64_t value = hdr_value_at_index(iter->h, iter->counts_index);
|
||||
const int32_t bucket_index = get_bucket_index(iter->h, value);
|
||||
const int32_t sub_bucket_index = get_sub_bucket_index(value, bucket_index, iter->h->unit_magnitude);
|
||||
const int64_t leq = lowest_equivalent_value_given_bucket_indices(iter->h, bucket_index, sub_bucket_index);
|
||||
const int64_t size_of_equivalent_value_range = size_of_equivalent_value_range_given_bucket_indices(
|
||||
iter->h, bucket_index, sub_bucket_index);
|
||||
iter->lowest_equivalent_value = leq;
|
||||
iter->value = value;
|
||||
iter->highest_equivalent_value = leq + size_of_equivalent_value_range - 1;
|
||||
iter->median_equivalent_value = leq + (size_of_equivalent_value_range >> 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Vendored
+28
-16
@@ -16,7 +16,7 @@
|
||||
|
||||
struct hdr_histogram
|
||||
{
|
||||
int64_t lowest_trackable_value;
|
||||
int64_t lowest_discernible_value;
|
||||
int64_t highest_trackable_value;
|
||||
int32_t unit_magnitude;
|
||||
int32_t significant_figures;
|
||||
@@ -45,8 +45,8 @@ extern "C" {
|
||||
* involved math on the input parameters this function it is tricky to stack allocate.
|
||||
* The histogram should be released with hdr_close
|
||||
*
|
||||
* @param lowest_trackable_value The smallest possible value to be put into the
|
||||
* histogram.
|
||||
* @param lowest_discernible_value The smallest possible value that is distinguishable from 0.
|
||||
* Must be a positive integer that is >= 1. May be internally rounded down to nearest power of 2.
|
||||
* @param highest_trackable_value The largest possible value to be put into the
|
||||
* histogram.
|
||||
* @param significant_figures The level of precision for this histogram, i.e. the number
|
||||
@@ -54,12 +54,12 @@ extern "C" {
|
||||
* the results from the histogram will be accurate up to the first three digits. Must
|
||||
* be a value between 1 and 5 (inclusive).
|
||||
* @param result Output parameter to capture allocated histogram.
|
||||
* @return 0 on success, EINVAL if lowest_trackable_value is < 1 or the
|
||||
* @return 0 on success, EINVAL if lowest_discernible_value is < 1 or the
|
||||
* significant_figure value is outside of the allowed range, ENOMEM if malloc
|
||||
* failed.
|
||||
*/
|
||||
int hdr_init(
|
||||
int64_t lowest_trackable_value,
|
||||
int64_t lowest_discernible_value,
|
||||
int64_t highest_trackable_value,
|
||||
int significant_figures,
|
||||
struct hdr_histogram** result);
|
||||
@@ -159,10 +159,10 @@ bool hdr_record_values_atomic(struct hdr_histogram* h, int64_t value, int64_t co
|
||||
* Record a value in the histogram and backfill based on an expected interval.
|
||||
*
|
||||
* Records a value in the histogram, will round this value of to a precision at or better
|
||||
* than the significant_figure specified at contruction time. This is specifically used
|
||||
* than the significant_figure specified at construction time. This is specifically used
|
||||
* for recording latency. If the value is larger than the expected_interval then the
|
||||
* latency recording system has experienced co-ordinated omission. This method fills in the
|
||||
* values that would have occured had the client providing the load not been blocked.
|
||||
* values that would have occurred had the client providing the load not been blocked.
|
||||
|
||||
* @param h "This" pointer
|
||||
* @param value Value to add to the histogram
|
||||
@@ -170,16 +170,16 @@ bool hdr_record_values_atomic(struct hdr_histogram* h, int64_t value, int64_t co
|
||||
* @return false if the value is larger than the highest_trackable_value and can't be recorded,
|
||||
* true otherwise.
|
||||
*/
|
||||
bool hdr_record_corrected_value(struct hdr_histogram* h, int64_t value, int64_t expexcted_interval);
|
||||
bool hdr_record_corrected_value(struct hdr_histogram* h, int64_t value, int64_t expected_interval);
|
||||
|
||||
/**
|
||||
* Record a value in the histogram and backfill based on an expected interval.
|
||||
*
|
||||
* Records a value in the histogram, will round this value of to a precision at or better
|
||||
* than the significant_figure specified at contruction time. This is specifically used
|
||||
* than the significant_figure specified at construction time. This is specifically used
|
||||
* for recording latency. If the value is larger than the expected_interval then the
|
||||
* latency recording system has experienced co-ordinated omission. This method fills in the
|
||||
* values that would have occured had the client providing the load not been blocked.
|
||||
* values that would have occurred had the client providing the load not been blocked.
|
||||
*
|
||||
* Will record this value atomically, however the whole structure may appear inconsistent
|
||||
* when read concurrently with this update. Do NOT mix calls to this method with calls
|
||||
@@ -191,7 +191,7 @@ bool hdr_record_corrected_value(struct hdr_histogram* h, int64_t value, int64_t
|
||||
* @return false if the value is larger than the highest_trackable_value and can't be recorded,
|
||||
* true otherwise.
|
||||
*/
|
||||
bool hdr_record_corrected_value_atomic(struct hdr_histogram* h, int64_t value, int64_t expexcted_interval);
|
||||
bool hdr_record_corrected_value_atomic(struct hdr_histogram* h, int64_t value, int64_t expected_interval);
|
||||
|
||||
/**
|
||||
* Record a value in the histogram 'count' times. Applies the same correcting logic
|
||||
@@ -226,7 +226,7 @@ bool hdr_record_corrected_values_atomic(struct hdr_histogram* h, int64_t value,
|
||||
/**
|
||||
* Adds all of the values from 'from' to 'this' histogram. Will return the
|
||||
* number of values that are dropped when copying. Values will be dropped
|
||||
* if they around outside of h.lowest_trackable_value and
|
||||
* if they around outside of h.lowest_discernible_value and
|
||||
* h.highest_trackable_value.
|
||||
*
|
||||
* @param h "This" pointer
|
||||
@@ -238,7 +238,7 @@ int64_t hdr_add(struct hdr_histogram* h, const struct hdr_histogram* from);
|
||||
/**
|
||||
* Adds all of the values from 'from' to 'this' histogram. Will return the
|
||||
* number of values that are dropped when copying. Values will be dropped
|
||||
* if they around outside of h.lowest_trackable_value and
|
||||
* if they around outside of h.lowest_discernible_value and
|
||||
* h.highest_trackable_value.
|
||||
*
|
||||
* @param h "This" pointer
|
||||
@@ -272,6 +272,18 @@ int64_t hdr_max(const struct hdr_histogram* h);
|
||||
*/
|
||||
int64_t hdr_value_at_percentile(const struct hdr_histogram* h, double percentile);
|
||||
|
||||
/**
|
||||
* Get the values at the given percentiles.
|
||||
*
|
||||
* @param h "This" pointer.
|
||||
* @param percentiles The ordered percentiles array to get the values for.
|
||||
* @param length Number of elements in the arrays.
|
||||
* @param values Destination array containing the values at the given percentiles.
|
||||
* The values array should be allocated by the caller.
|
||||
* @return 0 on success, ENOMEM if the provided destination array is null.
|
||||
*/
|
||||
int hdr_value_at_percentiles(const struct hdr_histogram *h, const double *percentiles, int64_t *values, size_t length);
|
||||
|
||||
/**
|
||||
* Gets the standard deviation for the values in the histogram.
|
||||
*
|
||||
@@ -470,7 +482,7 @@ int hdr_percentiles_print(
|
||||
*/
|
||||
struct hdr_histogram_bucket_config
|
||||
{
|
||||
int64_t lowest_trackable_value;
|
||||
int64_t lowest_discernible_value;
|
||||
int64_t highest_trackable_value;
|
||||
int64_t unit_magnitude;
|
||||
int64_t significant_figures;
|
||||
@@ -483,7 +495,7 @@ struct hdr_histogram_bucket_config
|
||||
};
|
||||
|
||||
int hdr_calculate_bucket_config(
|
||||
int64_t lowest_trackable_value,
|
||||
int64_t lowest_discernible_value,
|
||||
int64_t highest_trackable_value,
|
||||
int significant_figures,
|
||||
struct hdr_histogram_bucket_config* cfg);
|
||||
@@ -497,7 +509,7 @@ int64_t hdr_next_non_equivalent_value(const struct hdr_histogram* h, int64_t val
|
||||
int64_t hdr_median_equivalent_value(const struct hdr_histogram* h, int64_t value);
|
||||
|
||||
/**
|
||||
* Used to reset counters after importing data manuallying into the histogram, used by the logging code
|
||||
* Used to reset counters after importing data manually into the histogram, used by the logging code
|
||||
* and other custom serialisation tools.
|
||||
*/
|
||||
void hdr_reset_internal_counters(struct hdr_histogram* h);
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
#ifndef HDR_MALLOC_H__
|
||||
#define HDR_MALLOC_H__
|
||||
|
||||
void *zmalloc(size_t size);
|
||||
void *zcalloc_num(size_t num, size_t size);
|
||||
void *zrealloc(void *ptr, size_t size);
|
||||
void zfree(void *ptr);
|
||||
|
||||
#define hdr_malloc zmalloc
|
||||
#define hdr_calloc zcalloc_num
|
||||
#define hdr_realloc zrealloc
|
||||
#define hdr_free zfree
|
||||
#endif
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
#ifndef HDR_TESTS_H
|
||||
#define HDR_TESTS_H
|
||||
|
||||
/* These are functions used in tests and are not intended for normal usage. */
|
||||
|
||||
#include "hdr_histogram.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int32_t counts_index_for(const struct hdr_histogram* h, int64_t value);
|
||||
int hdr_encode_compressed(struct hdr_histogram* h, uint8_t** compressed_histogram, size_t* compressed_len);
|
||||
int hdr_decode_compressed(uint8_t* buffer, size_t length, struct hdr_histogram** histogram);
|
||||
void hdr_base64_decode_block(const char* input, uint8_t* output);
|
||||
void hdr_base64_encode_block(const uint8_t* input, char* output);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
name: Build and test
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
ubuntu:
|
||||
name: Ubuntu
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo add-apt-repository -y ppa:chris-lea/redis-server
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y redis-server valgrind libevent-dev
|
||||
|
||||
- name: Build using cmake
|
||||
env:
|
||||
EXTRA_CMAKE_OPTS: -DENABLE_EXAMPLES:BOOL=ON -DENABLE_SSL:BOOL=ON -DENABLE_SSL_TESTS:BOOL=ON -DENABLE_ASYNC_TESTS:BOOL=ON
|
||||
CFLAGS: -Werror
|
||||
CXXFLAGS: -Werror
|
||||
run: mkdir build-ubuntu && cd build-ubuntu && cmake ..
|
||||
|
||||
- name: Build using makefile
|
||||
run: USE_SSL=1 TEST_ASYNC=1 make
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
SKIPS_AS_FAILS: 1
|
||||
TEST_SSL: 1
|
||||
run: $GITHUB_WORKSPACE/test.sh
|
||||
|
||||
# - name: Run tests under valgrind
|
||||
# env:
|
||||
# SKIPS_AS_FAILS: 1
|
||||
# TEST_PREFIX: valgrind --error-exitcode=99 --track-origins=yes --leak-check=full
|
||||
# run: $GITHUB_WORKSPACE/test.sh
|
||||
|
||||
centos7:
|
||||
name: CentOS 7
|
||||
runs-on: ubuntu-latest
|
||||
container: centos:7
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
|
||||
yum -y --enablerepo=remi install redis
|
||||
yum -y install gcc gcc-c++ make openssl openssl-devel cmake3 valgrind libevent-devel
|
||||
|
||||
- name: Build using cmake
|
||||
env:
|
||||
EXTRA_CMAKE_OPTS: -DENABLE_EXAMPLES:BOOL=ON -DENABLE_SSL:BOOL=ON -DENABLE_SSL_TESTS:BOOL=ON -DENABLE_ASYNC_TESTS:BOOL=ON
|
||||
CFLAGS: -Werror
|
||||
CXXFLAGS: -Werror
|
||||
run: mkdir build-centos7 && cd build-centos7 && cmake3 ..
|
||||
|
||||
- name: Build using Makefile
|
||||
run: USE_SSL=1 TEST_ASYNC=1 make
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
SKIPS_AS_FAILS: 1
|
||||
TEST_SSL: 1
|
||||
run: $GITHUB_WORKSPACE/test.sh
|
||||
|
||||
- name: Run tests under valgrind
|
||||
env:
|
||||
SKIPS_AS_FAILS: 1
|
||||
TEST_SSL: 1
|
||||
TEST_PREFIX: valgrind --error-exitcode=99 --track-origins=yes --leak-check=full
|
||||
run: $GITHUB_WORKSPACE/test.sh
|
||||
|
||||
centos8:
|
||||
name: RockyLinux 8
|
||||
runs-on: ubuntu-latest
|
||||
container: rockylinux:8
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
|
||||
dnf -y module install redis:remi-6.0
|
||||
dnf -y group install "Development Tools"
|
||||
dnf -y install openssl-devel cmake valgrind libevent-devel
|
||||
|
||||
- name: Build using cmake
|
||||
env:
|
||||
EXTRA_CMAKE_OPTS: -DENABLE_EXAMPLES:BOOL=ON -DENABLE_SSL:BOOL=ON -DENABLE_SSL_TESTS:BOOL=ON -DENABLE_ASYNC_TESTS:BOOL=ON
|
||||
CFLAGS: -Werror
|
||||
CXXFLAGS: -Werror
|
||||
run: mkdir build-centos8 && cd build-centos8 && cmake ..
|
||||
|
||||
- name: Build using Makefile
|
||||
run: USE_SSL=1 TEST_ASYNC=1 make
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
SKIPS_AS_FAILS: 1
|
||||
TEST_SSL: 1
|
||||
run: $GITHUB_WORKSPACE/test.sh
|
||||
|
||||
- name: Run tests under valgrind
|
||||
env:
|
||||
SKIPS_AS_FAILS: 1
|
||||
TEST_SSL: 1
|
||||
TEST_PREFIX: valgrind --error-exitcode=99 --track-origins=yes --leak-check=full
|
||||
run: $GITHUB_WORKSPACE/test.sh
|
||||
|
||||
freebsd:
|
||||
runs-on: macos-10.15
|
||||
name: FreeBSD
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
|
||||
- name: Build in FreeBSD
|
||||
uses: vmactions/freebsd-vm@v0.1.5
|
||||
with:
|
||||
prepare: pkg install -y gmake cmake
|
||||
run: |
|
||||
mkdir build && cd build && cmake .. && make && cd ..
|
||||
gmake
|
||||
|
||||
macos:
|
||||
name: macOS
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
brew install openssl redis
|
||||
|
||||
- name: Build hiredis
|
||||
run: USE_SSL=1 make
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
TEST_SSL: 1
|
||||
run: $GITHUB_WORKSPACE/test.sh
|
||||
|
||||
windows:
|
||||
name: Windows
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ env.GITHUB_REPOSITORY }}
|
||||
ref: ${{ env.GITHUB_HEAD_REF }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
choco install -y ninja memurai-developer
|
||||
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
- name: Build hiredis
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_EXAMPLES=ON
|
||||
ninja -v
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
./build/hiredis-test.exe
|
||||
|
||||
- name: Setup cygwin
|
||||
uses: egor-tensin/setup-cygwin@v3
|
||||
with:
|
||||
platform: x64
|
||||
packages: make git gcc-core
|
||||
|
||||
- name: Build in cygwin
|
||||
env:
|
||||
HIREDIS_PATH: ${{ github.workspace }}
|
||||
run: |
|
||||
build_hiredis() {
|
||||
cd $(cygpath -u $HIREDIS_PATH)
|
||||
git clean -xfd
|
||||
make
|
||||
}
|
||||
build_hiredis
|
||||
shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
|
||||
Vendored
+3
-9
@@ -17,11 +17,11 @@ branches:
|
||||
- /^release\/.*$/
|
||||
|
||||
install:
|
||||
- if [ "$BITS" == "64" ]; then
|
||||
- if [ "$TRAVIS_COMPILER" != "mingw" ]; then
|
||||
wget https://github.com/redis/redis/archive/6.0.6.tar.gz;
|
||||
tar -xzvf 6.0.6.tar.gz;
|
||||
pushd redis-6.0.6 && BUILD_TLS=yes make && export PATH=$PWD/src:$PATH && popd;
|
||||
fi
|
||||
fi;
|
||||
|
||||
before_script:
|
||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||
@@ -33,8 +33,6 @@ before_script:
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:chris-lea/redis-server'
|
||||
packages:
|
||||
- libc6-dbg
|
||||
- libc6-dev
|
||||
@@ -46,17 +44,13 @@ addons:
|
||||
- libssl-dev
|
||||
- libssl-dev:i386
|
||||
- valgrind
|
||||
- redis
|
||||
|
||||
env:
|
||||
- BITS="32"
|
||||
- BITS="64"
|
||||
|
||||
script:
|
||||
- EXTRA_CMAKE_OPTS="-DENABLE_EXAMPLES:BOOL=ON -DENABLE_SSL:BOOL=ON";
|
||||
if [ "$BITS" == "64" ]; then
|
||||
EXTRA_CMAKE_OPTS="$EXTRA_CMAKE_OPTS -DENABLE_SSL_TESTS:BOOL=ON";
|
||||
fi;
|
||||
- EXTRA_CMAKE_OPTS="-DENABLE_EXAMPLES:BOOL=ON -DENABLE_SSL:BOOL=ON -DENABLE_SSL_TESTS:BOOL=ON";
|
||||
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
|
||||
if [ "$BITS" == "32" ]; then
|
||||
CFLAGS="-m32 -Werror";
|
||||
|
||||
Vendored
+19
@@ -1,3 +1,22 @@
|
||||
## [1.0.2](https://github.com/redis/hiredis/tree/v1.0.2) - (2021-10-07)
|
||||
|
||||
Announcing Hiredis v1.0.2, which fixes CVE-2021-32765 but returns the SONAME to the correct value of `1.0.0`.
|
||||
|
||||
- [Revert SONAME bump](https://github.com/redis/hiredis/commit/d4e6f109a064690cde64765c654e679fea1d3548)
|
||||
([Michael Grunder](https://github.com/michael-grunder))
|
||||
|
||||
## [1.0.1](https://github.com/redis/hiredis/tree/v1.0.1) - (2021-10-04)
|
||||
|
||||
<span style="color:red">This release erroneously bumped the SONAME, please use [1.0.2](https://github.com/redis/hiredis/tree/v1.0.2)</span>
|
||||
|
||||
Announcing Hiredis v1.0.1, a security release fixing CVE-2021-32765
|
||||
|
||||
- Fix for [CVE-2021-32765](https://github.com/redis/hiredis/security/advisories/GHSA-hfm9-39pp-55p2)
|
||||
[commit](https://github.com/redis/hiredis/commit/76a7b10005c70babee357a7d0f2becf28ec7ed1e)
|
||||
([Yossi Gottlieb](https://github.com/yossigo))
|
||||
|
||||
_Thanks to [Yossi Gottlieb](https://github.com/yossigo) for the security fix and to [Microsoft Security Vulnerability Research](https://www.microsoft.com/en-us/msrc/msvr) for finding the bug._ :sparkling_heart:
|
||||
|
||||
## [1.0.0](https://github.com/redis/hiredis/tree/v1.0.0) - (2020-08-03)
|
||||
|
||||
Announcing Hiredis v1.0.0, which adds support for RESP3, SSL connections, allocator injection, and better Windows support! :tada:
|
||||
|
||||
Vendored
+95
-15
@@ -1,10 +1,9 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.4.0)
|
||||
INCLUDE(GNUInstallDirs)
|
||||
PROJECT(hiredis)
|
||||
|
||||
OPTION(ENABLE_SSL "Build hiredis_ssl for SSL support" OFF)
|
||||
OPTION(DISABLE_TESTS "If tests should be compiled or not" OFF)
|
||||
OPTION(ENABLE_SSL_TESTS, "Should we test SSL connections" OFF)
|
||||
OPTION(ENABLE_SSL_TESTS "Should we test SSL connections" OFF)
|
||||
OPTION(ENABLE_ASYNC_TESTS "Should we run all asynchronous API tests" OFF)
|
||||
|
||||
MACRO(getVersionBit name)
|
||||
SET(VERSION_REGEX "^#define ${name} (.+)$")
|
||||
@@ -20,7 +19,13 @@ getVersionBit(HIREDIS_SONAME)
|
||||
SET(VERSION "${HIREDIS_MAJOR}.${HIREDIS_MINOR}.${HIREDIS_PATCH}")
|
||||
MESSAGE("Detected version: ${VERSION}")
|
||||
|
||||
PROJECT(hiredis VERSION "${VERSION}")
|
||||
PROJECT(hiredis LANGUAGES "C" VERSION "${VERSION}")
|
||||
INCLUDE(GNUInstallDirs)
|
||||
|
||||
# Hiredis requires C99
|
||||
SET(CMAKE_C_STANDARD 99)
|
||||
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
SET(CMAKE_DEBUG_POSTFIX d)
|
||||
|
||||
SET(ENABLE_EXAMPLES OFF CACHE BOOL "Enable building hiredis examples")
|
||||
|
||||
@@ -41,30 +46,84 @@ IF(WIN32)
|
||||
ENDIF()
|
||||
|
||||
ADD_LIBRARY(hiredis SHARED ${hiredis_sources})
|
||||
ADD_LIBRARY(hiredis_static STATIC ${hiredis_sources})
|
||||
ADD_LIBRARY(hiredis::hiredis ALIAS hiredis)
|
||||
ADD_LIBRARY(hiredis::hiredis_static ALIAS hiredis_static)
|
||||
|
||||
SET_TARGET_PROPERTIES(hiredis
|
||||
PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE
|
||||
VERSION "${HIREDIS_SONAME}")
|
||||
SET_TARGET_PROPERTIES(hiredis_static
|
||||
PROPERTIES COMPILE_PDB_NAME hiredis_static)
|
||||
SET_TARGET_PROPERTIES(hiredis_static
|
||||
PROPERTIES COMPILE_PDB_NAME_DEBUG hiredis_static${CMAKE_DEBUG_POSTFIX})
|
||||
IF(WIN32 OR MINGW)
|
||||
TARGET_LINK_LIBRARIES(hiredis PRIVATE ws2_32)
|
||||
TARGET_LINK_LIBRARIES(hiredis PUBLIC ws2_32 crypt32)
|
||||
TARGET_LINK_LIBRARIES(hiredis_static PUBLIC ws2_32 crypt32)
|
||||
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
TARGET_LINK_LIBRARIES(hiredis PUBLIC m)
|
||||
TARGET_LINK_LIBRARIES(hiredis_static PUBLIC m)
|
||||
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
||||
TARGET_LINK_LIBRARIES(hiredis PUBLIC socket)
|
||||
TARGET_LINK_LIBRARIES(hiredis_static PUBLIC socket)
|
||||
ENDIF()
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(hiredis PUBLIC $<INSTALL_INTERFACE:.> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||
TARGET_INCLUDE_DIRECTORIES(hiredis PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||
TARGET_INCLUDE_DIRECTORIES(hiredis_static PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||
|
||||
CONFIGURE_FILE(hiredis.pc.in hiredis.pc @ONLY)
|
||||
|
||||
INSTALL(TARGETS hiredis
|
||||
set(CPACK_PACKAGE_VENDOR "Redis")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "\
|
||||
Hiredis is a minimalistic C client library for the Redis database.
|
||||
|
||||
It is minimalistic because it just adds minimal support for the protocol, \
|
||||
but at the same time it uses a high level printf-alike API in order to make \
|
||||
it much higher level than otherwise suggested by its minimal code base and the \
|
||||
lack of explicit bindings for every Redis command.
|
||||
|
||||
Apart from supporting sending commands and receiving replies, it comes with a \
|
||||
reply parser that is decoupled from the I/O layer. It is a stream parser designed \
|
||||
for easy reusability, which can for instance be used in higher level language bindings \
|
||||
for efficient reply parsing.
|
||||
|
||||
Hiredis only supports the binary-safe Redis protocol, so you can use it with any Redis \
|
||||
version >= 1.2.0.
|
||||
|
||||
The library comes with multiple APIs. There is the synchronous API, the asynchronous API \
|
||||
and the reply parsing API.")
|
||||
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/redis/hiredis")
|
||||
set(CPACK_PACKAGE_CONTACT "michael dot grunder at gmail dot com")
|
||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||
set(CPACK_RPM_PACKAGE_AUTOREQPROV ON)
|
||||
|
||||
include(CPack)
|
||||
|
||||
INSTALL(TARGETS hiredis hiredis_static
|
||||
EXPORT hiredis-targets
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
if (MSVC)
|
||||
INSTALL(FILES $<TARGET_PDB_FILE:hiredis>
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
CONFIGURATIONS Debug RelWithDebInfo)
|
||||
INSTALL(FILES $<TARGET_FILE_DIR:hiredis_static>/$<TARGET_FILE_BASE_NAME:hiredis_static>.pdb
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
CONFIGURATIONS Debug RelWithDebInfo)
|
||||
endif()
|
||||
|
||||
# For NuGet packages
|
||||
INSTALL(FILES hiredis.targets
|
||||
DESTINATION build/native)
|
||||
|
||||
INSTALL(FILES hiredis.h read.h sds.h async.h alloc.h
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hiredis)
|
||||
|
||||
|
||||
INSTALL(DIRECTORY adapters
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hiredis)
|
||||
|
||||
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/hiredis.pc
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
|
||||
@@ -95,10 +154,12 @@ IF(ENABLE_SSL)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
FIND_PACKAGE(OpenSSL REQUIRED)
|
||||
SET(hiredis_ssl_sources
|
||||
SET(hiredis_ssl_sources
|
||||
ssl.c)
|
||||
ADD_LIBRARY(hiredis_ssl SHARED
|
||||
${hiredis_ssl_sources})
|
||||
ADD_LIBRARY(hiredis_ssl_static STATIC
|
||||
${hiredis_ssl_sources})
|
||||
|
||||
IF (APPLE)
|
||||
SET_PROPERTY(TARGET hiredis_ssl PROPERTY LINK_FLAGS "-Wl,-undefined -Wl,dynamic_lookup")
|
||||
@@ -108,23 +169,39 @@ IF(ENABLE_SSL)
|
||||
PROPERTIES
|
||||
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
|
||||
VERSION "${HIREDIS_SONAME}")
|
||||
SET_TARGET_PROPERTIES(hiredis_ssl_static
|
||||
PROPERTIES COMPILE_PDB_NAME hiredis_ssl_static)
|
||||
SET_TARGET_PROPERTIES(hiredis_ssl_static
|
||||
PROPERTIES COMPILE_PDB_NAME_DEBUG hiredis_ssl_static${CMAKE_DEBUG_POSTFIX})
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(hiredis_ssl PRIVATE "${OPENSSL_INCLUDE_DIR}")
|
||||
TARGET_INCLUDE_DIRECTORIES(hiredis_ssl_static PRIVATE "${OPENSSL_INCLUDE_DIR}")
|
||||
|
||||
TARGET_LINK_LIBRARIES(hiredis_ssl PRIVATE ${OPENSSL_LIBRARIES})
|
||||
IF (WIN32 OR MINGW)
|
||||
TARGET_LINK_LIBRARIES(hiredis_ssl PRIVATE hiredis)
|
||||
TARGET_LINK_LIBRARIES(hiredis_ssl_static PUBLIC hiredis_static)
|
||||
ENDIF()
|
||||
CONFIGURE_FILE(hiredis_ssl.pc.in hiredis_ssl.pc @ONLY)
|
||||
|
||||
INSTALL(TARGETS hiredis_ssl
|
||||
INSTALL(TARGETS hiredis_ssl hiredis_ssl_static
|
||||
EXPORT hiredis_ssl-targets
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
if (MSVC)
|
||||
INSTALL(FILES $<TARGET_PDB_FILE:hiredis_ssl>
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
CONFIGURATIONS Debug RelWithDebInfo)
|
||||
INSTALL(FILES $<TARGET_FILE_DIR:hiredis_ssl_static>/$<TARGET_FILE_BASE_NAME:hiredis_ssl_static>.pdb
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
CONFIGURATIONS Debug RelWithDebInfo)
|
||||
endif()
|
||||
|
||||
INSTALL(FILES hiredis_ssl.h
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hiredis)
|
||||
|
||||
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/hiredis_ssl.pc
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
|
||||
@@ -149,11 +226,14 @@ ENDIF()
|
||||
IF(NOT DISABLE_TESTS)
|
||||
ENABLE_TESTING()
|
||||
ADD_EXECUTABLE(hiredis-test test.c)
|
||||
TARGET_LINK_LIBRARIES(hiredis-test hiredis)
|
||||
IF(ENABLE_SSL_TESTS)
|
||||
ADD_DEFINITIONS(-DHIREDIS_TEST_SSL=1)
|
||||
TARGET_LINK_LIBRARIES(hiredis-test hiredis hiredis_ssl)
|
||||
ELSE()
|
||||
TARGET_LINK_LIBRARIES(hiredis-test hiredis)
|
||||
TARGET_LINK_LIBRARIES(hiredis-test hiredis_ssl)
|
||||
ENDIF()
|
||||
IF(ENABLE_ASYNC_TESTS)
|
||||
ADD_DEFINITIONS(-DHIREDIS_TEST_ASYNC=1)
|
||||
TARGET_LINK_LIBRARIES(hiredis-test event)
|
||||
ENDIF()
|
||||
ADD_TEST(NAME hiredis-test
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test.sh)
|
||||
|
||||
Vendored
+71
-41
@@ -4,16 +4,10 @@
|
||||
# This file is released under the BSD license, see the COPYING file
|
||||
|
||||
OBJ=alloc.o net.o hiredis.o sds.o async.o read.o sockcompat.o
|
||||
SSL_OBJ=ssl.o
|
||||
EXAMPLES=hiredis-example hiredis-example-libevent hiredis-example-libev hiredis-example-glib hiredis-example-push
|
||||
ifeq ($(USE_SSL),1)
|
||||
EXAMPLES+=hiredis-example-ssl hiredis-example-libevent-ssl
|
||||
endif
|
||||
TESTS=hiredis-test
|
||||
LIBNAME=libhiredis
|
||||
PKGCONFNAME=hiredis.pc
|
||||
SSL_LIBNAME=libhiredis_ssl
|
||||
SSL_PKGCONFNAME=hiredis_ssl.pc
|
||||
|
||||
HIREDIS_MAJOR=$(shell grep HIREDIS_MAJOR hiredis.h | awk '{print $$3}')
|
||||
HIREDIS_MINOR=$(shell grep HIREDIS_MINOR hiredis.h | awk '{print $$3}')
|
||||
@@ -60,28 +54,66 @@ DYLIB_MAKE_CMD=$(CC) -shared -Wl,-soname,$(DYLIB_MINOR_NAME)
|
||||
STLIBNAME=$(LIBNAME).$(STLIBSUFFIX)
|
||||
STLIB_MAKE_CMD=$(AR) rcs
|
||||
|
||||
#################### SSL variables start ####################
|
||||
SSL_OBJ=ssl.o
|
||||
SSL_LIBNAME=libhiredis_ssl
|
||||
SSL_PKGCONFNAME=hiredis_ssl.pc
|
||||
SSL_INSTALLNAME=install-ssl
|
||||
SSL_DYLIB_MINOR_NAME=$(SSL_LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_SONAME)
|
||||
SSL_DYLIB_MAJOR_NAME=$(SSL_LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_MAJOR)
|
||||
SSL_DYLIBNAME=$(SSL_LIBNAME).$(DYLIBSUFFIX)
|
||||
SSL_STLIBNAME=$(SSL_LIBNAME).$(STLIBSUFFIX)
|
||||
SSL_DYLIB_MAKE_CMD=$(CC) -shared -Wl,-soname,$(SSL_DYLIB_MINOR_NAME)
|
||||
|
||||
USE_SSL?=0
|
||||
ifeq ($(USE_SSL),1)
|
||||
# This is required for test.c only
|
||||
CFLAGS+=-DHIREDIS_TEST_SSL
|
||||
EXAMPLES+=hiredis-example-ssl hiredis-example-libevent-ssl
|
||||
SSL_STLIB=$(SSL_STLIBNAME)
|
||||
SSL_DYLIB=$(SSL_DYLIBNAME)
|
||||
SSL_PKGCONF=$(SSL_PKGCONFNAME)
|
||||
SSL_INSTALL=$(SSL_INSTALLNAME)
|
||||
else
|
||||
SSL_STLIB=
|
||||
SSL_DYLIB=
|
||||
SSL_PKGCONF=
|
||||
SSL_INSTALL=
|
||||
endif
|
||||
##################### SSL variables end #####################
|
||||
|
||||
|
||||
# Platform-specific overrides
|
||||
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
||||
|
||||
USE_SSL?=0
|
||||
|
||||
# This is required for test.c only
|
||||
ifeq ($(USE_SSL),1)
|
||||
CFLAGS+=-DHIREDIS_TEST_SSL
|
||||
ifeq ($(TEST_ASYNC),1)
|
||||
export CFLAGS+=-DHIREDIS_TEST_ASYNC
|
||||
endif
|
||||
|
||||
ifeq ($(uname_S),Linux)
|
||||
SSL_LDFLAGS=-lssl -lcrypto
|
||||
ifeq ($(USE_SSL),1)
|
||||
ifeq ($(uname_S),Linux)
|
||||
ifdef OPENSSL_PREFIX
|
||||
CFLAGS+=-I$(OPENSSL_PREFIX)/include
|
||||
SSL_LDFLAGS+=-L$(OPENSSL_PREFIX)/lib -lssl -lcrypto
|
||||
else
|
||||
SSL_LDFLAGS=-lssl -lcrypto
|
||||
endif
|
||||
else
|
||||
OPENSSL_PREFIX?=/usr/local/opt/openssl
|
||||
CFLAGS+=-I$(OPENSSL_PREFIX)/include
|
||||
SSL_LDFLAGS+=-L$(OPENSSL_PREFIX)/lib -lssl -lcrypto
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(uname_S),FreeBSD)
|
||||
LDFLAGS+=-lm
|
||||
IS_GCC=$(shell sh -c '$(CC) --version 2>/dev/null |egrep -i -c "gcc"')
|
||||
ifeq ($(IS_GCC),1)
|
||||
REAL_CFLAGS+=-pedantic
|
||||
endif
|
||||
else
|
||||
OPENSSL_PREFIX?=/usr/local/opt/openssl
|
||||
CFLAGS+=-I$(OPENSSL_PREFIX)/include
|
||||
SSL_LDFLAGS+=-L$(OPENSSL_PREFIX)/lib -lssl -lcrypto
|
||||
REAL_CFLAGS+=-pedantic
|
||||
endif
|
||||
|
||||
ifeq ($(uname_S),SunOS)
|
||||
@@ -103,10 +135,13 @@ ifeq ($(uname_S),Darwin)
|
||||
DYLIB_PLUGIN=-Wl,-undefined -Wl,dynamic_lookup
|
||||
endif
|
||||
|
||||
all: $(DYLIBNAME) $(STLIBNAME) hiredis-test $(PKGCONFNAME)
|
||||
ifeq ($(USE_SSL),1)
|
||||
all: $(SSL_DYLIBNAME) $(SSL_STLIBNAME) $(SSL_PKGCONFNAME)
|
||||
endif
|
||||
all: dynamic static hiredis-test pkgconfig
|
||||
|
||||
dynamic: $(DYLIBNAME) $(SSL_DYLIB)
|
||||
|
||||
static: $(STLIBNAME) $(SSL_STLIB)
|
||||
|
||||
pkgconfig: $(PKGCONFNAME) $(SSL_PKGCONF)
|
||||
|
||||
# Deps (use make dep to generate this)
|
||||
alloc.o: alloc.c fmacros.h alloc.h
|
||||
@@ -117,7 +152,6 @@ net.o: net.c fmacros.h net.h hiredis.h read.h sds.h alloc.h sockcompat.h win32.h
|
||||
read.o: read.c fmacros.h alloc.h read.h sds.h win32.h
|
||||
sds.o: sds.c sds.h sdsalloc.h alloc.h
|
||||
sockcompat.o: sockcompat.c sockcompat.h
|
||||
ssl.o: ssl.c hiredis.h read.h sds.h alloc.h async.h win32.h async_private.h
|
||||
test.o: test.c fmacros.h hiredis.h read.h sds.h alloc.h net.h sockcompat.h win32.h
|
||||
|
||||
$(DYLIBNAME): $(OBJ)
|
||||
@@ -126,18 +160,15 @@ $(DYLIBNAME): $(OBJ)
|
||||
$(STLIBNAME): $(OBJ)
|
||||
$(STLIB_MAKE_CMD) $(STLIBNAME) $(OBJ)
|
||||
|
||||
#################### SSL building rules start ####################
|
||||
$(SSL_DYLIBNAME): $(SSL_OBJ)
|
||||
$(SSL_DYLIB_MAKE_CMD) $(DYLIB_PLUGIN) -o $(SSL_DYLIBNAME) $(SSL_OBJ) $(REAL_LDFLAGS) $(LDFLAGS) $(SSL_LDFLAGS)
|
||||
|
||||
$(SSL_STLIBNAME): $(SSL_OBJ)
|
||||
$(STLIB_MAKE_CMD) $(SSL_STLIBNAME) $(SSL_OBJ)
|
||||
|
||||
dynamic: $(DYLIBNAME)
|
||||
static: $(STLIBNAME)
|
||||
ifeq ($(USE_SSL),1)
|
||||
dynamic: $(SSL_DYLIBNAME)
|
||||
static: $(SSL_STLIBNAME)
|
||||
endif
|
||||
$(SSL_OBJ): ssl.c hiredis.h read.h sds.h alloc.h async.h win32.h async_private.h
|
||||
#################### SSL building rules end ####################
|
||||
|
||||
# Binaries:
|
||||
hiredis-example-libevent: examples/example-libevent.c adapters/libevent.h $(STLIBNAME)
|
||||
@@ -161,7 +192,6 @@ hiredis-example-macosx: examples/example-macosx.c adapters/macosx.h $(STLIBNAME)
|
||||
hiredis-example-ssl: examples/example-ssl.c $(STLIBNAME) $(SSL_STLIBNAME)
|
||||
$(CC) -o examples/$@ $(REAL_CFLAGS) -I. $< $(STLIBNAME) $(SSL_STLIBNAME) $(REAL_LDFLAGS) $(SSL_LDFLAGS)
|
||||
|
||||
|
||||
ifndef AE_DIR
|
||||
hiredis-example-ae:
|
||||
@echo "Please specify AE_DIR (e.g. <redis repository>/src)"
|
||||
@@ -172,10 +202,11 @@ hiredis-example-ae: examples/example-ae.c adapters/ae.h $(STLIBNAME)
|
||||
endif
|
||||
|
||||
ifndef LIBUV_DIR
|
||||
hiredis-example-libuv:
|
||||
@echo "Please specify LIBUV_DIR (e.g. ../libuv/)"
|
||||
@false
|
||||
# dynamic link libuv.so
|
||||
hiredis-example-libuv: examples/example-libuv.c adapters/libuv.h $(STLIBNAME)
|
||||
$(CC) -o examples/$@ $(REAL_CFLAGS) -I. -I$(LIBUV_DIR)/include $< -luv -lpthread -lrt $(STLIBNAME) $(REAL_LDFLAGS)
|
||||
else
|
||||
# use user provided static lib
|
||||
hiredis-example-libuv: examples/example-libuv.c adapters/libuv.h $(STLIBNAME)
|
||||
$(CC) -o examples/$@ $(REAL_CFLAGS) -I. -I$(LIBUV_DIR)/include $< $(LIBUV_DIR)/.libs/libuv.a -lpthread -lrt $(STLIBNAME) $(REAL_LDFLAGS)
|
||||
endif
|
||||
@@ -201,10 +232,13 @@ hiredis-example-push: examples/example-push.c $(STLIBNAME)
|
||||
|
||||
examples: $(EXAMPLES)
|
||||
|
||||
TEST_LIBS = $(STLIBNAME)
|
||||
TEST_LIBS = $(STLIBNAME) $(SSL_STLIB)
|
||||
TEST_LDFLAGS = $(SSL_LDFLAGS)
|
||||
ifeq ($(USE_SSL),1)
|
||||
TEST_LIBS += $(SSL_STLIBNAME)
|
||||
TEST_LDFLAGS = $(SSL_LDFLAGS) -lssl -lcrypto -lpthread
|
||||
TEST_LDFLAGS += -pthread
|
||||
endif
|
||||
ifeq ($(TEST_ASYNC),1)
|
||||
TEST_LDFLAGS += -levent
|
||||
endif
|
||||
|
||||
hiredis-test: test.o $(TEST_LIBS)
|
||||
@@ -220,7 +254,7 @@ check: hiredis-test
|
||||
TEST_SSL=$(USE_SSL) ./test.sh
|
||||
|
||||
.c.o:
|
||||
$(CC) -std=c99 -pedantic -c $(REAL_CFLAGS) $<
|
||||
$(CC) -std=c99 -c $(REAL_CFLAGS) $<
|
||||
|
||||
clean:
|
||||
rm -rf $(DYLIBNAME) $(STLIBNAME) $(SSL_DYLIBNAME) $(SSL_STLIBNAME) $(TESTS) $(PKGCONFNAME) examples/hiredis-example* *.o *.gcda *.gcno *.gcov
|
||||
@@ -257,7 +291,7 @@ $(SSL_PKGCONFNAME): hiredis_ssl.h
|
||||
@echo Libs: -L\$${libdir} -lhiredis_ssl >> $@
|
||||
@echo Libs.private: -lssl -lcrypto >> $@
|
||||
|
||||
install: $(DYLIBNAME) $(STLIBNAME) $(PKGCONFNAME)
|
||||
install: $(DYLIBNAME) $(STLIBNAME) $(PKGCONFNAME) $(SSL_INSTALL)
|
||||
mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_INCLUDE_PATH)/adapters $(INSTALL_LIBRARY_PATH)
|
||||
$(INSTALL) hiredis.h async.h read.h sds.h alloc.h $(INSTALL_INCLUDE_PATH)
|
||||
$(INSTALL) adapters/*.h $(INSTALL_INCLUDE_PATH)/adapters
|
||||
@@ -267,9 +301,6 @@ install: $(DYLIBNAME) $(STLIBNAME) $(PKGCONFNAME)
|
||||
mkdir -p $(INSTALL_PKGCONF_PATH)
|
||||
$(INSTALL) $(PKGCONFNAME) $(INSTALL_PKGCONF_PATH)
|
||||
|
||||
ifeq ($(USE_SSL),1)
|
||||
install: install-ssl
|
||||
|
||||
install-ssl: $(SSL_DYLIBNAME) $(SSL_STLIBNAME) $(SSL_PKGCONFNAME)
|
||||
mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_LIBRARY_PATH)
|
||||
$(INSTALL) hiredis_ssl.h $(INSTALL_INCLUDE_PATH)
|
||||
@@ -278,7 +309,6 @@ install-ssl: $(SSL_DYLIBNAME) $(SSL_STLIBNAME) $(SSL_PKGCONFNAME)
|
||||
$(INSTALL) $(SSL_STLIBNAME) $(INSTALL_LIBRARY_PATH)
|
||||
mkdir -p $(INSTALL_PKGCONF_PATH)
|
||||
$(INSTALL) $(SSL_PKGCONFNAME) $(INSTALL_PKGCONF_PATH)
|
||||
endif
|
||||
|
||||
32bit:
|
||||
@echo ""
|
||||
@@ -294,12 +324,12 @@ gprof:
|
||||
$(MAKE) CFLAGS="-pg" LDFLAGS="-pg"
|
||||
|
||||
gcov:
|
||||
$(MAKE) CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS="-fprofile-arcs"
|
||||
$(MAKE) CFLAGS+="-fprofile-arcs -ftest-coverage" LDFLAGS="-fprofile-arcs"
|
||||
|
||||
coverage: gcov
|
||||
make check
|
||||
mkdir -p tmp/lcov
|
||||
lcov -d . -c -o tmp/lcov/hiredis.info
|
||||
lcov -d . -c --exclude '/usr*' -o tmp/lcov/hiredis.info
|
||||
genhtml --legend -o tmp/lcov/report tmp/lcov/hiredis.info
|
||||
|
||||
noopt:
|
||||
|
||||
Vendored
+27
-14
@@ -1,10 +1,11 @@
|
||||
[](https://travis-ci.org/redis/hiredis)
|
||||
|
||||
[](https://github.com/redis/hiredis/actions/workflows/build.yml)
|
||||
|
||||
**This Readme reflects the latest changed in the master branch. See [v1.0.0](https://github.com/redis/hiredis/tree/v1.0.0) for the Readme and documentation for the latest release ([API/ABI history](https://abi-laboratory.pro/?view=timeline&l=hiredis)).**
|
||||
|
||||
# HIREDIS
|
||||
|
||||
Hiredis is a minimalistic C client library for the [Redis](http://redis.io/) database.
|
||||
Hiredis is a minimalistic C client library for the [Redis](https://redis.io/) database.
|
||||
|
||||
It is minimalistic because it just adds minimal support for the protocol, but
|
||||
at the same time it uses a high level printf-alike API in order to make it
|
||||
@@ -22,6 +23,12 @@ Redis version >= 1.2.0.
|
||||
The library comes with multiple APIs. There is the
|
||||
*synchronous API*, the *asynchronous API* and the *reply parsing API*.
|
||||
|
||||
## Upgrading to `1.0.2`
|
||||
|
||||
<span style="color:red">NOTE: v1.0.1 erroneously bumped SONAME, which is why it is skipped here.</span>
|
||||
|
||||
Version 1.0.2 is simply 1.0.0 with a fix for [CVE-2021-32765](https://github.com/redis/hiredis/security/advisories/GHSA-hfm9-39pp-55p2). They are otherwise identical.
|
||||
|
||||
## Upgrading to `1.0.0`
|
||||
|
||||
Version 1.0.0 marks the first stable release of Hiredis.
|
||||
@@ -169,7 +176,7 @@ Hiredis also supports every new `RESP3` data type which are as follows. For mor
|
||||
|
||||
* **`REDIS_REPLY_MAP`**:
|
||||
* An array with the added invariant that there will always be an even number of elements.
|
||||
The MAP is functionally equivelant to `REDIS_REPLY_ARRAY` except for the previously mentioned invariant.
|
||||
The MAP is functionally equivalent to `REDIS_REPLY_ARRAY` except for the previously mentioned invariant.
|
||||
|
||||
* **`REDIS_REPLY_SET`**:
|
||||
* An array response where each entry is unique.
|
||||
@@ -189,7 +196,7 @@ Hiredis also supports every new `RESP3` data type which are as follows. For mor
|
||||
|
||||
* **`REDIS_REPLY_VERB`**:
|
||||
* A verbatim string, intended to be presented to the user without modification.
|
||||
The string payload is stored in the `str` memeber, and type data is stored in the `vtype` member (e.g. `txt` for raw text or `md` for markdown).
|
||||
The string payload is stored in the `str` member, and type data is stored in the `vtype` member (e.g. `txt` for raw text or `md` for markdown).
|
||||
|
||||
Replies should be freed using the `freeReplyObject()` function.
|
||||
Note that this function will take care of freeing sub-reply objects
|
||||
@@ -261,9 +268,9 @@ a single call to `read(2)`):
|
||||
redisReply *reply;
|
||||
redisAppendCommand(context,"SET foo bar");
|
||||
redisAppendCommand(context,"GET foo");
|
||||
redisGetReply(context,(void *)&reply); // reply for SET
|
||||
redisGetReply(context,(void**)&reply); // reply for SET
|
||||
freeReplyObject(reply);
|
||||
redisGetReply(context,(void *)&reply); // reply for GET
|
||||
redisGetReply(context,(void**)&reply); // reply for GET
|
||||
freeReplyObject(reply);
|
||||
```
|
||||
This API can also be used to implement a blocking subscriber:
|
||||
@@ -517,7 +524,7 @@ initialize OpenSSL and create a context. You can do that in two ways:
|
||||
/* An Hiredis SSL context. It holds SSL configuration and can be reused across
|
||||
* many contexts.
|
||||
*/
|
||||
redisSSLContext *ssl;
|
||||
redisSSLContext *ssl_context;
|
||||
|
||||
/* An error variable to indicate what went wrong, if the context fails to
|
||||
* initialize.
|
||||
@@ -532,17 +539,23 @@ redisSSLContextError ssl_error;
|
||||
redisInitOpenSSL();
|
||||
|
||||
/* Create SSL context */
|
||||
ssl = redisCreateSSLContext(
|
||||
ssl_context = redisCreateSSLContext(
|
||||
"cacertbundle.crt", /* File name of trusted CA/ca bundle file, optional */
|
||||
"/path/to/certs", /* Path of trusted certificates, optional */
|
||||
"client_cert.pem", /* File name of client certificate file, optional */
|
||||
"client_key.pem", /* File name of client private key, optional */
|
||||
"redis.mydomain.com", /* Server name to request (SNI), optional */
|
||||
&ssl_error
|
||||
) != REDIS_OK) {
|
||||
printf("SSL error: %s\n", redisSSLContextGetError(ssl_error);
|
||||
/* Abort... */
|
||||
}
|
||||
&ssl_error);
|
||||
|
||||
if(ssl_context == NULL || ssl_error != 0) {
|
||||
/* Handle error and abort... */
|
||||
/* e.g.
|
||||
printf("SSL error: %s\n",
|
||||
(ssl_error != 0) ?
|
||||
redisSSLContextGetError(ssl_error) : "Unknown error");
|
||||
// Abort
|
||||
*/
|
||||
}
|
||||
|
||||
/* Create Redis context and establish connection */
|
||||
c = redisConnect("localhost", 6443);
|
||||
@@ -551,7 +564,7 @@ if (c == NULL || c->err) {
|
||||
}
|
||||
|
||||
/* Negotiate SSL/TLS */
|
||||
if (redisInitiateSSLWithContext(c, ssl) != REDIS_OK) {
|
||||
if (redisInitiateSSLWithContext(c, ssl_context) != REDIS_OK) {
|
||||
/* Handle error, in c->err / c->errstr */
|
||||
}
|
||||
```
|
||||
|
||||
Vendored
+18
-9
@@ -46,7 +46,7 @@ typedef struct redisLibevEvents {
|
||||
|
||||
static void redisLibevReadEvent(EV_P_ ev_io *watcher, int revents) {
|
||||
#if EV_MULTIPLICITY
|
||||
((void)loop);
|
||||
((void)EV_A);
|
||||
#endif
|
||||
((void)revents);
|
||||
|
||||
@@ -56,7 +56,7 @@ static void redisLibevReadEvent(EV_P_ ev_io *watcher, int revents) {
|
||||
|
||||
static void redisLibevWriteEvent(EV_P_ ev_io *watcher, int revents) {
|
||||
#if EV_MULTIPLICITY
|
||||
((void)loop);
|
||||
((void)EV_A);
|
||||
#endif
|
||||
((void)revents);
|
||||
|
||||
@@ -66,8 +66,9 @@ static void redisLibevWriteEvent(EV_P_ ev_io *watcher, int revents) {
|
||||
|
||||
static void redisLibevAddRead(void *privdata) {
|
||||
redisLibevEvents *e = (redisLibevEvents*)privdata;
|
||||
#if EV_MULTIPLICITY
|
||||
struct ev_loop *loop = e->loop;
|
||||
((void)loop);
|
||||
#endif
|
||||
if (!e->reading) {
|
||||
e->reading = 1;
|
||||
ev_io_start(EV_A_ &e->rev);
|
||||
@@ -76,8 +77,9 @@ static void redisLibevAddRead(void *privdata) {
|
||||
|
||||
static void redisLibevDelRead(void *privdata) {
|
||||
redisLibevEvents *e = (redisLibevEvents*)privdata;
|
||||
#if EV_MULTIPLICITY
|
||||
struct ev_loop *loop = e->loop;
|
||||
((void)loop);
|
||||
#endif
|
||||
if (e->reading) {
|
||||
e->reading = 0;
|
||||
ev_io_stop(EV_A_ &e->rev);
|
||||
@@ -86,8 +88,9 @@ static void redisLibevDelRead(void *privdata) {
|
||||
|
||||
static void redisLibevAddWrite(void *privdata) {
|
||||
redisLibevEvents *e = (redisLibevEvents*)privdata;
|
||||
#if EV_MULTIPLICITY
|
||||
struct ev_loop *loop = e->loop;
|
||||
((void)loop);
|
||||
#endif
|
||||
if (!e->writing) {
|
||||
e->writing = 1;
|
||||
ev_io_start(EV_A_ &e->wev);
|
||||
@@ -96,8 +99,9 @@ static void redisLibevAddWrite(void *privdata) {
|
||||
|
||||
static void redisLibevDelWrite(void *privdata) {
|
||||
redisLibevEvents *e = (redisLibevEvents*)privdata;
|
||||
#if EV_MULTIPLICITY
|
||||
struct ev_loop *loop = e->loop;
|
||||
((void)loop);
|
||||
#endif
|
||||
if (e->writing) {
|
||||
e->writing = 0;
|
||||
ev_io_stop(EV_A_ &e->wev);
|
||||
@@ -106,8 +110,9 @@ static void redisLibevDelWrite(void *privdata) {
|
||||
|
||||
static void redisLibevStopTimer(void *privdata) {
|
||||
redisLibevEvents *e = (redisLibevEvents*)privdata;
|
||||
#if EV_MULTIPLICITY
|
||||
struct ev_loop *loop = e->loop;
|
||||
((void)loop);
|
||||
#endif
|
||||
ev_timer_stop(EV_A_ &e->timer);
|
||||
}
|
||||
|
||||
@@ -120,6 +125,9 @@ static void redisLibevCleanup(void *privdata) {
|
||||
}
|
||||
|
||||
static void redisLibevTimeout(EV_P_ ev_timer *timer, int revents) {
|
||||
#if EV_MULTIPLICITY
|
||||
((void)EV_A);
|
||||
#endif
|
||||
((void)revents);
|
||||
redisLibevEvents *e = (redisLibevEvents*)timer->data;
|
||||
redisAsyncHandleTimeout(e->context);
|
||||
@@ -127,8 +135,9 @@ static void redisLibevTimeout(EV_P_ ev_timer *timer, int revents) {
|
||||
|
||||
static void redisLibevSetTimeout(void *privdata, struct timeval tv) {
|
||||
redisLibevEvents *e = (redisLibevEvents*)privdata;
|
||||
#if EV_MULTIPLICITY
|
||||
struct ev_loop *loop = e->loop;
|
||||
((void)loop);
|
||||
#endif
|
||||
|
||||
if (!ev_is_active(&e->timer)) {
|
||||
ev_init(&e->timer, redisLibevTimeout);
|
||||
@@ -154,7 +163,7 @@ static int redisLibevAttach(EV_P_ redisAsyncContext *ac) {
|
||||
|
||||
e->context = ac;
|
||||
#if EV_MULTIPLICITY
|
||||
e->loop = loop;
|
||||
e->loop = EV_A;
|
||||
#else
|
||||
e->loop = NULL;
|
||||
#endif
|
||||
|
||||
Vendored
+1
-1
@@ -50,7 +50,7 @@ static void redisLibeventDestroy(redisLibeventEvents *e) {
|
||||
hi_free(e);
|
||||
}
|
||||
|
||||
static void redisLibeventHandler(int fd, short event, void *arg) {
|
||||
static void redisLibeventHandler(evutil_socket_t fd, short event, void *arg) {
|
||||
((void)fd);
|
||||
redisLibeventEvents *e = (redisLibeventEvents*)arg;
|
||||
e->state |= REDIS_LIBEVENT_ENTERED;
|
||||
|
||||
Vendored
+105
-59
@@ -7,111 +7,157 @@
|
||||
#include <string.h>
|
||||
|
||||
typedef struct redisLibuvEvents {
|
||||
redisAsyncContext* context;
|
||||
uv_poll_t handle;
|
||||
int events;
|
||||
redisAsyncContext* context;
|
||||
uv_poll_t handle;
|
||||
uv_timer_t timer;
|
||||
int events;
|
||||
} redisLibuvEvents;
|
||||
|
||||
|
||||
static void redisLibuvPoll(uv_poll_t* handle, int status, int events) {
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)handle->data;
|
||||
int ev = (status ? p->events : events);
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)handle->data;
|
||||
int ev = (status ? p->events : events);
|
||||
|
||||
if (p->context != NULL && (ev & UV_READABLE)) {
|
||||
redisAsyncHandleRead(p->context);
|
||||
}
|
||||
if (p->context != NULL && (ev & UV_WRITABLE)) {
|
||||
redisAsyncHandleWrite(p->context);
|
||||
}
|
||||
if (p->context != NULL && (ev & UV_READABLE)) {
|
||||
redisAsyncHandleRead(p->context);
|
||||
}
|
||||
if (p->context != NULL && (ev & UV_WRITABLE)) {
|
||||
redisAsyncHandleWrite(p->context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void redisLibuvAddRead(void *privdata) {
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)privdata;
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)privdata;
|
||||
|
||||
p->events |= UV_READABLE;
|
||||
p->events |= UV_READABLE;
|
||||
|
||||
uv_poll_start(&p->handle, p->events, redisLibuvPoll);
|
||||
uv_poll_start(&p->handle, p->events, redisLibuvPoll);
|
||||
}
|
||||
|
||||
|
||||
static void redisLibuvDelRead(void *privdata) {
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)privdata;
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)privdata;
|
||||
|
||||
p->events &= ~UV_READABLE;
|
||||
p->events &= ~UV_READABLE;
|
||||
|
||||
if (p->events) {
|
||||
uv_poll_start(&p->handle, p->events, redisLibuvPoll);
|
||||
} else {
|
||||
uv_poll_stop(&p->handle);
|
||||
}
|
||||
if (p->events) {
|
||||
uv_poll_start(&p->handle, p->events, redisLibuvPoll);
|
||||
} else {
|
||||
uv_poll_stop(&p->handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void redisLibuvAddWrite(void *privdata) {
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)privdata;
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)privdata;
|
||||
|
||||
p->events |= UV_WRITABLE;
|
||||
p->events |= UV_WRITABLE;
|
||||
|
||||
uv_poll_start(&p->handle, p->events, redisLibuvPoll);
|
||||
uv_poll_start(&p->handle, p->events, redisLibuvPoll);
|
||||
}
|
||||
|
||||
|
||||
static void redisLibuvDelWrite(void *privdata) {
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)privdata;
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)privdata;
|
||||
|
||||
p->events &= ~UV_WRITABLE;
|
||||
p->events &= ~UV_WRITABLE;
|
||||
|
||||
if (p->events) {
|
||||
uv_poll_start(&p->handle, p->events, redisLibuvPoll);
|
||||
} else {
|
||||
uv_poll_stop(&p->handle);
|
||||
}
|
||||
if (p->events) {
|
||||
uv_poll_start(&p->handle, p->events, redisLibuvPoll);
|
||||
} else {
|
||||
uv_poll_stop(&p->handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void on_close(uv_handle_t* handle) {
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)handle->data;
|
||||
|
||||
hi_free(p);
|
||||
static void on_timer_close(uv_handle_t *handle) {
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)handle->data;
|
||||
p->timer.data = NULL;
|
||||
if (!p->handle.data) {
|
||||
// both timer and handle are closed
|
||||
hi_free(p);
|
||||
}
|
||||
// else, wait for `on_handle_close`
|
||||
}
|
||||
|
||||
static void on_handle_close(uv_handle_t *handle) {
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)handle->data;
|
||||
p->handle.data = NULL;
|
||||
if (!p->timer.data) {
|
||||
// timer never started, or timer already destroyed
|
||||
hi_free(p);
|
||||
}
|
||||
// else, wait for `on_timer_close`
|
||||
}
|
||||
|
||||
// libuv removed `status` parameter since v0.11.23
|
||||
// see: https://github.com/libuv/libuv/blob/v0.11.23/include/uv.h
|
||||
#if (UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR < 11) || \
|
||||
(UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR == 11 && UV_VERSION_PATCH < 23)
|
||||
static void redisLibuvTimeout(uv_timer_t *timer, int status) {
|
||||
(void)status; // unused
|
||||
#else
|
||||
static void redisLibuvTimeout(uv_timer_t *timer) {
|
||||
#endif
|
||||
redisLibuvEvents *e = (redisLibuvEvents*)timer->data;
|
||||
redisAsyncHandleTimeout(e->context);
|
||||
}
|
||||
|
||||
static void redisLibuvSetTimeout(void *privdata, struct timeval tv) {
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)privdata;
|
||||
|
||||
uint64_t millsec = tv.tv_sec * 1000 + tv.tv_usec / 1000.0;
|
||||
if (!p->timer.data) {
|
||||
// timer is uninitialized
|
||||
if (uv_timer_init(p->handle.loop, &p->timer) != 0) {
|
||||
return;
|
||||
}
|
||||
p->timer.data = p;
|
||||
}
|
||||
// updates the timeout if the timer has already started
|
||||
// or start the timer
|
||||
uv_timer_start(&p->timer, redisLibuvTimeout, millsec, 0);
|
||||
}
|
||||
|
||||
static void redisLibuvCleanup(void *privdata) {
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)privdata;
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)privdata;
|
||||
|
||||
p->context = NULL; // indicate that context might no longer exist
|
||||
uv_close((uv_handle_t*)&p->handle, on_close);
|
||||
p->context = NULL; // indicate that context might no longer exist
|
||||
if (p->timer.data) {
|
||||
uv_close((uv_handle_t*)&p->timer, on_timer_close);
|
||||
}
|
||||
uv_close((uv_handle_t*)&p->handle, on_handle_close);
|
||||
}
|
||||
|
||||
|
||||
static int redisLibuvAttach(redisAsyncContext* ac, uv_loop_t* loop) {
|
||||
redisContext *c = &(ac->c);
|
||||
redisContext *c = &(ac->c);
|
||||
|
||||
if (ac->ev.data != NULL) {
|
||||
return REDIS_ERR;
|
||||
}
|
||||
if (ac->ev.data != NULL) {
|
||||
return REDIS_ERR;
|
||||
}
|
||||
|
||||
ac->ev.addRead = redisLibuvAddRead;
|
||||
ac->ev.delRead = redisLibuvDelRead;
|
||||
ac->ev.addWrite = redisLibuvAddWrite;
|
||||
ac->ev.delWrite = redisLibuvDelWrite;
|
||||
ac->ev.cleanup = redisLibuvCleanup;
|
||||
ac->ev.addRead = redisLibuvAddRead;
|
||||
ac->ev.delRead = redisLibuvDelRead;
|
||||
ac->ev.addWrite = redisLibuvAddWrite;
|
||||
ac->ev.delWrite = redisLibuvDelWrite;
|
||||
ac->ev.cleanup = redisLibuvCleanup;
|
||||
ac->ev.scheduleTimer = redisLibuvSetTimeout;
|
||||
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)hi_malloc(sizeof(*p));
|
||||
if (p == NULL)
|
||||
return REDIS_ERR;
|
||||
redisLibuvEvents* p = (redisLibuvEvents*)hi_malloc(sizeof(*p));
|
||||
if (p == NULL)
|
||||
return REDIS_ERR;
|
||||
|
||||
memset(p, 0, sizeof(*p));
|
||||
memset(p, 0, sizeof(*p));
|
||||
|
||||
if (uv_poll_init_socket(loop, &p->handle, c->fd) != 0) {
|
||||
return REDIS_ERR;
|
||||
}
|
||||
if (uv_poll_init_socket(loop, &p->handle, c->fd) != 0) {
|
||||
return REDIS_ERR;
|
||||
}
|
||||
|
||||
ac->ev.data = p;
|
||||
p->handle.data = p;
|
||||
p->context = ac;
|
||||
ac->ev.data = p;
|
||||
p->handle.data = p;
|
||||
p->context = ac;
|
||||
|
||||
return REDIS_OK;
|
||||
return REDIS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
Vendored
+4
@@ -68,6 +68,10 @@ void *hi_malloc(size_t size) {
|
||||
}
|
||||
|
||||
void *hi_calloc(size_t nmemb, size_t size) {
|
||||
/* Overflow check as the user can specify any arbitrary allocator */
|
||||
if (SIZE_MAX / size < nmemb)
|
||||
return NULL;
|
||||
|
||||
return hiredisAllocFns.callocFn(nmemb, size);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+5
@@ -32,6 +32,7 @@
|
||||
#define HIREDIS_ALLOC_H
|
||||
|
||||
#include <stddef.h> /* for size_t */
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -59,6 +60,10 @@ static inline void *hi_malloc(size_t size) {
|
||||
}
|
||||
|
||||
static inline void *hi_calloc(size_t nmemb, size_t size) {
|
||||
/* Overflow check as the user can specify any arbitrary allocator */
|
||||
if (SIZE_MAX / size < nmemb)
|
||||
return NULL;
|
||||
|
||||
return hiredisAllocFns.callocFn(nmemb, size);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+75
-53
@@ -47,6 +47,11 @@
|
||||
|
||||
#include "async_private.h"
|
||||
|
||||
#ifdef NDEBUG
|
||||
#undef assert
|
||||
#define assert(e) (void)(e)
|
||||
#endif
|
||||
|
||||
/* Forward declarations of hiredis.c functions */
|
||||
int __redisAppendCommand(redisContext *c, const char *cmd, size_t len);
|
||||
void __redisSetError(redisContext *c, int type, const char *str);
|
||||
@@ -139,8 +144,8 @@ static redisAsyncContext *redisAsyncInitialize(redisContext *c) {
|
||||
|
||||
ac->replies.head = NULL;
|
||||
ac->replies.tail = NULL;
|
||||
ac->sub.invalid.head = NULL;
|
||||
ac->sub.invalid.tail = NULL;
|
||||
ac->sub.replies.head = NULL;
|
||||
ac->sub.replies.tail = NULL;
|
||||
ac->sub.channels = channels;
|
||||
ac->sub.patterns = patterns;
|
||||
|
||||
@@ -301,36 +306,28 @@ static void __redisRunPushCallback(redisAsyncContext *ac, redisReply *reply) {
|
||||
static void __redisAsyncFree(redisAsyncContext *ac) {
|
||||
redisContext *c = &(ac->c);
|
||||
redisCallback cb;
|
||||
dictIterator *it;
|
||||
dictIterator it;
|
||||
dictEntry *de;
|
||||
|
||||
/* Execute pending callbacks with NULL reply. */
|
||||
while (__redisShiftCallback(&ac->replies,&cb) == REDIS_OK)
|
||||
__redisRunCallback(ac,&cb,NULL);
|
||||
|
||||
/* Execute callbacks for invalid commands */
|
||||
while (__redisShiftCallback(&ac->sub.invalid,&cb) == REDIS_OK)
|
||||
while (__redisShiftCallback(&ac->sub.replies,&cb) == REDIS_OK)
|
||||
__redisRunCallback(ac,&cb,NULL);
|
||||
|
||||
/* Run subscription callbacks with NULL reply */
|
||||
if (ac->sub.channels) {
|
||||
it = dictGetIterator(ac->sub.channels);
|
||||
if (it != NULL) {
|
||||
while ((de = dictNext(it)) != NULL)
|
||||
__redisRunCallback(ac,dictGetEntryVal(de),NULL);
|
||||
dictReleaseIterator(it);
|
||||
}
|
||||
dictInitIterator(&it,ac->sub.channels);
|
||||
while ((de = dictNext(&it)) != NULL)
|
||||
__redisRunCallback(ac,dictGetEntryVal(de),NULL);
|
||||
|
||||
dictRelease(ac->sub.channels);
|
||||
}
|
||||
|
||||
if (ac->sub.patterns) {
|
||||
it = dictGetIterator(ac->sub.patterns);
|
||||
if (it != NULL) {
|
||||
while ((de = dictNext(it)) != NULL)
|
||||
__redisRunCallback(ac,dictGetEntryVal(de),NULL);
|
||||
dictReleaseIterator(it);
|
||||
}
|
||||
dictInitIterator(&it,ac->sub.patterns);
|
||||
while ((de = dictNext(&it)) != NULL)
|
||||
__redisRunCallback(ac,dictGetEntryVal(de),NULL);
|
||||
|
||||
dictRelease(ac->sub.patterns);
|
||||
}
|
||||
@@ -420,10 +417,11 @@ static int __redisGetSubscribeCallback(redisAsyncContext *ac, redisReply *reply,
|
||||
char *stype;
|
||||
hisds sname;
|
||||
|
||||
/* Custom reply functions are not supported for pub/sub. This will fail
|
||||
* very hard when they are used... */
|
||||
if (reply->type == REDIS_REPLY_ARRAY || reply->type == REDIS_REPLY_PUSH) {
|
||||
assert(reply->elements >= 2);
|
||||
/* Match reply with the expected format of a pushed message.
|
||||
* The type and number of elements (3 to 4) are specified at:
|
||||
* https://redis.io/topics/pubsub#format-of-pushed-messages */
|
||||
if ((reply->type == REDIS_REPLY_ARRAY && !(c->flags & REDIS_SUPPORTS_PUSH) && reply->elements >= 3) ||
|
||||
reply->type == REDIS_REPLY_PUSH) {
|
||||
assert(reply->element[0]->type == REDIS_REPLY_STRING);
|
||||
stype = reply->element[0]->str;
|
||||
pvariant = (tolower(stype[0]) == 'p') ? 1 : 0;
|
||||
@@ -462,14 +460,21 @@ static int __redisGetSubscribeCallback(redisAsyncContext *ac, redisReply *reply,
|
||||
/* Unset subscribed flag only when no pipelined pending subscribe. */
|
||||
if (reply->element[2]->integer == 0
|
||||
&& dictSize(ac->sub.channels) == 0
|
||||
&& dictSize(ac->sub.patterns) == 0)
|
||||
&& dictSize(ac->sub.patterns) == 0) {
|
||||
c->flags &= ~REDIS_SUBSCRIBED;
|
||||
|
||||
/* Move ongoing regular command callbacks. */
|
||||
redisCallback cb;
|
||||
while (__redisShiftCallback(&ac->sub.replies,&cb) == REDIS_OK) {
|
||||
__redisPushCallback(&ac->replies,&cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
hi_sdsfree(sname);
|
||||
} else {
|
||||
/* Shift callback for invalid commands. */
|
||||
__redisShiftCallback(&ac->sub.invalid,dstcb);
|
||||
/* Shift callback for pending command in subscribed context. */
|
||||
__redisShiftCallback(&ac->sub.replies,dstcb);
|
||||
}
|
||||
return REDIS_OK;
|
||||
oom:
|
||||
@@ -497,13 +502,12 @@ static int redisIsSubscribeReply(redisReply *reply) {
|
||||
len = reply->element[0]->len - off;
|
||||
|
||||
return !strncasecmp(str, "subscribe", len) ||
|
||||
!strncasecmp(str, "message", len);
|
||||
|
||||
!strncasecmp(str, "message", len) ||
|
||||
!strncasecmp(str, "unsubscribe", len);
|
||||
}
|
||||
|
||||
void redisProcessCallbacks(redisAsyncContext *ac) {
|
||||
redisContext *c = &(ac->c);
|
||||
redisCallback cb = {NULL, NULL, 0, NULL};
|
||||
void *reply = NULL;
|
||||
int status;
|
||||
|
||||
@@ -516,17 +520,14 @@ void redisProcessCallbacks(redisAsyncContext *ac) {
|
||||
__redisAsyncDisconnect(ac);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If monitor mode, repush callback */
|
||||
if(c->flags & REDIS_MONITORING) {
|
||||
__redisPushCallback(&ac->replies,&cb);
|
||||
}
|
||||
|
||||
/* When the connection is not being disconnected, simply stop
|
||||
* trying to get replies and wait for the next loop tick. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Keep track of push message support for subscribe handling */
|
||||
if (redisIsPushReply(reply)) c->flags |= REDIS_SUPPORTS_PUSH;
|
||||
|
||||
/* Send any non-subscribe related PUSH messages to our PUSH handler
|
||||
* while allowing subscribe related PUSH messages to pass through.
|
||||
* This allows existing code to be backward compatible and work in
|
||||
@@ -539,6 +540,7 @@ void redisProcessCallbacks(redisAsyncContext *ac) {
|
||||
|
||||
/* Even if the context is subscribed, pending regular
|
||||
* callbacks will get a reply before pub/sub messages arrive. */
|
||||
redisCallback cb = {NULL, NULL, 0, NULL};
|
||||
if (__redisShiftCallback(&ac->replies,&cb) != REDIS_OK) {
|
||||
/*
|
||||
* A spontaneous reply in a not-subscribed context can be the error
|
||||
@@ -562,15 +564,17 @@ void redisProcessCallbacks(redisAsyncContext *ac) {
|
||||
__redisAsyncDisconnect(ac);
|
||||
return;
|
||||
}
|
||||
/* No more regular callbacks and no errors, the context *must* be subscribed or monitoring. */
|
||||
assert((c->flags & REDIS_SUBSCRIBED || c->flags & REDIS_MONITORING));
|
||||
if(c->flags & REDIS_SUBSCRIBED)
|
||||
/* No more regular callbacks and no errors, the context *must* be subscribed. */
|
||||
assert(c->flags & REDIS_SUBSCRIBED);
|
||||
if (c->flags & REDIS_SUBSCRIBED)
|
||||
__redisGetSubscribeCallback(ac,reply,&cb);
|
||||
}
|
||||
|
||||
if (cb.fn != NULL) {
|
||||
__redisRunCallback(ac,&cb,reply);
|
||||
c->reader->fn->freeObject(reply);
|
||||
if (!(c->flags & REDIS_NO_AUTO_FREE_REPLIES)){
|
||||
c->reader->fn->freeObject(reply);
|
||||
}
|
||||
|
||||
/* Proceed with free'ing when redisAsyncFree() was called. */
|
||||
if (c->flags & REDIS_FREEING) {
|
||||
@@ -584,6 +588,11 @@ void redisProcessCallbacks(redisAsyncContext *ac) {
|
||||
* doesn't know what the server will spit out over the wire. */
|
||||
c->reader->fn->freeObject(reply);
|
||||
}
|
||||
|
||||
/* If in monitor mode, repush the callback */
|
||||
if (c->flags & REDIS_MONITORING) {
|
||||
__redisPushCallback(&ac->replies,&cb);
|
||||
}
|
||||
}
|
||||
|
||||
/* Disconnect when there was an error reading the reply */
|
||||
@@ -605,7 +614,8 @@ static int __redisAsyncHandleConnect(redisAsyncContext *ac) {
|
||||
|
||||
if (redisCheckConnectDone(c, &completed) == REDIS_ERR) {
|
||||
/* Error! */
|
||||
redisCheckSocketError(c);
|
||||
if (redisCheckSocketError(c) == REDIS_ERR)
|
||||
__redisAsyncCopyError(ac);
|
||||
__redisAsyncHandleConnectFailure(ac);
|
||||
return REDIS_ERR;
|
||||
} else if (completed == 1) {
|
||||
@@ -691,13 +701,22 @@ void redisAsyncHandleTimeout(redisAsyncContext *ac) {
|
||||
redisContext *c = &(ac->c);
|
||||
redisCallback cb;
|
||||
|
||||
if ((c->flags & REDIS_CONNECTED) && ac->replies.head == NULL) {
|
||||
/* Nothing to do - just an idle timeout */
|
||||
return;
|
||||
if ((c->flags & REDIS_CONNECTED)) {
|
||||
if (ac->replies.head == NULL && ac->sub.replies.head == NULL) {
|
||||
/* Nothing to do - just an idle timeout */
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ac->c.command_timeout ||
|
||||
(!ac->c.command_timeout->tv_sec && !ac->c.command_timeout->tv_usec)) {
|
||||
/* A belated connect timeout arriving, ignore */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!c->err) {
|
||||
__redisSetError(c, REDIS_ERR_TIMEOUT, "Timeout");
|
||||
__redisAsyncCopyError(ac);
|
||||
}
|
||||
|
||||
if (!(c->flags & REDIS_CONNECTED) && ac->onConnect) {
|
||||
@@ -796,17 +815,19 @@ static int __redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void
|
||||
/* (P)UNSUBSCRIBE does not have its own response: every channel or
|
||||
* pattern that is unsubscribed will receive a message. This means we
|
||||
* should not append a callback function for this command. */
|
||||
} else if(strncasecmp(cstr,"monitor\r\n",9) == 0) {
|
||||
/* Set monitor flag and push callback */
|
||||
c->flags |= REDIS_MONITORING;
|
||||
__redisPushCallback(&ac->replies,&cb);
|
||||
} else if (strncasecmp(cstr,"monitor\r\n",9) == 0) {
|
||||
/* Set monitor flag and push callback */
|
||||
c->flags |= REDIS_MONITORING;
|
||||
if (__redisPushCallback(&ac->replies,&cb) != REDIS_OK)
|
||||
goto oom;
|
||||
} else {
|
||||
if (c->flags & REDIS_SUBSCRIBED)
|
||||
/* This will likely result in an error reply, but it needs to be
|
||||
* received and passed to the callback. */
|
||||
__redisPushCallback(&ac->sub.invalid,&cb);
|
||||
else
|
||||
__redisPushCallback(&ac->replies,&cb);
|
||||
if (c->flags & REDIS_SUBSCRIBED) {
|
||||
if (__redisPushCallback(&ac->sub.replies,&cb) != REDIS_OK)
|
||||
goto oom;
|
||||
} else {
|
||||
if (__redisPushCallback(&ac->replies,&cb) != REDIS_OK)
|
||||
goto oom;
|
||||
}
|
||||
}
|
||||
|
||||
__redisAppendCommand(c,cmd,len);
|
||||
@@ -817,6 +838,7 @@ static int __redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void
|
||||
return REDIS_OK;
|
||||
oom:
|
||||
__redisSetError(&(ac->c), REDIS_ERR_OOM, "Out of memory");
|
||||
__redisAsyncCopyError(ac);
|
||||
return REDIS_ERR;
|
||||
}
|
||||
|
||||
@@ -846,7 +868,7 @@ int redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata
|
||||
|
||||
int redisAsyncCommandArgv(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, int argc, const char **argv, const size_t *argvlen) {
|
||||
hisds cmd;
|
||||
int len;
|
||||
long long len;
|
||||
int status;
|
||||
len = redisFormatSdsCommandArgv(&cmd,argc,argv,argvlen);
|
||||
if (len < 0)
|
||||
|
||||
Vendored
+1
-1
@@ -102,7 +102,7 @@ typedef struct redisAsyncContext {
|
||||
|
||||
/* Subscription callbacks */
|
||||
struct {
|
||||
redisCallbackList invalid;
|
||||
redisCallbackList replies;
|
||||
struct dict *channels;
|
||||
struct dict *patterns;
|
||||
} sub;
|
||||
|
||||
Vendored
+1
-10
@@ -267,16 +267,11 @@ static dictEntry *dictFind(dict *ht, const void *key) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static dictIterator *dictGetIterator(dict *ht) {
|
||||
dictIterator *iter = hi_malloc(sizeof(*iter));
|
||||
if (iter == NULL)
|
||||
return NULL;
|
||||
|
||||
static void dictInitIterator(dictIterator *iter, dict *ht) {
|
||||
iter->ht = ht;
|
||||
iter->index = -1;
|
||||
iter->entry = NULL;
|
||||
iter->nextEntry = NULL;
|
||||
return iter;
|
||||
}
|
||||
|
||||
static dictEntry *dictNext(dictIterator *iter) {
|
||||
@@ -299,10 +294,6 @@ static dictEntry *dictNext(dictIterator *iter) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void dictReleaseIterator(dictIterator *iter) {
|
||||
hi_free(iter);
|
||||
}
|
||||
|
||||
/* ------------------------- private functions ------------------------------ */
|
||||
|
||||
/* Expand the hash table if needed */
|
||||
|
||||
Vendored
+1
-2
@@ -119,8 +119,7 @@ static int dictReplace(dict *ht, void *key, void *val);
|
||||
static int dictDelete(dict *ht, const void *key);
|
||||
static void dictRelease(dict *ht);
|
||||
static dictEntry * dictFind(dict *ht, const void *key);
|
||||
static dictIterator *dictGetIterator(dict *ht);
|
||||
static void dictInitIterator(dictIterator *iter, dict *ht);
|
||||
static dictEntry *dictNext(dictIterator *iter);
|
||||
static void dictReleaseIterator(dictIterator *iter);
|
||||
|
||||
#endif /* __DICT_H */
|
||||
|
||||
Vendored
+1
-1
@@ -21,7 +21,7 @@ ENDIF()
|
||||
|
||||
FIND_PATH(LIBEVENT event.h)
|
||||
if (LIBEVENT)
|
||||
ADD_EXECUTABLE(example-libevent example-libevent)
|
||||
ADD_EXECUTABLE(example-libevent example-libevent.c)
|
||||
TARGET_LINK_LIBRARIES(example-libevent hiredis event)
|
||||
ENDIF()
|
||||
|
||||
|
||||
+31
-6
@@ -7,18 +7,33 @@
|
||||
#include <async.h>
|
||||
#include <adapters/libuv.h>
|
||||
|
||||
void debugCallback(redisAsyncContext *c, void *r, void *privdata) {
|
||||
(void)privdata; //unused
|
||||
redisReply *reply = r;
|
||||
if (reply == NULL) {
|
||||
/* The DEBUG SLEEP command will almost always fail, because we have set a 1 second timeout */
|
||||
printf("`DEBUG SLEEP` error: %s\n", c->errstr ? c->errstr : "unknown error");
|
||||
return;
|
||||
}
|
||||
/* Disconnect after receiving the reply of DEBUG SLEEP (which will not)*/
|
||||
redisAsyncDisconnect(c);
|
||||
}
|
||||
|
||||
void getCallback(redisAsyncContext *c, void *r, void *privdata) {
|
||||
redisReply *reply = r;
|
||||
if (reply == NULL) return;
|
||||
printf("argv[%s]: %s\n", (char*)privdata, reply->str);
|
||||
if (reply == NULL) {
|
||||
printf("`GET key` error: %s\n", c->errstr ? c->errstr : "unknown error");
|
||||
return;
|
||||
}
|
||||
printf("`GET key` result: argv[%s]: %s\n", (char*)privdata, reply->str);
|
||||
|
||||
/* Disconnect after receiving the reply to GET */
|
||||
redisAsyncDisconnect(c);
|
||||
/* start another request that demonstrate timeout */
|
||||
redisAsyncCommand(c, debugCallback, NULL, "DEBUG SLEEP %f", 1.5);
|
||||
}
|
||||
|
||||
void connectCallback(const redisAsyncContext *c, int status) {
|
||||
if (status != REDIS_OK) {
|
||||
printf("Error: %s\n", c->errstr);
|
||||
printf("connect error: %s\n", c->errstr);
|
||||
return;
|
||||
}
|
||||
printf("Connected...\n");
|
||||
@@ -26,7 +41,7 @@ void connectCallback(const redisAsyncContext *c, int status) {
|
||||
|
||||
void disconnectCallback(const redisAsyncContext *c, int status) {
|
||||
if (status != REDIS_OK) {
|
||||
printf("Error: %s\n", c->errstr);
|
||||
printf("disconnect because of error: %s\n", c->errstr);
|
||||
return;
|
||||
}
|
||||
printf("Disconnected...\n");
|
||||
@@ -49,8 +64,18 @@ int main (int argc, char **argv) {
|
||||
redisLibuvAttach(c,loop);
|
||||
redisAsyncSetConnectCallback(c,connectCallback);
|
||||
redisAsyncSetDisconnectCallback(c,disconnectCallback);
|
||||
redisAsyncSetTimeout(c, (struct timeval){ .tv_sec = 1, .tv_usec = 0});
|
||||
|
||||
/*
|
||||
In this demo, we first `set key`, then `get key` to demonstrate the basic usage of libuv adapter.
|
||||
Then in `getCallback`, we start a `debug sleep` command to create 1.5 second long request.
|
||||
Because we have set a 1 second timeout to the connection, the command will always fail with a
|
||||
timeout error, which is shown in the `debugCallback`.
|
||||
*/
|
||||
|
||||
redisAsyncCommand(c, NULL, NULL, "SET key %b", argv[argc-1], strlen(argv[argc-1]));
|
||||
redisAsyncCommand(c, getCallback, (char*)"end-1", "GET key");
|
||||
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Vendored
-1
@@ -31,7 +31,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <hiredis.h>
|
||||
#include <win32.h>
|
||||
|
||||
#define KEY_COUNT 5
|
||||
|
||||
|
||||
Vendored
+4
-1
@@ -4,7 +4,10 @@
|
||||
|
||||
#include <hiredis.h>
|
||||
#include <hiredis_ssl.h>
|
||||
#include <win32.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <winsock2.h> /* For struct timeval */
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
unsigned int j;
|
||||
|
||||
Vendored
+4
-1
@@ -2,7 +2,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <hiredis.h>
|
||||
#include <win32.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <winsock2.h> /* For struct timeval */
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
unsigned int j, isunix = 0;
|
||||
|
||||
Vendored
+2
@@ -1,8 +1,10 @@
|
||||
#ifndef __HIREDIS_FMACRO_H
|
||||
#define __HIREDIS_FMACRO_H
|
||||
|
||||
#ifndef _AIX
|
||||
#define _XOPEN_SOURCE 600
|
||||
#define _POSIX_C_SOURCE 200112L
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
/* Enable TCP_KEEPALIVE */
|
||||
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Salvatore Sanfilippo <antirez at gmail dot com>
|
||||
* Copyright (c) 2020, Pieter Noordhuis <pcnoordhuis at gmail dot com>
|
||||
* Copyright (c) 2020, Matt Stancliff <matt at genges dot com>,
|
||||
* Jan-Erik Rediger <janerik at fnordig dot com>
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Redis nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "hiredis.h"
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
char *new_str, *cmd;
|
||||
|
||||
if (size < 3)
|
||||
return 0;
|
||||
|
||||
new_str = malloc(size+1);
|
||||
if (new_str == NULL)
|
||||
return 0;
|
||||
|
||||
memcpy(new_str, data, size);
|
||||
new_str[size] = '\0';
|
||||
|
||||
redisFormatCommand(&cmd, new_str);
|
||||
|
||||
if (cmd != NULL)
|
||||
hi_free(cmd);
|
||||
free(new_str);
|
||||
return 0;
|
||||
}
|
||||
Vendored
+53
-39
@@ -96,6 +96,8 @@ void freeReplyObject(void *reply) {
|
||||
|
||||
switch(r->type) {
|
||||
case REDIS_REPLY_INTEGER:
|
||||
case REDIS_REPLY_NIL:
|
||||
case REDIS_REPLY_BOOL:
|
||||
break; /* Nothing to free */
|
||||
case REDIS_REPLY_ARRAY:
|
||||
case REDIS_REPLY_MAP:
|
||||
@@ -112,6 +114,7 @@ void freeReplyObject(void *reply) {
|
||||
case REDIS_REPLY_STRING:
|
||||
case REDIS_REPLY_DOUBLE:
|
||||
case REDIS_REPLY_VERB:
|
||||
case REDIS_REPLY_BIGNUM:
|
||||
hi_free(r->str);
|
||||
break;
|
||||
}
|
||||
@@ -129,7 +132,8 @@ static void *createStringObject(const redisReadTask *task, char *str, size_t len
|
||||
assert(task->type == REDIS_REPLY_ERROR ||
|
||||
task->type == REDIS_REPLY_STATUS ||
|
||||
task->type == REDIS_REPLY_STRING ||
|
||||
task->type == REDIS_REPLY_VERB);
|
||||
task->type == REDIS_REPLY_VERB ||
|
||||
task->type == REDIS_REPLY_BIGNUM);
|
||||
|
||||
/* Copy string value */
|
||||
if (task->type == REDIS_REPLY_VERB) {
|
||||
@@ -235,12 +239,14 @@ static void *createDoubleObject(const redisReadTask *task, double value, char *s
|
||||
* decimal string conversion artifacts. */
|
||||
memcpy(r->str, str, len);
|
||||
r->str[len] = '\0';
|
||||
r->len = len;
|
||||
|
||||
if (task->parent) {
|
||||
parent = task->parent->obj;
|
||||
assert(parent->type == REDIS_REPLY_ARRAY ||
|
||||
parent->type == REDIS_REPLY_MAP ||
|
||||
parent->type == REDIS_REPLY_SET);
|
||||
parent->type == REDIS_REPLY_SET ||
|
||||
parent->type == REDIS_REPLY_PUSH);
|
||||
parent->element[task->idx] = r;
|
||||
}
|
||||
return r;
|
||||
@@ -277,7 +283,8 @@ static void *createBoolObject(const redisReadTask *task, int bval) {
|
||||
parent = task->parent->obj;
|
||||
assert(parent->type == REDIS_REPLY_ARRAY ||
|
||||
parent->type == REDIS_REPLY_MAP ||
|
||||
parent->type == REDIS_REPLY_SET);
|
||||
parent->type == REDIS_REPLY_SET ||
|
||||
parent->type == REDIS_REPLY_PUSH);
|
||||
parent->element[task->idx] = r;
|
||||
}
|
||||
return r;
|
||||
@@ -565,13 +572,12 @@ int redisFormatCommand(char **target, const char *format, ...) {
|
||||
* lengths. If the latter is set to NULL, strlen will be used to compute the
|
||||
* argument lengths.
|
||||
*/
|
||||
int redisFormatSdsCommandArgv(hisds *target, int argc, const char **argv,
|
||||
const size_t *argvlen)
|
||||
long long redisFormatSdsCommandArgv(hisds *target, int argc, const char **argv,
|
||||
const size_t *argvlen)
|
||||
{
|
||||
hisds cmd, aux;
|
||||
unsigned long long totlen;
|
||||
unsigned long long totlen, len;
|
||||
int j;
|
||||
size_t len;
|
||||
|
||||
/* Abort on a NULL target */
|
||||
if (target == NULL)
|
||||
@@ -602,7 +608,7 @@ int redisFormatSdsCommandArgv(hisds *target, int argc, const char **argv,
|
||||
cmd = hi_sdscatfmt(cmd, "*%i\r\n", argc);
|
||||
for (j=0; j < argc; j++) {
|
||||
len = argvlen ? argvlen[j] : strlen(argv[j]);
|
||||
cmd = hi_sdscatfmt(cmd, "$%u\r\n", len);
|
||||
cmd = hi_sdscatfmt(cmd, "$%U\r\n", len);
|
||||
cmd = hi_sdscatlen(cmd, argv[j], len);
|
||||
cmd = hi_sdscatlen(cmd, "\r\n", sizeof("\r\n")-1);
|
||||
}
|
||||
@@ -622,11 +628,11 @@ void redisFreeSdsCommand(hisds cmd) {
|
||||
* lengths. If the latter is set to NULL, strlen will be used to compute the
|
||||
* argument lengths.
|
||||
*/
|
||||
int redisFormatCommandArgv(char **target, int argc, const char **argv, const size_t *argvlen) {
|
||||
long long redisFormatCommandArgv(char **target, int argc, const char **argv, const size_t *argvlen) {
|
||||
char *cmd = NULL; /* final command */
|
||||
int pos; /* position in final command */
|
||||
size_t len;
|
||||
int totlen, j;
|
||||
size_t pos; /* position in final command */
|
||||
size_t len, totlen;
|
||||
int j;
|
||||
|
||||
/* Abort on a NULL target */
|
||||
if (target == NULL)
|
||||
@@ -797,6 +803,9 @@ redisContext *redisConnectWithOptions(const redisOptions *options) {
|
||||
if (options->options & REDIS_OPT_NOAUTOFREE) {
|
||||
c->flags |= REDIS_NO_AUTO_FREE;
|
||||
}
|
||||
if (options->options & REDIS_OPT_NOAUTOFREEREPLIES) {
|
||||
c->flags |= REDIS_NO_AUTO_FREE_REPLIES;
|
||||
}
|
||||
|
||||
/* Set any user supplied RESP3 PUSH handler or use freeReplyObject
|
||||
* as a default unless specifically flagged that we don't want one. */
|
||||
@@ -825,7 +834,7 @@ redisContext *redisConnectWithOptions(const redisOptions *options) {
|
||||
c->fd = options->endpoint.fd;
|
||||
c->flags |= REDIS_CONNECTED;
|
||||
} else {
|
||||
// Unknown type - FIXME - FREE
|
||||
redisFree(c);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -939,13 +948,11 @@ int redisBufferRead(redisContext *c) {
|
||||
return REDIS_ERR;
|
||||
|
||||
nread = c->funcs->read(c, buf, sizeof(buf));
|
||||
if (nread > 0) {
|
||||
if (redisReaderFeed(c->reader, buf, nread) != REDIS_OK) {
|
||||
__redisSetError(c, c->reader->err, c->reader->errstr);
|
||||
return REDIS_ERR;
|
||||
} else {
|
||||
}
|
||||
} else if (nread < 0) {
|
||||
if (nread < 0) {
|
||||
return REDIS_ERR;
|
||||
}
|
||||
if (nread > 0 && redisReaderFeed(c->reader, buf, nread) != REDIS_OK) {
|
||||
__redisSetError(c, c->reader->err, c->reader->errstr);
|
||||
return REDIS_ERR;
|
||||
}
|
||||
return REDIS_OK;
|
||||
@@ -989,17 +996,6 @@ oom:
|
||||
return REDIS_ERR;
|
||||
}
|
||||
|
||||
/* Internal helper function to try and get a reply from the reader,
|
||||
* or set an error in the context otherwise. */
|
||||
int redisGetReplyFromReader(redisContext *c, void **reply) {
|
||||
if (redisReaderGetReply(c->reader,reply) == REDIS_ERR) {
|
||||
__redisSetError(c,c->reader->err,c->reader->errstr);
|
||||
return REDIS_ERR;
|
||||
}
|
||||
|
||||
return REDIS_OK;
|
||||
}
|
||||
|
||||
/* Internal helper that returns 1 if the reply was a RESP3 PUSH
|
||||
* message and we handled it with a user-provided callback. */
|
||||
static int redisHandledPushReply(redisContext *c, void *reply) {
|
||||
@@ -1011,12 +1007,34 @@ static int redisHandledPushReply(redisContext *c, void *reply) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get a reply from our reader or set an error in the context. */
|
||||
int redisGetReplyFromReader(redisContext *c, void **reply) {
|
||||
if (redisReaderGetReply(c->reader, reply) == REDIS_ERR) {
|
||||
__redisSetError(c,c->reader->err,c->reader->errstr);
|
||||
return REDIS_ERR;
|
||||
}
|
||||
|
||||
return REDIS_OK;
|
||||
}
|
||||
|
||||
/* Internal helper to get the next reply from our reader while handling
|
||||
* any PUSH messages we encounter along the way. This is separate from
|
||||
* redisGetReplyFromReader so as to not change its behavior. */
|
||||
static int redisNextInBandReplyFromReader(redisContext *c, void **reply) {
|
||||
do {
|
||||
if (redisGetReplyFromReader(c, reply) == REDIS_ERR)
|
||||
return REDIS_ERR;
|
||||
} while (redisHandledPushReply(c, *reply));
|
||||
|
||||
return REDIS_OK;
|
||||
}
|
||||
|
||||
int redisGetReply(redisContext *c, void **reply) {
|
||||
int wdone = 0;
|
||||
void *aux = NULL;
|
||||
|
||||
/* Try to read pending replies */
|
||||
if (redisGetReplyFromReader(c,&aux) == REDIS_ERR)
|
||||
if (redisNextInBandReplyFromReader(c,&aux) == REDIS_ERR)
|
||||
return REDIS_ERR;
|
||||
|
||||
/* For the blocking context, flush output buffer and read reply */
|
||||
@@ -1032,12 +1050,8 @@ int redisGetReply(redisContext *c, void **reply) {
|
||||
if (redisBufferRead(c) == REDIS_ERR)
|
||||
return REDIS_ERR;
|
||||
|
||||
/* We loop here in case the user has specified a RESP3
|
||||
* PUSH handler (e.g. for client tracking). */
|
||||
do {
|
||||
if (redisGetReplyFromReader(c,&aux) == REDIS_ERR)
|
||||
return REDIS_ERR;
|
||||
} while (redisHandledPushReply(c, aux));
|
||||
if (redisNextInBandReplyFromReader(c,&aux) == REDIS_ERR)
|
||||
return REDIS_ERR;
|
||||
} while (aux == NULL);
|
||||
}
|
||||
|
||||
@@ -1114,7 +1128,7 @@ int redisAppendCommand(redisContext *c, const char *format, ...) {
|
||||
|
||||
int redisAppendCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen) {
|
||||
hisds cmd;
|
||||
int len;
|
||||
long long len;
|
||||
|
||||
len = redisFormatSdsCommandArgv(&cmd,argc,argv,argvlen);
|
||||
if (len == -1) {
|
||||
|
||||
Vendored
+18
-6
@@ -47,8 +47,8 @@ typedef long long ssize_t;
|
||||
|
||||
#define HIREDIS_MAJOR 1
|
||||
#define HIREDIS_MINOR 0
|
||||
#define HIREDIS_PATCH 0
|
||||
#define HIREDIS_SONAME 1.0.0
|
||||
#define HIREDIS_PATCH 3
|
||||
#define HIREDIS_SONAME 1.0.3-dev
|
||||
|
||||
/* Connection type can be blocking or non-blocking and is set in the
|
||||
* least significant bit of the flags field in redisContext. */
|
||||
@@ -80,12 +80,18 @@ typedef long long ssize_t;
|
||||
/* Flag that is set when we should set SO_REUSEADDR before calling bind() */
|
||||
#define REDIS_REUSEADDR 0x80
|
||||
|
||||
/* Flag that is set when the async connection supports push replies. */
|
||||
#define REDIS_SUPPORTS_PUSH 0x100
|
||||
|
||||
/**
|
||||
* Flag that indicates the user does not want the context to
|
||||
* be automatically freed upon error
|
||||
*/
|
||||
#define REDIS_NO_AUTO_FREE 0x200
|
||||
|
||||
/* Flag that indicates the user does not want replies to be automatically freed */
|
||||
#define REDIS_NO_AUTO_FREE_REPLIES 0x400
|
||||
|
||||
#define REDIS_KEEPALIVE_INTERVAL 15 /* seconds */
|
||||
|
||||
/* number of times we retry to connect in the case of EADDRNOTAVAIL and
|
||||
@@ -112,7 +118,8 @@ typedef struct redisReply {
|
||||
double dval; /* The double when type is REDIS_REPLY_DOUBLE */
|
||||
size_t len; /* Length of string */
|
||||
char *str; /* Used for REDIS_REPLY_ERROR, REDIS_REPLY_STRING
|
||||
REDIS_REPLY_VERB, and REDIS_REPLY_DOUBLE (in additional to dval). */
|
||||
REDIS_REPLY_VERB, REDIS_REPLY_DOUBLE (in additional to dval),
|
||||
and REDIS_REPLY_BIGNUM. */
|
||||
char vtype[4]; /* Used for REDIS_REPLY_VERB, contains the null
|
||||
terminated 3 character content type, such as "txt". */
|
||||
size_t elements; /* number of elements, for REDIS_REPLY_ARRAY */
|
||||
@@ -127,8 +134,8 @@ void freeReplyObject(void *reply);
|
||||
/* Functions to format a command according to the protocol. */
|
||||
int redisvFormatCommand(char **target, const char *format, va_list ap);
|
||||
int redisFormatCommand(char **target, const char *format, ...);
|
||||
int redisFormatCommandArgv(char **target, int argc, const char **argv, const size_t *argvlen);
|
||||
int redisFormatSdsCommandArgv(hisds *target, int argc, const char ** argv, const size_t *argvlen);
|
||||
long long redisFormatCommandArgv(char **target, int argc, const char **argv, const size_t *argvlen);
|
||||
long long redisFormatSdsCommandArgv(hisds *target, int argc, const char ** argv, const size_t *argvlen);
|
||||
void redisFreeCommand(char *cmd);
|
||||
void redisFreeSdsCommand(hisds cmd);
|
||||
|
||||
@@ -152,6 +159,11 @@ struct redisSsl;
|
||||
/* Don't automatically intercept and free RESP3 PUSH replies. */
|
||||
#define REDIS_OPT_NO_PUSH_AUTOFREE 0x08
|
||||
|
||||
/**
|
||||
* Don't automatically free replies
|
||||
*/
|
||||
#define REDIS_OPT_NOAUTOFREEREPLIES 0x10
|
||||
|
||||
/* In Unix systems a file descriptor is a regular signed int, with -1
|
||||
* representing an invalid descriptor. In Windows it is a SOCKET
|
||||
* (32- or 64-bit unsigned integer depending on the architecture), where
|
||||
@@ -255,7 +267,7 @@ typedef struct redisContext {
|
||||
} unix_sock;
|
||||
|
||||
/* For non-blocking connect */
|
||||
struct sockadr *saddr;
|
||||
struct sockaddr *saddr;
|
||||
size_t addrlen;
|
||||
|
||||
/* Optional data and corresponding destructor users can use to provide
|
||||
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)\..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
||||
Vendored
+3
-1
@@ -56,7 +56,9 @@ typedef enum {
|
||||
REDIS_SSL_CTX_CERT_KEY_REQUIRED, /* Client cert and key must both be specified or skipped */
|
||||
REDIS_SSL_CTX_CA_CERT_LOAD_FAILED, /* Failed to load CA Certificate or CA Path */
|
||||
REDIS_SSL_CTX_CLIENT_CERT_LOAD_FAILED, /* Failed to load client certificate */
|
||||
REDIS_SSL_CTX_PRIVATE_KEY_LOAD_FAILED /* Failed to load private key */
|
||||
REDIS_SSL_CTX_PRIVATE_KEY_LOAD_FAILED, /* Failed to load private key */
|
||||
REDIS_SSL_CTX_OS_CERTSTORE_OPEN_FAILED, /* Failed to open system certificate store */
|
||||
REDIS_SSL_CTX_OS_CERT_ADD_FAILED /* Failed to add CA certificates obtained from system to the SSL context */
|
||||
} redisSSLContextError;
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+94
-48
@@ -123,29 +123,28 @@ static char *readBytes(redisReader *r, unsigned int bytes) {
|
||||
|
||||
/* Find pointer to \r\n. */
|
||||
static char *seekNewline(char *s, size_t len) {
|
||||
int pos = 0;
|
||||
int _len = len-1;
|
||||
char *ret;
|
||||
|
||||
/* Position should be < len-1 because the character at "pos" should be
|
||||
* followed by a \n. Note that strchr cannot be used because it doesn't
|
||||
* allow to search a limited length and the buffer that is being searched
|
||||
* might not have a trailing NULL character. */
|
||||
while (pos < _len) {
|
||||
while(pos < _len && s[pos] != '\r') pos++;
|
||||
if (pos==_len) {
|
||||
/* Not found. */
|
||||
return NULL;
|
||||
} else {
|
||||
if (s[pos+1] == '\n') {
|
||||
/* Found. */
|
||||
return s+pos;
|
||||
} else {
|
||||
/* Continue searching. */
|
||||
pos++;
|
||||
}
|
||||
/* We cannot match with fewer than 2 bytes */
|
||||
if (len < 2)
|
||||
return NULL;
|
||||
|
||||
/* Search up to len - 1 characters */
|
||||
len--;
|
||||
|
||||
/* Look for the \r */
|
||||
while ((ret = memchr(s, '\r', len)) != NULL) {
|
||||
if (ret[1] == '\n') {
|
||||
/* Found. */
|
||||
break;
|
||||
}
|
||||
/* Continue searching. */
|
||||
ret++;
|
||||
len -= ret - s;
|
||||
s = ret;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Convert a string into a long long. Returns REDIS_OK if the string could be
|
||||
@@ -274,60 +273,104 @@ static int processLineItem(redisReader *r) {
|
||||
|
||||
if ((p = readLine(r,&len)) != NULL) {
|
||||
if (cur->type == REDIS_REPLY_INTEGER) {
|
||||
long long v;
|
||||
|
||||
if (string2ll(p, len, &v) == REDIS_ERR) {
|
||||
__redisReaderSetError(r,REDIS_ERR_PROTOCOL,
|
||||
"Bad integer value");
|
||||
return REDIS_ERR;
|
||||
}
|
||||
|
||||
if (r->fn && r->fn->createInteger) {
|
||||
long long v;
|
||||
if (string2ll(p, len, &v) == REDIS_ERR) {
|
||||
__redisReaderSetError(r,REDIS_ERR_PROTOCOL,
|
||||
"Bad integer value");
|
||||
return REDIS_ERR;
|
||||
}
|
||||
obj = r->fn->createInteger(cur,v);
|
||||
} else {
|
||||
obj = (void*)REDIS_REPLY_INTEGER;
|
||||
}
|
||||
} else if (cur->type == REDIS_REPLY_DOUBLE) {
|
||||
if (r->fn && r->fn->createDouble) {
|
||||
char buf[326], *eptr;
|
||||
double d;
|
||||
char buf[326], *eptr;
|
||||
double d;
|
||||
|
||||
if ((size_t)len >= sizeof(buf)) {
|
||||
if ((size_t)len >= sizeof(buf)) {
|
||||
__redisReaderSetError(r,REDIS_ERR_PROTOCOL,
|
||||
"Double value is too large");
|
||||
return REDIS_ERR;
|
||||
}
|
||||
|
||||
memcpy(buf,p,len);
|
||||
buf[len] = '\0';
|
||||
|
||||
if (len == 3 && strcasecmp(buf,"inf") == 0) {
|
||||
d = INFINITY; /* Positive infinite. */
|
||||
} else if (len == 4 && strcasecmp(buf,"-inf") == 0) {
|
||||
d = -INFINITY; /* Negative infinite. */
|
||||
} else {
|
||||
d = strtod((char*)buf,&eptr);
|
||||
/* RESP3 only allows "inf", "-inf", and finite values, while
|
||||
* strtod() allows other variations on infinity, NaN,
|
||||
* etc. We explicity handle our two allowed infinite cases
|
||||
* above, so strtod() should only result in finite values. */
|
||||
if (buf[0] == '\0' || eptr != &buf[len] || !isfinite(d)) {
|
||||
__redisReaderSetError(r,REDIS_ERR_PROTOCOL,
|
||||
"Double value is too large");
|
||||
"Bad double value");
|
||||
return REDIS_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(buf,p,len);
|
||||
buf[len] = '\0';
|
||||
|
||||
if (strcasecmp(buf,",inf") == 0) {
|
||||
d = INFINITY; /* Positive infinite. */
|
||||
} else if (strcasecmp(buf,",-inf") == 0) {
|
||||
d = -INFINITY; /* Negative infinite. */
|
||||
} else {
|
||||
d = strtod((char*)buf,&eptr);
|
||||
if (buf[0] == '\0' || eptr[0] != '\0' || isnan(d)) {
|
||||
__redisReaderSetError(r,REDIS_ERR_PROTOCOL,
|
||||
"Bad double value");
|
||||
return REDIS_ERR;
|
||||
}
|
||||
}
|
||||
if (r->fn && r->fn->createDouble) {
|
||||
obj = r->fn->createDouble(cur,d,buf,len);
|
||||
} else {
|
||||
obj = (void*)REDIS_REPLY_DOUBLE;
|
||||
}
|
||||
} else if (cur->type == REDIS_REPLY_NIL) {
|
||||
if (len != 0) {
|
||||
__redisReaderSetError(r,REDIS_ERR_PROTOCOL,
|
||||
"Bad nil value");
|
||||
return REDIS_ERR;
|
||||
}
|
||||
|
||||
if (r->fn && r->fn->createNil)
|
||||
obj = r->fn->createNil(cur);
|
||||
else
|
||||
obj = (void*)REDIS_REPLY_NIL;
|
||||
} else if (cur->type == REDIS_REPLY_BOOL) {
|
||||
int bval = p[0] == 't' || p[0] == 'T';
|
||||
int bval;
|
||||
|
||||
if (len != 1 || !strchr("tTfF", p[0])) {
|
||||
__redisReaderSetError(r,REDIS_ERR_PROTOCOL,
|
||||
"Bad bool value");
|
||||
return REDIS_ERR;
|
||||
}
|
||||
|
||||
bval = p[0] == 't' || p[0] == 'T';
|
||||
if (r->fn && r->fn->createBool)
|
||||
obj = r->fn->createBool(cur,bval);
|
||||
else
|
||||
obj = (void*)REDIS_REPLY_BOOL;
|
||||
} else if (cur->type == REDIS_REPLY_BIGNUM) {
|
||||
/* Ensure all characters are decimal digits (with possible leading
|
||||
* minus sign). */
|
||||
for (int i = 0; i < len; i++) {
|
||||
/* XXX Consider: Allow leading '+'? Error on leading '0's? */
|
||||
if (i == 0 && p[0] == '-') continue;
|
||||
if (p[i] < '0' || p[i] > '9') {
|
||||
__redisReaderSetError(r,REDIS_ERR_PROTOCOL,
|
||||
"Bad bignum value");
|
||||
return REDIS_ERR;
|
||||
}
|
||||
}
|
||||
if (r->fn && r->fn->createString)
|
||||
obj = r->fn->createString(cur,p,len);
|
||||
else
|
||||
obj = (void*)REDIS_REPLY_BIGNUM;
|
||||
} else {
|
||||
/* Type will be error or status. */
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (p[i] == '\r' || p[i] == '\n') {
|
||||
__redisReaderSetError(r,REDIS_ERR_PROTOCOL,
|
||||
"Bad simple string value");
|
||||
return REDIS_ERR;
|
||||
}
|
||||
}
|
||||
if (r->fn && r->fn->createString)
|
||||
obj = r->fn->createString(cur,p,len);
|
||||
else
|
||||
@@ -453,7 +496,6 @@ static int processAggregateItem(redisReader *r) {
|
||||
long long elements;
|
||||
int root = 0, len;
|
||||
|
||||
/* Set error for nested multi bulks with depth > 7 */
|
||||
if (r->ridx == r->tasks - 1) {
|
||||
if (redisReaderGrow(r) == REDIS_ERR)
|
||||
return REDIS_ERR;
|
||||
@@ -569,6 +611,9 @@ static int processItem(redisReader *r) {
|
||||
case '>':
|
||||
cur->type = REDIS_REPLY_PUSH;
|
||||
break;
|
||||
case '(':
|
||||
cur->type = REDIS_REPLY_BIGNUM;
|
||||
break;
|
||||
default:
|
||||
__redisReaderSetErrorProtocolByte(r,*p);
|
||||
return REDIS_ERR;
|
||||
@@ -587,6 +632,7 @@ static int processItem(redisReader *r) {
|
||||
case REDIS_REPLY_DOUBLE:
|
||||
case REDIS_REPLY_NIL:
|
||||
case REDIS_REPLY_BOOL:
|
||||
case REDIS_REPLY_BIGNUM:
|
||||
return processLineItem(r);
|
||||
case REDIS_REPLY_STRING:
|
||||
case REDIS_REPLY_VERB:
|
||||
|
||||
Vendored
+2
-2
@@ -72,7 +72,7 @@ static inline char hi_sdsReqType(size_t string_size) {
|
||||
* and 'initlen'.
|
||||
* If NULL is used for 'init' the string is initialized with zero bytes.
|
||||
*
|
||||
* The string is always null-termined (all the hisds strings are, always) so
|
||||
* The string is always null-terminated (all the hisds strings are, always) so
|
||||
* even if you create an hisds string with:
|
||||
*
|
||||
* mystring = hi_sdsnewlen("abc",3);
|
||||
@@ -415,7 +415,7 @@ hisds hi_sdscpylen(hisds s, const char *t, size_t len) {
|
||||
return s;
|
||||
}
|
||||
|
||||
/* Like hi_sdscpylen() but 't' must be a null-termined string so that the length
|
||||
/* Like hi_sdscpylen() but 't' must be a null-terminated string so that the length
|
||||
* of the string is obtained with strlen(). */
|
||||
hisds hi_sdscpy(hisds s, const char *t) {
|
||||
return hi_sdscpylen(s, t, strlen(t));
|
||||
|
||||
Vendored
+44
-1
@@ -38,6 +38,7 @@
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
@@ -182,6 +183,10 @@ const char *redisSSLContextGetError(redisSSLContextError error)
|
||||
return "Failed to load client certificate";
|
||||
case REDIS_SSL_CTX_PRIVATE_KEY_LOAD_FAILED:
|
||||
return "Failed to load private key";
|
||||
case REDIS_SSL_CTX_OS_CERTSTORE_OPEN_FAILED:
|
||||
return "Failed to open system certificate store";
|
||||
case REDIS_SSL_CTX_OS_CERT_ADD_FAILED:
|
||||
return "Failed to add CA certificates obtained from system to the SSL context";
|
||||
default:
|
||||
return "Unknown error code";
|
||||
}
|
||||
@@ -214,6 +219,11 @@ redisSSLContext *redisCreateSSLContext(const char *cacert_filename, const char *
|
||||
const char *cert_filename, const char *private_key_filename,
|
||||
const char *server_name, redisSSLContextError *error)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
HCERTSTORE win_store = NULL;
|
||||
PCCERT_CONTEXT win_ctx = NULL;
|
||||
#endif
|
||||
|
||||
redisSSLContext *ctx = hi_calloc(1, sizeof(redisSSLContext));
|
||||
if (ctx == NULL)
|
||||
goto error;
|
||||
@@ -234,6 +244,31 @@ redisSSLContext *redisCreateSSLContext(const char *cacert_filename, const char *
|
||||
}
|
||||
|
||||
if (capath || cacert_filename) {
|
||||
#ifdef _WIN32
|
||||
if (0 == strcmp(cacert_filename, "wincert")) {
|
||||
win_store = CertOpenSystemStore(NULL, "Root");
|
||||
if (!win_store) {
|
||||
if (error) *error = REDIS_SSL_CTX_OS_CERTSTORE_OPEN_FAILED;
|
||||
goto error;
|
||||
}
|
||||
X509_STORE* store = SSL_CTX_get_cert_store(ctx->ssl_ctx);
|
||||
while (win_ctx = CertEnumCertificatesInStore(win_store, win_ctx)) {
|
||||
X509* x509 = NULL;
|
||||
x509 = d2i_X509(NULL, (const unsigned char**)&win_ctx->pbCertEncoded, win_ctx->cbCertEncoded);
|
||||
if (x509) {
|
||||
if ((1 != X509_STORE_add_cert(store, x509)) ||
|
||||
(1 != SSL_CTX_add_client_CA(ctx->ssl_ctx, x509)))
|
||||
{
|
||||
if (error) *error = REDIS_SSL_CTX_OS_CERT_ADD_FAILED;
|
||||
goto error;
|
||||
}
|
||||
X509_free(x509);
|
||||
}
|
||||
}
|
||||
CertFreeCertificateContext(win_ctx);
|
||||
CertCloseStore(win_store, 0);
|
||||
} else
|
||||
#endif
|
||||
if (!SSL_CTX_load_verify_locations(ctx->ssl_ctx, cacert_filename, capath)) {
|
||||
if (error) *error = REDIS_SSL_CTX_CA_CERT_LOAD_FAILED;
|
||||
goto error;
|
||||
@@ -257,6 +292,10 @@ redisSSLContext *redisCreateSSLContext(const char *cacert_filename, const char *
|
||||
return ctx;
|
||||
|
||||
error:
|
||||
#ifdef _WIN32
|
||||
CertFreeCertificateContext(win_ctx);
|
||||
CertCloseStore(win_store, 0);
|
||||
#endif
|
||||
redisFreeSSLContext(ctx);
|
||||
return NULL;
|
||||
}
|
||||
@@ -353,7 +392,11 @@ int redisInitiateSSLWithContext(redisContext *c, redisSSLContext *redis_ssl_ctx)
|
||||
}
|
||||
}
|
||||
|
||||
return redisSSLConnect(c, ssl);
|
||||
if (redisSSLConnect(c, ssl) != REDIS_OK) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
return REDIS_OK;
|
||||
|
||||
error:
|
||||
if (ssl)
|
||||
|
||||
Vendored
+630
@@ -11,12 +11,17 @@
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "hiredis.h"
|
||||
#include "async.h"
|
||||
#ifdef HIREDIS_TEST_SSL
|
||||
#include "hiredis_ssl.h"
|
||||
#endif
|
||||
#ifdef HIREDIS_TEST_ASYNC
|
||||
#include "adapters/libevent.h"
|
||||
#include <event2/event.h>
|
||||
#endif
|
||||
#include "net.h"
|
||||
#include "win32.h"
|
||||
|
||||
@@ -58,6 +63,8 @@ struct pushCounters {
|
||||
int str;
|
||||
};
|
||||
|
||||
static int insecure_calloc_calls;
|
||||
|
||||
#ifdef HIREDIS_TEST_SSL
|
||||
redisSSLContext *_ssl_ctx = NULL;
|
||||
#endif
|
||||
@@ -498,6 +505,20 @@ static void test_reply_reader(void) {
|
||||
freeReplyObject(reply);
|
||||
redisReaderFree(reader);
|
||||
|
||||
test("Multi-bulk never overflows regardless of maxelements: ");
|
||||
size_t bad_mbulk_len = (SIZE_MAX / sizeof(void *)) + 3;
|
||||
char bad_mbulk_reply[100];
|
||||
snprintf(bad_mbulk_reply, sizeof(bad_mbulk_reply), "*%llu\r\n+asdf\r\n",
|
||||
(unsigned long long) bad_mbulk_len);
|
||||
|
||||
reader = redisReaderCreate();
|
||||
reader->maxelements = 0; /* Don't rely on default limit */
|
||||
redisReaderFeed(reader, bad_mbulk_reply, strlen(bad_mbulk_reply));
|
||||
ret = redisReaderGetReply(reader,&reply);
|
||||
test_cond(ret == REDIS_ERR && strcasecmp(reader->errstr, "Out of memory") == 0);
|
||||
freeReplyObject(reply);
|
||||
redisReaderFree(reader);
|
||||
|
||||
#if LLONG_MAX > SIZE_MAX
|
||||
test("Set error when array > SIZE_MAX: ");
|
||||
reader = redisReaderCreate();
|
||||
@@ -583,6 +604,147 @@ static void test_reply_reader(void) {
|
||||
((redisReply*)reply)->element[1]->integer == 42);
|
||||
freeReplyObject(reply);
|
||||
redisReaderFree(reader);
|
||||
|
||||
test("Can parse RESP3 doubles: ");
|
||||
reader = redisReaderCreate();
|
||||
redisReaderFeed(reader, ",3.14159265358979323846\r\n",25);
|
||||
ret = redisReaderGetReply(reader,&reply);
|
||||
test_cond(ret == REDIS_OK &&
|
||||
((redisReply*)reply)->type == REDIS_REPLY_DOUBLE &&
|
||||
fabs(((redisReply*)reply)->dval - 3.14159265358979323846) < 0.00000001 &&
|
||||
((redisReply*)reply)->len == 22 &&
|
||||
strcmp(((redisReply*)reply)->str, "3.14159265358979323846") == 0);
|
||||
freeReplyObject(reply);
|
||||
redisReaderFree(reader);
|
||||
|
||||
test("Set error on invalid RESP3 double: ");
|
||||
reader = redisReaderCreate();
|
||||
redisReaderFeed(reader, ",3.14159\000265358979323846\r\n",26);
|
||||
ret = redisReaderGetReply(reader,&reply);
|
||||
test_cond(ret == REDIS_ERR &&
|
||||
strcasecmp(reader->errstr,"Bad double value") == 0);
|
||||
freeReplyObject(reply);
|
||||
redisReaderFree(reader);
|
||||
|
||||
test("Correctly parses RESP3 double INFINITY: ");
|
||||
reader = redisReaderCreate();
|
||||
redisReaderFeed(reader, ",inf\r\n",6);
|
||||
ret = redisReaderGetReply(reader,&reply);
|
||||
test_cond(ret == REDIS_OK &&
|
||||
((redisReply*)reply)->type == REDIS_REPLY_DOUBLE &&
|
||||
isinf(((redisReply*)reply)->dval) &&
|
||||
((redisReply*)reply)->dval > 0);
|
||||
freeReplyObject(reply);
|
||||
redisReaderFree(reader);
|
||||
|
||||
test("Set error when RESP3 double is NaN: ");
|
||||
reader = redisReaderCreate();
|
||||
redisReaderFeed(reader, ",nan\r\n",6);
|
||||
ret = redisReaderGetReply(reader,&reply);
|
||||
test_cond(ret == REDIS_ERR &&
|
||||
strcasecmp(reader->errstr,"Bad double value") == 0);
|
||||
freeReplyObject(reply);
|
||||
redisReaderFree(reader);
|
||||
|
||||
test("Can parse RESP3 nil: ");
|
||||
reader = redisReaderCreate();
|
||||
redisReaderFeed(reader, "_\r\n",3);
|
||||
ret = redisReaderGetReply(reader,&reply);
|
||||
test_cond(ret == REDIS_OK &&
|
||||
((redisReply*)reply)->type == REDIS_REPLY_NIL);
|
||||
freeReplyObject(reply);
|
||||
redisReaderFree(reader);
|
||||
|
||||
test("Set error on invalid RESP3 nil: ");
|
||||
reader = redisReaderCreate();
|
||||
redisReaderFeed(reader, "_nil\r\n",6);
|
||||
ret = redisReaderGetReply(reader,&reply);
|
||||
test_cond(ret == REDIS_ERR &&
|
||||
strcasecmp(reader->errstr,"Bad nil value") == 0);
|
||||
freeReplyObject(reply);
|
||||
redisReaderFree(reader);
|
||||
|
||||
test("Can parse RESP3 bool (true): ");
|
||||
reader = redisReaderCreate();
|
||||
redisReaderFeed(reader, "#t\r\n",4);
|
||||
ret = redisReaderGetReply(reader,&reply);
|
||||
test_cond(ret == REDIS_OK &&
|
||||
((redisReply*)reply)->type == REDIS_REPLY_BOOL &&
|
||||
((redisReply*)reply)->integer);
|
||||
freeReplyObject(reply);
|
||||
redisReaderFree(reader);
|
||||
|
||||
test("Can parse RESP3 bool (false): ");
|
||||
reader = redisReaderCreate();
|
||||
redisReaderFeed(reader, "#f\r\n",4);
|
||||
ret = redisReaderGetReply(reader,&reply);
|
||||
test_cond(ret == REDIS_OK &&
|
||||
((redisReply*)reply)->type == REDIS_REPLY_BOOL &&
|
||||
!((redisReply*)reply)->integer);
|
||||
freeReplyObject(reply);
|
||||
redisReaderFree(reader);
|
||||
|
||||
test("Set error on invalid RESP3 bool: ");
|
||||
reader = redisReaderCreate();
|
||||
redisReaderFeed(reader, "#foobar\r\n",9);
|
||||
ret = redisReaderGetReply(reader,&reply);
|
||||
test_cond(ret == REDIS_ERR &&
|
||||
strcasecmp(reader->errstr,"Bad bool value") == 0);
|
||||
freeReplyObject(reply);
|
||||
redisReaderFree(reader);
|
||||
|
||||
test("Can parse RESP3 map: ");
|
||||
reader = redisReaderCreate();
|
||||
redisReaderFeed(reader, "%2\r\n+first\r\n:123\r\n$6\r\nsecond\r\n#t\r\n",34);
|
||||
ret = redisReaderGetReply(reader,&reply);
|
||||
test_cond(ret == REDIS_OK &&
|
||||
((redisReply*)reply)->type == REDIS_REPLY_MAP &&
|
||||
((redisReply*)reply)->elements == 4 &&
|
||||
((redisReply*)reply)->element[0]->type == REDIS_REPLY_STATUS &&
|
||||
((redisReply*)reply)->element[0]->len == 5 &&
|
||||
!strcmp(((redisReply*)reply)->element[0]->str,"first") &&
|
||||
((redisReply*)reply)->element[1]->type == REDIS_REPLY_INTEGER &&
|
||||
((redisReply*)reply)->element[1]->integer == 123 &&
|
||||
((redisReply*)reply)->element[2]->type == REDIS_REPLY_STRING &&
|
||||
((redisReply*)reply)->element[2]->len == 6 &&
|
||||
!strcmp(((redisReply*)reply)->element[2]->str,"second") &&
|
||||
((redisReply*)reply)->element[3]->type == REDIS_REPLY_BOOL &&
|
||||
((redisReply*)reply)->element[3]->integer);
|
||||
freeReplyObject(reply);
|
||||
redisReaderFree(reader);
|
||||
|
||||
test("Can parse RESP3 set: ");
|
||||
reader = redisReaderCreate();
|
||||
redisReaderFeed(reader, "~5\r\n+orange\r\n$5\r\napple\r\n#f\r\n:100\r\n:999\r\n",40);
|
||||
ret = redisReaderGetReply(reader,&reply);
|
||||
test_cond(ret == REDIS_OK &&
|
||||
((redisReply*)reply)->type == REDIS_REPLY_SET &&
|
||||
((redisReply*)reply)->elements == 5 &&
|
||||
((redisReply*)reply)->element[0]->type == REDIS_REPLY_STATUS &&
|
||||
((redisReply*)reply)->element[0]->len == 6 &&
|
||||
!strcmp(((redisReply*)reply)->element[0]->str,"orange") &&
|
||||
((redisReply*)reply)->element[1]->type == REDIS_REPLY_STRING &&
|
||||
((redisReply*)reply)->element[1]->len == 5 &&
|
||||
!strcmp(((redisReply*)reply)->element[1]->str,"apple") &&
|
||||
((redisReply*)reply)->element[2]->type == REDIS_REPLY_BOOL &&
|
||||
!((redisReply*)reply)->element[2]->integer &&
|
||||
((redisReply*)reply)->element[3]->type == REDIS_REPLY_INTEGER &&
|
||||
((redisReply*)reply)->element[3]->integer == 100 &&
|
||||
((redisReply*)reply)->element[4]->type == REDIS_REPLY_INTEGER &&
|
||||
((redisReply*)reply)->element[4]->integer == 999);
|
||||
freeReplyObject(reply);
|
||||
redisReaderFree(reader);
|
||||
|
||||
test("Can parse RESP3 bignum: ");
|
||||
reader = redisReaderCreate();
|
||||
redisReaderFeed(reader,"(3492890328409238509324850943850943825024385\r\n",46);
|
||||
ret = redisReaderGetReply(reader,&reply);
|
||||
test_cond(ret == REDIS_OK &&
|
||||
((redisReply*)reply)->type == REDIS_REPLY_BIGNUM &&
|
||||
((redisReply*)reply)->len == 43 &&
|
||||
!strcmp(((redisReply*)reply)->str,"3492890328409238509324850943850943825024385"));
|
||||
freeReplyObject(reply);
|
||||
redisReaderFree(reader);
|
||||
}
|
||||
|
||||
static void test_free_null(void) {
|
||||
@@ -609,6 +771,13 @@ static void *hi_calloc_fail(size_t nmemb, size_t size) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *hi_calloc_insecure(size_t nmemb, size_t size) {
|
||||
(void)nmemb;
|
||||
(void)size;
|
||||
insecure_calloc_calls++;
|
||||
return (void*)0xdeadc0de;
|
||||
}
|
||||
|
||||
static void *hi_realloc_fail(void *ptr, size_t size) {
|
||||
(void)ptr;
|
||||
(void)size;
|
||||
@@ -616,6 +785,8 @@ static void *hi_realloc_fail(void *ptr, size_t size) {
|
||||
}
|
||||
|
||||
static void test_allocator_injection(void) {
|
||||
void *ptr;
|
||||
|
||||
hiredisAllocFuncs ha = {
|
||||
.mallocFn = hi_malloc_fail,
|
||||
.callocFn = hi_calloc_fail,
|
||||
@@ -635,6 +806,13 @@ static void test_allocator_injection(void) {
|
||||
redisReader *reader = redisReaderCreate();
|
||||
test_cond(reader == NULL);
|
||||
|
||||
/* Make sure hiredis itself protects against a non-overflow checking calloc */
|
||||
test("hiredis calloc wrapper protects against overflow: ");
|
||||
ha.callocFn = hi_calloc_insecure;
|
||||
hiredisSetAllocators(&ha);
|
||||
ptr = hi_calloc((SIZE_MAX / sizeof(void*)) + 3, sizeof(void*));
|
||||
test_cond(ptr == NULL && insecure_calloc_calls == 0);
|
||||
|
||||
// Return allocators to default
|
||||
hiredisResetAllocators();
|
||||
}
|
||||
@@ -1269,6 +1447,440 @@ static void test_throughput(struct config config) {
|
||||
// redisFree(c);
|
||||
// }
|
||||
|
||||
#ifdef HIREDIS_TEST_ASYNC
|
||||
struct event_base *base;
|
||||
|
||||
typedef struct TestState {
|
||||
redisOptions *options;
|
||||
int checkpoint;
|
||||
int resp3;
|
||||
int disconnect;
|
||||
} TestState;
|
||||
|
||||
/* Helper to disconnect and stop event loop */
|
||||
void async_disconnect(redisAsyncContext *ac) {
|
||||
redisAsyncDisconnect(ac);
|
||||
event_base_loopbreak(base);
|
||||
}
|
||||
|
||||
/* Testcase timeout, will trigger a failure */
|
||||
void timeout_cb(int fd, short event, void *arg) {
|
||||
(void) fd; (void) event; (void) arg;
|
||||
printf("Timeout in async testing!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Unexpected call, will trigger a failure */
|
||||
void unexpected_cb(redisAsyncContext *ac, void *r, void *privdata) {
|
||||
(void) ac; (void) r;
|
||||
printf("Unexpected call: %s\n",(char*)privdata);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Helper function to publish a message via own client. */
|
||||
void publish_msg(redisOptions *options, const char* channel, const char* msg) {
|
||||
redisContext *c = redisConnectWithOptions(options);
|
||||
assert(c != NULL);
|
||||
redisReply *reply = redisCommand(c,"PUBLISH %s %s",channel,msg);
|
||||
assert(reply->type == REDIS_REPLY_INTEGER && reply->integer == 1);
|
||||
freeReplyObject(reply);
|
||||
disconnect(c, 0);
|
||||
}
|
||||
|
||||
/* Expect a reply of type INTEGER */
|
||||
void integer_cb(redisAsyncContext *ac, void *r, void *privdata) {
|
||||
redisReply *reply = r;
|
||||
TestState *state = privdata;
|
||||
assert(reply != NULL && reply->type == REDIS_REPLY_INTEGER);
|
||||
state->checkpoint++;
|
||||
if (state->disconnect) async_disconnect(ac);
|
||||
}
|
||||
|
||||
/* Subscribe callback for test_pubsub_handling and test_pubsub_handling_resp3:
|
||||
* - a published message triggers an unsubscribe
|
||||
* - a command is sent before the unsubscribe response is received. */
|
||||
void subscribe_cb(redisAsyncContext *ac, void *r, void *privdata) {
|
||||
redisReply *reply = r;
|
||||
TestState *state = privdata;
|
||||
|
||||
assert(reply != NULL &&
|
||||
reply->type == (state->resp3 ? REDIS_REPLY_PUSH : REDIS_REPLY_ARRAY) &&
|
||||
reply->elements == 3);
|
||||
|
||||
if (strcmp(reply->element[0]->str,"subscribe") == 0) {
|
||||
assert(strcmp(reply->element[1]->str,"mychannel") == 0 &&
|
||||
reply->element[2]->str == NULL);
|
||||
publish_msg(state->options,"mychannel","Hello!");
|
||||
} else if (strcmp(reply->element[0]->str,"message") == 0) {
|
||||
assert(strcmp(reply->element[1]->str,"mychannel") == 0 &&
|
||||
strcmp(reply->element[2]->str,"Hello!") == 0);
|
||||
state->checkpoint++;
|
||||
|
||||
/* Unsubscribe after receiving the published message. Send unsubscribe
|
||||
* which should call the callback registered during subscribe */
|
||||
redisAsyncCommand(ac,unexpected_cb,
|
||||
(void*)"unsubscribe should call subscribe_cb()",
|
||||
"unsubscribe");
|
||||
/* Send a regular command after unsubscribing, then disconnect */
|
||||
state->disconnect = 1;
|
||||
redisAsyncCommand(ac,integer_cb,state,"LPUSH mylist foo");
|
||||
|
||||
} else if (strcmp(reply->element[0]->str,"unsubscribe") == 0) {
|
||||
assert(strcmp(reply->element[1]->str,"mychannel") == 0 &&
|
||||
reply->element[2]->str == NULL);
|
||||
} else {
|
||||
printf("Unexpected pubsub command: %s\n", reply->element[0]->str);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Expect a reply of type ARRAY */
|
||||
void array_cb(redisAsyncContext *ac, void *r, void *privdata) {
|
||||
redisReply *reply = r;
|
||||
TestState *state = privdata;
|
||||
assert(reply != NULL && reply->type == REDIS_REPLY_ARRAY);
|
||||
state->checkpoint++;
|
||||
if (state->disconnect) async_disconnect(ac);
|
||||
}
|
||||
|
||||
/* Expect a NULL reply */
|
||||
void null_cb(redisAsyncContext *ac, void *r, void *privdata) {
|
||||
(void) ac;
|
||||
assert(r == NULL);
|
||||
TestState *state = privdata;
|
||||
state->checkpoint++;
|
||||
}
|
||||
|
||||
static void test_pubsub_handling(struct config config) {
|
||||
test("Subscribe, handle published message and unsubscribe: ");
|
||||
/* Setup event dispatcher with a testcase timeout */
|
||||
base = event_base_new();
|
||||
struct event *timeout = evtimer_new(base, timeout_cb, NULL);
|
||||
assert(timeout != NULL);
|
||||
|
||||
evtimer_assign(timeout,base,timeout_cb,NULL);
|
||||
struct timeval timeout_tv = {.tv_sec = 10};
|
||||
evtimer_add(timeout, &timeout_tv);
|
||||
|
||||
/* Connect */
|
||||
redisOptions options = get_redis_tcp_options(config);
|
||||
redisAsyncContext *ac = redisAsyncConnectWithOptions(&options);
|
||||
assert(ac != NULL && ac->err == 0);
|
||||
redisLibeventAttach(ac,base);
|
||||
|
||||
/* Start subscribe */
|
||||
TestState state = {.options = &options};
|
||||
redisAsyncCommand(ac,subscribe_cb,&state,"subscribe mychannel");
|
||||
|
||||
/* Make sure non-subscribe commands are handled */
|
||||
redisAsyncCommand(ac,array_cb,&state,"PING");
|
||||
|
||||
/* Start event dispatching loop */
|
||||
test_cond(event_base_dispatch(base) == 0);
|
||||
event_free(timeout);
|
||||
event_base_free(base);
|
||||
|
||||
/* Verify test checkpoints */
|
||||
assert(state.checkpoint == 3);
|
||||
}
|
||||
|
||||
/* Unexpected push message, will trigger a failure */
|
||||
void unexpected_push_cb(redisAsyncContext *ac, void *r) {
|
||||
(void) ac; (void) r;
|
||||
printf("Unexpected call to the PUSH callback!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void test_pubsub_handling_resp3(struct config config) {
|
||||
test("Subscribe, handle published message and unsubscribe using RESP3: ");
|
||||
/* Setup event dispatcher with a testcase timeout */
|
||||
base = event_base_new();
|
||||
struct event *timeout = evtimer_new(base, timeout_cb, NULL);
|
||||
assert(timeout != NULL);
|
||||
|
||||
evtimer_assign(timeout,base,timeout_cb,NULL);
|
||||
struct timeval timeout_tv = {.tv_sec = 10};
|
||||
evtimer_add(timeout, &timeout_tv);
|
||||
|
||||
/* Connect */
|
||||
redisOptions options = get_redis_tcp_options(config);
|
||||
redisAsyncContext *ac = redisAsyncConnectWithOptions(&options);
|
||||
assert(ac != NULL && ac->err == 0);
|
||||
redisLibeventAttach(ac,base);
|
||||
|
||||
/* Not expecting any push messages in this test */
|
||||
redisAsyncSetPushCallback(ac, unexpected_push_cb);
|
||||
|
||||
/* Switch protocol */
|
||||
redisAsyncCommand(ac,NULL,NULL,"HELLO 3");
|
||||
|
||||
/* Start subscribe */
|
||||
TestState state = {.options = &options, .resp3 = 1};
|
||||
redisAsyncCommand(ac,subscribe_cb,&state,"subscribe mychannel");
|
||||
|
||||
/* Make sure non-subscribe commands are handled in RESP3 */
|
||||
redisAsyncCommand(ac,integer_cb,&state,"LPUSH mylist foo");
|
||||
redisAsyncCommand(ac,integer_cb,&state,"LPUSH mylist foo");
|
||||
redisAsyncCommand(ac,integer_cb,&state,"LPUSH mylist foo");
|
||||
/* Handle an array with 3 elements as a non-subscribe command */
|
||||
redisAsyncCommand(ac,array_cb,&state,"LRANGE mylist 0 2");
|
||||
|
||||
/* Start event dispatching loop */
|
||||
test_cond(event_base_dispatch(base) == 0);
|
||||
event_free(timeout);
|
||||
event_base_free(base);
|
||||
|
||||
/* Verify test checkpoints */
|
||||
assert(state.checkpoint == 6);
|
||||
}
|
||||
|
||||
/* Subscribe callback for test_command_timeout_during_pubsub:
|
||||
* - a subscribe response triggers a published message
|
||||
* - the published message triggers a command that times out
|
||||
* - the command timeout triggers a disconnect */
|
||||
void subscribe_with_timeout_cb(redisAsyncContext *ac, void *r, void *privdata) {
|
||||
redisReply *reply = r;
|
||||
TestState *state = privdata;
|
||||
|
||||
/* The non-clean disconnect should trigger the
|
||||
* subscription callback with a NULL reply. */
|
||||
if (reply == NULL) {
|
||||
state->checkpoint++;
|
||||
event_base_loopbreak(base);
|
||||
return;
|
||||
}
|
||||
|
||||
assert(reply->type == (state->resp3 ? REDIS_REPLY_PUSH : REDIS_REPLY_ARRAY) &&
|
||||
reply->elements == 3);
|
||||
|
||||
if (strcmp(reply->element[0]->str,"subscribe") == 0) {
|
||||
assert(strcmp(reply->element[1]->str,"mychannel") == 0 &&
|
||||
reply->element[2]->str == NULL);
|
||||
publish_msg(state->options,"mychannel","Hello!");
|
||||
state->checkpoint++;
|
||||
} else if (strcmp(reply->element[0]->str,"message") == 0) {
|
||||
assert(strcmp(reply->element[1]->str,"mychannel") == 0 &&
|
||||
strcmp(reply->element[2]->str,"Hello!") == 0);
|
||||
state->checkpoint++;
|
||||
|
||||
/* Send a command that will trigger a timeout */
|
||||
redisAsyncCommand(ac,null_cb,state,"DEBUG SLEEP 3");
|
||||
redisAsyncCommand(ac,null_cb,state,"LPUSH mylist foo");
|
||||
} else {
|
||||
printf("Unexpected pubsub command: %s\n", reply->element[0]->str);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_command_timeout_during_pubsub(struct config config) {
|
||||
test("Command timeout during Pub/Sub: ");
|
||||
/* Setup event dispatcher with a testcase timeout */
|
||||
base = event_base_new();
|
||||
struct event *timeout = evtimer_new(base,timeout_cb,NULL);
|
||||
assert(timeout != NULL);
|
||||
|
||||
evtimer_assign(timeout,base,timeout_cb,NULL);
|
||||
struct timeval timeout_tv = {.tv_sec = 10};
|
||||
evtimer_add(timeout,&timeout_tv);
|
||||
|
||||
/* Connect */
|
||||
redisOptions options = get_redis_tcp_options(config);
|
||||
redisAsyncContext *ac = redisAsyncConnectWithOptions(&options);
|
||||
assert(ac != NULL && ac->err == 0);
|
||||
redisLibeventAttach(ac,base);
|
||||
|
||||
/* Configure a command timout */
|
||||
struct timeval command_timeout = {.tv_sec = 2};
|
||||
redisAsyncSetTimeout(ac,command_timeout);
|
||||
|
||||
/* Not expecting any push messages in this test */
|
||||
redisAsyncSetPushCallback(ac,unexpected_push_cb);
|
||||
|
||||
/* Switch protocol */
|
||||
redisAsyncCommand(ac,NULL,NULL,"HELLO 3");
|
||||
|
||||
/* Start subscribe */
|
||||
TestState state = {.options = &options, .resp3 = 1};
|
||||
redisAsyncCommand(ac,subscribe_with_timeout_cb,&state,"subscribe mychannel");
|
||||
|
||||
/* Start event dispatching loop */
|
||||
assert(event_base_dispatch(base) == 0);
|
||||
event_free(timeout);
|
||||
event_base_free(base);
|
||||
|
||||
/* Verify test checkpoints */
|
||||
test_cond(state.checkpoint == 5);
|
||||
}
|
||||
|
||||
/* Subscribe callback for test_pubsub_multiple_channels */
|
||||
void subscribe_channel_a_cb(redisAsyncContext *ac, void *r, void *privdata) {
|
||||
redisReply *reply = r;
|
||||
TestState *state = privdata;
|
||||
|
||||
assert(reply != NULL && reply->type == REDIS_REPLY_ARRAY &&
|
||||
reply->elements == 3);
|
||||
|
||||
if (strcmp(reply->element[0]->str,"subscribe") == 0) {
|
||||
assert(strcmp(reply->element[1]->str,"A") == 0);
|
||||
publish_msg(state->options,"A","Hello!");
|
||||
state->checkpoint++;
|
||||
} else if (strcmp(reply->element[0]->str,"message") == 0) {
|
||||
assert(strcmp(reply->element[1]->str,"A") == 0 &&
|
||||
strcmp(reply->element[2]->str,"Hello!") == 0);
|
||||
state->checkpoint++;
|
||||
|
||||
/* Unsubscribe to channels, including a channel X which we don't subscribe to */
|
||||
redisAsyncCommand(ac,unexpected_cb,
|
||||
(void*)"unsubscribe should not call unexpected_cb()",
|
||||
"unsubscribe B X A");
|
||||
/* Send a regular command after unsubscribing, then disconnect */
|
||||
state->disconnect = 1;
|
||||
redisAsyncCommand(ac,integer_cb,state,"LPUSH mylist foo");
|
||||
} else if (strcmp(reply->element[0]->str,"unsubscribe") == 0) {
|
||||
assert(strcmp(reply->element[1]->str,"A") == 0);
|
||||
state->checkpoint++;
|
||||
} else {
|
||||
printf("Unexpected pubsub command: %s\n", reply->element[0]->str);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Subscribe callback for test_pubsub_multiple_channels */
|
||||
void subscribe_channel_b_cb(redisAsyncContext *ac, void *r, void *privdata) {
|
||||
redisReply *reply = r;
|
||||
TestState *state = privdata;
|
||||
|
||||
assert(reply != NULL && reply->type == REDIS_REPLY_ARRAY &&
|
||||
reply->elements == 3);
|
||||
|
||||
if (strcmp(reply->element[0]->str,"subscribe") == 0) {
|
||||
assert(strcmp(reply->element[1]->str,"B") == 0);
|
||||
state->checkpoint++;
|
||||
} else if (strcmp(reply->element[0]->str,"unsubscribe") == 0) {
|
||||
assert(strcmp(reply->element[1]->str,"B") == 0);
|
||||
state->checkpoint++;
|
||||
} else {
|
||||
printf("Unexpected pubsub command: %s\n", reply->element[0]->str);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Test handling of multiple channels
|
||||
* - subscribe to channel A and B
|
||||
* - a published message on A triggers an unsubscribe of channel B, X and A
|
||||
* where channel X is not subscribed to.
|
||||
* - a command sent after unsubscribe triggers a disconnect */
|
||||
static void test_pubsub_multiple_channels(struct config config) {
|
||||
test("Subscribe to multiple channels: ");
|
||||
/* Setup event dispatcher with a testcase timeout */
|
||||
base = event_base_new();
|
||||
struct event *timeout = evtimer_new(base,timeout_cb,NULL);
|
||||
assert(timeout != NULL);
|
||||
|
||||
evtimer_assign(timeout,base,timeout_cb,NULL);
|
||||
struct timeval timeout_tv = {.tv_sec = 10};
|
||||
evtimer_add(timeout,&timeout_tv);
|
||||
|
||||
/* Connect */
|
||||
redisOptions options = get_redis_tcp_options(config);
|
||||
redisAsyncContext *ac = redisAsyncConnectWithOptions(&options);
|
||||
assert(ac != NULL && ac->err == 0);
|
||||
redisLibeventAttach(ac,base);
|
||||
|
||||
/* Not expecting any push messages in this test */
|
||||
redisAsyncSetPushCallback(ac,unexpected_push_cb);
|
||||
|
||||
/* Start subscribing to two channels */
|
||||
TestState state = {.options = &options};
|
||||
redisAsyncCommand(ac,subscribe_channel_a_cb,&state,"subscribe A");
|
||||
redisAsyncCommand(ac,subscribe_channel_b_cb,&state,"subscribe B");
|
||||
|
||||
/* Start event dispatching loop */
|
||||
assert(event_base_dispatch(base) == 0);
|
||||
event_free(timeout);
|
||||
event_base_free(base);
|
||||
|
||||
/* Verify test checkpoints */
|
||||
test_cond(state.checkpoint == 6);
|
||||
}
|
||||
|
||||
/* Command callback for test_monitor() */
|
||||
void monitor_cb(redisAsyncContext *ac, void *r, void *privdata) {
|
||||
redisReply *reply = r;
|
||||
TestState *state = privdata;
|
||||
|
||||
/* NULL reply is received when BYE triggers a disconnect. */
|
||||
if (reply == NULL) {
|
||||
event_base_loopbreak(base);
|
||||
return;
|
||||
}
|
||||
|
||||
assert(reply != NULL && reply->type == REDIS_REPLY_STATUS);
|
||||
state->checkpoint++;
|
||||
|
||||
if (state->checkpoint == 1) {
|
||||
/* Response from MONITOR */
|
||||
redisContext *c = redisConnectWithOptions(state->options);
|
||||
assert(c != NULL);
|
||||
redisReply *reply = redisCommand(c,"SET first 1");
|
||||
assert(reply->type == REDIS_REPLY_STATUS);
|
||||
freeReplyObject(reply);
|
||||
redisFree(c);
|
||||
} else if (state->checkpoint == 2) {
|
||||
/* Response for monitored command 'SET first 1' */
|
||||
assert(strstr(reply->str,"first") != NULL);
|
||||
redisContext *c = redisConnectWithOptions(state->options);
|
||||
assert(c != NULL);
|
||||
redisReply *reply = redisCommand(c,"SET second 2");
|
||||
assert(reply->type == REDIS_REPLY_STATUS);
|
||||
freeReplyObject(reply);
|
||||
redisFree(c);
|
||||
} else if (state->checkpoint == 3) {
|
||||
/* Response for monitored command 'SET second 2' */
|
||||
assert(strstr(reply->str,"second") != NULL);
|
||||
/* Send QUIT to disconnect */
|
||||
redisAsyncCommand(ac,NULL,NULL,"QUIT");
|
||||
}
|
||||
}
|
||||
|
||||
/* Test handling of the monitor command
|
||||
* - sends MONITOR to enable monitoring.
|
||||
* - sends SET commands via separate clients to be monitored.
|
||||
* - sends QUIT to stop monitoring and disconnect. */
|
||||
static void test_monitor(struct config config) {
|
||||
test("Enable monitoring: ");
|
||||
/* Setup event dispatcher with a testcase timeout */
|
||||
base = event_base_new();
|
||||
struct event *timeout = evtimer_new(base, timeout_cb, NULL);
|
||||
assert(timeout != NULL);
|
||||
|
||||
evtimer_assign(timeout,base,timeout_cb,NULL);
|
||||
struct timeval timeout_tv = {.tv_sec = 10};
|
||||
evtimer_add(timeout, &timeout_tv);
|
||||
|
||||
/* Connect */
|
||||
redisOptions options = get_redis_tcp_options(config);
|
||||
redisAsyncContext *ac = redisAsyncConnectWithOptions(&options);
|
||||
assert(ac != NULL && ac->err == 0);
|
||||
redisLibeventAttach(ac,base);
|
||||
|
||||
/* Not expecting any push messages in this test */
|
||||
redisAsyncSetPushCallback(ac,unexpected_push_cb);
|
||||
|
||||
/* Start monitor */
|
||||
TestState state = {.options = &options};
|
||||
redisAsyncCommand(ac,monitor_cb,&state,"monitor");
|
||||
|
||||
/* Start event dispatching loop */
|
||||
test_cond(event_base_dispatch(base) == 0);
|
||||
event_free(timeout);
|
||||
event_base_free(base);
|
||||
|
||||
/* Verify test checkpoints */
|
||||
assert(state.checkpoint == 3);
|
||||
}
|
||||
#endif /* HIREDIS_TEST_ASYNC */
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
struct config cfg = {
|
||||
.tcp = {
|
||||
@@ -1387,6 +1999,24 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HIREDIS_TEST_ASYNC
|
||||
printf("\nTesting asynchronous API against TCP connection (%s:%d):\n", cfg.tcp.host, cfg.tcp.port);
|
||||
cfg.type = CONN_TCP;
|
||||
|
||||
int major;
|
||||
redisContext *c = do_connect(cfg);
|
||||
get_redis_version(c, &major, NULL);
|
||||
disconnect(c, 0);
|
||||
|
||||
test_pubsub_handling(cfg);
|
||||
test_pubsub_multiple_channels(cfg);
|
||||
test_monitor(cfg);
|
||||
if (major >= 6) {
|
||||
test_pubsub_handling_resp3(cfg);
|
||||
test_command_timeout_during_pubsub(cfg);
|
||||
}
|
||||
#endif /* HIREDIS_TEST_ASYNC */
|
||||
|
||||
if (test_inherit_fd) {
|
||||
printf("\nTesting against inherited fd (%s): ", cfg.unix_sock.path);
|
||||
if (test_unix_socket) {
|
||||
|
||||
Vendored
+8
-8
@@ -5,27 +5,27 @@ environment:
|
||||
- MSYSTEM: MINGW64
|
||||
CPU: x86_64
|
||||
MSVC: amd64
|
||||
CONFIG_FLAGS: --enable-debug
|
||||
- MSYSTEM: MINGW64
|
||||
CPU: x86_64
|
||||
CONFIG_FLAGS: --enable-debug
|
||||
- MSYSTEM: MINGW32
|
||||
CPU: i686
|
||||
MSVC: x86
|
||||
- MSYSTEM: MINGW64
|
||||
CPU: x86_64
|
||||
CONFIG_FLAGS: --enable-debug
|
||||
- MSYSTEM: MINGW32
|
||||
CPU: i686
|
||||
CONFIG_FLAGS: --enable-debug
|
||||
- MSYSTEM: MINGW64
|
||||
CPU: x86_64
|
||||
MSVC: amd64
|
||||
CONFIG_FLAGS: --enable-debug
|
||||
- MSYSTEM: MINGW64
|
||||
CPU: x86_64
|
||||
- MSYSTEM: MINGW32
|
||||
CPU: i686
|
||||
MSVC: x86
|
||||
CONFIG_FLAGS: --enable-debug
|
||||
- MSYSTEM: MINGW64
|
||||
CPU: x86_64
|
||||
CONFIG_FLAGS: --enable-debug
|
||||
- MSYSTEM: MINGW32
|
||||
CPU: i686
|
||||
CONFIG_FLAGS: --enable-debug
|
||||
|
||||
install:
|
||||
- set PATH=c:\msys64\%MSYSTEM%\bin;c:\msys64\usr\bin;%PATH%
|
||||
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
env:
|
||||
CIRRUS_CLONE_DEPTH: 1
|
||||
ARCH: amd64
|
||||
|
||||
task:
|
||||
freebsd_instance:
|
||||
matrix:
|
||||
image: freebsd-12-0-release-amd64
|
||||
image: freebsd-11-2-release-amd64
|
||||
install_script:
|
||||
- sed -i.bak -e 's,pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly,pkg+http://pkg.FreeBSD.org/\${ABI}/latest,' /etc/pkg/FreeBSD.conf
|
||||
- pkg upgrade -y
|
||||
- pkg install -y autoconf gmake
|
||||
script:
|
||||
- autoconf
|
||||
#- ./configure ${COMPILER_FLAGS:+ CC="$CC $COMPILER_FLAGS" CXX="$CXX $COMPILER_FLAGS" } $CONFIGURE_FLAGS
|
||||
- ./configure
|
||||
- export JFLAG=`sysctl -n kern.smp.cpus`
|
||||
- gmake -j${JFLAG}
|
||||
- gmake -j${JFLAG} tests
|
||||
- gmake check
|
||||
@@ -30,7 +30,6 @@
|
||||
/include/jemalloc/internal/public_namespace.h
|
||||
/include/jemalloc/internal/public_symbols.txt
|
||||
/include/jemalloc/internal/public_unnamespace.h
|
||||
/include/jemalloc/internal/size_classes.h
|
||||
/include/jemalloc/jemalloc.h
|
||||
/include/jemalloc/jemalloc_defs.h
|
||||
/include/jemalloc/jemalloc_macros.h
|
||||
|
||||
Vendored
+72
-33
@@ -11,7 +11,7 @@ matrix:
|
||||
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
addons:
|
||||
addons: &gcc_multilib
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
@@ -21,6 +21,10 @@ matrix:
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
@@ -37,20 +41,25 @@ matrix:
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: osx
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: osx
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: osx
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: osx
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=clang CXX=clang++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
addons: *gcc_multilib
|
||||
- os: linux
|
||||
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
@@ -61,50 +70,39 @@ matrix:
|
||||
env: CC=clang CXX=clang++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--enable-debug" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
addons: *gcc_multilib
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
addons: *gcc_multilib
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
addons: *gcc_multilib
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
addons: *gcc_multilib
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
addons: *gcc_multilib
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
addons: *gcc_multilib
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
addons: *gcc_multilib
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
addons: *gcc_multilib
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="-m32" CONFIGURE_FLAGS="--with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
addons: *gcc_multilib
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
@@ -115,6 +113,10 @@ matrix:
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --disable-stats" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
@@ -123,6 +125,10 @@ matrix:
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-prof --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats --disable-libdl" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats --enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
@@ -131,6 +137,24 @@ matrix:
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-stats --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl --enable-opt-safety-checks" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--disable-libdl --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks --with-malloc-conf=tcache:false" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks --with-malloc-conf=dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks --with-malloc-conf=percpu_arena:percpu" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-opt-safety-checks --with-malloc-conf=background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=tcache:false,dss:primary" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
@@ -143,10 +167,25 @@ matrix:
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=dss:primary,background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--with-malloc-conf=percpu_arena:percpu,background_thread:true" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
# Development build
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --disable-cache-oblivious --enable-stats --enable-log --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
# --enable-expermental-smallocx:
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="--enable-debug --enable-experimental-smallocx --enable-stats --enable-prof" EXTRA_CFLAGS="-Werror -Wno-array-bounds"
|
||||
|
||||
# Valgrind
|
||||
- os: linux
|
||||
env: CC=gcc CXX=g++ COMPILER_FLAGS="" CONFIGURE_FLAGS="" EXTRA_CFLAGS="-Werror -Wno-array-bounds" JEMALLOC_TEST_PREFIX="valgrind"
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- valgrind
|
||||
|
||||
|
||||
before_script:
|
||||
- autoconf
|
||||
- scripts/gen_travis.py > travis_script && diff .travis.yml travis_script
|
||||
- ./configure ${COMPILER_FLAGS:+ CC="$CC $COMPILER_FLAGS" CXX="$CXX $COMPILER_FLAGS" } $CONFIGURE_FLAGS
|
||||
- make -j3
|
||||
- make -j3 tests
|
||||
|
||||
Vendored
+2
-2
@@ -1,10 +1,10 @@
|
||||
Unless otherwise specified, files in the jemalloc source distribution are
|
||||
subject to the following license:
|
||||
--------------------------------------------------------------------------------
|
||||
Copyright (C) 2002-2018 Jason Evans <jasone@canonware.com>.
|
||||
Copyright (C) 2002-present Jason Evans <jasone@canonware.com>.
|
||||
All rights reserved.
|
||||
Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved.
|
||||
Copyright (C) 2009-2018 Facebook, Inc. All rights reserved.
|
||||
Copyright (C) 2009-present Facebook, Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Vendored
+137
-1
@@ -4,7 +4,143 @@ brevity. Much more detail can be found in the git revision history:
|
||||
|
||||
https://github.com/jemalloc/jemalloc
|
||||
|
||||
* 5.1.0 (May 4th, 2018)
|
||||
* 5.2.1 (August 5, 2019)
|
||||
|
||||
This release is primarily about Windows. A critical virtual memory leak is
|
||||
resolved on all Windows platforms. The regression was present in all releases
|
||||
since 5.0.0.
|
||||
|
||||
Bug fixes:
|
||||
- Fix a severe virtual memory leak on Windows. This regression was first
|
||||
released in 5.0.0. (@Ignition, @j0t, @frederik-h, @davidtgoldblatt,
|
||||
@interwq)
|
||||
- Fix size 0 handling in posix_memalign(). This regression was first released
|
||||
in 5.2.0. (@interwq)
|
||||
- Fix the prof_log unit test which may observe unexpected backtraces from
|
||||
compiler optimizations. The test was first added in 5.2.0. (@marxin,
|
||||
@gnzlbg, @interwq)
|
||||
- Fix the declaration of the extent_avail tree. This regression was first
|
||||
released in 5.1.0. (@zoulasc)
|
||||
- Fix an incorrect reference in jeprof. This functionality was first released
|
||||
in 3.0.0. (@prehistoric-penguin)
|
||||
- Fix an assertion on the deallocation fast-path. This regression was first
|
||||
released in 5.2.0. (@yinan1048576)
|
||||
- Fix the TLS_MODEL attribute in headers. This regression was first released
|
||||
in 5.0.0. (@zoulasc, @interwq)
|
||||
|
||||
Optimizations and refactors:
|
||||
- Implement opt.retain on Windows and enable by default on 64-bit. (@interwq,
|
||||
@davidtgoldblatt)
|
||||
- Optimize away a branch on the operator delete[] path. (@mgrice)
|
||||
- Add format annotation to the format generator function. (@zoulasc)
|
||||
- Refactor and improve the size class header generation. (@yinan1048576)
|
||||
- Remove best fit. (@djwatson)
|
||||
- Avoid blocking on background thread locks for stats. (@oranagra, @interwq)
|
||||
|
||||
* 5.2.0 (April 2, 2019)
|
||||
|
||||
This release includes a few notable improvements, which are summarized below:
|
||||
1) improved fast-path performance from the optimizations by @djwatson; 2)
|
||||
reduced virtual memory fragmentation and metadata usage; and 3) bug fixes on
|
||||
setting the number of background threads. In addition, peak / spike memory
|
||||
usage is improved with certain allocation patterns. As usual, the release and
|
||||
prior dev versions have gone through large-scale production testing.
|
||||
|
||||
New features:
|
||||
- Implement oversize_threshold, which uses a dedicated arena for allocations
|
||||
crossing the specified threshold to reduce fragmentation. (@interwq)
|
||||
- Add extents usage information to stats. (@tyleretzel)
|
||||
- Log time information for sampled allocations. (@tyleretzel)
|
||||
- Support 0 size in sdallocx. (@djwatson)
|
||||
- Output rate for certain counters in malloc_stats. (@zinoale)
|
||||
- Add configure option --enable-readlinkat, which allows the use of readlinkat
|
||||
over readlink. (@davidtgoldblatt)
|
||||
- Add configure options --{enable,disable}-{static,shared} to allow not
|
||||
building unwanted libraries. (@Ericson2314)
|
||||
- Add configure option --disable-libdl to enable fully static builds.
|
||||
(@interwq)
|
||||
- Add mallctl interfaces:
|
||||
+ opt.oversize_threshold (@interwq)
|
||||
+ stats.arenas.<i>.extent_avail (@tyleretzel)
|
||||
+ stats.arenas.<i>.extents.<j>.n{dirty,muzzy,retained} (@tyleretzel)
|
||||
+ stats.arenas.<i>.extents.<j>.{dirty,muzzy,retained}_bytes
|
||||
(@tyleretzel)
|
||||
|
||||
Portability improvements:
|
||||
- Update MSVC builds. (@maksqwe, @rustyx)
|
||||
- Workaround a compiler optimizer bug on s390x. (@rkmisra)
|
||||
- Make use of pthread_set_name_np(3) on FreeBSD. (@trasz)
|
||||
- Implement malloc_getcpu() to enable percpu_arena for windows. (@santagada)
|
||||
- Link against -pthread instead of -lpthread. (@paravoid)
|
||||
- Make background_thread not dependent on libdl. (@interwq)
|
||||
- Add stringify to fix a linker directive issue on MSVC. (@daverigby)
|
||||
- Detect and fall back when 8-bit atomics are unavailable. (@interwq)
|
||||
- Fall back to the default pthread_create if dlsym(3) fails. (@interwq)
|
||||
|
||||
Optimizations and refactors:
|
||||
- Refactor the TSD module. (@davidtgoldblatt)
|
||||
- Avoid taking extents_muzzy mutex when muzzy is disabled. (@interwq)
|
||||
- Avoid taking large_mtx for auto arenas on the tcache flush path. (@interwq)
|
||||
- Optimize ixalloc by avoiding a size lookup. (@interwq)
|
||||
- Implement opt.oversize_threshold which uses a dedicated arena for requests
|
||||
crossing the threshold, also eagerly purges the oversize extents. Default
|
||||
the threshold to 8 MiB. (@interwq)
|
||||
- Clean compilation with -Wextra. (@gnzlbg, @jasone)
|
||||
- Refactor the size class module. (@davidtgoldblatt)
|
||||
- Refactor the stats emitter. (@tyleretzel)
|
||||
- Optimize pow2_ceil. (@rkmisra)
|
||||
- Avoid runtime detection of lazy purging on FreeBSD. (@trasz)
|
||||
- Optimize mmap(2) alignment handling on FreeBSD. (@trasz)
|
||||
- Improve error handling for THP state initialization. (@jsteemann)
|
||||
- Rework the malloc() fast path. (@djwatson)
|
||||
- Rework the free() fast path. (@djwatson)
|
||||
- Refactor and optimize the tcache fill / flush paths. (@djwatson)
|
||||
- Optimize sync / lwsync on PowerPC. (@chmeeedalf)
|
||||
- Bypass extent_dalloc() when retain is enabled. (@interwq)
|
||||
- Optimize the locking on large deallocation. (@interwq)
|
||||
- Reduce the number of pages committed from sanity checking in debug build.
|
||||
(@trasz, @interwq)
|
||||
- Deprecate OSSpinLock. (@interwq)
|
||||
- Lower the default number of background threads to 4 (when the feature
|
||||
is enabled). (@interwq)
|
||||
- Optimize the trylock spin wait. (@djwatson)
|
||||
- Use arena index for arena-matching checks. (@interwq)
|
||||
- Avoid forced decay on thread termination when using background threads.
|
||||
(@interwq)
|
||||
- Disable muzzy decay by default. (@djwatson, @interwq)
|
||||
- Only initialize libgcc unwinder when profiling is enabled. (@paravoid,
|
||||
@interwq)
|
||||
|
||||
Bug fixes (all only relevant to jemalloc 5.x):
|
||||
- Fix background thread index issues with max_background_threads. (@djwatson,
|
||||
@interwq)
|
||||
- Fix stats output for opt.lg_extent_max_active_fit. (@interwq)
|
||||
- Fix opt.prof_prefix initialization. (@davidtgoldblatt)
|
||||
- Properly trigger decay on tcache destroy. (@interwq, @amosbird)
|
||||
- Fix tcache.flush. (@interwq)
|
||||
- Detect whether explicit extent zero out is necessary with huge pages or
|
||||
custom extent hooks, which may change the purge semantics. (@interwq)
|
||||
- Fix a side effect caused by extent_max_active_fit combined with decay-based
|
||||
purging, where freed extents can accumulate and not be reused for an
|
||||
extended period of time. (@interwq, @mpghf)
|
||||
- Fix a missing unlock on extent register error handling. (@zoulasc)
|
||||
|
||||
Testing:
|
||||
- Simplify the Travis script output. (@gnzlbg)
|
||||
- Update the test scripts for FreeBSD. (@devnexen)
|
||||
- Add unit tests for the producer-consumer pattern. (@interwq)
|
||||
- Add Cirrus-CI config for FreeBSD builds. (@jasone)
|
||||
- Add size-matching sanity checks on tcache flush. (@davidtgoldblatt,
|
||||
@interwq)
|
||||
|
||||
Incompatible changes:
|
||||
- Remove --with-lg-page-sizes. (@davidtgoldblatt)
|
||||
|
||||
Documentation:
|
||||
- Attempt to build docs by default, however skip doc building when xsltproc
|
||||
is missing. (@interwq, @cmuellner)
|
||||
|
||||
* 5.1.0 (May 4, 2018)
|
||||
|
||||
This release is primarily about fine-tuning, ranging from several new features
|
||||
to numerous notable performance and portability enhancements. The release and
|
||||
|
||||
Vendored
+5
-7
@@ -221,13 +221,6 @@ any of the following arguments (not a definitive list) to 'configure':
|
||||
system page size may change between configuration and execution, e.g. when
|
||||
cross compiling.
|
||||
|
||||
* `--with-lg-page-sizes=<lg-page-sizes>`
|
||||
|
||||
Specify the comma-separated base 2 logs of the page sizes to support. This
|
||||
option may be useful when cross compiling in combination with
|
||||
`--with-lg-page`, but its primary use case is for integration with FreeBSD's
|
||||
libc, wherein jemalloc is embedded.
|
||||
|
||||
* `--with-lg-hugepage=<lg-hugepage>`
|
||||
|
||||
Specify the base 2 log of the system huge page size. This option is useful
|
||||
@@ -276,6 +269,11 @@ any of the following arguments (not a definitive list) to 'configure':
|
||||
in the same process, which will almost certainly result in confusing runtime
|
||||
crashes if pointers leak from one implementation to the other.
|
||||
|
||||
* `--disable-libdl`
|
||||
|
||||
Disable the usage of libdl, namely dlsym(3) which is required by the lazy
|
||||
lock option. This can allow building static binaries.
|
||||
|
||||
The following environment variables (not a definitive list) impact configure's
|
||||
behavior:
|
||||
|
||||
|
||||
Vendored
+62
-8
@@ -47,6 +47,7 @@ REV := @rev@
|
||||
install_suffix := @install_suffix@
|
||||
ABI := @abi@
|
||||
XSLTPROC := @XSLTPROC@
|
||||
XSLROOT := @XSLROOT@
|
||||
AUTOCONF := @AUTOCONF@
|
||||
_RPATH = @RPATH@
|
||||
RPATH = $(if $(1),$(call _RPATH,$(1)))
|
||||
@@ -55,8 +56,12 @@ cfghdrs_out := @cfghdrs_out@
|
||||
cfgoutputs_in := $(addprefix $(srcroot),@cfgoutputs_in@)
|
||||
cfgoutputs_out := @cfgoutputs_out@
|
||||
enable_autogen := @enable_autogen@
|
||||
enable_doc := @enable_doc@
|
||||
enable_shared := @enable_shared@
|
||||
enable_static := @enable_static@
|
||||
enable_prof := @enable_prof@
|
||||
enable_zone_allocator := @enable_zone_allocator@
|
||||
enable_experimental_smallocx := @enable_experimental_smallocx@
|
||||
MALLOC_CONF := @JEMALLOC_CPREFIX@MALLOC_CONF
|
||||
link_whole_archive := @link_whole_archive@
|
||||
DSO_LDFLAGS = @DSO_LDFLAGS@
|
||||
@@ -102,7 +107,7 @@ C_SRCS := $(srcroot)src/jemalloc.c \
|
||||
$(srcroot)src/extent_dss.c \
|
||||
$(srcroot)src/extent_mmap.c \
|
||||
$(srcroot)src/hash.c \
|
||||
$(srcroot)src/hooks.c \
|
||||
$(srcroot)src/hook.c \
|
||||
$(srcroot)src/large.c \
|
||||
$(srcroot)src/log.c \
|
||||
$(srcroot)src/malloc_io.c \
|
||||
@@ -113,9 +118,12 @@ C_SRCS := $(srcroot)src/jemalloc.c \
|
||||
$(srcroot)src/prng.c \
|
||||
$(srcroot)src/prof.c \
|
||||
$(srcroot)src/rtree.c \
|
||||
$(srcroot)src/safety_check.c \
|
||||
$(srcroot)src/stats.c \
|
||||
$(srcroot)src/sc.c \
|
||||
$(srcroot)src/sz.c \
|
||||
$(srcroot)src/tcache.c \
|
||||
$(srcroot)src/test_hooks.c \
|
||||
$(srcroot)src/ticker.c \
|
||||
$(srcroot)src/tsd.c \
|
||||
$(srcroot)src/witness.c
|
||||
@@ -165,14 +173,18 @@ TESTS_UNIT := \
|
||||
$(srcroot)test/unit/background_thread_enable.c \
|
||||
$(srcroot)test/unit/base.c \
|
||||
$(srcroot)test/unit/bitmap.c \
|
||||
$(srcroot)test/unit/bit_util.c \
|
||||
$(srcroot)test/unit/binshard.c \
|
||||
$(srcroot)test/unit/ckh.c \
|
||||
$(srcroot)test/unit/decay.c \
|
||||
$(srcroot)test/unit/div.c \
|
||||
$(srcroot)test/unit/emitter.c \
|
||||
$(srcroot)test/unit/extent_quantize.c \
|
||||
$(srcroot)test/unit/extent_util.c \
|
||||
$(srcroot)test/unit/fork.c \
|
||||
$(srcroot)test/unit/hash.c \
|
||||
$(srcroot)test/unit/hooks.c \
|
||||
$(srcroot)test/unit/hook.c \
|
||||
$(srcroot)test/unit/huge.c \
|
||||
$(srcroot)test/unit/junk.c \
|
||||
$(srcroot)test/unit/junk_alloc.c \
|
||||
$(srcroot)test/unit/junk_free.c \
|
||||
@@ -190,6 +202,7 @@ TESTS_UNIT := \
|
||||
$(srcroot)test/unit/prof_active.c \
|
||||
$(srcroot)test/unit/prof_gdump.c \
|
||||
$(srcroot)test/unit/prof_idump.c \
|
||||
$(srcroot)test/unit/prof_log.c \
|
||||
$(srcroot)test/unit/prof_reset.c \
|
||||
$(srcroot)test/unit/prof_tctx.c \
|
||||
$(srcroot)test/unit/prof_thread_name.c \
|
||||
@@ -198,13 +211,17 @@ TESTS_UNIT := \
|
||||
$(srcroot)test/unit/rb.c \
|
||||
$(srcroot)test/unit/retained.c \
|
||||
$(srcroot)test/unit/rtree.c \
|
||||
$(srcroot)test/unit/safety_check.c \
|
||||
$(srcroot)test/unit/seq.c \
|
||||
$(srcroot)test/unit/SFMT.c \
|
||||
$(srcroot)test/unit/sc.c \
|
||||
$(srcroot)test/unit/size_classes.c \
|
||||
$(srcroot)test/unit/slab.c \
|
||||
$(srcroot)test/unit/smoothstep.c \
|
||||
$(srcroot)test/unit/spin.c \
|
||||
$(srcroot)test/unit/stats.c \
|
||||
$(srcroot)test/unit/stats_print.c \
|
||||
$(srcroot)test/unit/test_hooks.c \
|
||||
$(srcroot)test/unit/ticker.c \
|
||||
$(srcroot)test/unit/nstime.c \
|
||||
$(srcroot)test/unit/tsd.c \
|
||||
@@ -217,15 +234,21 @@ endif
|
||||
TESTS_INTEGRATION := $(srcroot)test/integration/aligned_alloc.c \
|
||||
$(srcroot)test/integration/allocated.c \
|
||||
$(srcroot)test/integration/extent.c \
|
||||
$(srcroot)test/integration/malloc.c \
|
||||
$(srcroot)test/integration/mallocx.c \
|
||||
$(srcroot)test/integration/MALLOCX_ARENA.c \
|
||||
$(srcroot)test/integration/overflow.c \
|
||||
$(srcroot)test/integration/posix_memalign.c \
|
||||
$(srcroot)test/integration/rallocx.c \
|
||||
$(srcroot)test/integration/sdallocx.c \
|
||||
$(srcroot)test/integration/slab_sizes.c \
|
||||
$(srcroot)test/integration/thread_arena.c \
|
||||
$(srcroot)test/integration/thread_tcache_enabled.c \
|
||||
$(srcroot)test/integration/xallocx.c
|
||||
ifeq (@enable_experimental_smallocx@, 1)
|
||||
TESTS_INTEGRATION += \
|
||||
$(srcroot)test/integration/smallocx.c
|
||||
endif
|
||||
ifeq (@enable_cxx@, 1)
|
||||
CPP_SRCS := $(srcroot)src/jemalloc_cpp.cpp
|
||||
TESTS_INTEGRATION_CPP := $(srcroot)test/integration/cpp/basic.cpp
|
||||
@@ -233,7 +256,9 @@ else
|
||||
CPP_SRCS :=
|
||||
TESTS_INTEGRATION_CPP :=
|
||||
endif
|
||||
TESTS_STRESS := $(srcroot)test/stress/microbench.c
|
||||
TESTS_STRESS := $(srcroot)test/stress/microbench.c \
|
||||
$(srcroot)test/stress/hookbench.c
|
||||
|
||||
|
||||
TESTS := $(TESTS_UNIT) $(TESTS_INTEGRATION) $(TESTS_INTEGRATION_CPP) $(TESTS_STRESS)
|
||||
|
||||
@@ -274,10 +299,24 @@ all: build_lib
|
||||
dist: build_doc
|
||||
|
||||
$(objroot)doc/%.html : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/html.xsl
|
||||
ifneq ($(XSLROOT),)
|
||||
$(XSLTPROC) -o $@ $(objroot)doc/html.xsl $<
|
||||
else
|
||||
ifeq ($(wildcard $(DOCS_HTML)),)
|
||||
@echo "<p>Missing xsltproc. Doc not built.</p>" > $@
|
||||
endif
|
||||
@echo "Missing xsltproc. "$@" not (re)built."
|
||||
endif
|
||||
|
||||
$(objroot)doc/%.3 : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/manpages.xsl
|
||||
ifneq ($(XSLROOT),)
|
||||
$(XSLTPROC) -o $@ $(objroot)doc/manpages.xsl $<
|
||||
else
|
||||
ifeq ($(wildcard $(DOCS_MAN3)),)
|
||||
@echo "Missing xsltproc. Doc not built." > $@
|
||||
endif
|
||||
@echo "Missing xsltproc. "$@" not (re)built."
|
||||
endif
|
||||
|
||||
build_doc_html: $(DOCS_HTML)
|
||||
build_doc_man: $(DOCS_MAN3)
|
||||
@@ -400,7 +439,7 @@ $(objroot)test/unit/%$(EXE): $(objroot)test/unit/%.$(O) $(C_JET_OBJS) $(C_TESTLI
|
||||
|
||||
$(objroot)test/integration/%$(EXE): $(objroot)test/integration/%.$(O) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
|
||||
@mkdir -p $(@D)
|
||||
$(CC) $(TEST_LD_MODE) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LJEMALLOC) $(LDFLAGS) $(filter-out -lm,$(filter -lrt -lpthread -lstdc++,$(LIBS))) $(LM) $(EXTRA_LDFLAGS)
|
||||
$(CC) $(TEST_LD_MODE) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LJEMALLOC) $(LDFLAGS) $(filter-out -lm,$(filter -lrt -pthread -lstdc++,$(LIBS))) $(LM) $(EXTRA_LDFLAGS)
|
||||
|
||||
$(objroot)test/integration/cpp/%$(EXE): $(objroot)test/integration/cpp/%.$(O) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
|
||||
@mkdir -p $(@D)
|
||||
@@ -412,7 +451,12 @@ $(objroot)test/stress/%$(EXE): $(objroot)test/stress/%.$(O) $(C_JET_OBJS) $(C_TE
|
||||
|
||||
build_lib_shared: $(DSOS)
|
||||
build_lib_static: $(STATIC_LIBS)
|
||||
build_lib: build_lib_shared build_lib_static
|
||||
ifeq ($(enable_shared), 1)
|
||||
build_lib: build_lib_shared
|
||||
endif
|
||||
ifeq ($(enable_static), 1)
|
||||
build_lib: build_lib_static
|
||||
endif
|
||||
|
||||
install_bin:
|
||||
$(INSTALL) -d $(BINDIR)
|
||||
@@ -449,7 +493,13 @@ install_lib_pc: $(PC)
|
||||
$(INSTALL) -m 644 $$l $(LIBDIR)/pkgconfig; \
|
||||
done
|
||||
|
||||
install_lib: install_lib_shared install_lib_static install_lib_pc
|
||||
ifeq ($(enable_shared), 1)
|
||||
install_lib: install_lib_shared
|
||||
endif
|
||||
ifeq ($(enable_static), 1)
|
||||
install_lib: install_lib_static
|
||||
endif
|
||||
install_lib: install_lib_pc
|
||||
|
||||
install_doc_html:
|
||||
$(INSTALL) -d $(DATADIR)/doc/jemalloc$(install_suffix)
|
||||
@@ -465,9 +515,13 @@ install_doc_man:
|
||||
$(INSTALL) -m 644 $$d $(MANDIR)/man3; \
|
||||
done
|
||||
|
||||
install_doc: install_doc_html install_doc_man
|
||||
install_doc: build_doc install_doc_html install_doc_man
|
||||
|
||||
install: install_bin install_include install_lib install_doc
|
||||
install: install_bin install_include install_lib
|
||||
|
||||
ifeq ($(enable_doc), 1)
|
||||
install: install_doc
|
||||
endif
|
||||
|
||||
tests_unit: $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%$(EXE))
|
||||
tests_integration: $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%$(EXE)) $(TESTS_INTEGRATION_CPP:$(srcroot)%.cpp=$(objroot)%$(EXE))
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
5.1.0-0-g0
|
||||
5.2.1-0-g0
|
||||
|
||||
Vendored
+2
-1
@@ -2909,6 +2909,7 @@ sub RemoveUninterestingFrames {
|
||||
'@JEMALLOC_PREFIX@xallocx',
|
||||
'@JEMALLOC_PREFIX@dallocx',
|
||||
'@JEMALLOC_PREFIX@sdallocx',
|
||||
'@JEMALLOC_PREFIX@sdallocx_noflags',
|
||||
'tc_calloc',
|
||||
'tc_cfree',
|
||||
'tc_malloc',
|
||||
@@ -5366,7 +5367,7 @@ sub GetProcedureBoundaries {
|
||||
my $demangle_flag = "";
|
||||
my $cppfilt_flag = "";
|
||||
my $to_devnull = ">$dev_null 2>&1";
|
||||
if (system(ShellEscape($nm, "--demangle", "image") . $to_devnull) == 0) {
|
||||
if (system(ShellEscape($nm, "--demangle", $image) . $to_devnull) == 0) {
|
||||
# In this mode, we do "nm --demangle <foo>"
|
||||
$demangle_flag = "--demangle";
|
||||
$cppfilt_flag = "";
|
||||
|
||||
Vendored
+623
-231
File diff suppressed because it is too large
Load Diff
Vendored
+250
-138
@@ -175,6 +175,9 @@ fi
|
||||
],
|
||||
XSLROOT="${DEFAULT_XSLROOT}"
|
||||
)
|
||||
if test "x$XSLTPROC" = "xfalse" ; then
|
||||
XSLROOT=""
|
||||
fi
|
||||
AC_SUBST([XSLROOT])
|
||||
|
||||
dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise,
|
||||
@@ -242,6 +245,7 @@ if test "x$GCC" = "xyes" ; then
|
||||
fi
|
||||
fi
|
||||
JE_CFLAGS_ADD([-Wall])
|
||||
JE_CFLAGS_ADD([-Wextra])
|
||||
JE_CFLAGS_ADD([-Wshorten-64-to-32])
|
||||
JE_CFLAGS_ADD([-Wsign-compare])
|
||||
JE_CFLAGS_ADD([-Wundef])
|
||||
@@ -289,6 +293,7 @@ if test "x$enable_cxx" = "x1" ; then
|
||||
AX_CXX_COMPILE_STDCXX([14], [noext], [optional])
|
||||
if test "x${HAVE_CXX14}" = "x1" ; then
|
||||
JE_CXXFLAGS_ADD([-Wall])
|
||||
JE_CXXFLAGS_ADD([-Wextra])
|
||||
JE_CXXFLAGS_ADD([-g3])
|
||||
|
||||
SAVED_LIBS="${LIBS}"
|
||||
@@ -536,6 +541,66 @@ AC_PROG_NM
|
||||
|
||||
AC_PROG_AWK
|
||||
|
||||
dnl ============================================================================
|
||||
dnl jemalloc version.
|
||||
dnl
|
||||
|
||||
AC_ARG_WITH([version],
|
||||
[AS_HELP_STRING([--with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>],
|
||||
[Version string])],
|
||||
[
|
||||
echo "${with_version}" | grep ['^[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+-g[0-9a-f]\+$'] 2>&1 1>/dev/null
|
||||
if test $? -eq 0 ; then
|
||||
echo "$with_version" > "${objroot}VERSION"
|
||||
else
|
||||
echo "${with_version}" | grep ['^VERSION$'] 2>&1 1>/dev/null
|
||||
if test $? -ne 0 ; then
|
||||
AC_MSG_ERROR([${with_version} does not match <major>.<minor>.<bugfix>-<nrev>-g<gid> or VERSION])
|
||||
fi
|
||||
fi
|
||||
], [
|
||||
dnl Set VERSION if source directory is inside a git repository.
|
||||
if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then
|
||||
dnl Pattern globs aren't powerful enough to match both single- and
|
||||
dnl double-digit version numbers, so iterate over patterns to support up
|
||||
dnl to version 99.99.99 without any accidental matches.
|
||||
for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \
|
||||
'[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \
|
||||
'[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \
|
||||
'[0-9][0-9].[0-9][0-9].[0-9]' \
|
||||
'[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do
|
||||
(test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null
|
||||
if test $? -eq 0 ; then
|
||||
mv "${objroot}VERSION.tmp" "${objroot}VERSION"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
rm -f "${objroot}VERSION.tmp"
|
||||
])
|
||||
|
||||
if test ! -e "${objroot}VERSION" ; then
|
||||
if test ! -e "${srcroot}VERSION" ; then
|
||||
AC_MSG_RESULT(
|
||||
[Missing VERSION file, and unable to generate it; creating bogus VERSION])
|
||||
echo "0.0.0-0-g0000000000000000000000000000000000000000" > "${objroot}VERSION"
|
||||
else
|
||||
cp ${srcroot}VERSION ${objroot}VERSION
|
||||
fi
|
||||
fi
|
||||
jemalloc_version=`cat "${objroot}VERSION"`
|
||||
jemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'`
|
||||
jemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'`
|
||||
jemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'`
|
||||
jemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'`
|
||||
jemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'`
|
||||
AC_SUBST([jemalloc_version])
|
||||
AC_SUBST([jemalloc_version_major])
|
||||
AC_SUBST([jemalloc_version_minor])
|
||||
AC_SUBST([jemalloc_version_bugfix])
|
||||
AC_SUBST([jemalloc_version_nrev])
|
||||
AC_SUBST([jemalloc_version_gid])
|
||||
|
||||
dnl Platform-specific settings. abi and RPATH can probably be determined
|
||||
dnl programmatically, but doing so is error-prone, which makes it generally
|
||||
dnl not worth the trouble.
|
||||
@@ -673,6 +738,9 @@ case "${host}" in
|
||||
libprefix=""
|
||||
SOREV="${so}"
|
||||
PIC_CFLAGS=""
|
||||
if test "${LG_SIZEOF_PTR}" = "3"; then
|
||||
default_retain="1"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([Unsupported operating system: ${host}])
|
||||
@@ -786,6 +854,18 @@ if test "x${je_cv_format_printf}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_PRINTF], [ ])
|
||||
fi
|
||||
|
||||
dnl Check for format_arg(...) attribute support.
|
||||
JE_CFLAGS_SAVE()
|
||||
JE_CFLAGS_ADD([-Werror])
|
||||
JE_CFLAGS_ADD([-herror_on_warning])
|
||||
JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>],
|
||||
[const char * __attribute__((__format_arg__(1))) foo(const char *format);],
|
||||
[je_cv_format_arg])
|
||||
JE_CFLAGS_RESTORE()
|
||||
if test "x${je_cv_format_arg}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_ARG], [ ])
|
||||
fi
|
||||
|
||||
dnl Support optional additions to rpath.
|
||||
AC_ARG_WITH([rpath],
|
||||
[AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])],
|
||||
@@ -816,6 +896,49 @@ AC_PROG_RANLIB
|
||||
AC_PATH_PROG([LD], [ld], [false], [$PATH])
|
||||
AC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH])
|
||||
|
||||
dnl Enable documentation
|
||||
AC_ARG_ENABLE([doc],
|
||||
[AS_HELP_STRING([--enable-documentation], [Build documentation])],
|
||||
if test "x$enable_doc" = "xno" ; then
|
||||
enable_doc="0"
|
||||
else
|
||||
enable_doc="1"
|
||||
fi
|
||||
,
|
||||
enable_doc="1"
|
||||
)
|
||||
AC_SUBST([enable_doc])
|
||||
|
||||
dnl Enable shared libs
|
||||
AC_ARG_ENABLE([shared],
|
||||
[AS_HELP_STRING([--enable-shared], [Build shared libaries])],
|
||||
if test "x$enable_shared" = "xno" ; then
|
||||
enable_shared="0"
|
||||
else
|
||||
enable_shared="1"
|
||||
fi
|
||||
,
|
||||
enable_shared="1"
|
||||
)
|
||||
AC_SUBST([enable_shared])
|
||||
|
||||
dnl Enable static libs
|
||||
AC_ARG_ENABLE([static],
|
||||
[AS_HELP_STRING([--enable-static], [Build static libaries])],
|
||||
if test "x$enable_static" = "xno" ; then
|
||||
enable_static="0"
|
||||
else
|
||||
enable_static="1"
|
||||
fi
|
||||
,
|
||||
enable_static="1"
|
||||
)
|
||||
AC_SUBST([enable_static])
|
||||
|
||||
if test "$enable_shared$enable_static" = "00" ; then
|
||||
AC_MSG_ERROR([Please enable one of shared or static builds])
|
||||
fi
|
||||
|
||||
dnl Perform no name mangling by default.
|
||||
AC_ARG_WITH([mangling],
|
||||
[AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])],
|
||||
@@ -848,7 +971,7 @@ AC_ARG_WITH([export],
|
||||
fi]
|
||||
)
|
||||
|
||||
public_syms="aligned_alloc calloc dallocx free mallctl mallctlbymib mallctlnametomib malloc malloc_conf malloc_message malloc_stats_print malloc_usable_size mallocx nallocx posix_memalign rallocx realloc sallocx sdallocx xallocx"
|
||||
public_syms="aligned_alloc calloc dallocx free mallctl mallctlbymib mallctlnametomib malloc malloc_conf malloc_message malloc_stats_print malloc_usable_size mallocx smallocx_${jemalloc_version_gid} nallocx posix_memalign rallocx realloc sallocx sdallocx xallocx"
|
||||
dnl Check for additional platform-specific public API functions.
|
||||
AC_CHECK_FUNC([memalign],
|
||||
[AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ])
|
||||
@@ -966,7 +1089,6 @@ cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_symbols.sh"
|
||||
cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_namespace.sh"
|
||||
cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_namespace.sh"
|
||||
cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_unnamespace.sh"
|
||||
cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/size_classes.sh"
|
||||
cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_rename.sh"
|
||||
cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_mangle.sh"
|
||||
cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc.sh"
|
||||
@@ -979,7 +1101,6 @@ cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_symbols_jet.awk"
|
||||
cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_symbols.txt"
|
||||
cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_namespace.h"
|
||||
cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h"
|
||||
cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/size_classes.h"
|
||||
cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h"
|
||||
cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_rename.h"
|
||||
cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle.h"
|
||||
@@ -991,6 +1112,10 @@ cfghdrs_tup="include/jemalloc/jemalloc_defs.h:include/jemalloc/jemalloc_defs.h.i
|
||||
cfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:include/jemalloc/internal/jemalloc_internal_defs.h.in"
|
||||
cfghdrs_tup="${cfghdrs_tup} test/include/test/jemalloc_test_defs.h:test/include/test/jemalloc_test_defs.h.in"
|
||||
|
||||
dnl ============================================================================
|
||||
dnl jemalloc build options.
|
||||
dnl
|
||||
|
||||
dnl Do not compile with debugging by default.
|
||||
AC_ARG_ENABLE([debug],
|
||||
[AS_HELP_STRING([--enable-debug],
|
||||
@@ -1043,6 +1168,22 @@ if test "x$enable_stats" = "x1" ; then
|
||||
fi
|
||||
AC_SUBST([enable_stats])
|
||||
|
||||
dnl Do not enable smallocx by default.
|
||||
AC_ARG_ENABLE([experimental_smallocx],
|
||||
[AS_HELP_STRING([--enable-experimental-smallocx], [Enable experimental smallocx API])],
|
||||
[if test "x$enable_experimental_smallocx" = "xno" ; then
|
||||
enable_experimental_smallocx="0"
|
||||
else
|
||||
enable_experimental_smallocx="1"
|
||||
fi
|
||||
],
|
||||
[enable_experimental_smallocx="0"]
|
||||
)
|
||||
if test "x$enable_experimental_smallocx" = "x1" ; then
|
||||
AC_DEFINE([JEMALLOC_EXPERIMENTAL_SMALLOCX_API])
|
||||
fi
|
||||
AC_SUBST([enable_experimental_smallocx])
|
||||
|
||||
dnl Do not enable profiling by default.
|
||||
AC_ARG_ENABLE([prof],
|
||||
[AS_HELP_STRING([--enable-prof], [Enable allocation profiling])],
|
||||
@@ -1277,6 +1418,38 @@ if test "x$enable_log" = "x1" ; then
|
||||
fi
|
||||
AC_SUBST([enable_log])
|
||||
|
||||
dnl Do not use readlinkat by default
|
||||
AC_ARG_ENABLE([readlinkat],
|
||||
[AS_HELP_STRING([--enable-readlinkat], [Use readlinkat over readlink])],
|
||||
[if test "x$enable_readlinkat" = "xno" ; then
|
||||
enable_readlinkat="0"
|
||||
else
|
||||
enable_readlinkat="1"
|
||||
fi
|
||||
],
|
||||
[enable_readlinkat="0"]
|
||||
)
|
||||
if test "x$enable_readlinkat" = "x1" ; then
|
||||
AC_DEFINE([JEMALLOC_READLINKAT], [ ])
|
||||
fi
|
||||
AC_SUBST([enable_readlinkat])
|
||||
|
||||
dnl Avoid extra safety checks by default
|
||||
AC_ARG_ENABLE([opt-safety-checks],
|
||||
[AS_HELP_STRING([--enable-opt-safety-checks],
|
||||
[Perform certain low-overhead checks, even in opt mode])],
|
||||
[if test "x$enable_opt_safety_checks" = "xno" ; then
|
||||
enable_opt_safety_checks="0"
|
||||
else
|
||||
enable_opt_safety_checks="1"
|
||||
fi
|
||||
],
|
||||
[enable_opt_safety_checks="0"]
|
||||
)
|
||||
if test "x$enable_opt_safety_checks" = "x1" ; then
|
||||
AC_DEFINE([JEMALLOC_OPT_SAFETY_CHECKS], [ ])
|
||||
fi
|
||||
AC_SUBST([enable_opt_safety_checks])
|
||||
|
||||
JE_COMPILABLE([a program using __builtin_unreachable], [
|
||||
void foo (void) {
|
||||
@@ -1333,6 +1506,21 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
JE_COMPILABLE([a program using __builtin_popcountl], [
|
||||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
], [
|
||||
{
|
||||
int rv = __builtin_popcountl(0x08);
|
||||
printf("%d\n", rv);
|
||||
}
|
||||
], [je_cv_gcc_builtin_popcountl])
|
||||
if test "x${je_cv_gcc_builtin_popcountl}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNT], [__builtin_popcount])
|
||||
AC_DEFINE([JEMALLOC_INTERNAL_POPCOUNTL], [__builtin_popcountl])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH([lg_quantum],
|
||||
[AS_HELP_STRING([--with-lg-quantum=<lg-quantum>],
|
||||
[Base 2 log of minimum allocation alignment])],
|
||||
@@ -1430,70 +1618,20 @@ if test "x${LG_PAGE}" != "xundefined" -a \
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([LG_HUGEPAGE], [${je_cv_lg_hugepage}])
|
||||
|
||||
AC_ARG_WITH([lg_page_sizes],
|
||||
[AS_HELP_STRING([--with-lg-page-sizes=<lg-page-sizes>],
|
||||
[Base 2 logs of system page sizes to support])],
|
||||
[LG_PAGE_SIZES="$with_lg_page_sizes"], [LG_PAGE_SIZES="$LG_PAGE"])
|
||||
|
||||
dnl ============================================================================
|
||||
dnl jemalloc configuration.
|
||||
dnl
|
||||
|
||||
AC_ARG_WITH([version],
|
||||
[AS_HELP_STRING([--with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>],
|
||||
[Version string])],
|
||||
[
|
||||
echo "${with_version}" | grep ['^[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+-g[0-9a-f]\+$'] 2>&1 1>/dev/null
|
||||
if test $? -eq 0 ; then
|
||||
echo "$with_version" > "${objroot}VERSION"
|
||||
else
|
||||
echo "${with_version}" | grep ['^VERSION$'] 2>&1 1>/dev/null
|
||||
if test $? -ne 0 ; then
|
||||
AC_MSG_ERROR([${with_version} does not match <major>.<minor>.<bugfix>-<nrev>-g<gid> or VERSION])
|
||||
fi
|
||||
fi
|
||||
], [
|
||||
dnl Set VERSION if source directory is inside a git repository.
|
||||
if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then
|
||||
dnl Pattern globs aren't powerful enough to match both single- and
|
||||
dnl double-digit version numbers, so iterate over patterns to support up
|
||||
dnl to version 99.99.99 without any accidental matches.
|
||||
for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \
|
||||
'[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \
|
||||
'[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \
|
||||
'[0-9][0-9].[0-9][0-9].[0-9]' \
|
||||
'[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do
|
||||
(test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null
|
||||
if test $? -eq 0 ; then
|
||||
mv "${objroot}VERSION.tmp" "${objroot}VERSION"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
rm -f "${objroot}VERSION.tmp"
|
||||
])
|
||||
|
||||
if test ! -e "${objroot}VERSION" ; then
|
||||
if test ! -e "${srcroot}VERSION" ; then
|
||||
AC_MSG_RESULT(
|
||||
[Missing VERSION file, and unable to generate it; creating bogus VERSION])
|
||||
echo "0.0.0-0-g0000000000000000000000000000000000000000" > "${objroot}VERSION"
|
||||
else
|
||||
cp ${srcroot}VERSION ${objroot}VERSION
|
||||
fi
|
||||
dnl Enable libdl by default.
|
||||
AC_ARG_ENABLE([libdl],
|
||||
[AS_HELP_STRING([--disable-libdl],
|
||||
[Do not use libdl])],
|
||||
[if test "x$enable_libdl" = "xno" ; then
|
||||
enable_libdl="0"
|
||||
else
|
||||
enable_libdl="1"
|
||||
fi
|
||||
jemalloc_version=`cat "${objroot}VERSION"`
|
||||
jemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'`
|
||||
jemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'`
|
||||
jemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'`
|
||||
jemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'`
|
||||
jemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'`
|
||||
AC_SUBST([jemalloc_version])
|
||||
AC_SUBST([jemalloc_version_major])
|
||||
AC_SUBST([jemalloc_version_minor])
|
||||
AC_SUBST([jemalloc_version_bugfix])
|
||||
AC_SUBST([jemalloc_version_nrev])
|
||||
AC_SUBST([jemalloc_version_gid])
|
||||
],
|
||||
[enable_libdl="1"]
|
||||
)
|
||||
AC_SUBST([libdl])
|
||||
|
||||
dnl ============================================================================
|
||||
dnl Configure pthreads.
|
||||
@@ -1503,20 +1641,26 @@ if test "x$abi" != "xpecoff" ; then
|
||||
AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])])
|
||||
dnl Some systems may embed pthreads functionality in libc; check for libpthread
|
||||
dnl first, but try libc too before failing.
|
||||
AC_CHECK_LIB([pthread], [pthread_create], [JE_APPEND_VS(LIBS, -lpthread)],
|
||||
AC_CHECK_LIB([pthread], [pthread_create], [JE_APPEND_VS(LIBS, -pthread)],
|
||||
[AC_SEARCH_LIBS([pthread_create], , ,
|
||||
AC_MSG_ERROR([libpthread is missing]))])
|
||||
wrap_syms="${wrap_syms} pthread_create"
|
||||
have_pthread="1"
|
||||
dnl Check if we have dlsym support.
|
||||
have_dlsym="1"
|
||||
AC_CHECK_HEADERS([dlfcn.h],
|
||||
AC_CHECK_FUNC([dlsym], [],
|
||||
[AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"], [have_dlsym="0"])]),
|
||||
[have_dlsym="0"])
|
||||
if test "x$have_dlsym" = "x1" ; then
|
||||
AC_DEFINE([JEMALLOC_HAVE_DLSYM], [ ])
|
||||
|
||||
dnl Check if we have dlsym support.
|
||||
if test "x$enable_libdl" = "x1" ; then
|
||||
have_dlsym="1"
|
||||
AC_CHECK_HEADERS([dlfcn.h],
|
||||
AC_CHECK_FUNC([dlsym], [],
|
||||
[AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"], [have_dlsym="0"])]),
|
||||
[have_dlsym="0"])
|
||||
if test "x$have_dlsym" = "x1" ; then
|
||||
AC_DEFINE([JEMALLOC_HAVE_DLSYM], [ ])
|
||||
fi
|
||||
else
|
||||
have_dlsym="0"
|
||||
fi
|
||||
|
||||
JE_COMPILABLE([pthread_atfork(3)], [
|
||||
#include <pthread.h>
|
||||
], [
|
||||
@@ -1780,6 +1924,19 @@ JE_COMPILABLE([GCC __atomic atomics], [
|
||||
], [je_cv_gcc_atomic_atomics])
|
||||
if test "x${je_cv_gcc_atomic_atomics}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_GCC_ATOMIC_ATOMICS])
|
||||
|
||||
dnl check for 8-bit atomic support
|
||||
JE_COMPILABLE([GCC 8-bit __atomic atomics], [
|
||||
], [
|
||||
unsigned char x = 0;
|
||||
int val = 1;
|
||||
int y = __atomic_fetch_add(&x, val, __ATOMIC_RELAXED);
|
||||
int after_add = (int)x;
|
||||
return after_add == 1;
|
||||
], [je_cv_gcc_u8_atomic_atomics])
|
||||
if test "x${je_cv_gcc_u8_atomic_atomics}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_GCC_U8_ATOMIC_ATOMICS])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ============================================================================
|
||||
@@ -1794,12 +1951,24 @@ JE_COMPILABLE([GCC __sync atomics], [
|
||||
], [je_cv_gcc_sync_atomics])
|
||||
if test "x${je_cv_gcc_sync_atomics}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_GCC_SYNC_ATOMICS])
|
||||
|
||||
dnl check for 8-bit atomic support
|
||||
JE_COMPILABLE([GCC 8-bit __sync atomics], [
|
||||
], [
|
||||
unsigned char x = 0;
|
||||
int before_add = __sync_fetch_and_add(&x, 1);
|
||||
int after_add = (int)x;
|
||||
return (before_add == 0) && (after_add == 1);
|
||||
], [je_cv_gcc_u8_sync_atomics])
|
||||
if test "x${je_cv_gcc_u8_sync_atomics}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_GCC_U8_SYNC_ATOMICS])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ============================================================================
|
||||
dnl Check for atomic(3) operations as provided on Darwin.
|
||||
dnl We need this not for the atomic operations (which are provided above), but
|
||||
dnl rather for the OSSpinLock type it exposes.
|
||||
dnl rather for the OS_unfair_lock type it exposes.
|
||||
|
||||
JE_COMPILABLE([Darwin OSAtomic*()], [
|
||||
#include <libkern/OSAtomic.h>
|
||||
@@ -1870,7 +2039,7 @@ if test "x${je_cv_madvise}" = "xyes" ; then
|
||||
if test "x${je_cv_madv_dontdump}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_MADVISE_DONTDUMP], [ ])
|
||||
fi
|
||||
|
||||
|
||||
dnl Check for madvise(..., MADV_[NO]HUGEPAGE).
|
||||
JE_COMPILABLE([madvise(..., MADV_[[NO]]HUGEPAGE)], [
|
||||
#include <sys/mman.h>
|
||||
@@ -1889,40 +2058,6 @@ case "${host_cpu}" in
|
||||
esac
|
||||
fi
|
||||
|
||||
dnl ============================================================================
|
||||
dnl Check whether __sync_{add,sub}_and_fetch() are available despite
|
||||
dnl __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros being undefined.
|
||||
|
||||
AC_DEFUN([JE_SYNC_COMPARE_AND_SWAP_CHECK],[
|
||||
AC_CACHE_CHECK([whether to force $1-bit __sync_{add,sub}_and_fetch()],
|
||||
[je_cv_sync_compare_and_swap_$2],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
||||
#include <stdint.h>
|
||||
],
|
||||
[
|
||||
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2
|
||||
{
|
||||
uint$1_t x$1 = 0;
|
||||
__sync_add_and_fetch(&x$1, 42);
|
||||
__sync_sub_and_fetch(&x$1, 1);
|
||||
}
|
||||
#else
|
||||
#error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 is defined, no need to force
|
||||
#endif
|
||||
])],
|
||||
[je_cv_sync_compare_and_swap_$2=yes],
|
||||
[je_cv_sync_compare_and_swap_$2=no])])
|
||||
|
||||
if test "x${je_cv_sync_compare_and_swap_$2}" = "xyes" ; then
|
||||
AC_DEFINE([JE_FORCE_SYNC_COMPARE_AND_SWAP_$2], [ ])
|
||||
fi
|
||||
])
|
||||
|
||||
if test "x${je_cv_atomic9}" != "xyes" -a "x${je_cv_osatomic}" != "xyes" ; then
|
||||
JE_SYNC_COMPARE_AND_SWAP_CHECK(32, 4)
|
||||
JE_SYNC_COMPARE_AND_SWAP_CHECK(64, 8)
|
||||
fi
|
||||
|
||||
dnl ============================================================================
|
||||
dnl Check for __builtin_clz() and __builtin_clzl().
|
||||
|
||||
@@ -1965,21 +2100,6 @@ if test "x${je_cv_os_unfair_lock}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_OS_UNFAIR_LOCK], [ ])
|
||||
fi
|
||||
|
||||
dnl ============================================================================
|
||||
dnl Check for spinlock(3) operations as provided on Darwin.
|
||||
|
||||
JE_COMPILABLE([Darwin OSSpin*()], [
|
||||
#include <libkern/OSAtomic.h>
|
||||
#include <inttypes.h>
|
||||
], [
|
||||
OSSpinLock lock = 0;
|
||||
OSSpinLockLock(&lock);
|
||||
OSSpinLockUnlock(&lock);
|
||||
], [je_cv_osspin])
|
||||
if test "x${je_cv_osspin}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_OSSPIN], [ ])
|
||||
fi
|
||||
|
||||
dnl ============================================================================
|
||||
dnl Darwin-related configuration.
|
||||
|
||||
@@ -2032,9 +2152,7 @@ fi
|
||||
dnl ============================================================================
|
||||
dnl Enable background threads if possible.
|
||||
|
||||
if test "x${have_pthread}" = "x1" -a "x${have_dlsym}" = "x1" \
|
||||
-a "x${je_cv_os_unfair_lock}" != "xyes" \
|
||||
-a "x${je_cv_osspin}" != "xyes" ; then
|
||||
if test "x${have_pthread}" = "x1" -a "x${je_cv_os_unfair_lock}" != "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_BACKGROUND_THREAD])
|
||||
fi
|
||||
|
||||
@@ -2175,16 +2293,6 @@ AC_CONFIG_COMMANDS([include/jemalloc/internal/public_unnamespace.h], [
|
||||
srcdir="${srcdir}"
|
||||
objroot="${objroot}"
|
||||
])
|
||||
AC_CONFIG_COMMANDS([include/jemalloc/internal/size_classes.h], [
|
||||
mkdir -p "${objroot}include/jemalloc/internal"
|
||||
"${SHELL}" "${srcdir}/include/jemalloc/internal/size_classes.sh" "${LG_QUANTA}" 3 "${LG_PAGE_SIZES}" 2 > "${objroot}include/jemalloc/internal/size_classes.h"
|
||||
], [
|
||||
SHELL="${SHELL}"
|
||||
srcdir="${srcdir}"
|
||||
objroot="${objroot}"
|
||||
LG_QUANTA="${LG_QUANTA}"
|
||||
LG_PAGE_SIZES="${LG_PAGE_SIZES}"
|
||||
])
|
||||
AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_protos_jet.h], [
|
||||
mkdir -p "${objroot}include/jemalloc"
|
||||
cat "${srcdir}/include/jemalloc/jemalloc_protos.h.in" | sed -e 's/@je_@/jet_/g' > "${objroot}include/jemalloc/jemalloc_protos_jet.h"
|
||||
@@ -2277,9 +2385,13 @@ AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE])
|
||||
AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}])
|
||||
AC_MSG_RESULT([install_suffix : ${install_suffix}])
|
||||
AC_MSG_RESULT([malloc_conf : ${config_malloc_conf}])
|
||||
AC_MSG_RESULT([documentation : ${enable_doc}])
|
||||
AC_MSG_RESULT([shared libs : ${enable_shared}])
|
||||
AC_MSG_RESULT([static libs : ${enable_static}])
|
||||
AC_MSG_RESULT([autogen : ${enable_autogen}])
|
||||
AC_MSG_RESULT([debug : ${enable_debug}])
|
||||
AC_MSG_RESULT([stats : ${enable_stats}])
|
||||
AC_MSG_RESULT([experimetal_smallocx : ${enable_experimental_smallocx}])
|
||||
AC_MSG_RESULT([prof : ${enable_prof}])
|
||||
AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}])
|
||||
AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}])
|
||||
|
||||
Vendored
+156
-22
@@ -424,7 +424,7 @@ for (i = 0; i < nbins; i++) {
|
||||
called repeatedly. General information that never changes during
|
||||
execution can be omitted by specifying <quote>g</quote> as a character
|
||||
within the <parameter>opts</parameter> string. Note that
|
||||
<function>malloc_message()</function> uses the
|
||||
<function>malloc_stats_print()</function> uses the
|
||||
<function>mallctl*()</function> functions internally, so inconsistent
|
||||
statistics can be reported if multiple threads use these functions
|
||||
simultaneously. If <option>--enable-stats</option> is specified during
|
||||
@@ -433,10 +433,11 @@ for (i = 0; i < nbins; i++) {
|
||||
arena statistics, respectively; <quote>b</quote> and <quote>l</quote> can
|
||||
be specified to omit per size class statistics for bins and large objects,
|
||||
respectively; <quote>x</quote> can be specified to omit all mutex
|
||||
statistics. Unrecognized characters are silently ignored. Note that
|
||||
thread caching may prevent some statistics from being completely up to
|
||||
date, since extra locking would be required to merge counters that track
|
||||
thread cache operations.</para>
|
||||
statistics; <quote>e</quote> can be used to omit extent statistics.
|
||||
Unrecognized characters are silently ignored. Note that thread caching
|
||||
may prevent some statistics from being completely up to date, since extra
|
||||
locking would be required to merge counters that track thread cache
|
||||
operations.</para>
|
||||
|
||||
<para>The <function>malloc_usable_size()</function> function
|
||||
returns the usable size of the allocation pointed to by
|
||||
@@ -903,6 +904,23 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay",
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="opt.confirm_conf">
|
||||
<term>
|
||||
<mallctl>opt.confirm_conf</mallctl>
|
||||
(<type>bool</type>)
|
||||
<literal>r-</literal>
|
||||
</term>
|
||||
<listitem><para>Confirm-runtime-options-when-program-starts
|
||||
enabled/disabled. If true, the string specified via
|
||||
<option>--with-malloc-conf</option>, the string pointed to by the
|
||||
global variable <varname>malloc_conf</varname>, the <quote>name</quote>
|
||||
of the file referenced by the symbolic link named
|
||||
<filename class="symlink">/etc/malloc.conf</filename>, and the value of
|
||||
the environment variable <envar>MALLOC_CONF</envar>, will be printed in
|
||||
order. Then, each option being set will be individually printed. This
|
||||
option is disabled by default.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="opt.abort_conf">
|
||||
<term>
|
||||
<mallctl>opt.abort_conf</mallctl>
|
||||
@@ -943,16 +961,19 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay",
|
||||
<citerefentry><refentrytitle>munmap</refentrytitle>
|
||||
<manvolnum>2</manvolnum></citerefentry> or equivalent (see <link
|
||||
linkend="stats.retained">stats.retained</link> for related details).
|
||||
This option is disabled by default unless discarding virtual memory is
|
||||
known to trigger
|
||||
platform-specific performance problems, e.g. for [64-bit] Linux, which
|
||||
has a quirk in its virtual memory allocation algorithm that causes
|
||||
semi-permanent VM map holes under normal jemalloc operation. Although
|
||||
<citerefentry><refentrytitle>munmap</refentrytitle>
|
||||
<manvolnum>2</manvolnum></citerefentry> causes issues on 32-bit Linux as
|
||||
well, retaining virtual memory for 32-bit Linux is disabled by default
|
||||
due to the practical possibility of address space exhaustion.
|
||||
</para></listitem>
|
||||
It also makes jemalloc use <citerefentry>
|
||||
<refentrytitle>mmap</refentrytitle><manvolnum>2</manvolnum>
|
||||
</citerefentry> or equivalent in a more greedy way, mapping larger
|
||||
chunks in one go. This option is disabled by default unless discarding
|
||||
virtual memory is known to trigger platform-specific performance
|
||||
problems, namely 1) for [64-bit] Linux, which has a quirk in its virtual
|
||||
memory allocation algorithm that causes semi-permanent VM map holes
|
||||
under normal jemalloc operation; and 2) for [64-bit] Windows, which
|
||||
disallows split / merged regions with
|
||||
<parameter><constant>MEM_RELEASE</constant></parameter>. Although the
|
||||
same issues may present on 32-bit platforms as well, retaining virtual
|
||||
memory for 32-bit Linux and Windows is disabled by default due to the
|
||||
practical possibility of address space exhaustion. </para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="opt.dss">
|
||||
@@ -988,6 +1009,24 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay",
|
||||
number of CPUs, or one if there is a single CPU.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="opt.oversize_threshold">
|
||||
<term>
|
||||
<mallctl>opt.oversize_threshold</mallctl>
|
||||
(<type>size_t</type>)
|
||||
<literal>r-</literal>
|
||||
</term>
|
||||
<listitem><para>The threshold in bytes of which requests are considered
|
||||
oversize. Allocation requests with greater sizes are fulfilled from a
|
||||
dedicated arena (automatically managed, however not within
|
||||
<literal>narenas</literal>), in order to reduce fragmentation by not
|
||||
mixing huge allocations with small ones. In addition, the decay API
|
||||
guarantees on the extents greater than the specified threshold may be
|
||||
overridden. Note that requests with arena index specified via
|
||||
<constant>MALLOCX_ARENA</constant>, or threads associated with explicit
|
||||
arenas will not be considered. The default threshold is 8MiB. Values
|
||||
not within large size classes disables this feature.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="opt.percpu_arena">
|
||||
<term>
|
||||
<mallctl>opt.percpu_arena</mallctl>
|
||||
@@ -1009,7 +1048,7 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay",
|
||||
<varlistentry id="opt.background_thread">
|
||||
<term>
|
||||
<mallctl>opt.background_thread</mallctl>
|
||||
(<type>const bool</type>)
|
||||
(<type>bool</type>)
|
||||
<literal>r-</literal>
|
||||
</term>
|
||||
<listitem><para>Internal background worker threads enabled/disabled.
|
||||
@@ -1024,7 +1063,7 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay",
|
||||
<varlistentry id="opt.max_background_threads">
|
||||
<term>
|
||||
<mallctl>opt.max_background_threads</mallctl>
|
||||
(<type>const size_t</type>)
|
||||
(<type>size_t</type>)
|
||||
<literal>r-</literal>
|
||||
</term>
|
||||
<listitem><para>Maximum number of background threads that will be created
|
||||
@@ -1055,7 +1094,11 @@ mallctl("arena." STRINGIFY(MALLCTL_ARENAS_ALL) ".decay",
|
||||
linkend="arena.i.dirty_decay_ms"><mallctl>arena.<i>.dirty_decay_ms</mallctl></link>
|
||||
for related dynamic control options. See <link
|
||||
linkend="opt.muzzy_decay_ms"><mallctl>opt.muzzy_decay_ms</mallctl></link>
|
||||
for a description of muzzy pages.</para></listitem>
|
||||
for a description of muzzy pages.for a description of muzzy pages. Note
|
||||
that when the <link
|
||||
linkend="opt.oversize_threshold"><mallctl>oversize_threshold</mallctl></link>
|
||||
feature is enabled, the arenas reserved for oversize requests may have
|
||||
its own default decay settings.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="opt.muzzy_decay_ms">
|
||||
@@ -1763,10 +1806,11 @@ malloc_conf = "xmalloc:true";]]></programlisting>
|
||||
to control allocation for arenas explicitly created via <link
|
||||
linkend="arenas.create"><mallctl>arenas.create</mallctl></link> such
|
||||
that all extents originate from an application-supplied extent allocator
|
||||
(by specifying the custom extent hook functions during arena creation),
|
||||
but the automatically created arenas will have already created extents
|
||||
prior to the application having an opportunity to take over extent
|
||||
allocation.</para>
|
||||
(by specifying the custom extent hook functions during arena creation).
|
||||
However, the API guarantees for the automatically created arenas may be
|
||||
relaxed -- hooks set there may be called in a "best effort" fashion; in
|
||||
addition there may be extents created prior to the application having an
|
||||
opportunity to take over extent allocation.</para>
|
||||
|
||||
<programlisting language="C"><![CDATA[
|
||||
typedef extent_hooks_s extent_hooks_t;
|
||||
@@ -2593,6 +2637,17 @@ struct extent_hooks_s {
|
||||
details.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="stats.arenas.i.extent_avail">
|
||||
<term>
|
||||
<mallctl>stats.arenas.<i>.extent_avail</mallctl>
|
||||
(<type>size_t</type>)
|
||||
<literal>r-</literal>
|
||||
[<option>--enable-stats</option>]
|
||||
</term>
|
||||
<listitem><para>Number of allocated (but unused) extent structs in this
|
||||
arena.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="stats.arenas.i.base">
|
||||
<term>
|
||||
<mallctl>stats.arenas.<i>.base</mallctl>
|
||||
@@ -2760,6 +2815,28 @@ struct extent_hooks_s {
|
||||
all bin size classes.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="stats.arenas.i.small.nfills">
|
||||
<term>
|
||||
<mallctl>stats.arenas.<i>.small.nfills</mallctl>
|
||||
(<type>uint64_t</type>)
|
||||
<literal>r-</literal>
|
||||
[<option>--enable-stats</option>]
|
||||
</term>
|
||||
<listitem><para>Cumulative number of tcache fills by all small size
|
||||
classes.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="stats.arenas.i.small.nflushes">
|
||||
<term>
|
||||
<mallctl>stats.arenas.<i>.small.nflushes</mallctl>
|
||||
(<type>uint64_t</type>)
|
||||
<literal>r-</literal>
|
||||
[<option>--enable-stats</option>]
|
||||
</term>
|
||||
<listitem><para>Cumulative number of tcache flushes by all small size
|
||||
classes.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="stats.arenas.i.large.allocated">
|
||||
<term>
|
||||
<mallctl>stats.arenas.<i>.large.allocated</mallctl>
|
||||
@@ -2810,6 +2887,28 @@ struct extent_hooks_s {
|
||||
all large size classes.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="stats.arenas.i.large.nfills">
|
||||
<term>
|
||||
<mallctl>stats.arenas.<i>.large.nfills</mallctl>
|
||||
(<type>uint64_t</type>)
|
||||
<literal>r-</literal>
|
||||
[<option>--enable-stats</option>]
|
||||
</term>
|
||||
<listitem><para>Cumulative number of tcache fills by all large size
|
||||
classes.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="stats.arenas.i.large.nflushes">
|
||||
<term>
|
||||
<mallctl>stats.arenas.<i>.large.nflushes</mallctl>
|
||||
(<type>uint64_t</type>)
|
||||
<literal>r-</literal>
|
||||
[<option>--enable-stats</option>]
|
||||
</term>
|
||||
<listitem><para>Cumulative number of tcache flushes by all large size
|
||||
classes.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="stats.arenas.i.bins.j.nmalloc">
|
||||
<term>
|
||||
<mallctl>stats.arenas.<i>.bins.<j>.nmalloc</mallctl>
|
||||
@@ -2909,6 +3008,17 @@ struct extent_hooks_s {
|
||||
<listitem><para>Current number of slabs.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry id="stats.arenas.i.bins.j.nonfull_slabs">
|
||||
<term>
|
||||
<mallctl>stats.arenas.<i>.bins.<j>.nonfull_slabs</mallctl>
|
||||
(<type>size_t</type>)
|
||||
<literal>r-</literal>
|
||||
[<option>--enable-stats</option>]
|
||||
</term>
|
||||
<listitem><para>Current number of nonfull slabs.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="stats.arenas.i.bins.mutex">
|
||||
<term>
|
||||
<mallctl>stats.arenas.<i>.bins.<j>.mutex.{counter}</mallctl>
|
||||
@@ -2922,6 +3032,30 @@ struct extent_hooks_s {
|
||||
counters</link>.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="stats.arenas.i.extents.n">
|
||||
<term>
|
||||
<mallctl>stats.arenas.<i>.extents.<j>.n{extent_type}</mallctl>
|
||||
(<type>size_t</type>)
|
||||
<literal>r-</literal>
|
||||
[<option>--enable-stats</option>]
|
||||
</term>
|
||||
<listitem><para> Number of extents of the given type in this arena in
|
||||
the bucket corresponding to page size index <j>. The extent type
|
||||
is one of dirty, muzzy, or retained.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="stats.arenas.i.extents.bytes">
|
||||
<term>
|
||||
<mallctl>stats.arenas.<i>.extents.<j>.{extent_type}_bytes</mallctl>
|
||||
(<type>size_t</type>)
|
||||
<literal>r-</literal>
|
||||
[<option>--enable-stats</option>]
|
||||
</term>
|
||||
<listitem><para> Sum of the bytes managed by extents of the given type
|
||||
in this arena in the bucket corresponding to page size index <j>.
|
||||
The extent type is one of dirty, muzzy, or retained.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="stats.arenas.i.lextents.j.nmalloc">
|
||||
<term>
|
||||
<mallctl>stats.arenas.<i>.lextents.<j>.nmalloc</mallctl>
|
||||
|
||||
+18
-8
@@ -3,8 +3,8 @@
|
||||
|
||||
#include "jemalloc/internal/bin.h"
|
||||
#include "jemalloc/internal/extent_dss.h"
|
||||
#include "jemalloc/internal/hook.h"
|
||||
#include "jemalloc/internal/pages.h"
|
||||
#include "jemalloc/internal/size_classes.h"
|
||||
#include "jemalloc/internal/stats.h"
|
||||
|
||||
extern ssize_t opt_dirty_decay_ms;
|
||||
@@ -16,13 +16,17 @@ extern const char *percpu_arena_mode_names[];
|
||||
extern const uint64_t h_steps[SMOOTHSTEP_NSTEPS];
|
||||
extern malloc_mutex_t arenas_lock;
|
||||
|
||||
extern size_t opt_oversize_threshold;
|
||||
extern size_t oversize_threshold;
|
||||
|
||||
void arena_basic_stats_merge(tsdn_t *tsdn, arena_t *arena,
|
||||
unsigned *nthreads, const char **dss, ssize_t *dirty_decay_ms,
|
||||
ssize_t *muzzy_decay_ms, size_t *nactive, size_t *ndirty, size_t *nmuzzy);
|
||||
void arena_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads,
|
||||
const char **dss, ssize_t *dirty_decay_ms, ssize_t *muzzy_decay_ms,
|
||||
size_t *nactive, size_t *ndirty, size_t *nmuzzy, arena_stats_t *astats,
|
||||
bin_stats_t *bstats, arena_stats_large_t *lstats);
|
||||
bin_stats_t *bstats, arena_stats_large_t *lstats,
|
||||
arena_stats_extents_t *estats);
|
||||
void arena_extents_dirty_dalloc(tsdn_t *tsdn, arena_t *arena,
|
||||
extent_hooks_t **r_extent_hooks, extent_t *extent);
|
||||
#ifdef JEMALLOC_JET
|
||||
@@ -56,16 +60,17 @@ void *arena_malloc_hard(tsdn_t *tsdn, arena_t *arena, size_t size,
|
||||
szind_t ind, bool zero);
|
||||
void *arena_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize,
|
||||
size_t alignment, bool zero, tcache_t *tcache);
|
||||
void arena_prof_promote(tsdn_t *tsdn, const void *ptr, size_t usize);
|
||||
void arena_prof_promote(tsdn_t *tsdn, void *ptr, size_t usize);
|
||||
void arena_dalloc_promoted(tsdn_t *tsdn, void *ptr, tcache_t *tcache,
|
||||
bool slow_path);
|
||||
void arena_dalloc_bin_junked_locked(tsdn_t *tsdn, arena_t *arena,
|
||||
extent_t *extent, void *ptr);
|
||||
void arena_dalloc_bin_junked_locked(tsdn_t *tsdn, arena_t *arena, bin_t *bin,
|
||||
szind_t binind, extent_t *extent, void *ptr);
|
||||
void arena_dalloc_small(tsdn_t *tsdn, void *ptr);
|
||||
bool arena_ralloc_no_move(tsdn_t *tsdn, void *ptr, size_t oldsize, size_t size,
|
||||
size_t extra, bool zero);
|
||||
size_t extra, bool zero, size_t *newsize);
|
||||
void *arena_ralloc(tsdn_t *tsdn, arena_t *arena, void *ptr, size_t oldsize,
|
||||
size_t size, size_t alignment, bool zero, tcache_t *tcache);
|
||||
size_t size, size_t alignment, bool zero, tcache_t *tcache,
|
||||
hook_ralloc_args_t *hook_args);
|
||||
dss_prec_t arena_dss_prec_get(arena_t *arena);
|
||||
bool arena_dss_prec_set(arena_t *arena, dss_prec_t dss_prec);
|
||||
ssize_t arena_dirty_decay_ms_default_get(void);
|
||||
@@ -79,7 +84,12 @@ void arena_nthreads_inc(arena_t *arena, bool internal);
|
||||
void arena_nthreads_dec(arena_t *arena, bool internal);
|
||||
size_t arena_extent_sn_next(arena_t *arena);
|
||||
arena_t *arena_new(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks);
|
||||
void arena_boot(void);
|
||||
bool arena_init_huge(void);
|
||||
bool arena_is_huge(unsigned arena_ind);
|
||||
arena_t *arena_choose_huge(tsd_t *tsd);
|
||||
bin_t *arena_bin_choose_lock(tsdn_t *tsdn, arena_t *arena, szind_t binind,
|
||||
unsigned *binshard);
|
||||
void arena_boot(sc_data_t *sc_data);
|
||||
void arena_prefork0(tsdn_t *tsdn, arena_t *arena);
|
||||
void arena_prefork1(tsdn_t *tsdn, arena_t *arena);
|
||||
void arena_prefork2(tsdn_t *tsdn, arena_t *arena);
|
||||
|
||||
+115
-42
@@ -4,10 +4,36 @@
|
||||
#include "jemalloc/internal/jemalloc_internal_types.h"
|
||||
#include "jemalloc/internal/mutex.h"
|
||||
#include "jemalloc/internal/rtree.h"
|
||||
#include "jemalloc/internal/size_classes.h"
|
||||
#include "jemalloc/internal/sc.h"
|
||||
#include "jemalloc/internal/sz.h"
|
||||
#include "jemalloc/internal/ticker.h"
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE bool
|
||||
arena_has_default_hooks(arena_t *arena) {
|
||||
return (extent_hooks_get(arena) == &extent_hooks_default);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE arena_t *
|
||||
arena_choose_maybe_huge(tsd_t *tsd, arena_t *arena, size_t size) {
|
||||
if (arena != NULL) {
|
||||
return arena;
|
||||
}
|
||||
|
||||
/*
|
||||
* For huge allocations, use the dedicated huge arena if both are true:
|
||||
* 1) is using auto arena selection (i.e. arena == NULL), and 2) the
|
||||
* thread is not assigned to a manual arena.
|
||||
*/
|
||||
if (unlikely(size >= oversize_threshold)) {
|
||||
arena_t *tsd_arena = tsd_arena_get(tsd);
|
||||
if (tsd_arena == NULL || arena_is_auto(tsd_arena)) {
|
||||
return arena_choose_huge(tsd);
|
||||
}
|
||||
}
|
||||
|
||||
return arena_choose(tsd, NULL);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE prof_tctx_t *
|
||||
arena_prof_tctx_get(tsdn_t *tsdn, const void *ptr, alloc_ctx_t *alloc_ctx) {
|
||||
cassert(config_prof);
|
||||
@@ -28,7 +54,7 @@ arena_prof_tctx_get(tsdn_t *tsdn, const void *ptr, alloc_ctx_t *alloc_ctx) {
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void
|
||||
arena_prof_tctx_set(tsdn_t *tsdn, const void *ptr, UNUSED size_t usize,
|
||||
arena_prof_tctx_set(tsdn_t *tsdn, const void *ptr, size_t usize,
|
||||
alloc_ctx_t *alloc_ctx, prof_tctx_t *tctx) {
|
||||
cassert(config_prof);
|
||||
assert(ptr != NULL);
|
||||
@@ -47,7 +73,7 @@ arena_prof_tctx_set(tsdn_t *tsdn, const void *ptr, UNUSED size_t usize,
|
||||
}
|
||||
|
||||
static inline void
|
||||
arena_prof_tctx_reset(tsdn_t *tsdn, const void *ptr, UNUSED prof_tctx_t *tctx) {
|
||||
arena_prof_tctx_reset(tsdn_t *tsdn, const void *ptr, prof_tctx_t *tctx) {
|
||||
cassert(config_prof);
|
||||
assert(ptr != NULL);
|
||||
|
||||
@@ -57,6 +83,32 @@ arena_prof_tctx_reset(tsdn_t *tsdn, const void *ptr, UNUSED prof_tctx_t *tctx) {
|
||||
large_prof_tctx_reset(tsdn, extent);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE nstime_t
|
||||
arena_prof_alloc_time_get(tsdn_t *tsdn, const void *ptr,
|
||||
alloc_ctx_t *alloc_ctx) {
|
||||
cassert(config_prof);
|
||||
assert(ptr != NULL);
|
||||
|
||||
extent_t *extent = iealloc(tsdn, ptr);
|
||||
/*
|
||||
* Unlike arena_prof_prof_tctx_{get, set}, we only call this once we're
|
||||
* sure we have a sampled allocation.
|
||||
*/
|
||||
assert(!extent_slab_get(extent));
|
||||
return large_prof_alloc_time_get(extent);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void
|
||||
arena_prof_alloc_time_set(tsdn_t *tsdn, const void *ptr, alloc_ctx_t *alloc_ctx,
|
||||
nstime_t t) {
|
||||
cassert(config_prof);
|
||||
assert(ptr != NULL);
|
||||
|
||||
extent_t *extent = iealloc(tsdn, ptr);
|
||||
assert(!extent_slab_get(extent));
|
||||
large_prof_alloc_time_set(extent, t);
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void
|
||||
arena_decay_ticks(tsdn_t *tsdn, arena_t *arena, unsigned nticks) {
|
||||
tsd_t *tsd;
|
||||
@@ -83,14 +135,33 @@ arena_decay_tick(tsdn_t *tsdn, arena_t *arena) {
|
||||
arena_decay_ticks(tsdn, arena, 1);
|
||||
}
|
||||
|
||||
/* Purge a single extent to retained / unmapped directly. */
|
||||
JEMALLOC_ALWAYS_INLINE void
|
||||
arena_decay_extent(tsdn_t *tsdn,arena_t *arena, extent_hooks_t **r_extent_hooks,
|
||||
extent_t *extent) {
|
||||
size_t extent_size = extent_size_get(extent);
|
||||
extent_dalloc_wrapper(tsdn, arena,
|
||||
r_extent_hooks, extent);
|
||||
if (config_stats) {
|
||||
/* Update stats accordingly. */
|
||||
arena_stats_lock(tsdn, &arena->stats);
|
||||
arena_stats_add_u64(tsdn, &arena->stats,
|
||||
&arena->decay_dirty.stats->nmadvise, 1);
|
||||
arena_stats_add_u64(tsdn, &arena->stats,
|
||||
&arena->decay_dirty.stats->purged, extent_size >> LG_PAGE);
|
||||
arena_stats_sub_zu(tsdn, &arena->stats, &arena->stats.mapped,
|
||||
extent_size);
|
||||
arena_stats_unlock(tsdn, &arena->stats);
|
||||
}
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void *
|
||||
arena_malloc(tsdn_t *tsdn, arena_t *arena, size_t size, szind_t ind, bool zero,
|
||||
tcache_t *tcache, bool slow_path) {
|
||||
assert(!tsdn_null(tsdn) || tcache == NULL);
|
||||
assert(size != 0);
|
||||
|
||||
if (likely(tcache != NULL)) {
|
||||
if (likely(size <= SMALL_MAXCLASS)) {
|
||||
if (likely(size <= SC_SMALL_MAXCLASS)) {
|
||||
return tcache_alloc_small(tsdn_tsd(tsdn), arena,
|
||||
tcache, size, ind, zero, slow_path);
|
||||
}
|
||||
@@ -119,7 +190,7 @@ arena_salloc(tsdn_t *tsdn, const void *ptr) {
|
||||
|
||||
szind_t szind = rtree_szind_read(tsdn, &extents_rtree, rtree_ctx,
|
||||
(uintptr_t)ptr, true);
|
||||
assert(szind != NSIZES);
|
||||
assert(szind != SC_NSIZES);
|
||||
|
||||
return sz_index2size(szind);
|
||||
}
|
||||
@@ -152,11 +223,21 @@ arena_vsalloc(tsdn_t *tsdn, const void *ptr) {
|
||||
/* Only slab members should be looked up via interior pointers. */
|
||||
assert(extent_addr_get(extent) == ptr || extent_slab_get(extent));
|
||||
|
||||
assert(szind != NSIZES);
|
||||
assert(szind != SC_NSIZES);
|
||||
|
||||
return sz_index2size(szind);
|
||||
}
|
||||
|
||||
static inline void
|
||||
arena_dalloc_large_no_tcache(tsdn_t *tsdn, void *ptr, szind_t szind) {
|
||||
if (config_prof && unlikely(szind < SC_NBINS)) {
|
||||
arena_dalloc_promoted(tsdn, ptr, NULL, true);
|
||||
} else {
|
||||
extent_t *extent = iealloc(tsdn, ptr);
|
||||
large_dalloc(tsdn, extent);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
arena_dalloc_no_tcache(tsdn_t *tsdn, void *ptr) {
|
||||
assert(ptr != NULL);
|
||||
@@ -173,13 +254,28 @@ arena_dalloc_no_tcache(tsdn_t *tsdn, void *ptr) {
|
||||
extent_t *extent = rtree_extent_read(tsdn, &extents_rtree,
|
||||
rtree_ctx, (uintptr_t)ptr, true);
|
||||
assert(szind == extent_szind_get(extent));
|
||||
assert(szind < NSIZES);
|
||||
assert(szind < SC_NSIZES);
|
||||
assert(slab == extent_slab_get(extent));
|
||||
}
|
||||
|
||||
if (likely(slab)) {
|
||||
/* Small allocation. */
|
||||
arena_dalloc_small(tsdn, ptr);
|
||||
} else {
|
||||
arena_dalloc_large_no_tcache(tsdn, ptr, szind);
|
||||
}
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void
|
||||
arena_dalloc_large(tsdn_t *tsdn, void *ptr, tcache_t *tcache, szind_t szind,
|
||||
bool slow_path) {
|
||||
if (szind < nhbins) {
|
||||
if (config_prof && unlikely(szind < SC_NBINS)) {
|
||||
arena_dalloc_promoted(tsdn, ptr, tcache, slow_path);
|
||||
} else {
|
||||
tcache_dalloc_large(tsdn_tsd(tsdn), tcache, ptr, szind,
|
||||
slow_path);
|
||||
}
|
||||
} else {
|
||||
extent_t *extent = iealloc(tsdn, ptr);
|
||||
large_dalloc(tsdn, extent);
|
||||
@@ -203,7 +299,7 @@ arena_dalloc(tsdn_t *tsdn, void *ptr, tcache_t *tcache,
|
||||
if (alloc_ctx != NULL) {
|
||||
szind = alloc_ctx->szind;
|
||||
slab = alloc_ctx->slab;
|
||||
assert(szind != NSIZES);
|
||||
assert(szind != SC_NSIZES);
|
||||
} else {
|
||||
rtree_ctx = tsd_rtree_ctx(tsdn_tsd(tsdn));
|
||||
rtree_szind_slab_read(tsdn, &extents_rtree, rtree_ctx,
|
||||
@@ -215,7 +311,7 @@ arena_dalloc(tsdn_t *tsdn, void *ptr, tcache_t *tcache,
|
||||
extent_t *extent = rtree_extent_read(tsdn, &extents_rtree,
|
||||
rtree_ctx, (uintptr_t)ptr, true);
|
||||
assert(szind == extent_szind_get(extent));
|
||||
assert(szind < NSIZES);
|
||||
assert(szind < SC_NSIZES);
|
||||
assert(slab == extent_slab_get(extent));
|
||||
}
|
||||
|
||||
@@ -224,25 +320,14 @@ arena_dalloc(tsdn_t *tsdn, void *ptr, tcache_t *tcache,
|
||||
tcache_dalloc_small(tsdn_tsd(tsdn), tcache, ptr, szind,
|
||||
slow_path);
|
||||
} else {
|
||||
if (szind < nhbins) {
|
||||
if (config_prof && unlikely(szind < NBINS)) {
|
||||
arena_dalloc_promoted(tsdn, ptr, tcache,
|
||||
slow_path);
|
||||
} else {
|
||||
tcache_dalloc_large(tsdn_tsd(tsdn), tcache, ptr,
|
||||
szind, slow_path);
|
||||
}
|
||||
} else {
|
||||
extent_t *extent = iealloc(tsdn, ptr);
|
||||
large_dalloc(tsdn, extent);
|
||||
}
|
||||
arena_dalloc_large(tsdn, ptr, tcache, szind, slow_path);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
arena_sdalloc_no_tcache(tsdn_t *tsdn, void *ptr, size_t size) {
|
||||
assert(ptr != NULL);
|
||||
assert(size <= LARGE_MAXCLASS);
|
||||
assert(size <= SC_LARGE_MAXCLASS);
|
||||
|
||||
szind_t szind;
|
||||
bool slab;
|
||||
@@ -252,7 +337,7 @@ arena_sdalloc_no_tcache(tsdn_t *tsdn, void *ptr, size_t size) {
|
||||
* object, so base szind and slab on the given size.
|
||||
*/
|
||||
szind = sz_size2index(size);
|
||||
slab = (szind < NBINS);
|
||||
slab = (szind < SC_NBINS);
|
||||
}
|
||||
|
||||
if ((config_prof && opt_prof) || config_debug) {
|
||||
@@ -264,7 +349,7 @@ arena_sdalloc_no_tcache(tsdn_t *tsdn, void *ptr, size_t size) {
|
||||
(uintptr_t)ptr, true, &szind, &slab);
|
||||
|
||||
assert(szind == sz_size2index(size));
|
||||
assert((config_prof && opt_prof) || slab == (szind < NBINS));
|
||||
assert((config_prof && opt_prof) || slab == (szind < SC_NBINS));
|
||||
|
||||
if (config_debug) {
|
||||
extent_t *extent = rtree_extent_read(tsdn,
|
||||
@@ -278,8 +363,7 @@ arena_sdalloc_no_tcache(tsdn_t *tsdn, void *ptr, size_t size) {
|
||||
/* Small allocation. */
|
||||
arena_dalloc_small(tsdn, ptr);
|
||||
} else {
|
||||
extent_t *extent = iealloc(tsdn, ptr);
|
||||
large_dalloc(tsdn, extent);
|
||||
arena_dalloc_large_no_tcache(tsdn, ptr, szind);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,7 +372,7 @@ arena_sdalloc(tsdn_t *tsdn, void *ptr, size_t size, tcache_t *tcache,
|
||||
alloc_ctx_t *alloc_ctx, bool slow_path) {
|
||||
assert(!tsdn_null(tsdn) || tcache == NULL);
|
||||
assert(ptr != NULL);
|
||||
assert(size <= LARGE_MAXCLASS);
|
||||
assert(size <= SC_LARGE_MAXCLASS);
|
||||
|
||||
if (unlikely(tcache == NULL)) {
|
||||
arena_sdalloc_no_tcache(tsdn, ptr, size);
|
||||
@@ -297,7 +381,7 @@ arena_sdalloc(tsdn_t *tsdn, void *ptr, size_t size, tcache_t *tcache,
|
||||
|
||||
szind_t szind;
|
||||
bool slab;
|
||||
UNUSED alloc_ctx_t local_ctx;
|
||||
alloc_ctx_t local_ctx;
|
||||
if (config_prof && opt_prof) {
|
||||
if (alloc_ctx == NULL) {
|
||||
/* Uncommon case and should be a static check. */
|
||||
@@ -318,7 +402,7 @@ arena_sdalloc(tsdn_t *tsdn, void *ptr, size_t size, tcache_t *tcache,
|
||||
* object, so base szind and slab on the given size.
|
||||
*/
|
||||
szind = sz_size2index(size);
|
||||
slab = (szind < NBINS);
|
||||
slab = (szind < SC_NBINS);
|
||||
}
|
||||
|
||||
if (config_debug) {
|
||||
@@ -336,18 +420,7 @@ arena_sdalloc(tsdn_t *tsdn, void *ptr, size_t size, tcache_t *tcache,
|
||||
tcache_dalloc_small(tsdn_tsd(tsdn), tcache, ptr, szind,
|
||||
slow_path);
|
||||
} else {
|
||||
if (szind < nhbins) {
|
||||
if (config_prof && unlikely(szind < NBINS)) {
|
||||
arena_dalloc_promoted(tsdn, ptr, tcache,
|
||||
slow_path);
|
||||
} else {
|
||||
tcache_dalloc_large(tsdn_tsd(tsdn),
|
||||
tcache, ptr, szind, slow_path);
|
||||
}
|
||||
} else {
|
||||
extent_t *extent = iealloc(tsdn, ptr);
|
||||
large_dalloc(tsdn, extent);
|
||||
}
|
||||
arena_dalloc_large(tsdn, ptr, tcache, szind, slow_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+49
-15
@@ -4,7 +4,9 @@
|
||||
#include "jemalloc/internal/atomic.h"
|
||||
#include "jemalloc/internal/mutex.h"
|
||||
#include "jemalloc/internal/mutex_prof.h"
|
||||
#include "jemalloc/internal/size_classes.h"
|
||||
#include "jemalloc/internal/sc.h"
|
||||
|
||||
JEMALLOC_DIAGNOSTIC_DISABLE_SPURIOUS
|
||||
|
||||
/*
|
||||
* In those architectures that support 64-bit atomics, we use atomic updates for
|
||||
@@ -33,6 +35,13 @@ struct arena_stats_large_s {
|
||||
* periodically merges into this counter.
|
||||
*/
|
||||
arena_stats_u64_t nrequests; /* Partially derived. */
|
||||
/*
|
||||
* Number of tcache fills / flushes for large (similarly, periodically
|
||||
* merged). Note that there is no large tcache batch-fill currently
|
||||
* (i.e. only fill 1 at a time); however flush may be batched.
|
||||
*/
|
||||
arena_stats_u64_t nfills; /* Partially derived. */
|
||||
arena_stats_u64_t nflushes; /* Partially derived. */
|
||||
|
||||
/* Current number of allocations of this size class. */
|
||||
size_t curlextents; /* Derived. */
|
||||
@@ -48,6 +57,22 @@ struct arena_stats_decay_s {
|
||||
arena_stats_u64_t purged;
|
||||
};
|
||||
|
||||
typedef struct arena_stats_extents_s arena_stats_extents_t;
|
||||
struct arena_stats_extents_s {
|
||||
/*
|
||||
* Stats for a given index in the range [0, SC_NPSIZES] in an extents_t.
|
||||
* We track both bytes and # of extents: two extents in the same bucket
|
||||
* may have different sizes if adjacent size classes differ by more than
|
||||
* a page, so bytes cannot always be derived from # of extents.
|
||||
*/
|
||||
atomic_zu_t ndirty;
|
||||
atomic_zu_t dirty_bytes;
|
||||
atomic_zu_t nmuzzy;
|
||||
atomic_zu_t muzzy_bytes;
|
||||
atomic_zu_t nretained;
|
||||
atomic_zu_t retained_bytes;
|
||||
};
|
||||
|
||||
/*
|
||||
* Arena stats. Note that fields marked "derived" are not directly maintained
|
||||
* within the arena code; rather their values are derived during stats merge
|
||||
@@ -69,6 +94,9 @@ struct arena_stats_s {
|
||||
*/
|
||||
atomic_zu_t retained; /* Derived. */
|
||||
|
||||
/* Number of extent_t structs allocated by base, but not being used. */
|
||||
atomic_zu_t extent_avail;
|
||||
|
||||
arena_stats_decay_t decay_dirty;
|
||||
arena_stats_decay_t decay_muzzy;
|
||||
|
||||
@@ -80,22 +108,27 @@ struct arena_stats_s {
|
||||
atomic_zu_t allocated_large; /* Derived. */
|
||||
arena_stats_u64_t nmalloc_large; /* Derived. */
|
||||
arena_stats_u64_t ndalloc_large; /* Derived. */
|
||||
arena_stats_u64_t nfills_large; /* Derived. */
|
||||
arena_stats_u64_t nflushes_large; /* Derived. */
|
||||
arena_stats_u64_t nrequests_large; /* Derived. */
|
||||
|
||||
/* VM space had to be leaked (undocumented). Normally 0. */
|
||||
atomic_zu_t abandoned_vm;
|
||||
|
||||
/* Number of bytes cached in tcache associated with this arena. */
|
||||
atomic_zu_t tcache_bytes; /* Derived. */
|
||||
|
||||
mutex_prof_data_t mutex_prof_data[mutex_prof_num_arena_mutexes];
|
||||
|
||||
/* One element for each large size class. */
|
||||
arena_stats_large_t lstats[NSIZES - NBINS];
|
||||
arena_stats_large_t lstats[SC_NSIZES - SC_NBINS];
|
||||
|
||||
/* Arena uptime. */
|
||||
nstime_t uptime;
|
||||
};
|
||||
|
||||
static inline bool
|
||||
arena_stats_init(UNUSED tsdn_t *tsdn, arena_stats_t *arena_stats) {
|
||||
arena_stats_init(tsdn_t *tsdn, arena_stats_t *arena_stats) {
|
||||
if (config_debug) {
|
||||
for (size_t i = 0; i < sizeof(arena_stats_t); i++) {
|
||||
assert(((char *)arena_stats)[i] == 0);
|
||||
@@ -147,11 +180,11 @@ arena_stats_add_u64(tsdn_t *tsdn, arena_stats_t *arena_stats,
|
||||
#endif
|
||||
}
|
||||
|
||||
UNUSED static inline void
|
||||
static inline void
|
||||
arena_stats_sub_u64(tsdn_t *tsdn, arena_stats_t *arena_stats,
|
||||
arena_stats_u64_t *p, uint64_t x) {
|
||||
#ifdef JEMALLOC_ATOMIC_U64
|
||||
UNUSED uint64_t r = atomic_fetch_sub_u64(p, x, ATOMIC_RELAXED);
|
||||
uint64_t r = atomic_fetch_sub_u64(p, x, ATOMIC_RELAXED);
|
||||
assert(r - x <= r);
|
||||
#else
|
||||
malloc_mutex_assert_owner(tsdn, &arena_stats->mtx);
|
||||
@@ -176,7 +209,8 @@ arena_stats_accum_u64(arena_stats_u64_t *dst, uint64_t src) {
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
arena_stats_read_zu(tsdn_t *tsdn, arena_stats_t *arena_stats, atomic_zu_t *p) {
|
||||
arena_stats_read_zu(tsdn_t *tsdn, arena_stats_t *arena_stats,
|
||||
atomic_zu_t *p) {
|
||||
#ifdef JEMALLOC_ATOMIC_U64
|
||||
return atomic_load_zu(p, ATOMIC_RELAXED);
|
||||
#else
|
||||
@@ -186,8 +220,8 @@ arena_stats_read_zu(tsdn_t *tsdn, arena_stats_t *arena_stats, atomic_zu_t *p) {
|
||||
}
|
||||
|
||||
static inline void
|
||||
arena_stats_add_zu(tsdn_t *tsdn, arena_stats_t *arena_stats, atomic_zu_t *p,
|
||||
size_t x) {
|
||||
arena_stats_add_zu(tsdn_t *tsdn, arena_stats_t *arena_stats,
|
||||
atomic_zu_t *p, size_t x) {
|
||||
#ifdef JEMALLOC_ATOMIC_U64
|
||||
atomic_fetch_add_zu(p, x, ATOMIC_RELAXED);
|
||||
#else
|
||||
@@ -198,10 +232,10 @@ arena_stats_add_zu(tsdn_t *tsdn, arena_stats_t *arena_stats, atomic_zu_t *p,
|
||||
}
|
||||
|
||||
static inline void
|
||||
arena_stats_sub_zu(tsdn_t *tsdn, arena_stats_t *arena_stats, atomic_zu_t *p,
|
||||
size_t x) {
|
||||
arena_stats_sub_zu(tsdn_t *tsdn, arena_stats_t *arena_stats,
|
||||
atomic_zu_t *p, size_t x) {
|
||||
#ifdef JEMALLOC_ATOMIC_U64
|
||||
UNUSED size_t r = atomic_fetch_sub_zu(p, x, ATOMIC_RELAXED);
|
||||
size_t r = atomic_fetch_sub_zu(p, x, ATOMIC_RELAXED);
|
||||
assert(r - x <= r);
|
||||
#else
|
||||
malloc_mutex_assert_owner(tsdn, &arena_stats->mtx);
|
||||
@@ -218,11 +252,12 @@ arena_stats_accum_zu(atomic_zu_t *dst, size_t src) {
|
||||
}
|
||||
|
||||
static inline void
|
||||
arena_stats_large_nrequests_add(tsdn_t *tsdn, arena_stats_t *arena_stats,
|
||||
arena_stats_large_flush_nrequests_add(tsdn_t *tsdn, arena_stats_t *arena_stats,
|
||||
szind_t szind, uint64_t nrequests) {
|
||||
arena_stats_lock(tsdn, arena_stats);
|
||||
arena_stats_add_u64(tsdn, arena_stats, &arena_stats->lstats[szind -
|
||||
NBINS].nrequests, nrequests);
|
||||
arena_stats_large_t *lstats = &arena_stats->lstats[szind - SC_NBINS];
|
||||
arena_stats_add_u64(tsdn, arena_stats, &lstats->nrequests, nrequests);
|
||||
arena_stats_add_u64(tsdn, arena_stats, &lstats->nflushes, 1);
|
||||
arena_stats_unlock(tsdn, arena_stats);
|
||||
}
|
||||
|
||||
@@ -233,5 +268,4 @@ arena_stats_mapped_add(tsdn_t *tsdn, arena_stats_t *arena_stats, size_t size) {
|
||||
arena_stats_unlock(tsdn, arena_stats);
|
||||
}
|
||||
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_ARENA_STATS_H */
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "jemalloc/internal/mutex.h"
|
||||
#include "jemalloc/internal/nstime.h"
|
||||
#include "jemalloc/internal/ql.h"
|
||||
#include "jemalloc/internal/size_classes.h"
|
||||
#include "jemalloc/internal/sc.h"
|
||||
#include "jemalloc/internal/smoothstep.h"
|
||||
#include "jemalloc/internal/ticker.h"
|
||||
|
||||
@@ -90,6 +90,9 @@ struct arena_s {
|
||||
*/
|
||||
atomic_u_t nthreads[2];
|
||||
|
||||
/* Next bin shard for binding new threads. Synchronization: atomic. */
|
||||
atomic_u_t binshard_next;
|
||||
|
||||
/*
|
||||
* When percpu_arena is enabled, to amortize the cost of reading /
|
||||
* updating the current CPU id, track the most recent thread accessing
|
||||
@@ -113,7 +116,6 @@ struct arena_s {
|
||||
|
||||
/* Synchronization: internal. */
|
||||
prof_accum_t prof_accum;
|
||||
uint64_t prof_accumbytes;
|
||||
|
||||
/*
|
||||
* PRNG state for cache index randomization of large allocation base
|
||||
@@ -196,6 +198,7 @@ struct arena_s {
|
||||
* Synchronization: extent_avail_mtx.
|
||||
*/
|
||||
extent_tree_t extent_avail;
|
||||
atomic_zu_t extent_avail_cnt;
|
||||
malloc_mutex_t extent_avail_mtx;
|
||||
|
||||
/*
|
||||
@@ -203,7 +206,7 @@ struct arena_s {
|
||||
*
|
||||
* Synchronization: internal.
|
||||
*/
|
||||
bin_t bins[NBINS];
|
||||
bins_t bins[SC_NBINS];
|
||||
|
||||
/*
|
||||
* Base allocator, from which arena metadata are allocated.
|
||||
|
||||
+10
-2
@@ -1,13 +1,15 @@
|
||||
#ifndef JEMALLOC_INTERNAL_ARENA_TYPES_H
|
||||
#define JEMALLOC_INTERNAL_ARENA_TYPES_H
|
||||
|
||||
#include "jemalloc/internal/sc.h"
|
||||
|
||||
/* Maximum number of regions in one slab. */
|
||||
#define LG_SLAB_MAXREGS (LG_PAGE - LG_TINY_MIN)
|
||||
#define LG_SLAB_MAXREGS (LG_PAGE - SC_LG_TINY_MIN)
|
||||
#define SLAB_MAXREGS (1U << LG_SLAB_MAXREGS)
|
||||
|
||||
/* Default decay times in milliseconds. */
|
||||
#define DIRTY_DECAY_MS_DEFAULT ZD(10 * 1000)
|
||||
#define MUZZY_DECAY_MS_DEFAULT ZD(10 * 1000)
|
||||
#define MUZZY_DECAY_MS_DEFAULT (0)
|
||||
/* Number of event ticks between time checks. */
|
||||
#define DECAY_NTICKS_PER_UPDATE 1000
|
||||
|
||||
@@ -40,4 +42,10 @@ typedef enum {
|
||||
#define PERCPU_ARENA_ENABLED(m) ((m) >= percpu_arena_mode_enabled_base)
|
||||
#define PERCPU_ARENA_DEFAULT percpu_arena_disabled
|
||||
|
||||
/*
|
||||
* When allocation_size >= oversize_threshold, use the dedicated huge arena
|
||||
* (unless have explicitly spicified arena index). 0 disables the feature.
|
||||
*/
|
||||
#define OVERSIZE_THRESHOLD_DEFAULT (8 << 20)
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_ARENA_TYPES_H */
|
||||
|
||||
+10
-1
@@ -1,12 +1,19 @@
|
||||
#ifndef JEMALLOC_INTERNAL_ATOMIC_H
|
||||
#define JEMALLOC_INTERNAL_ATOMIC_H
|
||||
|
||||
#define ATOMIC_INLINE static inline
|
||||
#define ATOMIC_INLINE JEMALLOC_ALWAYS_INLINE
|
||||
|
||||
#define JEMALLOC_U8_ATOMICS
|
||||
#if defined(JEMALLOC_GCC_ATOMIC_ATOMICS)
|
||||
# include "jemalloc/internal/atomic_gcc_atomic.h"
|
||||
# if !defined(JEMALLOC_GCC_U8_ATOMIC_ATOMICS)
|
||||
# undef JEMALLOC_U8_ATOMICS
|
||||
# endif
|
||||
#elif defined(JEMALLOC_GCC_SYNC_ATOMICS)
|
||||
# include "jemalloc/internal/atomic_gcc_sync.h"
|
||||
# if !defined(JEMALLOC_GCC_U8_SYNC_ATOMICS)
|
||||
# undef JEMALLOC_U8_ATOMICS
|
||||
# endif
|
||||
#elif defined(_MSC_VER)
|
||||
# include "jemalloc/internal/atomic_msvc.h"
|
||||
#elif defined(JEMALLOC_C11_ATOMICS)
|
||||
@@ -66,6 +73,8 @@ JEMALLOC_GENERATE_INT_ATOMICS(size_t, zu, LG_SIZEOF_PTR)
|
||||
|
||||
JEMALLOC_GENERATE_INT_ATOMICS(ssize_t, zd, LG_SIZEOF_PTR)
|
||||
|
||||
JEMALLOC_GENERATE_INT_ATOMICS(uint8_t, u8, 0)
|
||||
|
||||
JEMALLOC_GENERATE_INT_ATOMICS(uint32_t, u32, 2)
|
||||
|
||||
#ifdef JEMALLOC_ATOMIC_U64
|
||||
|
||||
@@ -67,7 +67,8 @@ atomic_exchange_##short_type(atomic_##short_type##_t *a, type val, \
|
||||
\
|
||||
ATOMIC_INLINE bool \
|
||||
atomic_compare_exchange_weak_##short_type(atomic_##short_type##_t *a, \
|
||||
type *expected, type desired, atomic_memory_order_t success_mo, \
|
||||
UNUSED type *expected, type desired, \
|
||||
atomic_memory_order_t success_mo, \
|
||||
atomic_memory_order_t failure_mo) { \
|
||||
return __atomic_compare_exchange(&a->repr, expected, &desired, \
|
||||
true, atomic_enum_to_builtin(success_mo), \
|
||||
@@ -76,7 +77,8 @@ atomic_compare_exchange_weak_##short_type(atomic_##short_type##_t *a, \
|
||||
\
|
||||
ATOMIC_INLINE bool \
|
||||
atomic_compare_exchange_strong_##short_type(atomic_##short_type##_t *a, \
|
||||
type *expected, type desired, atomic_memory_order_t success_mo, \
|
||||
UNUSED type *expected, type desired, \
|
||||
atomic_memory_order_t success_mo, \
|
||||
atomic_memory_order_t failure_mo) { \
|
||||
return __atomic_compare_exchange(&a->repr, expected, &desired, \
|
||||
false, \
|
||||
|
||||
+11
-7
@@ -27,8 +27,10 @@ atomic_fence(atomic_memory_order_t mo) {
|
||||
asm volatile("" ::: "memory");
|
||||
# if defined(__i386__) || defined(__x86_64__)
|
||||
/* This is implicit on x86. */
|
||||
# elif defined(__ppc__)
|
||||
# elif defined(__ppc64__)
|
||||
asm volatile("lwsync");
|
||||
# elif defined(__ppc__)
|
||||
asm volatile("sync");
|
||||
# elif defined(__sparc__) && defined(__arch64__)
|
||||
if (mo == atomic_memory_order_acquire) {
|
||||
asm volatile("membar #LoadLoad | #LoadStore");
|
||||
@@ -113,8 +115,8 @@ atomic_store_##short_type(atomic_##short_type##_t *a, \
|
||||
} \
|
||||
\
|
||||
ATOMIC_INLINE type \
|
||||
atomic_exchange_##short_type(atomic_##short_type##_t *a, type val, \
|
||||
atomic_memory_order_t mo) { \
|
||||
atomic_exchange_##short_type(atomic_##short_type##_t *a, type val, \
|
||||
atomic_memory_order_t mo) { \
|
||||
/* \
|
||||
* Because of FreeBSD, we care about gcc 4.2, which doesn't have\
|
||||
* an atomic exchange builtin. We fake it with a CAS loop. \
|
||||
@@ -129,8 +131,9 @@ atomic_exchange_##short_type(atomic_##short_type##_t *a, type val, \
|
||||
\
|
||||
ATOMIC_INLINE bool \
|
||||
atomic_compare_exchange_weak_##short_type(atomic_##short_type##_t *a, \
|
||||
type *expected, type desired, atomic_memory_order_t success_mo, \
|
||||
atomic_memory_order_t failure_mo) { \
|
||||
type *expected, type desired, \
|
||||
atomic_memory_order_t success_mo, \
|
||||
atomic_memory_order_t failure_mo) { \
|
||||
type prev = __sync_val_compare_and_swap(&a->repr, *expected, \
|
||||
desired); \
|
||||
if (prev == *expected) { \
|
||||
@@ -142,8 +145,9 @@ atomic_compare_exchange_weak_##short_type(atomic_##short_type##_t *a, \
|
||||
} \
|
||||
ATOMIC_INLINE bool \
|
||||
atomic_compare_exchange_strong_##short_type(atomic_##short_type##_t *a, \
|
||||
type *expected, type desired, atomic_memory_order_t success_mo, \
|
||||
atomic_memory_order_t failure_mo) { \
|
||||
type *expected, type desired, \
|
||||
atomic_memory_order_t success_mo, \
|
||||
atomic_memory_order_t failure_mo) { \
|
||||
type prev = __sync_val_compare_and_swap(&a->repr, *expected, \
|
||||
desired); \
|
||||
if (prev == *expected) { \
|
||||
|
||||
@@ -8,7 +8,6 @@ extern atomic_b_t background_thread_enabled_state;
|
||||
extern size_t n_background_threads;
|
||||
extern size_t max_background_threads;
|
||||
extern background_thread_info_t *background_thread_info;
|
||||
extern bool can_enable_background_thread;
|
||||
|
||||
bool background_thread_create(tsd_t *tsd, unsigned arena_ind);
|
||||
bool background_threads_enable(tsd_t *tsd);
|
||||
|
||||
@@ -15,7 +15,12 @@ background_thread_enabled_set(tsdn_t *tsdn, bool state) {
|
||||
JEMALLOC_ALWAYS_INLINE background_thread_info_t *
|
||||
arena_background_thread_info_get(arena_t *arena) {
|
||||
unsigned arena_ind = arena_ind_get(arena);
|
||||
return &background_thread_info[arena_ind % ncpus];
|
||||
return &background_thread_info[arena_ind % max_background_threads];
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE background_thread_info_t *
|
||||
background_thread_info_get(size_t ind) {
|
||||
return &background_thread_info[ind % max_background_threads];
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE uint64_t
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#define BACKGROUND_THREAD_INDEFINITE_SLEEP UINT64_MAX
|
||||
#define MAX_BACKGROUND_THREAD_LIMIT MALLOCX_ARENA_LIMIT
|
||||
#define DEFAULT_NUM_BACKGROUND_THREAD 4
|
||||
|
||||
typedef enum {
|
||||
background_thread_stopped,
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "jemalloc/internal/jemalloc_internal_types.h"
|
||||
#include "jemalloc/internal/mutex.h"
|
||||
#include "jemalloc/internal/size_classes.h"
|
||||
#include "jemalloc/internal/sc.h"
|
||||
|
||||
/* Embedded at the beginning of every block of base-managed virtual memory. */
|
||||
struct base_block_s {
|
||||
@@ -46,7 +46,7 @@ struct base_s {
|
||||
base_block_t *blocks;
|
||||
|
||||
/* Heap of extents that track unused trailing space within blocks. */
|
||||
extent_heap_t avail[NSIZES];
|
||||
extent_heap_t avail[SC_NSIZES];
|
||||
|
||||
/* Stats, only maintained if config_stats. */
|
||||
size_t allocated;
|
||||
|
||||
+21
-4
@@ -1,10 +1,12 @@
|
||||
#ifndef JEMALLOC_INTERNAL_BIN_H
|
||||
#define JEMALLOC_INTERNAL_BIN_H
|
||||
|
||||
#include "jemalloc/internal/bin_stats.h"
|
||||
#include "jemalloc/internal/bin_types.h"
|
||||
#include "jemalloc/internal/extent_types.h"
|
||||
#include "jemalloc/internal/extent_structs.h"
|
||||
#include "jemalloc/internal/mutex.h"
|
||||
#include "jemalloc/internal/bin_stats.h"
|
||||
#include "jemalloc/internal/sc.h"
|
||||
|
||||
/*
|
||||
* A bin contains a set of extents that are currently being used for slab
|
||||
@@ -41,6 +43,9 @@ struct bin_info_s {
|
||||
/* Total number of regions in a slab for this bin's size class. */
|
||||
uint32_t nregs;
|
||||
|
||||
/* Number of sharded bins in each arena for this size class. */
|
||||
uint32_t n_shards;
|
||||
|
||||
/*
|
||||
* Metadata used to manipulate bitmaps for slabs associated with this
|
||||
* bin.
|
||||
@@ -48,8 +53,7 @@ struct bin_info_s {
|
||||
bitmap_info_t bitmap_info;
|
||||
};
|
||||
|
||||
extern const bin_info_t bin_infos[NBINS];
|
||||
|
||||
extern bin_info_t bin_infos[SC_NBINS];
|
||||
|
||||
typedef struct bin_s bin_t;
|
||||
struct bin_s {
|
||||
@@ -78,6 +82,18 @@ struct bin_s {
|
||||
bin_stats_t stats;
|
||||
};
|
||||
|
||||
/* A set of sharded bins of the same size class. */
|
||||
typedef struct bins_s bins_t;
|
||||
struct bins_s {
|
||||
/* Sharded bins. Dynamically sized. */
|
||||
bin_t *bin_shards;
|
||||
};
|
||||
|
||||
void bin_shard_sizes_boot(unsigned bin_shards[SC_NBINS]);
|
||||
bool bin_update_shard_size(unsigned bin_shards[SC_NBINS], size_t start_size,
|
||||
size_t end_size, size_t nshards);
|
||||
void bin_boot(sc_data_t *sc_data, unsigned bin_shard_sizes[SC_NBINS]);
|
||||
|
||||
/* Initializes a bin to empty. Returns true on error. */
|
||||
bool bin_init(bin_t *bin);
|
||||
|
||||
@@ -90,7 +106,7 @@ void bin_postfork_child(tsdn_t *tsdn, bin_t *bin);
|
||||
static inline void
|
||||
bin_stats_merge(tsdn_t *tsdn, bin_stats_t *dst_bin_stats, bin_t *bin) {
|
||||
malloc_mutex_lock(tsdn, &bin->lock);
|
||||
malloc_mutex_prof_read(tsdn, &dst_bin_stats->mutex_data, &bin->lock);
|
||||
malloc_mutex_prof_accum(tsdn, &dst_bin_stats->mutex_data, &bin->lock);
|
||||
dst_bin_stats->nmalloc += bin->stats.nmalloc;
|
||||
dst_bin_stats->ndalloc += bin->stats.ndalloc;
|
||||
dst_bin_stats->nrequests += bin->stats.nrequests;
|
||||
@@ -100,6 +116,7 @@ bin_stats_merge(tsdn_t *tsdn, bin_stats_t *dst_bin_stats, bin_t *bin) {
|
||||
dst_bin_stats->nslabs += bin->stats.nslabs;
|
||||
dst_bin_stats->reslabs += bin->stats.reslabs;
|
||||
dst_bin_stats->curslabs += bin->stats.curslabs;
|
||||
dst_bin_stats->nonfull_slabs += bin->stats.nonfull_slabs;
|
||||
malloc_mutex_unlock(tsdn, &bin->lock);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,9 @@ struct bin_stats_s {
|
||||
/* Current number of slabs in this bin. */
|
||||
size_t curslabs;
|
||||
|
||||
/* Current size of nonfull slabs heap in this bin. */
|
||||
size_t nonfull_slabs;
|
||||
|
||||
mutex_prof_data_t mutex_data;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef JEMALLOC_INTERNAL_BIN_TYPES_H
|
||||
#define JEMALLOC_INTERNAL_BIN_TYPES_H
|
||||
|
||||
#include "jemalloc/internal/sc.h"
|
||||
|
||||
#define BIN_SHARDS_MAX (1 << EXTENT_BITS_BINSHARD_WIDTH)
|
||||
#define N_BIN_SHARDS_DEFAULT 1
|
||||
|
||||
/* Used in TSD static initializer only. Real init in arena_bind(). */
|
||||
#define TSD_BINSHARDS_ZERO_INITIALIZER {{UINT8_MAX}}
|
||||
|
||||
typedef struct tsd_binshards_s tsd_binshards_t;
|
||||
struct tsd_binshards_s {
|
||||
uint8_t binshard[SC_NBINS];
|
||||
};
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_BIN_TYPES_H */
|
||||
@@ -27,6 +27,25 @@ ffs_u(unsigned bitmap) {
|
||||
return JEMALLOC_INTERNAL_FFS(bitmap);
|
||||
}
|
||||
|
||||
#ifdef JEMALLOC_INTERNAL_POPCOUNTL
|
||||
BIT_UTIL_INLINE unsigned
|
||||
popcount_lu(unsigned long bitmap) {
|
||||
return JEMALLOC_INTERNAL_POPCOUNTL(bitmap);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Clears first unset bit in bitmap, and returns
|
||||
* place of bit. bitmap *must not* be 0.
|
||||
*/
|
||||
|
||||
BIT_UTIL_INLINE size_t
|
||||
cfs_lu(unsigned long* bitmap) {
|
||||
size_t bit = ffs_lu(*bitmap) - 1;
|
||||
*bitmap ^= ZU(1) << bit;
|
||||
return bit;
|
||||
}
|
||||
|
||||
BIT_UTIL_INLINE unsigned
|
||||
ffs_zu(size_t bitmap) {
|
||||
#if LG_SIZEOF_PTR == LG_SIZEOF_INT
|
||||
@@ -63,6 +82,22 @@ ffs_u32(uint32_t bitmap) {
|
||||
|
||||
BIT_UTIL_INLINE uint64_t
|
||||
pow2_ceil_u64(uint64_t x) {
|
||||
#if (defined(__amd64__) || defined(__x86_64__) || defined(JEMALLOC_HAVE_BUILTIN_CLZ))
|
||||
if(unlikely(x <= 1)) {
|
||||
return x;
|
||||
}
|
||||
size_t msb_on_index;
|
||||
#if (defined(__amd64__) || defined(__x86_64__))
|
||||
asm ("bsrq %1, %0"
|
||||
: "=r"(msb_on_index) // Outputs.
|
||||
: "r"(x-1) // Inputs.
|
||||
);
|
||||
#elif (defined(JEMALLOC_HAVE_BUILTIN_CLZ))
|
||||
msb_on_index = (63 ^ __builtin_clzll(x - 1));
|
||||
#endif
|
||||
assert(msb_on_index < 63);
|
||||
return 1ULL << (msb_on_index + 1);
|
||||
#else
|
||||
x--;
|
||||
x |= x >> 1;
|
||||
x |= x >> 2;
|
||||
@@ -72,10 +107,27 @@ pow2_ceil_u64(uint64_t x) {
|
||||
x |= x >> 32;
|
||||
x++;
|
||||
return x;
|
||||
#endif
|
||||
}
|
||||
|
||||
BIT_UTIL_INLINE uint32_t
|
||||
pow2_ceil_u32(uint32_t x) {
|
||||
#if ((defined(__i386__) || defined(JEMALLOC_HAVE_BUILTIN_CLZ)) && (!defined(__s390__)))
|
||||
if(unlikely(x <= 1)) {
|
||||
return x;
|
||||
}
|
||||
size_t msb_on_index;
|
||||
#if (defined(__i386__))
|
||||
asm ("bsr %1, %0"
|
||||
: "=r"(msb_on_index) // Outputs.
|
||||
: "r"(x-1) // Inputs.
|
||||
);
|
||||
#elif (defined(JEMALLOC_HAVE_BUILTIN_CLZ))
|
||||
msb_on_index = (31 ^ __builtin_clz(x - 1));
|
||||
#endif
|
||||
assert(msb_on_index < 31);
|
||||
return 1U << (msb_on_index + 1);
|
||||
#else
|
||||
x--;
|
||||
x |= x >> 1;
|
||||
x |= x >> 2;
|
||||
@@ -84,6 +136,7 @@ pow2_ceil_u32(uint32_t x) {
|
||||
x |= x >> 16;
|
||||
x++;
|
||||
return x;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Compute the smallest power of 2 that is >= x. */
|
||||
@@ -160,6 +213,27 @@ lg_floor(size_t x) {
|
||||
}
|
||||
#endif
|
||||
|
||||
BIT_UTIL_INLINE unsigned
|
||||
lg_ceil(size_t x) {
|
||||
return lg_floor(x) + ((x & (x - 1)) == 0 ? 0 : 1);
|
||||
}
|
||||
|
||||
#undef BIT_UTIL_INLINE
|
||||
|
||||
/* A compile-time version of lg_floor and lg_ceil. */
|
||||
#define LG_FLOOR_1(x) 0
|
||||
#define LG_FLOOR_2(x) (x < (1ULL << 1) ? LG_FLOOR_1(x) : 1 + LG_FLOOR_1(x >> 1))
|
||||
#define LG_FLOOR_4(x) (x < (1ULL << 2) ? LG_FLOOR_2(x) : 2 + LG_FLOOR_2(x >> 2))
|
||||
#define LG_FLOOR_8(x) (x < (1ULL << 4) ? LG_FLOOR_4(x) : 4 + LG_FLOOR_4(x >> 4))
|
||||
#define LG_FLOOR_16(x) (x < (1ULL << 8) ? LG_FLOOR_8(x) : 8 + LG_FLOOR_8(x >> 8))
|
||||
#define LG_FLOOR_32(x) (x < (1ULL << 16) ? LG_FLOOR_16(x) : 16 + LG_FLOOR_16(x >> 16))
|
||||
#define LG_FLOOR_64(x) (x < (1ULL << 32) ? LG_FLOOR_32(x) : 32 + LG_FLOOR_32(x >> 32))
|
||||
#if LG_SIZEOF_PTR == 2
|
||||
# define LG_FLOOR(x) LG_FLOOR_32((x))
|
||||
#else
|
||||
# define LG_FLOOR(x) LG_FLOOR_64((x))
|
||||
#endif
|
||||
|
||||
#define LG_CEIL(x) (LG_FLOOR(x) + (((x) & ((x) - 1)) == 0 ? 0 : 1))
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_BIT_UTIL_H */
|
||||
|
||||
+3
-3
@@ -3,18 +3,18 @@
|
||||
|
||||
#include "jemalloc/internal/arena_types.h"
|
||||
#include "jemalloc/internal/bit_util.h"
|
||||
#include "jemalloc/internal/size_classes.h"
|
||||
#include "jemalloc/internal/sc.h"
|
||||
|
||||
typedef unsigned long bitmap_t;
|
||||
#define LG_SIZEOF_BITMAP LG_SIZEOF_LONG
|
||||
|
||||
/* Maximum bitmap bit count is 2^LG_BITMAP_MAXBITS. */
|
||||
#if LG_SLAB_MAXREGS > LG_CEIL_NSIZES
|
||||
#if LG_SLAB_MAXREGS > LG_CEIL(SC_NSIZES)
|
||||
/* Maximum bitmap bit count is determined by maximum regions per slab. */
|
||||
# define LG_BITMAP_MAXBITS LG_SLAB_MAXREGS
|
||||
#else
|
||||
/* Maximum bitmap bit count is determined by number of extent size classes. */
|
||||
# define LG_BITMAP_MAXBITS LG_CEIL_NSIZES
|
||||
# define LG_BITMAP_MAXBITS LG_CEIL(SC_NSIZES)
|
||||
#endif
|
||||
#define BITMAP_MAXBITS (ZU(1) << LG_BITMAP_MAXBITS)
|
||||
|
||||
|
||||
+27
-10
@@ -88,11 +88,21 @@ JEMALLOC_ALWAYS_INLINE void *
|
||||
cache_bin_alloc_easy(cache_bin_t *bin, bool *success) {
|
||||
void *ret;
|
||||
|
||||
if (unlikely(bin->ncached == 0)) {
|
||||
bin->low_water = -1;
|
||||
*success = false;
|
||||
return NULL;
|
||||
bin->ncached--;
|
||||
|
||||
/*
|
||||
* Check for both bin->ncached == 0 and ncached < low_water
|
||||
* in a single branch.
|
||||
*/
|
||||
if (unlikely(bin->ncached <= bin->low_water)) {
|
||||
bin->low_water = bin->ncached;
|
||||
if (bin->ncached == -1) {
|
||||
bin->ncached = 0;
|
||||
*success = false;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* success (instead of ret) should be checked upon the return of this
|
||||
* function. We avoid checking (ret == NULL) because there is never a
|
||||
@@ -101,14 +111,21 @@ cache_bin_alloc_easy(cache_bin_t *bin, bool *success) {
|
||||
* cacheline).
|
||||
*/
|
||||
*success = true;
|
||||
ret = *(bin->avail - bin->ncached);
|
||||
bin->ncached--;
|
||||
|
||||
if (unlikely(bin->ncached < bin->low_water)) {
|
||||
bin->low_water = bin->ncached;
|
||||
}
|
||||
ret = *(bin->avail - (bin->ncached + 1));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE bool
|
||||
cache_bin_dalloc_easy(cache_bin_t *bin, cache_bin_info_t *bin_info, void *ptr) {
|
||||
if (unlikely(bin->ncached == bin_info->ncached_max)) {
|
||||
return false;
|
||||
}
|
||||
assert(bin->ncached < bin_info->ncached_max);
|
||||
bin->ncached++;
|
||||
*(bin->avail - bin->ncached) = ptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_CACHE_BIN_H */
|
||||
|
||||
+6
-3
@@ -5,7 +5,7 @@
|
||||
#include "jemalloc/internal/malloc_io.h"
|
||||
#include "jemalloc/internal/mutex_prof.h"
|
||||
#include "jemalloc/internal/ql.h"
|
||||
#include "jemalloc/internal/size_classes.h"
|
||||
#include "jemalloc/internal/sc.h"
|
||||
#include "jemalloc/internal/stats.h"
|
||||
|
||||
/* Maximum ctl tree depth. */
|
||||
@@ -39,9 +39,12 @@ typedef struct ctl_arena_stats_s {
|
||||
uint64_t nmalloc_small;
|
||||
uint64_t ndalloc_small;
|
||||
uint64_t nrequests_small;
|
||||
uint64_t nfills_small;
|
||||
uint64_t nflushes_small;
|
||||
|
||||
bin_stats_t bstats[NBINS];
|
||||
arena_stats_large_t lstats[NSIZES - NBINS];
|
||||
bin_stats_t bstats[SC_NBINS];
|
||||
arena_stats_large_t lstats[SC_NSIZES - SC_NBINS];
|
||||
arena_stats_extents_t estats[SC_NPSIZES];
|
||||
} ctl_arena_stats_t;
|
||||
|
||||
typedef struct ctl_stats_s {
|
||||
|
||||
+244
-193
@@ -45,7 +45,9 @@ struct emitter_col_s {
|
||||
int int_val;
|
||||
unsigned unsigned_val;
|
||||
uint32_t uint32_val;
|
||||
uint32_t uint32_t_val;
|
||||
uint64_t uint64_val;
|
||||
uint64_t uint64_t_val;
|
||||
size_t size_val;
|
||||
ssize_t ssize_val;
|
||||
const char *str_val;
|
||||
@@ -60,17 +62,6 @@ struct emitter_row_s {
|
||||
ql_head(emitter_col_t) cols;
|
||||
};
|
||||
|
||||
static inline void
|
||||
emitter_row_init(emitter_row_t *row) {
|
||||
ql_new(&row->cols);
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_col_init(emitter_col_t *col, emitter_row_t *row) {
|
||||
ql_elm_new(col, link);
|
||||
ql_tail_insert(&row->cols, col, link);
|
||||
}
|
||||
|
||||
typedef struct emitter_s emitter_t;
|
||||
struct emitter_s {
|
||||
emitter_output_t output;
|
||||
@@ -80,18 +71,10 @@ struct emitter_s {
|
||||
int nesting_depth;
|
||||
/* True if we've already emitted a value at the given depth. */
|
||||
bool item_at_depth;
|
||||
/* True if we emitted a key and will emit corresponding value next. */
|
||||
bool emitted_key;
|
||||
};
|
||||
|
||||
static inline void
|
||||
emitter_init(emitter_t *emitter, emitter_output_t emitter_output,
|
||||
void (*write_cb)(void *, const char *), void *cbopaque) {
|
||||
emitter->output = emitter_output;
|
||||
emitter->write_cb = write_cb;
|
||||
emitter->cbopaque = cbopaque;
|
||||
emitter->item_at_depth = false;
|
||||
emitter->nesting_depth = 0;
|
||||
}
|
||||
|
||||
/* Internal convenience function. Write to the emitter the given string. */
|
||||
JEMALLOC_FORMAT_PRINTF(2, 3)
|
||||
static inline void
|
||||
@@ -103,22 +86,11 @@ emitter_printf(emitter_t *emitter, const char *format, ...) {
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/* Write to the emitter the given string, but only in table mode. */
|
||||
JEMALLOC_FORMAT_PRINTF(2, 3)
|
||||
static inline void
|
||||
emitter_table_printf(emitter_t *emitter, const char *format, ...) {
|
||||
if (emitter->output == emitter_output_table) {
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
malloc_vcprintf(emitter->write_cb, emitter->cbopaque, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
static inline const char * JEMALLOC_FORMAT_ARG(3)
|
||||
emitter_gen_fmt(char *out_fmt, size_t out_size, const char *fmt_specifier,
|
||||
emitter_justify_t justify, int width) {
|
||||
size_t written;
|
||||
fmt_specifier++;
|
||||
if (justify == emitter_justify_none) {
|
||||
written = malloc_snprintf(out_fmt, out_size,
|
||||
"%%%s", fmt_specifier);
|
||||
@@ -131,6 +103,7 @@ emitter_gen_fmt(char *out_fmt, size_t out_size, const char *fmt_specifier,
|
||||
}
|
||||
/* Only happens in case of bad format string, which *we* choose. */
|
||||
assert(written < out_size);
|
||||
return out_fmt;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -156,26 +129,27 @@ emitter_print_value(emitter_t *emitter, emitter_justify_t justify, int width,
|
||||
char buf[BUF_SIZE];
|
||||
|
||||
#define EMIT_SIMPLE(type, format) \
|
||||
emitter_gen_fmt(fmt, FMT_SIZE, format, justify, width); \
|
||||
emitter_printf(emitter, fmt, *(const type *)value); \
|
||||
emitter_printf(emitter, \
|
||||
emitter_gen_fmt(fmt, FMT_SIZE, format, justify, width), \
|
||||
*(const type *)value);
|
||||
|
||||
switch (value_type) {
|
||||
case emitter_type_bool:
|
||||
emitter_gen_fmt(fmt, FMT_SIZE, "s", justify, width);
|
||||
emitter_printf(emitter, fmt, *(const bool *)value ?
|
||||
"true" : "false");
|
||||
emitter_printf(emitter,
|
||||
emitter_gen_fmt(fmt, FMT_SIZE, "%s", justify, width),
|
||||
*(const bool *)value ? "true" : "false");
|
||||
break;
|
||||
case emitter_type_int:
|
||||
EMIT_SIMPLE(int, "d")
|
||||
EMIT_SIMPLE(int, "%d")
|
||||
break;
|
||||
case emitter_type_unsigned:
|
||||
EMIT_SIMPLE(unsigned, "u")
|
||||
EMIT_SIMPLE(unsigned, "%u")
|
||||
break;
|
||||
case emitter_type_ssize:
|
||||
EMIT_SIMPLE(ssize_t, "zd")
|
||||
EMIT_SIMPLE(ssize_t, "%zd")
|
||||
break;
|
||||
case emitter_type_size:
|
||||
EMIT_SIMPLE(size_t, "zu")
|
||||
EMIT_SIMPLE(size_t, "%zu")
|
||||
break;
|
||||
case emitter_type_string:
|
||||
str_written = malloc_snprintf(buf, BUF_SIZE, "\"%s\"",
|
||||
@@ -185,17 +159,17 @@ emitter_print_value(emitter_t *emitter, emitter_justify_t justify, int width,
|
||||
* anywhere near the fmt size.
|
||||
*/
|
||||
assert(str_written < BUF_SIZE);
|
||||
emitter_gen_fmt(fmt, FMT_SIZE, "s", justify, width);
|
||||
emitter_printf(emitter, fmt, buf);
|
||||
emitter_printf(emitter,
|
||||
emitter_gen_fmt(fmt, FMT_SIZE, "%s", justify, width), buf);
|
||||
break;
|
||||
case emitter_type_uint32:
|
||||
EMIT_SIMPLE(uint32_t, FMTu32)
|
||||
EMIT_SIMPLE(uint32_t, "%" FMTu32)
|
||||
break;
|
||||
case emitter_type_uint64:
|
||||
EMIT_SIMPLE(uint64_t, FMTu64)
|
||||
EMIT_SIMPLE(uint64_t, "%" FMTu64)
|
||||
break;
|
||||
case emitter_type_title:
|
||||
EMIT_SIMPLE(char *const, "s");
|
||||
EMIT_SIMPLE(char *const, "%s");
|
||||
break;
|
||||
default:
|
||||
unreachable();
|
||||
@@ -235,47 +209,143 @@ emitter_indent(emitter_t *emitter) {
|
||||
|
||||
static inline void
|
||||
emitter_json_key_prefix(emitter_t *emitter) {
|
||||
if (emitter->emitted_key) {
|
||||
emitter->emitted_key = false;
|
||||
return;
|
||||
}
|
||||
emitter_printf(emitter, "%s\n", emitter->item_at_depth ? "," : "");
|
||||
emitter_indent(emitter);
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_begin(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
assert(emitter->nesting_depth == 0);
|
||||
emitter_printf(emitter, "{");
|
||||
emitter_nest_inc(emitter);
|
||||
} else {
|
||||
// tabular init
|
||||
emitter_printf(emitter, "%s", "");
|
||||
}
|
||||
}
|
||||
/******************************************************************************/
|
||||
/* Public functions for emitter_t. */
|
||||
|
||||
static inline void
|
||||
emitter_end(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
assert(emitter->nesting_depth == 1);
|
||||
emitter_nest_dec(emitter);
|
||||
emitter_printf(emitter, "\n}\n");
|
||||
}
|
||||
emitter_init(emitter_t *emitter, emitter_output_t emitter_output,
|
||||
void (*write_cb)(void *, const char *), void *cbopaque) {
|
||||
emitter->output = emitter_output;
|
||||
emitter->write_cb = write_cb;
|
||||
emitter->cbopaque = cbopaque;
|
||||
emitter->item_at_depth = false;
|
||||
emitter->emitted_key = false;
|
||||
emitter->nesting_depth = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note emits a different kv pair as well, but only in table mode. Omits the
|
||||
* note if table_note_key is NULL.
|
||||
/******************************************************************************/
|
||||
/* JSON public API. */
|
||||
|
||||
/*
|
||||
* Emits a key (e.g. as appears in an object). The next json entity emitted will
|
||||
* be the corresponding value.
|
||||
*/
|
||||
static inline void
|
||||
emitter_kv_note(emitter_t *emitter, const char *json_key, const char *table_key,
|
||||
emitter_json_key(emitter_t *emitter, const char *json_key) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
emitter_json_key_prefix(emitter);
|
||||
emitter_printf(emitter, "\"%s\": ", json_key);
|
||||
emitter->emitted_key = true;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_json_value(emitter_t *emitter, emitter_type_t value_type,
|
||||
const void *value) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
emitter_json_key_prefix(emitter);
|
||||
emitter_print_value(emitter, emitter_justify_none, -1,
|
||||
value_type, value);
|
||||
emitter->item_at_depth = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Shorthand for calling emitter_json_key and then emitter_json_value. */
|
||||
static inline void
|
||||
emitter_json_kv(emitter_t *emitter, const char *json_key,
|
||||
emitter_type_t value_type, const void *value) {
|
||||
emitter_json_key(emitter, json_key);
|
||||
emitter_json_value(emitter, value_type, value);
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_json_array_begin(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
emitter_json_key_prefix(emitter);
|
||||
emitter_printf(emitter, "[");
|
||||
emitter_nest_inc(emitter);
|
||||
}
|
||||
}
|
||||
|
||||
/* Shorthand for calling emitter_json_key and then emitter_json_array_begin. */
|
||||
static inline void
|
||||
emitter_json_array_kv_begin(emitter_t *emitter, const char *json_key) {
|
||||
emitter_json_key(emitter, json_key);
|
||||
emitter_json_array_begin(emitter);
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_json_array_end(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
assert(emitter->nesting_depth > 0);
|
||||
emitter_nest_dec(emitter);
|
||||
emitter_printf(emitter, "\n");
|
||||
emitter_indent(emitter);
|
||||
emitter_printf(emitter, "]");
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_json_object_begin(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
emitter_json_key_prefix(emitter);
|
||||
emitter_printf(emitter, "{");
|
||||
emitter_nest_inc(emitter);
|
||||
}
|
||||
}
|
||||
|
||||
/* Shorthand for calling emitter_json_key and then emitter_json_object_begin. */
|
||||
static inline void
|
||||
emitter_json_object_kv_begin(emitter_t *emitter, const char *json_key) {
|
||||
emitter_json_key(emitter, json_key);
|
||||
emitter_json_object_begin(emitter);
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_json_object_end(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
assert(emitter->nesting_depth > 0);
|
||||
emitter_nest_dec(emitter);
|
||||
emitter_printf(emitter, "\n");
|
||||
emitter_indent(emitter);
|
||||
emitter_printf(emitter, "}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* Table public API. */
|
||||
|
||||
static inline void
|
||||
emitter_table_dict_begin(emitter_t *emitter, const char *table_key) {
|
||||
if (emitter->output == emitter_output_table) {
|
||||
emitter_indent(emitter);
|
||||
emitter_printf(emitter, "%s\n", table_key);
|
||||
emitter_nest_inc(emitter);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_table_dict_end(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_table) {
|
||||
emitter_nest_dec(emitter);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_table_kv_note(emitter_t *emitter, const char *table_key,
|
||||
emitter_type_t value_type, const void *value,
|
||||
const char *table_note_key, emitter_type_t table_note_value_type,
|
||||
const void *table_note_value) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
assert(emitter->nesting_depth > 0);
|
||||
emitter_json_key_prefix(emitter);
|
||||
emitter_printf(emitter, "\"%s\": ", json_key);
|
||||
emitter_print_value(emitter, emitter_justify_none, -1,
|
||||
value_type, value);
|
||||
} else {
|
||||
if (emitter->output == emitter_output_table) {
|
||||
emitter_indent(emitter);
|
||||
emitter_printf(emitter, "%s: ", table_key);
|
||||
emitter_print_value(emitter, emitter_justify_none, -1,
|
||||
@@ -292,130 +362,22 @@ emitter_kv_note(emitter_t *emitter, const char *json_key, const char *table_key,
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_kv(emitter_t *emitter, const char *json_key, const char *table_key,
|
||||
emitter_table_kv(emitter_t *emitter, const char *table_key,
|
||||
emitter_type_t value_type, const void *value) {
|
||||
emitter_kv_note(emitter, json_key, table_key, value_type, value, NULL,
|
||||
emitter_table_kv_note(emitter, table_key, value_type, value, NULL,
|
||||
emitter_type_bool, NULL);
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_json_kv(emitter_t *emitter, const char *json_key,
|
||||
emitter_type_t value_type, const void *value) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
emitter_kv(emitter, json_key, NULL, value_type, value);
|
||||
}
|
||||
}
|
||||
|
||||
/* Write to the emitter the given string, but only in table mode. */
|
||||
JEMALLOC_FORMAT_PRINTF(2, 3)
|
||||
static inline void
|
||||
emitter_table_kv(emitter_t *emitter, const char *table_key,
|
||||
emitter_type_t value_type, const void *value) {
|
||||
emitter_table_printf(emitter_t *emitter, const char *format, ...) {
|
||||
if (emitter->output == emitter_output_table) {
|
||||
emitter_kv(emitter, NULL, table_key, value_type, value);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_dict_begin(emitter_t *emitter, const char *json_key,
|
||||
const char *table_header) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
emitter_json_key_prefix(emitter);
|
||||
emitter_printf(emitter, "\"%s\": {", json_key);
|
||||
emitter_nest_inc(emitter);
|
||||
} else {
|
||||
emitter_indent(emitter);
|
||||
emitter_printf(emitter, "%s\n", table_header);
|
||||
emitter_nest_inc(emitter);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_dict_end(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
assert(emitter->nesting_depth > 0);
|
||||
emitter_nest_dec(emitter);
|
||||
emitter_printf(emitter, "\n");
|
||||
emitter_indent(emitter);
|
||||
emitter_printf(emitter, "}");
|
||||
} else {
|
||||
emitter_nest_dec(emitter);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_json_dict_begin(emitter_t *emitter, const char *json_key) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
emitter_dict_begin(emitter, json_key, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_json_dict_end(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
emitter_dict_end(emitter);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_table_dict_begin(emitter_t *emitter, const char *table_key) {
|
||||
if (emitter->output == emitter_output_table) {
|
||||
emitter_dict_begin(emitter, NULL, table_key);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_table_dict_end(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_table) {
|
||||
emitter_dict_end(emitter);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_json_arr_begin(emitter_t *emitter, const char *json_key) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
emitter_json_key_prefix(emitter);
|
||||
emitter_printf(emitter, "\"%s\": [", json_key);
|
||||
emitter_nest_inc(emitter);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_json_arr_end(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
assert(emitter->nesting_depth > 0);
|
||||
emitter_nest_dec(emitter);
|
||||
emitter_printf(emitter, "\n");
|
||||
emitter_indent(emitter);
|
||||
emitter_printf(emitter, "]");
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_json_arr_obj_begin(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
emitter_json_key_prefix(emitter);
|
||||
emitter_printf(emitter, "{");
|
||||
emitter_nest_inc(emitter);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_json_arr_obj_end(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
assert(emitter->nesting_depth > 0);
|
||||
emitter_nest_dec(emitter);
|
||||
emitter_printf(emitter, "\n");
|
||||
emitter_indent(emitter);
|
||||
emitter_printf(emitter, "}");
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_json_arr_value(emitter_t *emitter, emitter_type_t value_type,
|
||||
const void *value) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
emitter_json_key_prefix(emitter);
|
||||
emitter_print_value(emitter, emitter_justify_none, -1,
|
||||
value_type, value);
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
malloc_vcprintf(emitter->write_cb, emitter->cbopaque, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,4 +394,93 @@ emitter_table_row(emitter_t *emitter, emitter_row_t *row) {
|
||||
emitter_table_printf(emitter, "\n");
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_row_init(emitter_row_t *row) {
|
||||
ql_new(&row->cols);
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_col_init(emitter_col_t *col, emitter_row_t *row) {
|
||||
ql_elm_new(col, link);
|
||||
ql_tail_insert(&row->cols, col, link);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/*
|
||||
* Generalized public API. Emits using either JSON or table, according to
|
||||
* settings in the emitter_t. */
|
||||
|
||||
/*
|
||||
* Note emits a different kv pair as well, but only in table mode. Omits the
|
||||
* note if table_note_key is NULL.
|
||||
*/
|
||||
static inline void
|
||||
emitter_kv_note(emitter_t *emitter, const char *json_key, const char *table_key,
|
||||
emitter_type_t value_type, const void *value,
|
||||
const char *table_note_key, emitter_type_t table_note_value_type,
|
||||
const void *table_note_value) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
emitter_json_key(emitter, json_key);
|
||||
emitter_json_value(emitter, value_type, value);
|
||||
} else {
|
||||
emitter_table_kv_note(emitter, table_key, value_type, value,
|
||||
table_note_key, table_note_value_type, table_note_value);
|
||||
}
|
||||
emitter->item_at_depth = true;
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_kv(emitter_t *emitter, const char *json_key, const char *table_key,
|
||||
emitter_type_t value_type, const void *value) {
|
||||
emitter_kv_note(emitter, json_key, table_key, value_type, value, NULL,
|
||||
emitter_type_bool, NULL);
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_dict_begin(emitter_t *emitter, const char *json_key,
|
||||
const char *table_header) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
emitter_json_key(emitter, json_key);
|
||||
emitter_json_object_begin(emitter);
|
||||
} else {
|
||||
emitter_table_dict_begin(emitter, table_header);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_dict_end(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
emitter_json_object_end(emitter);
|
||||
} else {
|
||||
emitter_table_dict_end(emitter);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_begin(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
assert(emitter->nesting_depth == 0);
|
||||
emitter_printf(emitter, "{");
|
||||
emitter_nest_inc(emitter);
|
||||
} else {
|
||||
/*
|
||||
* This guarantees that we always call write_cb at least once.
|
||||
* This is useful if some invariant is established by each call
|
||||
* to write_cb, but doesn't hold initially: e.g., some buffer
|
||||
* holds a null-terminated string.
|
||||
*/
|
||||
emitter_printf(emitter, "%s", "");
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
emitter_end(emitter_t *emitter) {
|
||||
if (emitter->output == emitter_output_json) {
|
||||
assert(emitter->nesting_depth == 1);
|
||||
emitter_nest_dec(emitter);
|
||||
emitter_printf(emitter, "\n}\n");
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_EMITTER_H */
|
||||
|
||||
+11
-1
@@ -24,13 +24,17 @@ size_t extent_size_quantize_floor(size_t size);
|
||||
size_t extent_size_quantize_ceil(size_t size);
|
||||
#endif
|
||||
|
||||
rb_proto(, extent_avail_, extent_tree_t, extent_t)
|
||||
ph_proto(, extent_avail_, extent_tree_t, extent_t)
|
||||
ph_proto(, extent_heap_, extent_heap_t, extent_t)
|
||||
|
||||
bool extents_init(tsdn_t *tsdn, extents_t *extents, extent_state_t state,
|
||||
bool delay_coalesce);
|
||||
extent_state_t extents_state_get(const extents_t *extents);
|
||||
size_t extents_npages_get(extents_t *extents);
|
||||
/* Get the number of extents in the given page size index. */
|
||||
size_t extents_nextents_get(extents_t *extents, pszind_t ind);
|
||||
/* Get the sum total bytes of the extents in the given page size index. */
|
||||
size_t extents_nbytes_get(extents_t *extents, pszind_t ind);
|
||||
extent_t *extents_alloc(tsdn_t *tsdn, arena_t *arena,
|
||||
extent_hooks_t **r_extent_hooks, extents_t *extents, void *new_addr,
|
||||
size_t size, size_t pad, size_t alignment, bool slab, szind_t szind,
|
||||
@@ -70,4 +74,10 @@ bool extent_merge_wrapper(tsdn_t *tsdn, arena_t *arena,
|
||||
|
||||
bool extent_boot(void);
|
||||
|
||||
void extent_util_stats_get(tsdn_t *tsdn, const void *ptr,
|
||||
size_t *nfree, size_t *nregs, size_t *size);
|
||||
void extent_util_stats_verbose_get(tsdn_t *tsdn, const void *ptr,
|
||||
size_t *nfree, size_t *nregs, size_t *size,
|
||||
size_t *bin_nfree, size_t *bin_nregs, void **slabcur_addr);
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_EXTENT_EXTERNS_H */
|
||||
|
||||
+83
-15
@@ -6,6 +6,7 @@
|
||||
#include "jemalloc/internal/pages.h"
|
||||
#include "jemalloc/internal/prng.h"
|
||||
#include "jemalloc/internal/ql.h"
|
||||
#include "jemalloc/internal/sc.h"
|
||||
#include "jemalloc/internal/sz.h"
|
||||
|
||||
static inline void
|
||||
@@ -34,18 +35,19 @@ extent_unlock2(tsdn_t *tsdn, extent_t *extent1, extent_t *extent2) {
|
||||
(uintptr_t)extent2);
|
||||
}
|
||||
|
||||
static inline arena_t *
|
||||
extent_arena_get(const extent_t *extent) {
|
||||
static inline unsigned
|
||||
extent_arena_ind_get(const extent_t *extent) {
|
||||
unsigned arena_ind = (unsigned)((extent->e_bits &
|
||||
EXTENT_BITS_ARENA_MASK) >> EXTENT_BITS_ARENA_SHIFT);
|
||||
/*
|
||||
* The following check is omitted because we should never actually read
|
||||
* a NULL arena pointer.
|
||||
*/
|
||||
if (false && arena_ind >= MALLOCX_ARENA_LIMIT) {
|
||||
return NULL;
|
||||
}
|
||||
assert(arena_ind < MALLOCX_ARENA_LIMIT);
|
||||
|
||||
return arena_ind;
|
||||
}
|
||||
|
||||
static inline arena_t *
|
||||
extent_arena_get(const extent_t *extent) {
|
||||
unsigned arena_ind = extent_arena_ind_get(extent);
|
||||
|
||||
return (arena_t *)atomic_load_p(&arenas[arena_ind], ATOMIC_ACQUIRE);
|
||||
}
|
||||
|
||||
@@ -53,14 +55,14 @@ static inline szind_t
|
||||
extent_szind_get_maybe_invalid(const extent_t *extent) {
|
||||
szind_t szind = (szind_t)((extent->e_bits & EXTENT_BITS_SZIND_MASK) >>
|
||||
EXTENT_BITS_SZIND_SHIFT);
|
||||
assert(szind <= NSIZES);
|
||||
assert(szind <= SC_NSIZES);
|
||||
return szind;
|
||||
}
|
||||
|
||||
static inline szind_t
|
||||
extent_szind_get(const extent_t *extent) {
|
||||
szind_t szind = extent_szind_get_maybe_invalid(extent);
|
||||
assert(szind < NSIZES); /* Never call when "invalid". */
|
||||
assert(szind < SC_NSIZES); /* Never call when "invalid". */
|
||||
return szind;
|
||||
}
|
||||
|
||||
@@ -69,6 +71,14 @@ extent_usize_get(const extent_t *extent) {
|
||||
return sz_index2size(extent_szind_get(extent));
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
extent_binshard_get(const extent_t *extent) {
|
||||
unsigned binshard = (unsigned)((extent->e_bits &
|
||||
EXTENT_BITS_BINSHARD_MASK) >> EXTENT_BITS_BINSHARD_SHIFT);
|
||||
assert(binshard < bin_infos[extent_szind_get(extent)].n_shards);
|
||||
return binshard;
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
extent_sn_get(const extent_t *extent) {
|
||||
return (size_t)((extent->e_bits & EXTENT_BITS_SN_MASK) >>
|
||||
@@ -176,6 +186,11 @@ extent_prof_tctx_get(const extent_t *extent) {
|
||||
ATOMIC_ACQUIRE);
|
||||
}
|
||||
|
||||
static inline nstime_t
|
||||
extent_prof_alloc_time_get(const extent_t *extent) {
|
||||
return extent->e_alloc_time;
|
||||
}
|
||||
|
||||
static inline void
|
||||
extent_arena_set(extent_t *extent, arena_t *arena) {
|
||||
unsigned arena_ind = (arena != NULL) ? arena_ind_get(arena) : ((1U <<
|
||||
@@ -184,13 +199,21 @@ extent_arena_set(extent_t *extent, arena_t *arena) {
|
||||
((uint64_t)arena_ind << EXTENT_BITS_ARENA_SHIFT);
|
||||
}
|
||||
|
||||
static inline void
|
||||
extent_binshard_set(extent_t *extent, unsigned binshard) {
|
||||
/* The assertion assumes szind is set already. */
|
||||
assert(binshard < bin_infos[extent_szind_get(extent)].n_shards);
|
||||
extent->e_bits = (extent->e_bits & ~EXTENT_BITS_BINSHARD_MASK) |
|
||||
((uint64_t)binshard << EXTENT_BITS_BINSHARD_SHIFT);
|
||||
}
|
||||
|
||||
static inline void
|
||||
extent_addr_set(extent_t *extent, void *addr) {
|
||||
extent->e_addr = addr;
|
||||
}
|
||||
|
||||
static inline void
|
||||
extent_addr_randomize(UNUSED tsdn_t *tsdn, extent_t *extent, size_t alignment) {
|
||||
extent_addr_randomize(tsdn_t *tsdn, extent_t *extent, size_t alignment) {
|
||||
assert(extent_base_get(extent) == extent_addr_get(extent));
|
||||
|
||||
if (alignment < PAGE) {
|
||||
@@ -234,7 +257,7 @@ extent_bsize_set(extent_t *extent, size_t bsize) {
|
||||
|
||||
static inline void
|
||||
extent_szind_set(extent_t *extent, szind_t szind) {
|
||||
assert(szind <= NSIZES); /* NSIZES means "invalid". */
|
||||
assert(szind <= SC_NSIZES); /* SC_NSIZES means "invalid". */
|
||||
extent->e_bits = (extent->e_bits & ~EXTENT_BITS_SZIND_MASK) |
|
||||
((uint64_t)szind << EXTENT_BITS_SZIND_SHIFT);
|
||||
}
|
||||
@@ -246,6 +269,16 @@ extent_nfree_set(extent_t *extent, unsigned nfree) {
|
||||
((uint64_t)nfree << EXTENT_BITS_NFREE_SHIFT);
|
||||
}
|
||||
|
||||
static inline void
|
||||
extent_nfree_binshard_set(extent_t *extent, unsigned nfree, unsigned binshard) {
|
||||
/* The assertion assumes szind is set already. */
|
||||
assert(binshard < bin_infos[extent_szind_get(extent)].n_shards);
|
||||
extent->e_bits = (extent->e_bits &
|
||||
(~EXTENT_BITS_NFREE_MASK & ~EXTENT_BITS_BINSHARD_MASK)) |
|
||||
((uint64_t)binshard << EXTENT_BITS_BINSHARD_SHIFT) |
|
||||
((uint64_t)nfree << EXTENT_BITS_NFREE_SHIFT);
|
||||
}
|
||||
|
||||
static inline void
|
||||
extent_nfree_inc(extent_t *extent) {
|
||||
assert(extent_slab_get(extent));
|
||||
@@ -258,6 +291,12 @@ extent_nfree_dec(extent_t *extent) {
|
||||
extent->e_bits -= ((uint64_t)1U << EXTENT_BITS_NFREE_SHIFT);
|
||||
}
|
||||
|
||||
static inline void
|
||||
extent_nfree_sub(extent_t *extent, uint64_t n) {
|
||||
assert(extent_slab_get(extent));
|
||||
extent->e_bits -= (n << EXTENT_BITS_NFREE_SHIFT);
|
||||
}
|
||||
|
||||
static inline void
|
||||
extent_sn_set(extent_t *extent, size_t sn) {
|
||||
extent->e_bits = (extent->e_bits & ~EXTENT_BITS_SN_MASK) |
|
||||
@@ -299,10 +338,35 @@ extent_prof_tctx_set(extent_t *extent, prof_tctx_t *tctx) {
|
||||
atomic_store_p(&extent->e_prof_tctx, tctx, ATOMIC_RELEASE);
|
||||
}
|
||||
|
||||
static inline void
|
||||
extent_prof_alloc_time_set(extent_t *extent, nstime_t t) {
|
||||
nstime_copy(&extent->e_alloc_time, &t);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
extent_is_head_get(extent_t *extent) {
|
||||
if (maps_coalesce) {
|
||||
not_reached();
|
||||
}
|
||||
|
||||
return (bool)((extent->e_bits & EXTENT_BITS_IS_HEAD_MASK) >>
|
||||
EXTENT_BITS_IS_HEAD_SHIFT);
|
||||
}
|
||||
|
||||
static inline void
|
||||
extent_is_head_set(extent_t *extent, bool is_head) {
|
||||
if (maps_coalesce) {
|
||||
not_reached();
|
||||
}
|
||||
|
||||
extent->e_bits = (extent->e_bits & ~EXTENT_BITS_IS_HEAD_MASK) |
|
||||
((uint64_t)is_head << EXTENT_BITS_IS_HEAD_SHIFT);
|
||||
}
|
||||
|
||||
static inline void
|
||||
extent_init(extent_t *extent, arena_t *arena, void *addr, size_t size,
|
||||
bool slab, szind_t szind, size_t sn, extent_state_t state, bool zeroed,
|
||||
bool committed, bool dumpable) {
|
||||
bool committed, bool dumpable, extent_head_state_t is_head) {
|
||||
assert(addr == PAGE_ADDR2BASE(addr) || !slab);
|
||||
|
||||
extent_arena_set(extent, arena);
|
||||
@@ -316,6 +380,10 @@ extent_init(extent_t *extent, arena_t *arena, void *addr, size_t size,
|
||||
extent_committed_set(extent, committed);
|
||||
extent_dumpable_set(extent, dumpable);
|
||||
ql_elm_new(extent, ql_link);
|
||||
if (!maps_coalesce) {
|
||||
extent_is_head_set(extent, (is_head == EXTENT_IS_HEAD) ? true :
|
||||
false);
|
||||
}
|
||||
if (config_prof) {
|
||||
extent_prof_tctx_set(extent, NULL);
|
||||
}
|
||||
@@ -327,7 +395,7 @@ extent_binit(extent_t *extent, void *addr, size_t bsize, size_t sn) {
|
||||
extent_addr_set(extent, addr);
|
||||
extent_bsize_set(extent, bsize);
|
||||
extent_slab_set(extent, false);
|
||||
extent_szind_set(extent, NSIZES);
|
||||
extent_szind_set(extent, SC_NSIZES);
|
||||
extent_sn_set(extent, sn);
|
||||
extent_state_set(extent, extent_state_active);
|
||||
extent_zeroed_set(extent, true);
|
||||
|
||||
+48
-11
@@ -2,11 +2,12 @@
|
||||
#define JEMALLOC_INTERNAL_EXTENT_STRUCTS_H
|
||||
|
||||
#include "jemalloc/internal/atomic.h"
|
||||
#include "jemalloc/internal/bit_util.h"
|
||||
#include "jemalloc/internal/bitmap.h"
|
||||
#include "jemalloc/internal/mutex.h"
|
||||
#include "jemalloc/internal/ql.h"
|
||||
#include "jemalloc/internal/ph.h"
|
||||
#include "jemalloc/internal/size_classes.h"
|
||||
#include "jemalloc/internal/sc.h"
|
||||
|
||||
typedef enum {
|
||||
extent_state_active = 0,
|
||||
@@ -28,9 +29,10 @@ struct extent_s {
|
||||
* t: state
|
||||
* i: szind
|
||||
* f: nfree
|
||||
* s: bin_shard
|
||||
* n: sn
|
||||
*
|
||||
* nnnnnnnn ... nnnnffff ffffffii iiiiiitt zdcbaaaa aaaaaaaa
|
||||
* nnnnnnnn ... nnnnnnss ssssffff ffffffii iiiiiitt zdcbaaaa aaaaaaaa
|
||||
*
|
||||
* arena_ind: Arena from which this extent came, or all 1 bits if
|
||||
* unassociated.
|
||||
@@ -75,6 +77,8 @@ struct extent_s {
|
||||
*
|
||||
* nfree: Number of free regions in slab.
|
||||
*
|
||||
* bin_shard: the shard of the bin from which this extent came.
|
||||
*
|
||||
* sn: Serial number (potentially non-unique).
|
||||
*
|
||||
* Serial numbers may wrap around if !opt_retain, but as long as
|
||||
@@ -112,7 +116,7 @@ struct extent_s {
|
||||
#define EXTENT_BITS_STATE_SHIFT (EXTENT_BITS_ZEROED_WIDTH + EXTENT_BITS_ZEROED_SHIFT)
|
||||
#define EXTENT_BITS_STATE_MASK MASK(EXTENT_BITS_STATE_WIDTH, EXTENT_BITS_STATE_SHIFT)
|
||||
|
||||
#define EXTENT_BITS_SZIND_WIDTH LG_CEIL_NSIZES
|
||||
#define EXTENT_BITS_SZIND_WIDTH LG_CEIL(SC_NSIZES)
|
||||
#define EXTENT_BITS_SZIND_SHIFT (EXTENT_BITS_STATE_WIDTH + EXTENT_BITS_STATE_SHIFT)
|
||||
#define EXTENT_BITS_SZIND_MASK MASK(EXTENT_BITS_SZIND_WIDTH, EXTENT_BITS_SZIND_SHIFT)
|
||||
|
||||
@@ -120,7 +124,15 @@ struct extent_s {
|
||||
#define EXTENT_BITS_NFREE_SHIFT (EXTENT_BITS_SZIND_WIDTH + EXTENT_BITS_SZIND_SHIFT)
|
||||
#define EXTENT_BITS_NFREE_MASK MASK(EXTENT_BITS_NFREE_WIDTH, EXTENT_BITS_NFREE_SHIFT)
|
||||
|
||||
#define EXTENT_BITS_SN_SHIFT (EXTENT_BITS_NFREE_WIDTH + EXTENT_BITS_NFREE_SHIFT)
|
||||
#define EXTENT_BITS_BINSHARD_WIDTH 6
|
||||
#define EXTENT_BITS_BINSHARD_SHIFT (EXTENT_BITS_NFREE_WIDTH + EXTENT_BITS_NFREE_SHIFT)
|
||||
#define EXTENT_BITS_BINSHARD_MASK MASK(EXTENT_BITS_BINSHARD_WIDTH, EXTENT_BITS_BINSHARD_SHIFT)
|
||||
|
||||
#define EXTENT_BITS_IS_HEAD_WIDTH 1
|
||||
#define EXTENT_BITS_IS_HEAD_SHIFT (EXTENT_BITS_BINSHARD_WIDTH + EXTENT_BITS_BINSHARD_SHIFT)
|
||||
#define EXTENT_BITS_IS_HEAD_MASK MASK(EXTENT_BITS_IS_HEAD_WIDTH, EXTENT_BITS_IS_HEAD_SHIFT)
|
||||
|
||||
#define EXTENT_BITS_SN_SHIFT (EXTENT_BITS_IS_HEAD_WIDTH + EXTENT_BITS_IS_HEAD_SHIFT)
|
||||
#define EXTENT_BITS_SN_MASK (UINT64_MAX << EXTENT_BITS_SN_SHIFT)
|
||||
|
||||
/* Pointer to the extent that this structure is responsible for. */
|
||||
@@ -160,11 +172,13 @@ struct extent_s {
|
||||
/* Small region slab metadata. */
|
||||
arena_slab_data_t e_slab_data;
|
||||
|
||||
/*
|
||||
* Profile counters, used for large objects. Points to a
|
||||
* prof_tctx_t.
|
||||
*/
|
||||
atomic_p_t e_prof_tctx;
|
||||
/* Profiling data, used for large objects. */
|
||||
struct {
|
||||
/* Time when this was allocated. */
|
||||
nstime_t e_alloc_time;
|
||||
/* Points to a prof_tctx_t. */
|
||||
atomic_p_t e_prof_tctx;
|
||||
};
|
||||
};
|
||||
};
|
||||
typedef ql_head(extent_t) extent_list_t;
|
||||
@@ -180,14 +194,16 @@ struct extents_s {
|
||||
*
|
||||
* Synchronization: mtx.
|
||||
*/
|
||||
extent_heap_t heaps[NPSIZES+1];
|
||||
extent_heap_t heaps[SC_NPSIZES + 1];
|
||||
atomic_zu_t nextents[SC_NPSIZES + 1];
|
||||
atomic_zu_t nbytes[SC_NPSIZES + 1];
|
||||
|
||||
/*
|
||||
* Bitmap for which set bits correspond to non-empty heaps.
|
||||
*
|
||||
* Synchronization: mtx.
|
||||
*/
|
||||
bitmap_t bitmap[BITMAP_GROUPS(NPSIZES+1)];
|
||||
bitmap_t bitmap[BITMAP_GROUPS(SC_NPSIZES + 1)];
|
||||
|
||||
/*
|
||||
* LRU of all extents in heaps.
|
||||
@@ -216,4 +232,25 @@ struct extents_s {
|
||||
bool delay_coalesce;
|
||||
};
|
||||
|
||||
/*
|
||||
* The following two structs are for experimental purposes. See
|
||||
* experimental_utilization_query_ctl and
|
||||
* experimental_utilization_batch_query_ctl in src/ctl.c.
|
||||
*/
|
||||
|
||||
struct extent_util_stats_s {
|
||||
size_t nfree;
|
||||
size_t nregs;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
struct extent_util_stats_verbose_s {
|
||||
void *slabcur_addr;
|
||||
size_t nfree;
|
||||
size_t nregs;
|
||||
size_t size;
|
||||
size_t bin_nfree;
|
||||
size_t bin_nregs;
|
||||
};
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_EXTENT_STRUCTS_H */
|
||||
|
||||
+8
-2
@@ -4,9 +4,10 @@
|
||||
typedef struct extent_s extent_t;
|
||||
typedef struct extents_s extents_t;
|
||||
|
||||
#define EXTENT_HOOKS_INITIALIZER NULL
|
||||
typedef struct extent_util_stats_s extent_util_stats_t;
|
||||
typedef struct extent_util_stats_verbose_s extent_util_stats_verbose_t;
|
||||
|
||||
#define EXTENT_GROW_MAX_PIND (NPSIZES - 1)
|
||||
#define EXTENT_HOOKS_INITIALIZER NULL
|
||||
|
||||
/*
|
||||
* When reuse (and split) an active extent, (1U << opt_lg_extent_max_active_fit)
|
||||
@@ -14,4 +15,9 @@ typedef struct extents_s extents_t;
|
||||
*/
|
||||
#define LG_EXTENT_MAX_ACTIVE_FIT_DEFAULT 6
|
||||
|
||||
typedef enum {
|
||||
EXTENT_NOT_HEAD,
|
||||
EXTENT_IS_HEAD /* Only relevant for Windows && opt.retain. */
|
||||
} extent_head_state_t;
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_EXTENT_TYPES_H */
|
||||
|
||||
+33
-32
@@ -104,8 +104,8 @@ hash_x86_32(const void *key, int len, uint32_t seed) {
|
||||
uint32_t k1 = 0;
|
||||
|
||||
switch (len & 3) {
|
||||
case 3: k1 ^= tail[2] << 16;
|
||||
case 2: k1 ^= tail[1] << 8;
|
||||
case 3: k1 ^= tail[2] << 16; JEMALLOC_FALLTHROUGH
|
||||
case 2: k1 ^= tail[1] << 8; JEMALLOC_FALLTHROUGH
|
||||
case 1: k1 ^= tail[0]; k1 *= c1; k1 = hash_rotl_32(k1, 15);
|
||||
k1 *= c2; h1 ^= k1;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ hash_x86_32(const void *key, int len, uint32_t seed) {
|
||||
return h1;
|
||||
}
|
||||
|
||||
UNUSED static inline void
|
||||
static inline void
|
||||
hash_x86_128(const void *key, const int len, uint32_t seed,
|
||||
uint64_t r_out[2]) {
|
||||
const uint8_t * data = (const uint8_t *) key;
|
||||
@@ -177,28 +177,29 @@ hash_x86_128(const void *key, const int len, uint32_t seed,
|
||||
uint32_t k4 = 0;
|
||||
|
||||
switch (len & 15) {
|
||||
case 15: k4 ^= tail[14] << 16;
|
||||
case 14: k4 ^= tail[13] << 8;
|
||||
case 15: k4 ^= tail[14] << 16; JEMALLOC_FALLTHROUGH
|
||||
case 14: k4 ^= tail[13] << 8; JEMALLOC_FALLTHROUGH
|
||||
case 13: k4 ^= tail[12] << 0;
|
||||
k4 *= c4; k4 = hash_rotl_32(k4, 18); k4 *= c1; h4 ^= k4;
|
||||
|
||||
case 12: k3 ^= tail[11] << 24;
|
||||
case 11: k3 ^= tail[10] << 16;
|
||||
case 10: k3 ^= tail[ 9] << 8;
|
||||
JEMALLOC_FALLTHROUGH
|
||||
case 12: k3 ^= tail[11] << 24; JEMALLOC_FALLTHROUGH
|
||||
case 11: k3 ^= tail[10] << 16; JEMALLOC_FALLTHROUGH
|
||||
case 10: k3 ^= tail[ 9] << 8; JEMALLOC_FALLTHROUGH
|
||||
case 9: k3 ^= tail[ 8] << 0;
|
||||
k3 *= c3; k3 = hash_rotl_32(k3, 17); k3 *= c4; h3 ^= k3;
|
||||
|
||||
case 8: k2 ^= tail[ 7] << 24;
|
||||
case 7: k2 ^= tail[ 6] << 16;
|
||||
case 6: k2 ^= tail[ 5] << 8;
|
||||
JEMALLOC_FALLTHROUGH
|
||||
case 8: k2 ^= tail[ 7] << 24; JEMALLOC_FALLTHROUGH
|
||||
case 7: k2 ^= tail[ 6] << 16; JEMALLOC_FALLTHROUGH
|
||||
case 6: k2 ^= tail[ 5] << 8; JEMALLOC_FALLTHROUGH
|
||||
case 5: k2 ^= tail[ 4] << 0;
|
||||
k2 *= c2; k2 = hash_rotl_32(k2, 16); k2 *= c3; h2 ^= k2;
|
||||
|
||||
case 4: k1 ^= tail[ 3] << 24;
|
||||
case 3: k1 ^= tail[ 2] << 16;
|
||||
case 2: k1 ^= tail[ 1] << 8;
|
||||
JEMALLOC_FALLTHROUGH
|
||||
case 4: k1 ^= tail[ 3] << 24; JEMALLOC_FALLTHROUGH
|
||||
case 3: k1 ^= tail[ 2] << 16; JEMALLOC_FALLTHROUGH
|
||||
case 2: k1 ^= tail[ 1] << 8; JEMALLOC_FALLTHROUGH
|
||||
case 1: k1 ^= tail[ 0] << 0;
|
||||
k1 *= c1; k1 = hash_rotl_32(k1, 15); k1 *= c2; h1 ^= k1;
|
||||
JEMALLOC_FALLTHROUGH
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +221,7 @@ hash_x86_128(const void *key, const int len, uint32_t seed,
|
||||
r_out[1] = (((uint64_t) h4) << 32) | h3;
|
||||
}
|
||||
|
||||
UNUSED static inline void
|
||||
static inline void
|
||||
hash_x64_128(const void *key, const int len, const uint32_t seed,
|
||||
uint64_t r_out[2]) {
|
||||
const uint8_t *data = (const uint8_t *) key;
|
||||
@@ -260,22 +261,22 @@ hash_x64_128(const void *key, const int len, const uint32_t seed,
|
||||
uint64_t k2 = 0;
|
||||
|
||||
switch (len & 15) {
|
||||
case 15: k2 ^= ((uint64_t)(tail[14])) << 48; /* falls through */
|
||||
case 14: k2 ^= ((uint64_t)(tail[13])) << 40; /* falls through */
|
||||
case 13: k2 ^= ((uint64_t)(tail[12])) << 32; /* falls through */
|
||||
case 12: k2 ^= ((uint64_t)(tail[11])) << 24; /* falls through */
|
||||
case 11: k2 ^= ((uint64_t)(tail[10])) << 16; /* falls through */
|
||||
case 10: k2 ^= ((uint64_t)(tail[ 9])) << 8; /* falls through */
|
||||
case 15: k2 ^= ((uint64_t)(tail[14])) << 48; JEMALLOC_FALLTHROUGH
|
||||
case 14: k2 ^= ((uint64_t)(tail[13])) << 40; JEMALLOC_FALLTHROUGH
|
||||
case 13: k2 ^= ((uint64_t)(tail[12])) << 32; JEMALLOC_FALLTHROUGH
|
||||
case 12: k2 ^= ((uint64_t)(tail[11])) << 24; JEMALLOC_FALLTHROUGH
|
||||
case 11: k2 ^= ((uint64_t)(tail[10])) << 16; JEMALLOC_FALLTHROUGH
|
||||
case 10: k2 ^= ((uint64_t)(tail[ 9])) << 8; JEMALLOC_FALLTHROUGH
|
||||
case 9: k2 ^= ((uint64_t)(tail[ 8])) << 0;
|
||||
k2 *= c2; k2 = hash_rotl_64(k2, 33); k2 *= c1; h2 ^= k2;
|
||||
/* falls through */
|
||||
case 8: k1 ^= ((uint64_t)(tail[ 7])) << 56; /* falls through */
|
||||
case 7: k1 ^= ((uint64_t)(tail[ 6])) << 48; /* falls through */
|
||||
case 6: k1 ^= ((uint64_t)(tail[ 5])) << 40; /* falls through */
|
||||
case 5: k1 ^= ((uint64_t)(tail[ 4])) << 32; /* falls through */
|
||||
case 4: k1 ^= ((uint64_t)(tail[ 3])) << 24; /* falls through */
|
||||
case 3: k1 ^= ((uint64_t)(tail[ 2])) << 16; /* falls through */
|
||||
case 2: k1 ^= ((uint64_t)(tail[ 1])) << 8; /* falls through */
|
||||
JEMALLOC_FALLTHROUGH
|
||||
case 8: k1 ^= ((uint64_t)(tail[ 7])) << 56; JEMALLOC_FALLTHROUGH
|
||||
case 7: k1 ^= ((uint64_t)(tail[ 6])) << 48; JEMALLOC_FALLTHROUGH
|
||||
case 6: k1 ^= ((uint64_t)(tail[ 5])) << 40; JEMALLOC_FALLTHROUGH
|
||||
case 5: k1 ^= ((uint64_t)(tail[ 4])) << 32; JEMALLOC_FALLTHROUGH
|
||||
case 4: k1 ^= ((uint64_t)(tail[ 3])) << 24; JEMALLOC_FALLTHROUGH
|
||||
case 3: k1 ^= ((uint64_t)(tail[ 2])) << 16; JEMALLOC_FALLTHROUGH
|
||||
case 2: k1 ^= ((uint64_t)(tail[ 1])) << 8; JEMALLOC_FALLTHROUGH
|
||||
case 1: k1 ^= ((uint64_t)(tail[ 0])) << 0;
|
||||
k1 *= c1; k1 = hash_rotl_64(k1, 31); k1 *= c2; h1 ^= k1;
|
||||
}
|
||||
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
#ifndef JEMALLOC_INTERNAL_HOOK_H
|
||||
#define JEMALLOC_INTERNAL_HOOK_H
|
||||
|
||||
#include "jemalloc/internal/tsd.h"
|
||||
|
||||
/*
|
||||
* This API is *extremely* experimental, and may get ripped out, changed in API-
|
||||
* and ABI-incompatible ways, be insufficiently or incorrectly documented, etc.
|
||||
*
|
||||
* It allows hooking the stateful parts of the API to see changes as they
|
||||
* happen.
|
||||
*
|
||||
* Allocation hooks are called after the allocation is done, free hooks are
|
||||
* called before the free is done, and expand hooks are called after the
|
||||
* allocation is expanded.
|
||||
*
|
||||
* For realloc and rallocx, if the expansion happens in place, the expansion
|
||||
* hook is called. If it is moved, then the alloc hook is called on the new
|
||||
* location, and then the free hook is called on the old location (i.e. both
|
||||
* hooks are invoked in between the alloc and the dalloc).
|
||||
*
|
||||
* If we return NULL from OOM, then usize might not be trustworthy. Calling
|
||||
* realloc(NULL, size) only calls the alloc hook, and calling realloc(ptr, 0)
|
||||
* only calls the free hook. (Calling realloc(NULL, 0) is treated as malloc(0),
|
||||
* and only calls the alloc hook).
|
||||
*
|
||||
* Reentrancy:
|
||||
* Reentrancy is guarded against from within the hook implementation. If you
|
||||
* call allocator functions from within a hook, the hooks will not be invoked
|
||||
* again.
|
||||
* Threading:
|
||||
* The installation of a hook synchronizes with all its uses. If you can
|
||||
* prove the installation of a hook happens-before a jemalloc entry point,
|
||||
* then the hook will get invoked (unless there's a racing removal).
|
||||
*
|
||||
* Hook insertion appears to be atomic at a per-thread level (i.e. if a thread
|
||||
* allocates and has the alloc hook invoked, then a subsequent free on the
|
||||
* same thread will also have the free hook invoked).
|
||||
*
|
||||
* The *removal* of a hook does *not* block until all threads are done with
|
||||
* the hook. Hook authors have to be resilient to this, and need some
|
||||
* out-of-band mechanism for cleaning up any dynamically allocated memory
|
||||
* associated with their hook.
|
||||
* Ordering:
|
||||
* Order of hook execution is unspecified, and may be different than insertion
|
||||
* order.
|
||||
*/
|
||||
|
||||
#define HOOK_MAX 4
|
||||
|
||||
enum hook_alloc_e {
|
||||
hook_alloc_malloc,
|
||||
hook_alloc_posix_memalign,
|
||||
hook_alloc_aligned_alloc,
|
||||
hook_alloc_calloc,
|
||||
hook_alloc_memalign,
|
||||
hook_alloc_valloc,
|
||||
hook_alloc_mallocx,
|
||||
|
||||
/* The reallocating functions have both alloc and dalloc variants */
|
||||
hook_alloc_realloc,
|
||||
hook_alloc_rallocx,
|
||||
};
|
||||
/*
|
||||
* We put the enum typedef after the enum, since this file may get included by
|
||||
* jemalloc_cpp.cpp, and C++ disallows enum forward declarations.
|
||||
*/
|
||||
typedef enum hook_alloc_e hook_alloc_t;
|
||||
|
||||
enum hook_dalloc_e {
|
||||
hook_dalloc_free,
|
||||
hook_dalloc_dallocx,
|
||||
hook_dalloc_sdallocx,
|
||||
|
||||
/*
|
||||
* The dalloc halves of reallocation (not called if in-place expansion
|
||||
* happens).
|
||||
*/
|
||||
hook_dalloc_realloc,
|
||||
hook_dalloc_rallocx,
|
||||
};
|
||||
typedef enum hook_dalloc_e hook_dalloc_t;
|
||||
|
||||
|
||||
enum hook_expand_e {
|
||||
hook_expand_realloc,
|
||||
hook_expand_rallocx,
|
||||
hook_expand_xallocx,
|
||||
};
|
||||
typedef enum hook_expand_e hook_expand_t;
|
||||
|
||||
typedef void (*hook_alloc)(
|
||||
void *extra, hook_alloc_t type, void *result, uintptr_t result_raw,
|
||||
uintptr_t args_raw[3]);
|
||||
|
||||
typedef void (*hook_dalloc)(
|
||||
void *extra, hook_dalloc_t type, void *address, uintptr_t args_raw[3]);
|
||||
|
||||
typedef void (*hook_expand)(
|
||||
void *extra, hook_expand_t type, void *address, size_t old_usize,
|
||||
size_t new_usize, uintptr_t result_raw, uintptr_t args_raw[4]);
|
||||
|
||||
typedef struct hooks_s hooks_t;
|
||||
struct hooks_s {
|
||||
hook_alloc alloc_hook;
|
||||
hook_dalloc dalloc_hook;
|
||||
hook_expand expand_hook;
|
||||
void *extra;
|
||||
};
|
||||
|
||||
/*
|
||||
* Begin implementation details; everything above this point might one day live
|
||||
* in a public API. Everything below this point never will.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The realloc pathways haven't gotten any refactoring love in a while, and it's
|
||||
* fairly difficult to pass information from the entry point to the hooks. We
|
||||
* put the informaiton the hooks will need into a struct to encapsulate
|
||||
* everything.
|
||||
*
|
||||
* Much of these pathways are force-inlined, so that the compiler can avoid
|
||||
* materializing this struct until we hit an extern arena function. For fairly
|
||||
* goofy reasons, *many* of the realloc paths hit an extern arena function.
|
||||
* These paths are cold enough that it doesn't matter; eventually, we should
|
||||
* rewrite the realloc code to make the expand-in-place and the
|
||||
* free-then-realloc paths more orthogonal, at which point we don't need to
|
||||
* spread the hook logic all over the place.
|
||||
*/
|
||||
typedef struct hook_ralloc_args_s hook_ralloc_args_t;
|
||||
struct hook_ralloc_args_s {
|
||||
/* I.e. as opposed to rallocx. */
|
||||
bool is_realloc;
|
||||
/*
|
||||
* The expand hook takes 4 arguments, even if only 3 are actually used;
|
||||
* we add an extra one in case the user decides to memcpy without
|
||||
* looking too closely at the hooked function.
|
||||
*/
|
||||
uintptr_t args[4];
|
||||
};
|
||||
|
||||
/*
|
||||
* Returns an opaque handle to be used when removing the hook. NULL means that
|
||||
* we couldn't install the hook.
|
||||
*/
|
||||
bool hook_boot();
|
||||
|
||||
void *hook_install(tsdn_t *tsdn, hooks_t *hooks);
|
||||
/* Uninstalls the hook with the handle previously returned from hook_install. */
|
||||
void hook_remove(tsdn_t *tsdn, void *opaque);
|
||||
|
||||
/* Hooks */
|
||||
|
||||
void hook_invoke_alloc(hook_alloc_t type, void *result, uintptr_t result_raw,
|
||||
uintptr_t args_raw[3]);
|
||||
|
||||
void hook_invoke_dalloc(hook_dalloc_t type, void *address,
|
||||
uintptr_t args_raw[3]);
|
||||
|
||||
void hook_invoke_expand(hook_expand_t type, void *address, size_t old_usize,
|
||||
size_t new_usize, uintptr_t result_raw, uintptr_t args_raw[4]);
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_HOOK_H */
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
#ifndef JEMALLOC_INTERNAL_HOOKS_H
|
||||
#define JEMALLOC_INTERNAL_HOOKS_H
|
||||
|
||||
extern JEMALLOC_EXPORT void (*hooks_arena_new_hook)();
|
||||
extern JEMALLOC_EXPORT void (*hooks_libc_hook)();
|
||||
|
||||
#define JEMALLOC_HOOK(fn, hook) ((void)(hook != NULL && (hook(), 0)), fn)
|
||||
|
||||
#define open JEMALLOC_HOOK(open, hooks_libc_hook)
|
||||
#define read JEMALLOC_HOOK(read, hooks_libc_hook)
|
||||
#define write JEMALLOC_HOOK(write, hooks_libc_hook)
|
||||
#define readlink JEMALLOC_HOOK(readlink, hooks_libc_hook)
|
||||
#define close JEMALLOC_HOOK(close, hooks_libc_hook)
|
||||
#define creat JEMALLOC_HOOK(creat, hooks_libc_hook)
|
||||
#define secure_getenv JEMALLOC_HOOK(secure_getenv, hooks_libc_hook)
|
||||
/* Note that this is undef'd and re-define'd in src/prof.c. */
|
||||
#define _Unwind_Backtrace JEMALLOC_HOOK(_Unwind_Backtrace, hooks_libc_hook)
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_HOOKS_H */
|
||||
@@ -31,6 +31,9 @@
|
||||
# include <sys/uio.h>
|
||||
# endif
|
||||
# include <pthread.h>
|
||||
# ifdef __FreeBSD__
|
||||
# include <pthread_np.h>
|
||||
# endif
|
||||
# include <signal.h>
|
||||
# ifdef JEMALLOC_OS_UNFAIR_LOCK
|
||||
# include <os/lock.h>
|
||||
|
||||
@@ -48,25 +48,13 @@
|
||||
|
||||
/* Defined if GCC __atomic atomics are available. */
|
||||
#undef JEMALLOC_GCC_ATOMIC_ATOMICS
|
||||
/* and the 8-bit variant support. */
|
||||
#undef JEMALLOC_GCC_U8_ATOMIC_ATOMICS
|
||||
|
||||
/* Defined if GCC __sync atomics are available. */
|
||||
#undef JEMALLOC_GCC_SYNC_ATOMICS
|
||||
|
||||
/*
|
||||
* Defined if __sync_add_and_fetch(uint32_t *, uint32_t) and
|
||||
* __sync_sub_and_fetch(uint32_t *, uint32_t) are available, despite
|
||||
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the
|
||||
* functions are defined in libgcc instead of being inlines).
|
||||
*/
|
||||
#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4
|
||||
|
||||
/*
|
||||
* Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and
|
||||
* __sync_sub_and_fetch(uint64_t *, uint64_t) are available, despite
|
||||
* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the
|
||||
* functions are defined in libgcc instead of being inlines).
|
||||
*/
|
||||
#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8
|
||||
/* and the 8-bit variant support. */
|
||||
#undef JEMALLOC_GCC_U8_SYNC_ATOMICS
|
||||
|
||||
/*
|
||||
* Defined if __builtin_clz() and __builtin_clzl() are available.
|
||||
@@ -78,12 +66,6 @@
|
||||
*/
|
||||
#undef JEMALLOC_OS_UNFAIR_LOCK
|
||||
|
||||
/*
|
||||
* Defined if OSSpin*() functions are available, as provided by Darwin, and
|
||||
* documented in the spinlock(3) manual page.
|
||||
*/
|
||||
#undef JEMALLOC_OSSPIN
|
||||
|
||||
/* Defined if syscall(2) is usable. */
|
||||
#undef JEMALLOC_USE_SYSCALL
|
||||
|
||||
@@ -153,6 +135,9 @@
|
||||
/* JEMALLOC_STATS enables statistics calculation. */
|
||||
#undef JEMALLOC_STATS
|
||||
|
||||
/* JEMALLOC_EXPERIMENTAL_SMALLOCX_API enables experimental smallocx API. */
|
||||
#undef JEMALLOC_EXPERIMENTAL_SMALLOCX_API
|
||||
|
||||
/* JEMALLOC_PROF enables allocation profiling. */
|
||||
#undef JEMALLOC_PROF
|
||||
|
||||
@@ -233,6 +218,12 @@
|
||||
#undef JEMALLOC_INTERNAL_FFSL
|
||||
#undef JEMALLOC_INTERNAL_FFS
|
||||
|
||||
/*
|
||||
* popcount*() functions to use for bitmapping.
|
||||
*/
|
||||
#undef JEMALLOC_INTERNAL_POPCOUNTL
|
||||
#undef JEMALLOC_INTERNAL_POPCOUNT
|
||||
|
||||
/*
|
||||
* If defined, explicitly attempt to more uniformly distribute large allocation
|
||||
* pointer alignments across all cache indices.
|
||||
@@ -245,6 +236,12 @@
|
||||
*/
|
||||
#undef JEMALLOC_LOG
|
||||
|
||||
/*
|
||||
* If defined, use readlinkat() (instead of readlink()) to follow
|
||||
* /etc/malloc_conf.
|
||||
*/
|
||||
#undef JEMALLOC_READLINKAT
|
||||
|
||||
/*
|
||||
* Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
|
||||
*/
|
||||
@@ -363,4 +360,7 @@
|
||||
*/
|
||||
#undef JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE
|
||||
|
||||
/* Performs additional safety checks when defined. */
|
||||
#undef JEMALLOC_OPT_SAFETY_CHECKS
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define JEMALLOC_INTERNAL_EXTERNS_H
|
||||
|
||||
#include "jemalloc/internal/atomic.h"
|
||||
#include "jemalloc/internal/size_classes.h"
|
||||
#include "jemalloc/internal/tsd_types.h"
|
||||
|
||||
/* TSD checks this to set thread local slow state accordingly. */
|
||||
@@ -11,6 +10,7 @@ extern bool malloc_slow;
|
||||
/* Run-time options. */
|
||||
extern bool opt_abort;
|
||||
extern bool opt_abort_conf;
|
||||
extern bool opt_confirm_conf;
|
||||
extern const char *opt_junk;
|
||||
extern bool opt_junk_alloc;
|
||||
extern bool opt_junk_free;
|
||||
@@ -25,6 +25,9 @@ extern unsigned ncpus;
|
||||
/* Number of arenas used for automatic multiplexing of threads and arenas. */
|
||||
extern unsigned narenas_auto;
|
||||
|
||||
/* Base index for manual arenas. */
|
||||
extern unsigned manual_arena_base;
|
||||
|
||||
/*
|
||||
* Arenas that are used to service external requests. Not all elements of the
|
||||
* arenas array are necessarily used; arenas are created lazily as needed.
|
||||
@@ -49,5 +52,6 @@ void jemalloc_prefork(void);
|
||||
void jemalloc_postfork_parent(void);
|
||||
void jemalloc_postfork_child(void);
|
||||
bool malloc_initialized(void);
|
||||
void je_sdallocx_noflags(void *ptr, size_t size);
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_EXTERNS_H */
|
||||
|
||||
@@ -4,13 +4,15 @@
|
||||
#include "jemalloc/internal/atomic.h"
|
||||
#include "jemalloc/internal/bit_util.h"
|
||||
#include "jemalloc/internal/jemalloc_internal_types.h"
|
||||
#include "jemalloc/internal/size_classes.h"
|
||||
#include "jemalloc/internal/sc.h"
|
||||
#include "jemalloc/internal/ticker.h"
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE malloc_cpuid_t
|
||||
malloc_getcpu(void) {
|
||||
assert(have_percpu_arena);
|
||||
#if defined(JEMALLOC_HAVE_SCHED_GETCPU)
|
||||
#if defined(_WIN32)
|
||||
return GetCurrentProcessorNumber();
|
||||
#elif defined(JEMALLOC_HAVE_SCHED_GETCPU)
|
||||
return (malloc_cpuid_t)sched_getcpu();
|
||||
#else
|
||||
not_reached();
|
||||
@@ -108,14 +110,14 @@ decay_ticker_get(tsd_t *tsd, unsigned ind) {
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE cache_bin_t *
|
||||
tcache_small_bin_get(tcache_t *tcache, szind_t binind) {
|
||||
assert(binind < NBINS);
|
||||
assert(binind < SC_NBINS);
|
||||
return &tcache->bins_small[binind];
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE cache_bin_t *
|
||||
tcache_large_bin_get(tcache_t *tcache, szind_t binind) {
|
||||
assert(binind >= NBINS &&binind < nhbins);
|
||||
return &tcache->bins_large[binind - NBINS];
|
||||
assert(binind >= SC_NBINS &&binind < nhbins);
|
||||
return &tcache->bins_large[binind - SC_NBINS];
|
||||
}
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE bool
|
||||
@@ -156,7 +158,7 @@ pre_reentrancy(tsd_t *tsd, arena_t *arena) {
|
||||
if (fast) {
|
||||
/* Prepare slow path for reentrancy. */
|
||||
tsd_slow_update(tsd);
|
||||
assert(tsd->state == tsd_state_nominal_slow);
|
||||
assert(tsd_state_get(tsd) == tsd_state_nominal_slow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user