1extern crate c2rust_bitfields;
2extern crate libc;
3extern crate core;
4use debug::core::cell::UnsafeCell;
5extern "C" {
6 pub type _IO_wide_data;
7 pub type _IO_codecvt;
8 pub type _IO_marker;
9 pub type RedisModuleCtx;
10 pub type RedisModuleDefragCtx;
11 pub type RedisModuleInfoCtx;
12 pub type RedisModuleKeyOptCtx;
13 pub type RedisModuleCommand;
14 pub type clusterSlotToKeyMapping;
15 pub type clusterState;
16 fn open(__file: *const libc::c_char, __oflag: libc::c_int, _: ...) -> libc::c_int;
17 static mut stdout: *mut FILE;
18 fn fclose(__stream: *mut FILE) -> libc::c_int;
19 fn fflush(__stream: *mut FILE) -> libc::c_int;
20 fn fopen(_: *const libc::c_char, _: *const libc::c_char) -> *mut FILE;
21 fn printf(_: *const libc::c_char, _: ...) -> libc::c_int;
22 fn snprintf(
23 _: *mut libc::c_char,
24 _: libc::c_ulong,
25 _: *const libc::c_char,
26 _: ...
27 ) -> libc::c_int;
28 fn vsnprintf(
29 _: *mut libc::c_char,
30 _: libc::c_ulong,
31 _: *const libc::c_char,
32 _: core::ffi::VaList,
33 ) -> libc::c_int;
34 fn fgets(
35 __s: *mut libc::c_char,
36 __n: libc::c_int,
37 __stream: *mut FILE,
38 ) -> *mut libc::c_char;
39 fn sdsnewlen(init: *const libc::c_void, initlen: size_t) -> sds;
40 fn sdsempty() -> sds;
41 fn sdsdup(s: sds) -> sds;
42 fn sdsfree(s: sds);
43 fn sdscatlen(s: sds, t: *const libc::c_void, len: size_t) -> sds;
44 fn sdscat(s: sds, t: *const libc::c_char) -> sds;
45 fn sdscatsds(s: sds, t: sds) -> sds;
46 fn sdscatprintf(s: sds, fmt: *const libc::c_char, _: ...) -> sds;
47 fn sdscatfmt(s: sds, fmt: *const libc::c_char, _: ...) -> sds;
48 fn sdscatrepr(s: sds, p: *const libc::c_char, len: size_t) -> sds;
49 fn sdsmapchars(
50 s: sds,
51 from: *const libc::c_char,
52 to: *const libc::c_char,
53 setlen: size_t,
54 ) -> sds;
55 fn __errno_location() -> *mut libc::c_int;
56 fn connGetInfo(
57 conn: *mut connection,
58 buf: *mut libc::c_char,
59 buf_len: size_t,
60 ) -> *const libc::c_char;
61 fn time(__timer: *mut time_t) -> time_t;
62 fn nanosleep(
63 __requested_time: *const timespec,
64 __remaining: *mut timespec,
65 ) -> libc::c_int;
66 fn pthread_join(
67 __th: pthread_t,
68 __thread_return: *mut *mut libc::c_void,
69 ) -> libc::c_int;
70 fn pthread_self() -> pthread_t;
71 fn pthread_cancel(__th: pthread_t) -> libc::c_int;
72 fn pthread_mutex_lock(__mutex: *mut pthread_mutex_t) -> libc::c_int;
73 fn pthread_mutex_unlock(__mutex: *mut pthread_mutex_t) -> libc::c_int;
74 fn strtod(_: *const libc::c_char, _: *mut *mut libc::c_char) -> libc::c_double;
75 fn strtol(
76 _: *const libc::c_char,
77 _: *mut *mut libc::c_char,
78 _: libc::c_int,
79 ) -> libc::c_long;
80 fn strtoul(
81 _: *const libc::c_char,
82 _: *mut *mut libc::c_char,
83 _: libc::c_int,
84 ) -> libc::c_ulong;
85 fn rand() -> libc::c_int;
86 fn abort() -> !;
87 fn exit(_: libc::c_int) -> !;
88 fn memcpy(
89 _: *mut libc::c_void,
90 _: *const libc::c_void,
91 _: libc::c_ulong,
92 ) -> *mut libc::c_void;
93 fn memset(
94 _: *mut libc::c_void,
95 _: libc::c_int,
96 _: libc::c_ulong,
97 ) -> *mut libc::c_void;
98 fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
99 fn strchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char;
100 fn strstr(_: *const libc::c_char, _: *const libc::c_char) -> *mut libc::c_char;
101 fn strlen(_: *const libc::c_char) -> libc::c_ulong;
102 fn strerror(_: libc::c_int) -> *mut libc::c_char;
103 fn strcasecmp(__s1: *const libc::c_char, __s2: *const libc::c_char) -> libc::c_int;
104 fn close(__fd: libc::c_int) -> libc::c_int;
105 fn write(__fd: libc::c_int, __buf: *const libc::c_void, __n: size_t) -> ssize_t;
106 fn usleep(__useconds: __useconds_t) -> libc::c_int;
107 fn _exit(__status: libc::c_int) -> !;
108 fn sysconf(__name: libc::c_int) -> libc::c_long;
109 fn getpid() -> __pid_t;
110 fn unlink(__name: *const libc::c_char) -> libc::c_int;
111 fn kill(__pid: __pid_t, __sig: libc::c_int) -> libc::c_int;
112 fn sigemptyset(__set: *mut sigset_t) -> libc::c_int;
113 fn sigaction(
114 __sig: libc::c_int,
115 __act: *const sigaction,
116 __oact: *mut sigaction,
117 ) -> libc::c_int;
118 fn setitimer(
119 __which: __itimer_which_t,
120 __new: *const itimerval,
121 __old: *mut itimerval,
122 ) -> libc::c_int;
123 fn dictExpand(d: *mut dict, size: libc::c_ulong) -> libc::c_int;
124 fn dictFind(d: *mut dict, key: *const libc::c_void) -> *mut dictEntry;
125 fn dictGetIterator(d: *mut dict) -> *mut dictIterator;
126 fn dictGetSafeIterator(d: *mut dict) -> *mut dictIterator;
127 fn dictNext(iter: *mut dictIterator) -> *mut dictEntry;
128 fn dictReleaseIterator(iter: *mut dictIterator);
129 fn dictGetStats(buf: *mut libc::c_char, bufsize: size_t, d: *mut dict);
130 fn je_mallctl(
131 name: *const libc::c_char,
132 oldp: *mut libc::c_void,
133 oldlenp: *mut size_t,
134 newp: *mut libc::c_void,
135 newlen: size_t,
136 ) -> libc::c_int;
137 fn zmalloc(size: size_t) -> *mut libc::c_void;
138 fn zfree(ptr: *mut libc::c_void);
139 fn stringmatchlen_fuzz_test() -> libc::c_int;
140 fn memtoull(p: *const libc::c_char, err: *mut libc::c_int) -> libc::c_ulonglong;
141 fn ll2string(
142 s: *mut libc::c_char,
143 len: size_t,
144 value: libc::c_longlong,
145 ) -> libc::c_int;
146 fn quicklistRepr(ql: *mut libc::c_uchar, full: libc::c_int);
147 fn quicklistisSetPackedThreshold(sz: size_t) -> libc::c_int;
148 fn SHA1Init(context: *mut SHA1_CTX);
149 fn SHA1Update(context: *mut SHA1_CTX, data: *const libc::c_uchar, len: uint32_t);
150 fn SHA1Final(digest: *mut libc::c_uchar, context: *mut SHA1_CTX);
151 fn lpGetValue(
152 p: *mut libc::c_uchar,
153 slen: *mut libc::c_uint,
154 lval: *mut libc::c_longlong,
155 ) -> *mut libc::c_uchar;
156 fn lpNext(lp: *mut libc::c_uchar, p: *mut libc::c_uchar) -> *mut libc::c_uchar;
157 fn lpSeek(lp: *mut libc::c_uchar, index: libc::c_long) -> *mut libc::c_uchar;
158 fn lpRepr(lp: *mut libc::c_uchar);
159 fn streamIteratorStart(
160 si: *mut streamIterator,
161 s: *mut stream,
162 start: *mut streamID,
163 end: *mut streamID,
164 rev: libc::c_int,
165 );
166 fn streamIteratorGetID(
167 si: *mut streamIterator,
168 id: *mut streamID,
169 numfields: *mut int64_t,
170 ) -> libc::c_int;
171 fn streamIteratorGetField(
172 si: *mut streamIterator,
173 fieldptr: *mut *mut libc::c_uchar,
174 valueptr: *mut *mut libc::c_uchar,
175 fieldlen: *mut int64_t,
176 valuelen: *mut int64_t,
177 );
178 fn streamIteratorStop(si: *mut streamIterator);
179 static mut server: redisServer;
180 static mut shared: sharedObjectsStruct;
181 fn modulesCollectInfo(
182 info: sds,
183 sections_dict: *mut dict,
184 for_crash_report: libc::c_int,
185 sections: libc::c_int,
186 ) -> sds;
187 fn addReplyNull(c: *mut client);
188 fn addReplyBool(c: *mut client, b: libc::c_int);
189 fn addReplyVerbatim(
190 c: *mut client,
191 s: *const libc::c_char,
192 len: size_t,
193 ext: *const libc::c_char,
194 );
195 fn addReplyBulkCString(c: *mut client, s: *const libc::c_char);
196 fn addReply(c: *mut client, obj: *mut robj);
197 fn addReplySds(c: *mut client, s: sds);
198 fn addReplyBulkSds(c: *mut client, s: sds);
199 fn addReplyErrorObject(c: *mut client, err: *mut robj);
200 fn addReplyError(c: *mut client, err: *const libc::c_char);
201 fn addReplyStatus(c: *mut client, status: *const libc::c_char);
202 fn addReplyDouble(c: *mut client, d: libc::c_double);
203 fn addReplyBigNum(c: *mut client, num: *const libc::c_char, len: size_t);
204 fn addReplyLongLong(c: *mut client, ll: libc::c_longlong);
205 fn addReplyArrayLen(c: *mut client, length: libc::c_long);
206 fn addReplyMapLen(c: *mut client, length: libc::c_long);
207 fn addReplySetLen(c: *mut client, length: libc::c_long);
208 fn addReplyAttributeLen(c: *mut client, length: libc::c_long);
209 fn addReplyPushLen(c: *mut client, length: libc::c_long);
210 fn addReplyHelp(c: *mut client, help: *mut *const libc::c_char);
211 fn addReplySubcommandSyntaxError(c: *mut client);
212 fn sdsZmallocSize(s: sds) -> size_t;
213 fn getStringObjectSdsUsedMemory(o: *mut robj) -> size_t;
214 fn catClientInfoString(s: sds, client: *mut client) -> sds;
215 fn getAllClientsInfoString(type_0: libc::c_int) -> sds;
216 fn rdbPopulateSaveInfo(rsi: *mut rdbSaveInfo) -> *mut rdbSaveInfo;
217 fn rdbSavedObjectLen(o: *mut robj, key: *mut robj, dbid: libc::c_int) -> size_t;
218 fn rdbSave(
219 req: libc::c_int,
220 filename: *mut libc::c_char,
221 rsi: *mut rdbSaveInfo,
222 ) -> libc::c_int;
223 fn rdbLoad(
224 filename: *mut libc::c_char,
225 rsi: *mut rdbSaveInfo,
226 rdbflags: libc::c_int,
227 ) -> libc::c_int;
228 fn _serverLog(level: libc::c_int, fmt: *const libc::c_char, _: ...);
229 fn getLongFromObjectOrReply(
230 c: *mut client,
231 o: *mut robj,
232 target: *mut libc::c_long,
233 msg: *const libc::c_char,
234 ) -> libc::c_int;
235 fn getPositiveLongFromObjectOrReply(
236 c: *mut client,
237 o: *mut robj,
238 target: *mut libc::c_long,
239 msg: *const libc::c_char,
240 ) -> libc::c_int;
241 fn getLongLongFromObjectOrReply(
242 c: *mut client,
243 o: *mut robj,
244 target: *mut libc::c_longlong,
245 msg: *const libc::c_char,
246 ) -> libc::c_int;
247 fn strEncoding(encoding: libc::c_int) -> *mut libc::c_char;
248 fn estimateObjectIdleTime(o: *mut robj) -> libc::c_ulonglong;
249 fn replicationFeedSlaves(
250 slaves: *mut list,
251 dictid: libc::c_int,
252 argv: *mut *mut robj,
253 argc: libc::c_int,
254 );
255 fn changeReplicationId();
256 fn clearReplicationId2();
257 fn getDecodedObject(o: *mut robj) -> *mut robj;
258 fn createStringObject(ptr: *const libc::c_char, len: size_t) -> *mut robj;
259 fn decrRefCount(o: *mut robj);
260 fn flushAppendOnlyFile(force: libc::c_int);
261 fn loadAppendOnlyFiles(am: *mut aofManifest) -> libc::c_int;
262 fn aofLoadManifestFromDisk();
263 fn aofManifestFree(am: *mut aofManifest);
264 fn aofDelHistoryFiles() -> libc::c_int;
265 fn zzlGetScore(sptr: *mut libc::c_uchar) -> libc::c_double;
266 fn zzlNext(
267 zl: *mut libc::c_uchar,
268 eptr: *mut *mut libc::c_uchar,
269 sptr: *mut *mut libc::c_uchar,
270 );
271 fn removeSignalHandlers();
272 fn protectClient(c: *mut client);
273 fn unprotectClient(c: *mut client);
274 fn addReplyStatusFormat(c: *mut client, fmt: *const libc::c_char, _: ...);
275 fn listTypeInitIterator(
276 subject: *mut robj,
277 index: libc::c_long,
278 direction: libc::c_uchar,
279 ) -> *mut listTypeIterator;
280 fn listTypeReleaseIterator(li: *mut listTypeIterator);
281 fn listTypeNext(li: *mut listTypeIterator, entry: *mut listTypeEntry) -> libc::c_int;
282 fn listTypeGet(entry: *mut listTypeEntry) -> *mut robj;
283 fn addReplyErrorFormat(c: *mut client, fmt: *const libc::c_char, _: ...);
284 fn rewriteConfig(path: *mut libc::c_char, force_write: libc::c_int) -> libc::c_int;
285 fn getConfigDebugInfo() -> sds;
286 fn getExpire(db: *mut redisDb, key: *mut robj) -> libc::c_longlong;
287 fn lookupKeyWrite(db: *mut redisDb, key: *mut robj) -> *mut robj;
288 fn objectCommandLookupOrReply(
289 c: *mut client,
290 key: *mut robj,
291 reply: *mut robj,
292 ) -> *mut robj;
293 fn dbAdd(db: *mut redisDb, key: *mut robj, val: *mut robj);
294 fn emptyData(
295 dbnum: libc::c_int,
296 flags: libc::c_int,
297 callback: Option::<unsafe extern "C" fn(*mut dict) -> ()>,
298 ) -> libc::c_longlong;
299 fn signalModifiedKey(c: *mut client, db: *mut redisDb, key: *mut robj);
300 fn serverLogRaw(level: libc::c_int, msg: *const libc::c_char);
301 fn serverLogFromHandler(level: libc::c_int, msg: *const libc::c_char);
302 fn restartServer(flags: libc::c_int, delay: mstime_t) -> libc::c_int;
303 fn setTypeInitIterator(subject: *mut robj) -> *mut setTypeIterator;
304 fn setTypeReleaseIterator(si: *mut setTypeIterator);
305 fn setTypeNextObject(si: *mut setTypeIterator) -> sds;
306 fn hashTypeInitIterator(subject: *mut robj) -> *mut hashTypeIterator;
307 fn hashTypeReleaseIterator(hi: *mut hashTypeIterator);
308 fn hashTypeNext(hi: *mut hashTypeIterator) -> libc::c_int;
309 fn hashTypeCurrentObjectNewSds(hi: *mut hashTypeIterator, what: libc::c_int) -> sds;
310 fn genRedisInfoString(
311 section_dict: *mut dict,
312 all_sections: libc::c_int,
313 everything: libc::c_int,
314 ) -> sds;
315 fn releaseInfoSectionDict(sec: *mut dict);
316 fn genInfoSectionDict(
317 argv: *mut *mut robj,
318 argc: libc::c_int,
319 defaults: *mut *mut libc::c_char,
320 out_all: *mut libc::c_int,
321 out_everything: *mut libc::c_int,
322 ) -> *mut dict;
323 fn memtest_preserving_test(
324 m: *mut libc::c_ulong,
325 bytes: size_t,
326 passes: libc::c_int,
327 ) -> libc::c_int;
328 fn killIOThreads();
329 fn bioKillThreads();
330 fn dladdr(__address: *const libc::c_void, __info: *mut Dl_info) -> libc::c_int;
331 fn mmap(
332 __addr: *mut libc::c_void,
333 __len: size_t,
334 __prot: libc::c_int,
335 __flags: libc::c_int,
336 __fd: libc::c_int,
337 __offset: __off64_t,
338 ) -> *mut libc::c_void;
339 fn backtrace(__array: *mut *mut libc::c_void, __size: libc::c_int) -> libc::c_int;
340 fn backtrace_symbols_fd(
341 __array: *const *mut libc::c_void,
342 __size: libc::c_int,
343 __fd: libc::c_int,
344 );
345}
346pub type __builtin_va_list = __va_list;
347#[derive(Copy, Clone)]
348#[repr(C)]
349pub struct __va_list {
350 pub __stack: *mut libc::c_void,
351 pub __gr_top: *mut libc::c_void,
352 pub __vr_top: *mut libc::c_void,
353 pub __gr_offs: libc::c_int,
354 pub __vr_offs: libc::c_int,
355}
356pub type __uint8_t = libc::c_uchar;
357pub type __int16_t = libc::c_short;
358pub type __uint16_t = libc::c_ushort;
359pub type __int32_t = libc::c_int;
360pub type __uint32_t = libc::c_uint;
361pub type __int64_t = libc::c_long;
362pub type __uint64_t = libc::c_ulong;
363pub type __uint_least64_t = __uint64_t;
364pub type __uid_t = libc::c_uint;
365pub type __mode_t = libc::c_uint;
366pub type __off_t = libc::c_long;
367pub type __off64_t = libc::c_long;
368pub type __pid_t = libc::c_int;
369pub type __clock_t = libc::c_long;
370pub type __time_t = libc::c_long;
371pub type __useconds_t = libc::c_uint;
372pub type __suseconds_t = libc::c_long;
373pub type __ssize_t = libc::c_long;
374pub type __syscall_slong_t = libc::c_long;
375pub type __sig_atomic_t = libc::c_int;
376pub type size_t = libc::c_ulong;
377#[derive(Copy, Clone)]
378#[repr(C)]
379pub struct iovec {
380 pub iov_base: *mut libc::c_void,
381 pub iov_len: size_t,
382}
383pub type mode_t = __mode_t;
384pub type off_t = __off64_t;
385pub type pid_t = __pid_t;
386#[derive(Copy, Clone)]
387#[repr(C)]
388pub struct timespec {
389 pub tv_sec: __time_t,
390 pub tv_nsec: __syscall_slong_t,
391}
392pub type ssize_t = __ssize_t;
393pub type time_t = __time_t;
394pub type int16_t = __int16_t;
395pub type int32_t = __int32_t;
396pub type int64_t = __int64_t;
397#[derive(Copy, Clone)]
398#[repr(C)]
399pub struct __sigset_t {
400 pub __val: [libc::c_ulong; 16],
401}
402pub type sigset_t = __sigset_t;
403#[derive(Copy, Clone)]
404#[repr(C)]
405pub struct timeval {
406 pub tv_sec: __time_t,
407 pub tv_usec: __suseconds_t,
408}
409#[derive(Copy, Clone)]
410#[repr(C)]
411pub struct __pthread_internal_list {
412 pub __prev: *mut __pthread_internal_list,
413 pub __next: *mut __pthread_internal_list,
414}
415pub type __pthread_list_t = __pthread_internal_list;
416#[derive(Copy, Clone)]
417#[repr(C)]
418pub struct __pthread_mutex_s {
419 pub __lock: libc::c_int,
420 pub __count: libc::c_uint,
421 pub __owner: libc::c_int,
422 pub __nusers: libc::c_uint,
423 pub __kind: libc::c_int,
424 pub __spins: libc::c_int,
425 pub __list: __pthread_list_t,
426}
427pub type pthread_t = libc::c_ulong;
428#[derive(Copy, Clone)]
429#[repr(C)]
430pub union pthread_mutex_t {
431 pub __data: __pthread_mutex_s,
432 pub __size: [libc::c_char; 48],
433 pub __align: libc::c_long,
434}
435pub type va_list = __builtin_va_list;
436#[derive(Copy, Clone)]
437#[repr(C)]
438pub struct _IO_FILE {
439 pub _flags: libc::c_int,
440 pub _IO_read_ptr: *mut libc::c_char,
441 pub _IO_read_end: *mut libc::c_char,
442 pub _IO_read_base: *mut libc::c_char,
443 pub _IO_write_base: *mut libc::c_char,
444 pub _IO_write_ptr: *mut libc::c_char,
445 pub _IO_write_end: *mut libc::c_char,
446 pub _IO_buf_base: *mut libc::c_char,
447 pub _IO_buf_end: *mut libc::c_char,
448 pub _IO_save_base: *mut libc::c_char,
449 pub _IO_backup_base: *mut libc::c_char,
450 pub _IO_save_end: *mut libc::c_char,
451 pub _markers: *mut _IO_marker,
452 pub _chain: *mut _IO_FILE,
453 pub _fileno: libc::c_int,
454 pub _flags2: libc::c_int,
455 pub _old_offset: __off_t,
456 pub _cur_column: libc::c_ushort,
457 pub _vtable_offset: libc::c_schar,
458 pub _shortbuf: [libc::c_char; 1],
459 pub _lock: *mut libc::c_void,
460 pub _offset: __off64_t,
461 pub _codecvt: *mut _IO_codecvt,
462 pub _wide_data: *mut _IO_wide_data,
463 pub _freeres_list: *mut _IO_FILE,
464 pub _freeres_buf: *mut libc::c_void,
465 pub __pad5: size_t,
466 pub _mode: libc::c_int,
467 pub _unused2: [libc::c_char; 20],
468}
469pub type _IO_lock_t = ();
470pub type FILE = _IO_FILE;
471pub type uint8_t = __uint8_t;
472pub type uint16_t = __uint16_t;
473pub type uint32_t = __uint32_t;
474pub type uint64_t = __uint64_t;
475pub type uint_least64_t = __uint_least64_t;
476pub type sds = *mut libc::c_char;
477#[derive(Copy, Clone)]
478#[repr(C, packed)]
479pub struct sdshdr5 {
480 pub flags: libc::c_uchar,
481 pub buf: [libc::c_char; 0],
482}
483#[derive(Copy, Clone)]
484#[repr(C, packed)]
485pub struct sdshdr8 {
486 pub len: uint8_t,
487 pub alloc: uint8_t,
488 pub flags: libc::c_uchar,
489 pub buf: [libc::c_char; 0],
490}
491#[derive(Copy, Clone)]
492#[repr(C, packed)]
493pub struct sdshdr16 {
494 pub len: uint16_t,
495 pub alloc: uint16_t,
496 pub flags: libc::c_uchar,
497 pub buf: [libc::c_char; 0],
498}
499#[derive(Copy, Clone)]
500#[repr(C, packed)]
501pub struct sdshdr32 {
502 pub len: uint32_t,
503 pub alloc: uint32_t,
504 pub flags: libc::c_uchar,
505 pub buf: [libc::c_char; 0],
506}
507#[derive(Copy, Clone)]
508#[repr(C, packed)]
509pub struct sdshdr64 {
510 pub len: uint64_t,
511 pub alloc: uint64_t,
512 pub flags: libc::c_uchar,
513 pub buf: [libc::c_char; 0],
514}
515#[derive(Copy, Clone)]
516#[repr(C)]
517pub struct aeEventLoop {
518 pub maxfd: libc::c_int,
519 pub setsize: libc::c_int,
520 pub timeEventNextId: libc::c_longlong,
521 pub events: *mut aeFileEvent,
522 pub fired: *mut aeFiredEvent,
523 pub timeEventHead: *mut aeTimeEvent,
524 pub stop: libc::c_int,
525 pub apidata: *mut libc::c_void,
526 pub beforesleep: Option::<aeBeforeSleepProc>,
527 pub aftersleep: Option::<aeBeforeSleepProc>,
528 pub flags: libc::c_int,
529}
530pub type aeBeforeSleepProc = unsafe extern "C" fn(*mut aeEventLoop) -> ();
531#[derive(Copy, Clone)]
532#[repr(C)]
533pub struct aeTimeEvent {
534 pub id: libc::c_longlong,
535 pub when: monotime,
536 pub timeProc: Option::<aeTimeProc>,
537 pub finalizerProc: Option::<aeEventFinalizerProc>,
538 pub clientData: *mut libc::c_void,
539 pub prev: *mut aeTimeEvent,
540 pub next: *mut aeTimeEvent,
541 pub refcount: libc::c_int,
542}
543pub type aeEventFinalizerProc = unsafe extern "C" fn(
544 *mut aeEventLoop,
545 *mut libc::c_void,
546) -> ();
547pub type aeTimeProc = unsafe extern "C" fn(
548 *mut aeEventLoop,
549 libc::c_longlong,
550 *mut libc::c_void,
551) -> libc::c_int;
552pub type monotime = uint64_t;
553#[derive(Copy, Clone)]
554#[repr(C)]
555pub struct aeFiredEvent {
556 pub fd: libc::c_int,
557 pub mask: libc::c_int,
558}
559#[derive(Copy, Clone)]
560#[repr(C)]
561pub struct aeFileEvent {
562 pub mask: libc::c_int,
563 pub rfileProc: Option::<aeFileProc>,
564 pub wfileProc: Option::<aeFileProc>,
565 pub clientData: *mut libc::c_void,
566}
567pub type aeFileProc = unsafe extern "C" fn(
568 *mut aeEventLoop,
569 libc::c_int,
570 *mut libc::c_void,
571 libc::c_int,
572) -> ();
573#[derive(Copy, Clone)]
574#[repr(C)]
575pub struct connection {
576 pub type_0: *mut ConnectionType,
577 pub state: ConnectionState,
578 pub flags: libc::c_short,
579 pub refs: libc::c_short,
580 pub last_errno: libc::c_int,
581 pub private_data: *mut libc::c_void,
582 pub conn_handler: ConnectionCallbackFunc,
583 pub write_handler: ConnectionCallbackFunc,
584 pub read_handler: ConnectionCallbackFunc,
585 pub fd: libc::c_int,
586}
587pub type ConnectionCallbackFunc = Option::<unsafe extern "C" fn(*mut connection) -> ()>;
588pub type ConnectionState = libc::c_uint;
589pub const CONN_STATE_ERROR: ConnectionState = 5;
590pub const CONN_STATE_CLOSED: ConnectionState = 4;
591pub const CONN_STATE_CONNECTED: ConnectionState = 3;
592pub const CONN_STATE_ACCEPTING: ConnectionState = 2;
593pub const CONN_STATE_CONNECTING: ConnectionState = 1;
594pub const CONN_STATE_NONE: ConnectionState = 0;
595#[derive(Copy, Clone)]
596#[repr(C)]
597pub struct ConnectionType {
598 pub ae_handler: Option::<
599 unsafe extern "C" fn(
600 *mut aeEventLoop,
601 libc::c_int,
602 *mut libc::c_void,
603 libc::c_int,
604 ) -> (),
605 >,
606 pub connect: Option::<
607 unsafe extern "C" fn(
608 *mut connection,
609 *const libc::c_char,
610 libc::c_int,
611 *const libc::c_char,
612 ConnectionCallbackFunc,
613 ) -> libc::c_int,
614 >,
615 pub write: Option::<
616 unsafe extern "C" fn(*mut connection, *const libc::c_void, size_t) -> libc::c_int,
617 >,
618 pub writev: Option::<
619 unsafe extern "C" fn(*mut connection, *const iovec, libc::c_int) -> libc::c_int,
620 >,
621 pub read: Option::<
622 unsafe extern "C" fn(*mut connection, *mut libc::c_void, size_t) -> libc::c_int,
623 >,
624 pub close: Option::<unsafe extern "C" fn(*mut connection) -> ()>,
625 pub accept: Option::<
626 unsafe extern "C" fn(*mut connection, ConnectionCallbackFunc) -> libc::c_int,
627 >,
628 pub set_write_handler: Option::<
629 unsafe extern "C" fn(
630 *mut connection,
631 ConnectionCallbackFunc,
632 libc::c_int,
633 ) -> libc::c_int,
634 >,
635 pub set_read_handler: Option::<
636 unsafe extern "C" fn(*mut connection, ConnectionCallbackFunc) -> libc::c_int,
637 >,
638 pub get_last_error: Option::<
639 unsafe extern "C" fn(*mut connection) -> *const libc::c_char,
640 >,
641 pub blocking_connect: Option::<
642 unsafe extern "C" fn(
643 *mut connection,
644 *const libc::c_char,
645 libc::c_int,
646 libc::c_longlong,
647 ) -> libc::c_int,
648 >,
649 pub sync_write: Option::<
650 unsafe extern "C" fn(
651 *mut connection,
652 *mut libc::c_char,
653 ssize_t,
654 libc::c_longlong,
655 ) -> ssize_t,
656 >,
657 pub sync_read: Option::<
658 unsafe extern "C" fn(
659 *mut connection,
660 *mut libc::c_char,
661 ssize_t,
662 libc::c_longlong,
663 ) -> ssize_t,
664 >,
665 pub sync_readline: Option::<
666 unsafe extern "C" fn(
667 *mut connection,
668 *mut libc::c_char,
669 ssize_t,
670 libc::c_longlong,
671 ) -> ssize_t,
672 >,
673 pub get_type: Option::<unsafe extern "C" fn(*mut connection) -> libc::c_int>,
674}
675#[derive(Copy, Clone)]
676#[repr(C)]
677pub struct _rio {
678 pub read: Option::<
679 unsafe extern "C" fn(*mut _rio, *mut libc::c_void, size_t) -> size_t,
680 >,
681 pub write: Option::<
682 unsafe extern "C" fn(*mut _rio, *const libc::c_void, size_t) -> size_t,
683 >,
684 pub tell: Option::<unsafe extern "C" fn(*mut _rio) -> off_t>,
685 pub flush: Option::<unsafe extern "C" fn(*mut _rio) -> libc::c_int>,
686 pub update_cksum: Option::<
687 unsafe extern "C" fn(*mut _rio, *const libc::c_void, size_t) -> (),
688 >,
689 pub cksum: uint64_t,
690 pub flags: uint64_t,
691 pub processed_bytes: size_t,
692 pub max_processing_chunk: size_t,
693 pub io: C2RustUnnamed,
694}
695#[derive(Copy, Clone)]
696#[repr(C)]
697pub union C2RustUnnamed {
698 pub buffer: C2RustUnnamed_3,
699 pub file: C2RustUnnamed_2,
700 pub conn: C2RustUnnamed_1,
701 pub fd: C2RustUnnamed_0,
702}
703#[derive(Copy, Clone)]
704#[repr(C)]
705pub struct C2RustUnnamed_0 {
706 pub fd: libc::c_int,
707 pub pos: off_t,
708 pub buf: sds,
709}
710#[derive(Copy, Clone)]
711#[repr(C)]
712pub struct C2RustUnnamed_1 {
713 pub conn: *mut connection,
714 pub pos: off_t,
715 pub buf: sds,
716 pub read_limit: size_t,
717 pub read_so_far: size_t,
718}
719#[derive(Copy, Clone)]
720#[repr(C)]
721pub struct C2RustUnnamed_2 {
722 pub fp: *mut FILE,
723 pub buffered: off_t,
724 pub autosync: off_t,
725}
726#[derive(Copy, Clone)]
727#[repr(C)]
728pub struct C2RustUnnamed_3 {
729 pub ptr: sds,
730 pub pos: off_t,
731}
732pub type rio = _rio;
733#[derive(Copy, Clone,c2rust_bitfields::BitfieldStruct)]
734#[repr(C)]
735pub struct redisObject {
736 #[bitfield(name = "type_0", ty = "libc::c_uint", bits = "0..=3")]
737 #[bitfield(name = "encoding", ty = "libc::c_uint", bits = "4..=7")]
738 #[bitfield(name = "lru", ty = "libc::c_uint", bits = "8..=31")]
739 pub type_0_encoding_lru: [u8; 4],
740 pub refcount: libc::c_int,
741 pub ptr: *mut libc::c_void,
742}
743pub type __sigval_t = sigval;
744#[derive(Copy, Clone)]
745#[repr(C)]
746pub union sigval {
747 pub sival_int: libc::c_int,
748 pub sival_ptr: *mut libc::c_void,
749}
750pub type C2RustUnnamed_4 = libc::c_uint;
751pub const PTHREAD_MUTEX_FAST_NP: C2RustUnnamed_4 = 0;
752pub const PTHREAD_MUTEX_DEFAULT: C2RustUnnamed_4 = 0;
753pub const PTHREAD_MUTEX_ERRORCHECK: C2RustUnnamed_4 = 2;
754pub const PTHREAD_MUTEX_RECURSIVE: C2RustUnnamed_4 = 1;
755pub const PTHREAD_MUTEX_NORMAL: C2RustUnnamed_4 = 0;
756pub const PTHREAD_MUTEX_ADAPTIVE_NP: C2RustUnnamed_4 = 3;
757pub const PTHREAD_MUTEX_ERRORCHECK_NP: C2RustUnnamed_4 = 2;
758pub const PTHREAD_MUTEX_RECURSIVE_NP: C2RustUnnamed_4 = 1;
759pub const PTHREAD_MUTEX_TIMED_NP: C2RustUnnamed_4 = 0;
760pub type atomic_int = libc::c_int;
761pub type atomic_uint = libc::c_uint;
762pub type atomic_llong = libc::c_longlong;
763pub type C2RustUnnamed_5 = libc::c_uint;
764pub const _SC_THREAD_ROBUST_PRIO_PROTECT: C2RustUnnamed_5 = 248;
765pub const _SC_THREAD_ROBUST_PRIO_INHERIT: C2RustUnnamed_5 = 247;
766pub const _SC_XOPEN_STREAMS: C2RustUnnamed_5 = 246;
767pub const _SC_TRACE_USER_EVENT_MAX: C2RustUnnamed_5 = 245;
768pub const _SC_TRACE_SYS_MAX: C2RustUnnamed_5 = 244;
769pub const _SC_TRACE_NAME_MAX: C2RustUnnamed_5 = 243;
770pub const _SC_TRACE_EVENT_NAME_MAX: C2RustUnnamed_5 = 242;
771pub const _SC_SS_REPL_MAX: C2RustUnnamed_5 = 241;
772pub const _SC_V7_LPBIG_OFFBIG: C2RustUnnamed_5 = 240;
773pub const _SC_V7_LP64_OFF64: C2RustUnnamed_5 = 239;
774pub const _SC_V7_ILP32_OFFBIG: C2RustUnnamed_5 = 238;
775pub const _SC_V7_ILP32_OFF32: C2RustUnnamed_5 = 237;
776pub const _SC_RAW_SOCKETS: C2RustUnnamed_5 = 236;
777pub const _SC_IPV6: C2RustUnnamed_5 = 235;
778pub const _SC_LEVEL4_CACHE_LINESIZE: C2RustUnnamed_5 = 199;
779pub const _SC_LEVEL4_CACHE_ASSOC: C2RustUnnamed_5 = 198;
780pub const _SC_LEVEL4_CACHE_SIZE: C2RustUnnamed_5 = 197;
781pub const _SC_LEVEL3_CACHE_LINESIZE: C2RustUnnamed_5 = 196;
782pub const _SC_LEVEL3_CACHE_ASSOC: C2RustUnnamed_5 = 195;
783pub const _SC_LEVEL3_CACHE_SIZE: C2RustUnnamed_5 = 194;
784pub const _SC_LEVEL2_CACHE_LINESIZE: C2RustUnnamed_5 = 193;
785pub const _SC_LEVEL2_CACHE_ASSOC: C2RustUnnamed_5 = 192;
786pub const _SC_LEVEL2_CACHE_SIZE: C2RustUnnamed_5 = 191;
787pub const _SC_LEVEL1_DCACHE_LINESIZE: C2RustUnnamed_5 = 190;
788pub const _SC_LEVEL1_DCACHE_ASSOC: C2RustUnnamed_5 = 189;
789pub const _SC_LEVEL1_DCACHE_SIZE: C2RustUnnamed_5 = 188;
790pub const _SC_LEVEL1_ICACHE_LINESIZE: C2RustUnnamed_5 = 187;
791pub const _SC_LEVEL1_ICACHE_ASSOC: C2RustUnnamed_5 = 186;
792pub const _SC_LEVEL1_ICACHE_SIZE: C2RustUnnamed_5 = 185;
793pub const _SC_TRACE_LOG: C2RustUnnamed_5 = 184;
794pub const _SC_TRACE_INHERIT: C2RustUnnamed_5 = 183;
795pub const _SC_TRACE_EVENT_FILTER: C2RustUnnamed_5 = 182;
796pub const _SC_TRACE: C2RustUnnamed_5 = 181;
797pub const _SC_HOST_NAME_MAX: C2RustUnnamed_5 = 180;
798pub const _SC_V6_LPBIG_OFFBIG: C2RustUnnamed_5 = 179;
799pub const _SC_V6_LP64_OFF64: C2RustUnnamed_5 = 178;
800pub const _SC_V6_ILP32_OFFBIG: C2RustUnnamed_5 = 177;
801pub const _SC_V6_ILP32_OFF32: C2RustUnnamed_5 = 176;
802pub const _SC_2_PBS_CHECKPOINT: C2RustUnnamed_5 = 175;
803pub const _SC_STREAMS: C2RustUnnamed_5 = 174;
804pub const _SC_SYMLOOP_MAX: C2RustUnnamed_5 = 173;
805pub const _SC_2_PBS_TRACK: C2RustUnnamed_5 = 172;
806pub const _SC_2_PBS_MESSAGE: C2RustUnnamed_5 = 171;
807pub const _SC_2_PBS_LOCATE: C2RustUnnamed_5 = 170;
808pub const _SC_2_PBS_ACCOUNTING: C2RustUnnamed_5 = 169;
809pub const _SC_2_PBS: C2RustUnnamed_5 = 168;
810pub const _SC_USER_GROUPS_R: C2RustUnnamed_5 = 167;
811pub const _SC_USER_GROUPS: C2RustUnnamed_5 = 166;
812pub const _SC_TYPED_MEMORY_OBJECTS: C2RustUnnamed_5 = 165;
813pub const _SC_TIMEOUTS: C2RustUnnamed_5 = 164;
814pub const _SC_SYSTEM_DATABASE_R: C2RustUnnamed_5 = 163;
815pub const _SC_SYSTEM_DATABASE: C2RustUnnamed_5 = 162;
816pub const _SC_THREAD_SPORADIC_SERVER: C2RustUnnamed_5 = 161;
817pub const _SC_SPORADIC_SERVER: C2RustUnnamed_5 = 160;
818pub const _SC_SPAWN: C2RustUnnamed_5 = 159;
819pub const _SC_SIGNALS: C2RustUnnamed_5 = 158;
820pub const _SC_SHELL: C2RustUnnamed_5 = 157;
821pub const _SC_REGEX_VERSION: C2RustUnnamed_5 = 156;
822pub const _SC_REGEXP: C2RustUnnamed_5 = 155;
823pub const _SC_SPIN_LOCKS: C2RustUnnamed_5 = 154;
824pub const _SC_READER_WRITER_LOCKS: C2RustUnnamed_5 = 153;
825pub const _SC_NETWORKING: C2RustUnnamed_5 = 152;
826pub const _SC_SINGLE_PROCESS: C2RustUnnamed_5 = 151;
827pub const _SC_MULTI_PROCESS: C2RustUnnamed_5 = 150;
828pub const _SC_MONOTONIC_CLOCK: C2RustUnnamed_5 = 149;
829pub const _SC_FILE_SYSTEM: C2RustUnnamed_5 = 148;
830pub const _SC_FILE_LOCKING: C2RustUnnamed_5 = 147;
831pub const _SC_FILE_ATTRIBUTES: C2RustUnnamed_5 = 146;
832pub const _SC_PIPE: C2RustUnnamed_5 = 145;
833pub const _SC_FIFO: C2RustUnnamed_5 = 144;
834pub const _SC_FD_MGMT: C2RustUnnamed_5 = 143;
835pub const _SC_DEVICE_SPECIFIC_R: C2RustUnnamed_5 = 142;
836pub const _SC_DEVICE_SPECIFIC: C2RustUnnamed_5 = 141;
837pub const _SC_DEVICE_IO: C2RustUnnamed_5 = 140;
838pub const _SC_THREAD_CPUTIME: C2RustUnnamed_5 = 139;
839pub const _SC_CPUTIME: C2RustUnnamed_5 = 138;
840pub const _SC_CLOCK_SELECTION: C2RustUnnamed_5 = 137;
841pub const _SC_C_LANG_SUPPORT_R: C2RustUnnamed_5 = 136;
842pub const _SC_C_LANG_SUPPORT: C2RustUnnamed_5 = 135;
843pub const _SC_BASE: C2RustUnnamed_5 = 134;
844pub const _SC_BARRIERS: C2RustUnnamed_5 = 133;
845pub const _SC_ADVISORY_INFO: C2RustUnnamed_5 = 132;
846pub const _SC_XOPEN_REALTIME_THREADS: C2RustUnnamed_5 = 131;
847pub const _SC_XOPEN_REALTIME: C2RustUnnamed_5 = 130;
848pub const _SC_XOPEN_LEGACY: C2RustUnnamed_5 = 129;
849pub const _SC_XBS5_LPBIG_OFFBIG: C2RustUnnamed_5 = 128;
850pub const _SC_XBS5_LP64_OFF64: C2RustUnnamed_5 = 127;
851pub const _SC_XBS5_ILP32_OFFBIG: C2RustUnnamed_5 = 126;
852pub const _SC_XBS5_ILP32_OFF32: C2RustUnnamed_5 = 125;
853pub const _SC_NL_TEXTMAX: C2RustUnnamed_5 = 124;
854pub const _SC_NL_SETMAX: C2RustUnnamed_5 = 123;
855pub const _SC_NL_NMAX: C2RustUnnamed_5 = 122;
856pub const _SC_NL_MSGMAX: C2RustUnnamed_5 = 121;
857pub const _SC_NL_LANGMAX: C2RustUnnamed_5 = 120;
858pub const _SC_NL_ARGMAX: C2RustUnnamed_5 = 119;
859pub const _SC_USHRT_MAX: C2RustUnnamed_5 = 118;
860pub const _SC_ULONG_MAX: C2RustUnnamed_5 = 117;
861pub const _SC_UINT_MAX: C2RustUnnamed_5 = 116;
862pub const _SC_UCHAR_MAX: C2RustUnnamed_5 = 115;
863pub const _SC_SHRT_MIN: C2RustUnnamed_5 = 114;
864pub const _SC_SHRT_MAX: C2RustUnnamed_5 = 113;
865pub const _SC_SCHAR_MIN: C2RustUnnamed_5 = 112;
866pub const _SC_SCHAR_MAX: C2RustUnnamed_5 = 111;
867pub const _SC_SSIZE_MAX: C2RustUnnamed_5 = 110;
868pub const _SC_NZERO: C2RustUnnamed_5 = 109;
869pub const _SC_MB_LEN_MAX: C2RustUnnamed_5 = 108;
870pub const _SC_WORD_BIT: C2RustUnnamed_5 = 107;
871pub const _SC_LONG_BIT: C2RustUnnamed_5 = 106;
872pub const _SC_INT_MIN: C2RustUnnamed_5 = 105;
873pub const _SC_INT_MAX: C2RustUnnamed_5 = 104;
874pub const _SC_CHAR_MIN: C2RustUnnamed_5 = 103;
875pub const _SC_CHAR_MAX: C2RustUnnamed_5 = 102;
876pub const _SC_CHAR_BIT: C2RustUnnamed_5 = 101;
877pub const _SC_XOPEN_XPG4: C2RustUnnamed_5 = 100;
878pub const _SC_XOPEN_XPG3: C2RustUnnamed_5 = 99;
879pub const _SC_XOPEN_XPG2: C2RustUnnamed_5 = 98;
880pub const _SC_2_UPE: C2RustUnnamed_5 = 97;
881pub const _SC_2_C_VERSION: C2RustUnnamed_5 = 96;
882pub const _SC_2_CHAR_TERM: C2RustUnnamed_5 = 95;
883pub const _SC_XOPEN_SHM: C2RustUnnamed_5 = 94;
884pub const _SC_XOPEN_ENH_I18N: C2RustUnnamed_5 = 93;
885pub const _SC_XOPEN_CRYPT: C2RustUnnamed_5 = 92;
886pub const _SC_XOPEN_UNIX: C2RustUnnamed_5 = 91;
887pub const _SC_XOPEN_XCU_VERSION: C2RustUnnamed_5 = 90;
888pub const _SC_XOPEN_VERSION: C2RustUnnamed_5 = 89;
889pub const _SC_PASS_MAX: C2RustUnnamed_5 = 88;
890pub const _SC_ATEXIT_MAX: C2RustUnnamed_5 = 87;
891pub const _SC_AVPHYS_PAGES: C2RustUnnamed_5 = 86;
892pub const _SC_PHYS_PAGES: C2RustUnnamed_5 = 85;
893pub const _SC_NPROCESSORS_ONLN: C2RustUnnamed_5 = 84;
894pub const _SC_NPROCESSORS_CONF: C2RustUnnamed_5 = 83;
895pub const _SC_THREAD_PROCESS_SHARED: C2RustUnnamed_5 = 82;
896pub const _SC_THREAD_PRIO_PROTECT: C2RustUnnamed_5 = 81;
897pub const _SC_THREAD_PRIO_INHERIT: C2RustUnnamed_5 = 80;
898pub const _SC_THREAD_PRIORITY_SCHEDULING: C2RustUnnamed_5 = 79;
899pub const _SC_THREAD_ATTR_STACKSIZE: C2RustUnnamed_5 = 78;
900pub const _SC_THREAD_ATTR_STACKADDR: C2RustUnnamed_5 = 77;
901pub const _SC_THREAD_THREADS_MAX: C2RustUnnamed_5 = 76;
902pub const _SC_THREAD_STACK_MIN: C2RustUnnamed_5 = 75;
903pub const _SC_THREAD_KEYS_MAX: C2RustUnnamed_5 = 74;
904pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: C2RustUnnamed_5 = 73;
905pub const _SC_TTY_NAME_MAX: C2RustUnnamed_5 = 72;
906pub const _SC_LOGIN_NAME_MAX: C2RustUnnamed_5 = 71;
907pub const _SC_GETPW_R_SIZE_MAX: C2RustUnnamed_5 = 70;
908pub const _SC_GETGR_R_SIZE_MAX: C2RustUnnamed_5 = 69;
909pub const _SC_THREAD_SAFE_FUNCTIONS: C2RustUnnamed_5 = 68;
910pub const _SC_THREADS: C2RustUnnamed_5 = 67;
911pub const _SC_T_IOV_MAX: C2RustUnnamed_5 = 66;
912pub const _SC_PII_OSI_M: C2RustUnnamed_5 = 65;
913pub const _SC_PII_OSI_CLTS: C2RustUnnamed_5 = 64;
914pub const _SC_PII_OSI_COTS: C2RustUnnamed_5 = 63;
915pub const _SC_PII_INTERNET_DGRAM: C2RustUnnamed_5 = 62;
916pub const _SC_PII_INTERNET_STREAM: C2RustUnnamed_5 = 61;
917pub const _SC_IOV_MAX: C2RustUnnamed_5 = 60;
918pub const _SC_UIO_MAXIOV: C2RustUnnamed_5 = 60;
919pub const _SC_SELECT: C2RustUnnamed_5 = 59;
920pub const _SC_POLL: C2RustUnnamed_5 = 58;
921pub const _SC_PII_OSI: C2RustUnnamed_5 = 57;
922pub const _SC_PII_INTERNET: C2RustUnnamed_5 = 56;
923pub const _SC_PII_SOCKET: C2RustUnnamed_5 = 55;
924pub const _SC_PII_XTI: C2RustUnnamed_5 = 54;
925pub const _SC_PII: C2RustUnnamed_5 = 53;
926pub const _SC_2_LOCALEDEF: C2RustUnnamed_5 = 52;
927pub const _SC_2_SW_DEV: C2RustUnnamed_5 = 51;
928pub const _SC_2_FORT_RUN: C2RustUnnamed_5 = 50;
929pub const _SC_2_FORT_DEV: C2RustUnnamed_5 = 49;
930pub const _SC_2_C_DEV: C2RustUnnamed_5 = 48;
931pub const _SC_2_C_BIND: C2RustUnnamed_5 = 47;
932pub const _SC_2_VERSION: C2RustUnnamed_5 = 46;
933pub const _SC_CHARCLASS_NAME_MAX: C2RustUnnamed_5 = 45;
934pub const _SC_RE_DUP_MAX: C2RustUnnamed_5 = 44;
935pub const _SC_LINE_MAX: C2RustUnnamed_5 = 43;
936pub const _SC_EXPR_NEST_MAX: C2RustUnnamed_5 = 42;
937pub const _SC_EQUIV_CLASS_MAX: C2RustUnnamed_5 = 41;
938pub const _SC_COLL_WEIGHTS_MAX: C2RustUnnamed_5 = 40;
939pub const _SC_BC_STRING_MAX: C2RustUnnamed_5 = 39;
940pub const _SC_BC_SCALE_MAX: C2RustUnnamed_5 = 38;
941pub const _SC_BC_DIM_MAX: C2RustUnnamed_5 = 37;
942pub const _SC_BC_BASE_MAX: C2RustUnnamed_5 = 36;
943pub const _SC_TIMER_MAX: C2RustUnnamed_5 = 35;
944pub const _SC_SIGQUEUE_MAX: C2RustUnnamed_5 = 34;
945pub const _SC_SEM_VALUE_MAX: C2RustUnnamed_5 = 33;
946pub const _SC_SEM_NSEMS_MAX: C2RustUnnamed_5 = 32;
947pub const _SC_RTSIG_MAX: C2RustUnnamed_5 = 31;
948pub const _SC_PAGESIZE: C2RustUnnamed_5 = 30;
949pub const _SC_VERSION: C2RustUnnamed_5 = 29;
950pub const _SC_MQ_PRIO_MAX: C2RustUnnamed_5 = 28;
951pub const _SC_MQ_OPEN_MAX: C2RustUnnamed_5 = 27;
952pub const _SC_DELAYTIMER_MAX: C2RustUnnamed_5 = 26;
953pub const _SC_AIO_PRIO_DELTA_MAX: C2RustUnnamed_5 = 25;
954pub const _SC_AIO_MAX: C2RustUnnamed_5 = 24;
955pub const _SC_AIO_LISTIO_MAX: C2RustUnnamed_5 = 23;
956pub const _SC_SHARED_MEMORY_OBJECTS: C2RustUnnamed_5 = 22;
957pub const _SC_SEMAPHORES: C2RustUnnamed_5 = 21;
958pub const _SC_MESSAGE_PASSING: C2RustUnnamed_5 = 20;
959pub const _SC_MEMORY_PROTECTION: C2RustUnnamed_5 = 19;
960pub const _SC_MEMLOCK_RANGE: C2RustUnnamed_5 = 18;
961pub const _SC_MEMLOCK: C2RustUnnamed_5 = 17;
962pub const _SC_MAPPED_FILES: C2RustUnnamed_5 = 16;
963pub const _SC_FSYNC: C2RustUnnamed_5 = 15;
964pub const _SC_SYNCHRONIZED_IO: C2RustUnnamed_5 = 14;
965pub const _SC_PRIORITIZED_IO: C2RustUnnamed_5 = 13;
966pub const _SC_ASYNCHRONOUS_IO: C2RustUnnamed_5 = 12;
967pub const _SC_TIMERS: C2RustUnnamed_5 = 11;
968pub const _SC_PRIORITY_SCHEDULING: C2RustUnnamed_5 = 10;
969pub const _SC_REALTIME_SIGNALS: C2RustUnnamed_5 = 9;
970pub const _SC_SAVED_IDS: C2RustUnnamed_5 = 8;
971pub const _SC_JOB_CONTROL: C2RustUnnamed_5 = 7;
972pub const _SC_TZNAME_MAX: C2RustUnnamed_5 = 6;
973pub const _SC_STREAM_MAX: C2RustUnnamed_5 = 5;
974pub const _SC_OPEN_MAX: C2RustUnnamed_5 = 4;
975pub const _SC_NGROUPS_MAX: C2RustUnnamed_5 = 3;
976pub const _SC_CLK_TCK: C2RustUnnamed_5 = 2;
977pub const _SC_CHILD_MAX: C2RustUnnamed_5 = 1;
978pub const _SC_ARG_MAX: C2RustUnnamed_5 = 0;
979pub type sig_atomic_t = __sig_atomic_t;
980#[derive(Copy, Clone)]
981#[repr(C)]
982pub struct siginfo_t {
983 pub si_signo: libc::c_int,
984 pub si_errno: libc::c_int,
985 pub si_code: libc::c_int,
986 pub __pad0: libc::c_int,
987 pub _sifields: C2RustUnnamed_6,
988}
989#[derive(Copy, Clone)]
990#[repr(C)]
991pub union C2RustUnnamed_6 {
992 pub _pad: [libc::c_int; 28],
993 pub _kill: C2RustUnnamed_15,
994 pub _timer: C2RustUnnamed_14,
995 pub _rt: C2RustUnnamed_13,
996 pub _sigchld: C2RustUnnamed_12,
997 pub _sigfault: C2RustUnnamed_9,
998 pub _sigpoll: C2RustUnnamed_8,
999 pub _sigsys: C2RustUnnamed_7,
1000}
1001#[derive(Copy, Clone)]
1002#[repr(C)]
1003pub struct C2RustUnnamed_7 {
1004 pub _call_addr: *mut libc::c_void,
1005 pub _syscall: libc::c_int,
1006 pub _arch: libc::c_uint,
1007}
1008#[derive(Copy, Clone)]
1009#[repr(C)]
1010pub struct C2RustUnnamed_8 {
1011 pub si_band: libc::c_long,
1012 pub si_fd: libc::c_int,
1013}
1014#[derive(Copy, Clone)]
1015#[repr(C)]
1016pub struct C2RustUnnamed_9 {
1017 pub si_addr: *mut libc::c_void,
1018 pub si_addr_lsb: libc::c_short,
1019 pub _bounds: C2RustUnnamed_10,
1020}
1021#[derive(Copy, Clone)]
1022#[repr(C)]
1023pub union C2RustUnnamed_10 {
1024 pub _addr_bnd: C2RustUnnamed_11,
1025 pub _pkey: __uint32_t,
1026}
1027#[derive(Copy, Clone)]
1028#[repr(C)]
1029pub struct C2RustUnnamed_11 {
1030 pub _lower: *mut libc::c_void,
1031 pub _upper: *mut libc::c_void,
1032}
1033#[derive(Copy, Clone)]
1034#[repr(C)]
1035pub struct C2RustUnnamed_12 {
1036 pub si_pid: __pid_t,
1037 pub si_uid: __uid_t,
1038 pub si_status: libc::c_int,
1039 pub si_utime: __clock_t,
1040 pub si_stime: __clock_t,
1041}
1042#[derive(Copy, Clone)]
1043#[repr(C)]
1044pub struct C2RustUnnamed_13 {
1045 pub si_pid: __pid_t,
1046 pub si_uid: __uid_t,
1047 pub si_sigval: __sigval_t,
1048}
1049#[derive(Copy, Clone)]
1050#[repr(C)]
1051pub struct C2RustUnnamed_14 {
1052 pub si_tid: libc::c_int,
1053 pub si_overrun: libc::c_int,
1054 pub si_sigval: __sigval_t,
1055}
1056#[derive(Copy, Clone)]
1057#[repr(C)]
1058pub struct C2RustUnnamed_15 {
1059 pub si_pid: __pid_t,
1060 pub si_uid: __uid_t,
1061}
1062pub type C2RustUnnamed_16 = libc::c_int;
1063pub const SI_KERNEL: C2RustUnnamed_16 = 128;
1064pub const SI_USER: C2RustUnnamed_16 = 0;
1065pub const SI_QUEUE: C2RustUnnamed_16 = -1;
1066pub const SI_TIMER: C2RustUnnamed_16 = -2;
1067pub const SI_MESGQ: C2RustUnnamed_16 = -3;
1068pub const SI_ASYNCIO: C2RustUnnamed_16 = -4;
1069pub const SI_SIGIO: C2RustUnnamed_16 = -5;
1070pub const SI_TKILL: C2RustUnnamed_16 = -6;
1071pub const SI_DETHREAD: C2RustUnnamed_16 = -7;
1072pub const SI_ASYNCNL: C2RustUnnamed_16 = -60;
1073pub type __sighandler_t = Option::<unsafe extern "C" fn(libc::c_int) -> ()>;
1074#[derive(Copy, Clone)]
1075#[repr(C)]
1076pub struct sigaction {
1077 pub __sigaction_handler: C2RustUnnamed_17,
1078 pub sa_mask: __sigset_t,
1079 pub sa_flags: libc::c_int,
1080 pub sa_restorer: Option::<unsafe extern "C" fn() -> ()>,
1081}
1082#[derive(Copy, Clone)]
1083#[repr(C)]
1084pub union C2RustUnnamed_17 {
1085 pub sa_handler: __sighandler_t,
1086 pub sa_sigaction: Option::<
1087 unsafe extern "C" fn(libc::c_int, *mut siginfo_t, *mut libc::c_void) -> (),
1088 >,
1089}
1090#[derive(Copy, Clone)]
1091#[repr(C)]
1092pub struct stack_t {
1093 pub ss_sp: *mut libc::c_void,
1094 pub ss_flags: libc::c_int,
1095 pub ss_size: size_t,
1096}
1097pub type __itimer_which = libc::c_uint;
1098pub const ITIMER_PROF: __itimer_which = 2;
1099pub const ITIMER_VIRTUAL: __itimer_which = 1;
1100pub const ITIMER_REAL: __itimer_which = 0;
1101#[derive(Copy, Clone)]
1102#[repr(C)]
1103pub struct itimerval {
1104 pub it_interval: timeval,
1105 pub it_value: timeval,
1106}
1107pub type __itimer_which_t = __itimer_which;
1108#[derive(Copy, Clone)]
1109#[repr(C)]
1110pub struct mcontext_t {
1111 pub fault_address: libc::c_ulonglong,
1112 pub regs: [libc::c_ulonglong; 31],
1113 pub sp: libc::c_ulonglong,
1114 pub pc: libc::c_ulonglong,
1115 pub pstate: libc::c_ulonglong,
1116 pub __reserved: [libc::c_uchar; 4096],
1117}
1118#[derive(Copy, Clone)]
1119#[repr(C)]
1120pub struct ucontext_t {
1121 pub uc_flags: libc::c_ulong,
1122 pub uc_link: *mut ucontext_t,
1123 pub uc_stack: stack_t,
1124 pub uc_sigmask: sigset_t,
1125 pub uc_mcontext: mcontext_t,
1126}
1127#[derive(Copy, Clone)]
1128#[repr(C)]
1129pub struct hdr_histogram {
1130 pub lowest_discernible_value: int64_t,
1131 pub highest_trackable_value: int64_t,
1132 pub unit_magnitude: int32_t,
1133 pub significant_figures: int32_t,
1134 pub sub_bucket_half_count_magnitude: int32_t,
1135 pub sub_bucket_half_count: int32_t,
1136 pub sub_bucket_mask: int64_t,
1137 pub sub_bucket_count: int32_t,
1138 pub bucket_count: int32_t,
1139 pub min_value: int64_t,
1140 pub max_value: int64_t,
1141 pub normalizing_index_offset: int32_t,
1142 pub conversion_ratio: libc::c_double,
1143 pub counts_len: int32_t,
1144 pub total_count: int64_t,
1145 pub counts: *mut int64_t,
1146}
1147pub type mstime_t = libc::c_longlong;
1148pub type ustime_t = libc::c_longlong;
1149#[derive(Copy, Clone)]
1150#[repr(C)]
1151pub struct dictEntry {
1152 pub key: *mut libc::c_void,
1153 pub v: C2RustUnnamed_18,
1154 pub next: *mut dictEntry,
1155 pub metadata: [*mut libc::c_void; 0],
1156}
1157#[derive(Copy, Clone)]
1158#[repr(C)]
1159pub union C2RustUnnamed_18 {
1160 pub val: *mut libc::c_void,
1161 pub u64_0: uint64_t,
1162 pub s64: int64_t,
1163 pub d: libc::c_double,
1164}
1165#[derive(Copy, Clone)]
1166#[repr(C)]
1167pub struct dict {
1168 pub type_0: *mut dictType,
1169 pub ht_table: [*mut *mut dictEntry; 2],
1170 pub ht_used: [libc::c_ulong; 2],
1171 pub rehashidx: libc::c_long,
1172 pub pauserehash: int16_t,
1173 pub ht_size_exp: [libc::c_schar; 2],
1174}
1175#[derive(Copy, Clone)]
1176#[repr(C)]
1177pub struct dictType {
1178 pub hashFunction: Option::<unsafe extern "C" fn(*const libc::c_void) -> uint64_t>,
1179 pub keyDup: Option::<
1180 unsafe extern "C" fn(*mut dict, *const libc::c_void) -> *mut libc::c_void,
1181 >,
1182 pub valDup: Option::<
1183 unsafe extern "C" fn(*mut dict, *const libc::c_void) -> *mut libc::c_void,
1184 >,
1185 pub keyCompare: Option::<
1186 unsafe extern "C" fn(
1187 *mut dict,
1188 *const libc::c_void,
1189 *const libc::c_void,
1190 ) -> libc::c_int,
1191 >,
1192 pub keyDestructor: Option::<
1193 unsafe extern "C" fn(*mut dict, *mut libc::c_void) -> (),
1194 >,
1195 pub valDestructor: Option::<
1196 unsafe extern "C" fn(*mut dict, *mut libc::c_void) -> (),
1197 >,
1198 pub expandAllowed: Option::<
1199 unsafe extern "C" fn(size_t, libc::c_double) -> libc::c_int,
1200 >,
1201 pub dictEntryMetadataBytes: Option::<unsafe extern "C" fn(*mut dict) -> size_t>,
1202}
1203#[derive(Copy, Clone)]
1204#[repr(C)]
1205pub struct dictIterator {
1206 pub d: *mut dict,
1207 pub index: libc::c_long,
1208 pub table: libc::c_int,
1209 pub safe: libc::c_int,
1210 pub entry: *mut dictEntry,
1211 pub nextEntry: *mut dictEntry,
1212 pub fingerprint: libc::c_ulonglong,
1213}
1214#[derive(Copy, Clone)]
1215#[repr(C)]
1216pub struct listNode {
1217 pub prev: *mut listNode,
1218 pub next: *mut listNode,
1219 pub value: *mut libc::c_void,
1220}
1221#[derive(Copy, Clone)]
1222#[repr(C)]
1223pub struct list {
1224 pub head: *mut listNode,
1225 pub tail: *mut listNode,
1226 pub dup: Option::<unsafe extern "C" fn(*mut libc::c_void) -> *mut libc::c_void>,
1227 pub free: Option::<unsafe extern "C" fn(*mut libc::c_void) -> ()>,
1228 pub match_0: Option::<
1229 unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_void) -> libc::c_int,
1230 >,
1231 pub len: libc::c_ulong,
1232}
1233#[derive(Copy, Clone,c2rust_bitfields::BitfieldStruct)]
1234#[repr(C)]
1235pub struct quicklistNode {
1236 pub prev: *mut quicklistNode,
1237 pub next: *mut quicklistNode,
1238 pub entry: *mut libc::c_uchar,
1239 pub sz: size_t,
1240 #[bitfield(name = "count", ty = "libc::c_uint", bits = "0..=15")]
1241 #[bitfield(name = "encoding", ty = "libc::c_uint", bits = "16..=17")]
1242 #[bitfield(name = "container", ty = "libc::c_uint", bits = "18..=19")]
1243 #[bitfield(name = "recompress", ty = "libc::c_uint", bits = "20..=20")]
1244 #[bitfield(name = "attempted_compress", ty = "libc::c_uint", bits = "21..=21")]
1245 #[bitfield(name = "dont_compress", ty = "libc::c_uint", bits = "22..=22")]
1246 #[bitfield(name = "extra", ty = "libc::c_uint", bits = "23..=31")]
1247 pub count_encoding_container_recompress_attempted_compress_dont_compress_extra: [u8; 4],
1248 #[bitfield(padding)]
1249 pub c2rust_padding: [u8; 4],
1250}
1251#[derive(Copy, Clone)]
1252#[repr(C)]
1253pub struct quicklistBookmark {
1254 pub node: *mut quicklistNode,
1255 pub name: *mut libc::c_char,
1256}
1257#[derive(Copy, Clone,c2rust_bitfields::BitfieldStruct)]
1258#[repr(C)]
1259pub struct quicklist {
1260 pub head: *mut quicklistNode,
1261 pub tail: *mut quicklistNode,
1262 pub count: libc::c_ulong,
1263 pub len: libc::c_ulong,
1264 #[bitfield(name = "fill", ty = "libc::c_int", bits = "0..=15")]
1265 #[bitfield(name = "compress", ty = "libc::c_uint", bits = "16..=31")]
1266 #[bitfield(name = "bookmark_count", ty = "libc::c_uint", bits = "32..=35")]
1267 pub fill_compress_bookmark_count: [u8; 5],
1268 #[bitfield(padding)]
1269 pub c2rust_padding: [u8; 3],
1270 pub bookmarks: [quicklistBookmark; 0],
1271}
1272#[derive(Copy, Clone)]
1273#[repr(C)]
1274pub struct quicklistIter {
1275 pub quicklist: *mut quicklist,
1276 pub current: *mut quicklistNode,
1277 pub zi: *mut libc::c_uchar,
1278 pub offset: libc::c_long,
1279 pub direction: libc::c_int,
1280}
1281#[derive(Copy, Clone)]
1282#[repr(C)]
1283pub struct quicklistEntry {
1284 pub quicklist: *const quicklist,
1285 pub node: *mut quicklistNode,
1286 pub zi: *mut libc::c_uchar,
1287 pub value: *mut libc::c_uchar,
1288 pub longval: libc::c_longlong,
1289 pub sz: size_t,
1290 pub offset: libc::c_int,
1291}
1292#[derive(Copy, Clone,c2rust_bitfields::BitfieldStruct)]
1293#[repr(C)]
1294pub struct raxNode {
1295 #[bitfield(name = "iskey", ty = "uint32_t", bits = "0..=0")]
1296 #[bitfield(name = "isnull", ty = "uint32_t", bits = "1..=1")]
1297 #[bitfield(name = "iscompr", ty = "uint32_t", bits = "2..=2")]
1298 #[bitfield(name = "size", ty = "uint32_t", bits = "3..=31")]
1299 pub iskey_isnull_iscompr_size: [u8; 4],
1300 pub data: [libc::c_uchar; 0],
1301}
1302#[derive(Copy, Clone)]
1303#[repr(C)]
1304pub struct rax {
1305 pub head: *mut raxNode,
1306 pub numele: uint64_t,
1307 pub numnodes: uint64_t,
1308}
1309#[derive(Copy, Clone)]
1310#[repr(C)]
1311pub struct raxStack {
1312 pub stack: *mut *mut libc::c_void,
1313 pub items: size_t,
1314 pub maxitems: size_t,
1315 pub static_items: [*mut libc::c_void; 32],
1316 pub oom: libc::c_int,
1317}
1318pub type raxNodeCallback = Option::<
1319 unsafe extern "C" fn(*mut *mut raxNode) -> libc::c_int,
1320>;
1321#[derive(Copy, Clone)]
1322#[repr(C)]
1323pub struct raxIterator {
1324 pub flags: libc::c_int,
1325 pub rt: *mut rax,
1326 pub key: *mut libc::c_uchar,
1327 pub data: *mut libc::c_void,
1328 pub key_len: size_t,
1329 pub key_max: size_t,
1330 pub key_static_string: [libc::c_uchar; 128],
1331 pub node: *mut raxNode,
1332 pub stack: raxStack,
1333 pub node_cb: raxNodeCallback,
1334}
1335#[derive(Copy, Clone)]
1336#[repr(C)]
1337pub struct SHA1_CTX {
1338 pub state: [uint32_t; 5],
1339 pub count: [uint32_t; 2],
1340 pub buffer: [libc::c_uchar; 64],
1341}
1342pub type pause_type = libc::c_uint;
1343pub const CLIENT_PAUSE_ALL: pause_type = 2;
1344pub const CLIENT_PAUSE_WRITE: pause_type = 1;
1345pub const CLIENT_PAUSE_OFF: pause_type = 0;
1346#[derive(Copy, Clone)]
1347#[repr(C)]
1348pub struct pause_event {
1349 pub type_0: pause_type,
1350 pub end: mstime_t,
1351}
1352#[derive(Copy, Clone)]
1353#[repr(C)]
1354pub struct RedisModule {
1355 pub handle: *mut libc::c_void,
1356 pub name: *mut libc::c_char,
1357 pub ver: libc::c_int,
1358 pub apiver: libc::c_int,
1359 pub types: *mut list,
1360 pub usedby: *mut list,
1361 pub using: *mut list,
1362 pub filters: *mut list,
1363 pub module_configs: *mut list,
1364 pub configs_initialized: libc::c_int,
1365 pub in_call: libc::c_int,
1366 pub in_hook: libc::c_int,
1367 pub options: libc::c_int,
1368 pub blocked_clients: libc::c_int,
1369 pub info_cb: RedisModuleInfoFunc,
1370 pub defrag_cb: RedisModuleDefragFunc,
1371 pub loadmod: *mut moduleLoadQueueEntry,
1372}
1373#[derive(Copy, Clone)]
1374#[repr(C)]
1375pub struct moduleLoadQueueEntry {
1376 pub path: sds,
1377 pub argc: libc::c_int,
1378 pub argv: *mut *mut robj,
1379}
1380pub type robj = redisObject;
1381pub type RedisModuleDefragFunc = Option::<
1382 unsafe extern "C" fn(*mut RedisModuleDefragCtx) -> (),
1383>;
1384pub type RedisModuleInfoFunc = Option::<
1385 unsafe extern "C" fn(*mut RedisModuleInfoCtx, libc::c_int) -> (),
1386>;
1387#[derive(Copy, Clone)]
1388#[repr(C)]
1389pub struct RedisModuleIO {
1390 pub bytes: size_t,
1391 pub rio: *mut rio,
1392 pub type_0: *mut moduleType,
1393 pub error: libc::c_int,
1394 pub ver: libc::c_int,
1395 pub ctx: *mut RedisModuleCtx,
1396 pub key: *mut redisObject,
1397 pub dbid: libc::c_int,
1398}
1399pub type moduleType = RedisModuleType;
1400#[derive(Copy, Clone)]
1401#[repr(C)]
1402pub struct RedisModuleType {
1403 pub id: uint64_t,
1404 pub module: *mut RedisModule,
1405 pub rdb_load: moduleTypeLoadFunc,
1406 pub rdb_save: moduleTypeSaveFunc,
1407 pub aof_rewrite: moduleTypeRewriteFunc,
1408 pub mem_usage: moduleTypeMemUsageFunc,
1409 pub digest: moduleTypeDigestFunc,
1410 pub free: moduleTypeFreeFunc,
1411 pub free_effort: moduleTypeFreeEffortFunc,
1412 pub unlink: moduleTypeUnlinkFunc,
1413 pub copy: moduleTypeCopyFunc,
1414 pub defrag: moduleTypeDefragFunc,
1415 pub aux_load: moduleTypeAuxLoadFunc,
1416 pub aux_save: moduleTypeAuxSaveFunc,
1417 pub mem_usage2: moduleTypeMemUsageFunc2,
1418 pub free_effort2: moduleTypeFreeEffortFunc2,
1419 pub unlink2: moduleTypeUnlinkFunc2,
1420 pub copy2: moduleTypeCopyFunc2,
1421 pub aux_save_triggers: libc::c_int,
1422 pub name: [libc::c_char; 10],
1423}
1424pub type moduleTypeCopyFunc2 = Option::<
1425 unsafe extern "C" fn(
1426 *mut RedisModuleKeyOptCtx,
1427 *const libc::c_void,
1428 ) -> *mut libc::c_void,
1429>;
1430pub type moduleTypeUnlinkFunc2 = Option::<
1431 unsafe extern "C" fn(*mut RedisModuleKeyOptCtx, *mut libc::c_void) -> (),
1432>;
1433pub type moduleTypeFreeEffortFunc2 = Option::<
1434 unsafe extern "C" fn(*mut RedisModuleKeyOptCtx, *const libc::c_void) -> size_t,
1435>;
1436pub type moduleTypeMemUsageFunc2 = Option::<
1437 unsafe extern "C" fn(
1438 *mut RedisModuleKeyOptCtx,
1439 *const libc::c_void,
1440 size_t,
1441 ) -> size_t,
1442>;
1443pub type moduleTypeAuxSaveFunc = Option::<
1444 unsafe extern "C" fn(*mut RedisModuleIO, libc::c_int) -> (),
1445>;
1446pub type moduleTypeAuxLoadFunc = Option::<
1447 unsafe extern "C" fn(*mut RedisModuleIO, libc::c_int, libc::c_int) -> libc::c_int,
1448>;
1449pub type moduleTypeDefragFunc = Option::<
1450 unsafe extern "C" fn(
1451 *mut RedisModuleDefragCtx,
1452 *mut redisObject,
1453 *mut *mut libc::c_void,
1454 ) -> libc::c_int,
1455>;
1456pub type moduleTypeCopyFunc = Option::<
1457 unsafe extern "C" fn(
1458 *mut redisObject,
1459 *mut redisObject,
1460 *const libc::c_void,
1461 ) -> *mut libc::c_void,
1462>;
1463pub type moduleTypeUnlinkFunc = Option::<
1464 unsafe extern "C" fn(*mut redisObject, *mut libc::c_void) -> (),
1465>;
1466pub type moduleTypeFreeEffortFunc = Option::<
1467 unsafe extern "C" fn(*mut redisObject, *const libc::c_void) -> size_t,
1468>;
1469pub type moduleTypeFreeFunc = Option::<unsafe extern "C" fn(*mut libc::c_void) -> ()>;
1470pub type moduleTypeDigestFunc = Option::<
1471 unsafe extern "C" fn(*mut RedisModuleDigest, *mut libc::c_void) -> (),
1472>;
1473#[derive(Copy, Clone)]
1474#[repr(C)]
1475pub struct RedisModuleDigest {
1476 pub o: [libc::c_uchar; 20],
1477 pub x: [libc::c_uchar; 20],
1478 pub key: *mut redisObject,
1479 pub dbid: libc::c_int,
1480}
1481pub type moduleTypeMemUsageFunc = Option::<
1482 unsafe extern "C" fn(*const libc::c_void) -> size_t,
1483>;
1484pub type moduleTypeRewriteFunc = Option::<
1485 unsafe extern "C" fn(*mut RedisModuleIO, *mut redisObject, *mut libc::c_void) -> (),
1486>;
1487pub type moduleTypeSaveFunc = Option::<
1488 unsafe extern "C" fn(*mut RedisModuleIO, *mut libc::c_void) -> (),
1489>;
1490pub type moduleTypeLoadFunc = Option::<
1491 unsafe extern "C" fn(*mut RedisModuleIO, libc::c_int) -> *mut libc::c_void,
1492>;
1493pub type RedisModuleUserChangedFunc = Option::<
1494 unsafe extern "C" fn(uint64_t, *mut libc::c_void) -> (),
1495>;
1496#[derive(Copy, Clone)]
1497#[repr(C)]
1498pub struct moduleValue {
1499 pub type_0: *mut moduleType,
1500 pub value: *mut libc::c_void,
1501}
1502#[derive(Copy, Clone)]
1503#[repr(C)]
1504pub struct redisDb {
1505 pub dict: *mut dict,
1506 pub expires: *mut dict,
1507 pub blocking_keys: *mut dict,
1508 pub ready_keys: *mut dict,
1509 pub watched_keys: *mut dict,
1510 pub id: libc::c_int,
1511 pub avg_ttl: libc::c_longlong,
1512 pub expires_cursor: libc::c_ulong,
1513 pub defrag_later: *mut list,
1514 pub slots_to_keys: *mut clusterSlotToKeyMapping,
1515}
1516#[derive(Copy, Clone)]
1517#[repr(C)]
1518pub struct multiCmd {
1519 pub argv: *mut *mut robj,
1520 pub argv_len: libc::c_int,
1521 pub argc: libc::c_int,
1522 pub cmd: *mut redisCommand,
1523}
1524#[derive(Copy, Clone)]
1525#[repr(C)]
1526pub struct redisCommand {
1527 pub declared_name: *const libc::c_char,
1528 pub summary: *const libc::c_char,
1529 pub complexity: *const libc::c_char,
1530 pub since: *const libc::c_char,
1531 pub doc_flags: libc::c_int,
1532 pub replaced_by: *const libc::c_char,
1533 pub deprecated_since: *const libc::c_char,
1534 pub group: redisCommandGroup,
1535 pub history: *mut commandHistory,
1536 pub tips: *mut *const libc::c_char,
1537 pub proc_0: Option::<redisCommandProc>,
1538 pub arity: libc::c_int,
1539 pub flags: uint64_t,
1540 pub acl_categories: uint64_t,
1541 pub key_specs_static: [keySpec; 4],
1542 pub getkeys_proc: Option::<redisGetKeysProc>,
1543 pub subcommands: *mut redisCommand,
1544 pub args: *mut redisCommandArg,
1545 pub microseconds: libc::c_longlong,
1546 pub calls: libc::c_longlong,
1547 pub rejected_calls: libc::c_longlong,
1548 pub failed_calls: libc::c_longlong,
1549 pub id: libc::c_int,
1550 pub fullname: sds,
1551 pub latency_histogram: *mut hdr_histogram,
1552 pub key_specs: *mut keySpec,
1553 pub legacy_range_key_spec: keySpec,
1554 pub num_args: libc::c_int,
1555 pub num_history: libc::c_int,
1556 pub num_tips: libc::c_int,
1557 pub key_specs_num: libc::c_int,
1558 pub key_specs_max: libc::c_int,
1559 pub subcommands_dict: *mut dict,
1560 pub parent: *mut redisCommand,
1561 pub module_cmd: *mut RedisModuleCommand,
1562}
1563#[derive(Copy, Clone)]
1564#[repr(C)]
1565pub struct keySpec {
1566 pub notes: *const libc::c_char,
1567 pub flags: uint64_t,
1568 pub begin_search_type: kspec_bs_type,
1569 pub bs: C2RustUnnamed_22,
1570 pub find_keys_type: kspec_fk_type,
1571 pub fk: C2RustUnnamed_19,
1572}
1573#[derive(Copy, Clone)]
1574#[repr(C)]
1575pub union C2RustUnnamed_19 {
1576 pub range: C2RustUnnamed_21,
1577 pub keynum: C2RustUnnamed_20,
1578}
1579#[derive(Copy, Clone)]
1580#[repr(C)]
1581pub struct C2RustUnnamed_20 {
1582 pub keynumidx: libc::c_int,
1583 pub firstkey: libc::c_int,
1584 pub keystep: libc::c_int,
1585}
1586#[derive(Copy, Clone)]
1587#[repr(C)]
1588pub struct C2RustUnnamed_21 {
1589 pub lastkey: libc::c_int,
1590 pub keystep: libc::c_int,
1591 pub limit: libc::c_int,
1592}
1593pub type kspec_fk_type = libc::c_uint;
1594pub const KSPEC_FK_KEYNUM: kspec_fk_type = 3;
1595pub const KSPEC_FK_RANGE: kspec_fk_type = 2;
1596pub const KSPEC_FK_UNKNOWN: kspec_fk_type = 1;
1597pub const KSPEC_FK_INVALID: kspec_fk_type = 0;
1598#[derive(Copy, Clone)]
1599#[repr(C)]
1600pub union C2RustUnnamed_22 {
1601 pub index: C2RustUnnamed_24,
1602 pub keyword: C2RustUnnamed_23,
1603}
1604#[derive(Copy, Clone)]
1605#[repr(C)]
1606pub struct C2RustUnnamed_23 {
1607 pub keyword: *const libc::c_char,
1608 pub startfrom: libc::c_int,
1609}
1610#[derive(Copy, Clone)]
1611#[repr(C)]
1612pub struct C2RustUnnamed_24 {
1613 pub pos: libc::c_int,
1614}
1615pub type kspec_bs_type = libc::c_uint;
1616pub const KSPEC_BS_KEYWORD: kspec_bs_type = 3;
1617pub const KSPEC_BS_INDEX: kspec_bs_type = 2;
1618pub const KSPEC_BS_UNKNOWN: kspec_bs_type = 1;
1619pub const KSPEC_BS_INVALID: kspec_bs_type = 0;
1620#[derive(Copy, Clone)]
1621#[repr(C)]
1622pub struct redisCommandArg {
1623 pub name: *const libc::c_char,
1624 pub type_0: redisCommandArgType,
1625 pub key_spec_index: libc::c_int,
1626 pub token: *const libc::c_char,
1627 pub summary: *const libc::c_char,
1628 pub since: *const libc::c_char,
1629 pub flags: libc::c_int,
1630 pub deprecated_since: *const libc::c_char,
1631 pub subargs: *mut redisCommandArg,
1632 pub num_args: libc::c_int,
1633}
1634pub type redisCommandArgType = libc::c_uint;
1635pub const ARG_TYPE_BLOCK: redisCommandArgType = 8;
1636pub const ARG_TYPE_ONEOF: redisCommandArgType = 7;
1637pub const ARG_TYPE_PURE_TOKEN: redisCommandArgType = 6;
1638pub const ARG_TYPE_UNIX_TIME: redisCommandArgType = 5;
1639pub const ARG_TYPE_PATTERN: redisCommandArgType = 4;
1640pub const ARG_TYPE_KEY: redisCommandArgType = 3;
1641pub const ARG_TYPE_DOUBLE: redisCommandArgType = 2;
1642pub const ARG_TYPE_INTEGER: redisCommandArgType = 1;
1643pub const ARG_TYPE_STRING: redisCommandArgType = 0;
1644pub type redisGetKeysProc = unsafe extern "C" fn(
1645 *mut redisCommand,
1646 *mut *mut robj,
1647 libc::c_int,
1648 *mut getKeysResult,
1649) -> libc::c_int;
1650#[derive(Copy, Clone)]
1651#[repr(C)]
1652pub struct getKeysResult {
1653 pub keysbuf: [keyReference; 256],
1654 pub keys: *mut keyReference,
1655 pub numkeys: libc::c_int,
1656 pub size: libc::c_int,
1657}
1658#[derive(Copy, Clone)]
1659#[repr(C)]
1660pub struct keyReference {
1661 pub pos: libc::c_int,
1662 pub flags: libc::c_int,
1663}
1664pub type redisCommandProc = unsafe extern "C" fn(*mut client) -> ();
1665#[derive(Copy, Clone)]
1666#[repr(C)]
1667pub struct client {
1668 pub id: uint64_t,
1669 pub flags: uint64_t,
1670 pub conn: *mut connection,
1671 pub resp: libc::c_int,
1672 pub db: *mut redisDb,
1673 pub name: *mut robj,
1674 pub querybuf: sds,
1675 pub qb_pos: size_t,
1676 pub querybuf_peak: size_t,
1677 pub argc: libc::c_int,
1678 pub argv: *mut *mut robj,
1679 pub argv_len: libc::c_int,
1680 pub original_argc: libc::c_int,
1681 pub original_argv: *mut *mut robj,
1682 pub argv_len_sum: size_t,
1683 pub cmd: *mut redisCommand,
1684 pub lastcmd: *mut redisCommand,
1685 pub realcmd: *mut redisCommand,
1686 pub user: *mut user,
1687 pub reqtype: libc::c_int,
1688 pub multibulklen: libc::c_int,
1689 pub bulklen: libc::c_long,
1690 pub reply: *mut list,
1691 pub reply_bytes: libc::c_ulonglong,
1692 pub deferred_reply_errors: *mut list,
1693 pub sentlen: size_t,
1694 pub ctime: time_t,
1695 pub duration: libc::c_long,
1696 pub slot: libc::c_int,
1697 pub cur_script: *mut dictEntry,
1698 pub lastinteraction: time_t,
1699 pub obuf_soft_limit_reached_time: time_t,
1700 pub authenticated: libc::c_int,
1701 pub replstate: libc::c_int,
1702 pub repl_start_cmd_stream_on_ack: libc::c_int,
1703 pub repldbfd: libc::c_int,
1704 pub repldboff: off_t,
1705 pub repldbsize: off_t,
1706 pub replpreamble: sds,
1707 pub read_reploff: libc::c_longlong,
1708 pub reploff: libc::c_longlong,
1709 pub repl_applied: libc::c_longlong,
1710 pub repl_ack_off: libc::c_longlong,
1711 pub repl_ack_time: libc::c_longlong,
1712 pub repl_last_partial_write: libc::c_longlong,
1713 pub psync_initial_offset: libc::c_longlong,
1714 pub replid: [libc::c_char; 41],
1715 pub slave_listening_port: libc::c_int,
1716 pub slave_addr: *mut libc::c_char,
1717 pub slave_capa: libc::c_int,
1718 pub slave_req: libc::c_int,
1719 pub mstate: multiState,
1720 pub btype: libc::c_int,
1721 pub bpop: blockingState,
1722 pub woff: libc::c_longlong,
1723 pub watched_keys: *mut list,
1724 pub pubsub_channels: *mut dict,
1725 pub pubsub_patterns: *mut list,
1726 pub pubsubshard_channels: *mut dict,
1727 pub peerid: sds,
1728 pub sockname: sds,
1729 pub client_list_node: *mut listNode,
1730 pub postponed_list_node: *mut listNode,
1731 pub pending_read_list_node: *mut listNode,
1732 pub auth_callback: RedisModuleUserChangedFunc,
1733 pub auth_callback_privdata: *mut libc::c_void,
1734 pub auth_module: *mut libc::c_void,
1735 pub client_tracking_redirection: uint64_t,
1736 pub client_tracking_prefixes: *mut rax,
1737 pub last_memory_usage: size_t,
1738 pub last_memory_type: libc::c_int,
1739 pub mem_usage_bucket_node: *mut listNode,
1740 pub mem_usage_bucket: *mut clientMemUsageBucket,
1741 pub ref_repl_buf_node: *mut listNode,
1742 pub ref_block_pos: size_t,
1743 pub buf_peak: size_t,
1744 pub buf_peak_last_reset_time: mstime_t,
1745 pub bufpos: libc::c_int,
1746 pub buf_usable_size: size_t,
1747 pub buf: *mut libc::c_char,
1748}
1749#[derive(Copy, Clone)]
1750#[repr(C)]
1751pub struct clientMemUsageBucket {
1752 pub clients: *mut list,
1753 pub mem_usage_sum: size_t,
1754}
1755#[derive(Copy, Clone)]
1756#[repr(C)]
1757pub struct blockingState {
1758 pub count: libc::c_long,
1759 pub timeout: mstime_t,
1760 pub keys: *mut dict,
1761 pub target: *mut robj,
1762 pub blockpos: blockPos,
1763 pub xread_count: size_t,
1764 pub xread_group: *mut robj,
1765 pub xread_consumer: *mut robj,
1766 pub xread_group_noack: libc::c_int,
1767 pub numreplicas: libc::c_int,
1768 pub reploffset: libc::c_longlong,
1769 pub module_blocked_handle: *mut libc::c_void,
1770}
1771#[derive(Copy, Clone)]
1772#[repr(C)]
1773pub struct blockPos {
1774 pub wherefrom: libc::c_int,
1775 pub whereto: libc::c_int,
1776}
1777#[derive(Copy, Clone)]
1778#[repr(C)]
1779pub struct multiState {
1780 pub commands: *mut multiCmd,
1781 pub count: libc::c_int,
1782 pub cmd_flags: libc::c_int,
1783 pub cmd_inv_flags: libc::c_int,
1784 pub argv_len_sums: size_t,
1785 pub alloc_count: libc::c_int,
1786}
1787#[derive(Copy, Clone)]
1788#[repr(C)]
1789pub struct user {
1790 pub name: sds,
1791 pub flags: uint32_t,
1792 pub passwords: *mut list,
1793 pub selectors: *mut list,
1794 pub acl_string: *mut robj,
1795}
1796#[derive(Copy, Clone)]
1797#[repr(C)]
1798pub struct commandHistory {
1799 pub since: *const libc::c_char,
1800 pub changes: *const libc::c_char,
1801}
1802pub type redisCommandGroup = libc::c_uint;
1803pub const COMMAND_GROUP_MODULE: redisCommandGroup = 17;
1804pub const COMMAND_GROUP_BITMAP: redisCommandGroup = 16;
1805pub const COMMAND_GROUP_STREAM: redisCommandGroup = 15;
1806pub const COMMAND_GROUP_GEO: redisCommandGroup = 14;
1807pub const COMMAND_GROUP_SENTINEL: redisCommandGroup = 13;
1808pub const COMMAND_GROUP_CLUSTER: redisCommandGroup = 12;
1809pub const COMMAND_GROUP_HYPERLOGLOG: redisCommandGroup = 11;
1810pub const COMMAND_GROUP_SCRIPTING: redisCommandGroup = 10;
1811pub const COMMAND_GROUP_SERVER: redisCommandGroup = 9;
1812pub const COMMAND_GROUP_CONNECTION: redisCommandGroup = 8;
1813pub const COMMAND_GROUP_TRANSACTIONS: redisCommandGroup = 7;
1814pub const COMMAND_GROUP_PUBSUB: redisCommandGroup = 6;
1815pub const COMMAND_GROUP_HASH: redisCommandGroup = 5;
1816pub const COMMAND_GROUP_SORTED_SET: redisCommandGroup = 4;
1817pub const COMMAND_GROUP_SET: redisCommandGroup = 3;
1818pub const COMMAND_GROUP_LIST: redisCommandGroup = 2;
1819pub const COMMAND_GROUP_STRING: redisCommandGroup = 1;
1820pub const COMMAND_GROUP_GENERIC: redisCommandGroup = 0;
1821#[derive(Copy, Clone)]
1822#[repr(C)]
1823pub struct replBacklog {
1824 pub ref_repl_buf_node: *mut listNode,
1825 pub unindexed_count: size_t,
1826 pub blocks_index: *mut rax,
1827 pub histlen: libc::c_longlong,
1828 pub offset: libc::c_longlong,
1829}
1830#[derive(Copy, Clone)]
1831#[repr(C)]
1832pub struct saveparam {
1833 pub seconds: time_t,
1834 pub changes: libc::c_int,
1835}
1836#[derive(Copy, Clone)]
1837#[repr(C)]
1838pub struct sentinelConfig {
1839 pub pre_monitor_cfg: *mut list,
1840 pub monitor_cfg: *mut list,
1841 pub post_monitor_cfg: *mut list,
1842}
1843#[derive(Copy, Clone)]
1844#[repr(C)]
1845pub struct sharedObjectsStruct {
1846 pub crlf: *mut robj,
1847 pub ok: *mut robj,
1848 pub err: *mut robj,
1849 pub emptybulk: *mut robj,
1850 pub czero: *mut robj,
1851 pub cone: *mut robj,
1852 pub pong: *mut robj,
1853 pub space: *mut robj,
1854 pub queued: *mut robj,
1855 pub null: [*mut robj; 4],
1856 pub nullarray: [*mut robj; 4],
1857 pub emptymap: [*mut robj; 4],
1858 pub emptyset: [*mut robj; 4],
1859 pub emptyarray: *mut robj,
1860 pub wrongtypeerr: *mut robj,
1861 pub nokeyerr: *mut robj,
1862 pub syntaxerr: *mut robj,
1863 pub sameobjecterr: *mut robj,
1864 pub outofrangeerr: *mut robj,
1865 pub noscripterr: *mut robj,
1866 pub loadingerr: *mut robj,
1867 pub slowevalerr: *mut robj,
1868 pub slowscripterr: *mut robj,
1869 pub slowmoduleerr: *mut robj,
1870 pub bgsaveerr: *mut robj,
1871 pub masterdownerr: *mut robj,
1872 pub roslaveerr: *mut robj,
1873 pub execaborterr: *mut robj,
1874 pub noautherr: *mut robj,
1875 pub noreplicaserr: *mut robj,
1876 pub busykeyerr: *mut robj,
1877 pub oomerr: *mut robj,
1878 pub plus: *mut robj,
1879 pub messagebulk: *mut robj,
1880 pub pmessagebulk: *mut robj,
1881 pub subscribebulk: *mut robj,
1882 pub unsubscribebulk: *mut robj,
1883 pub psubscribebulk: *mut robj,
1884 pub punsubscribebulk: *mut robj,
1885 pub del: *mut robj,
1886 pub unlink: *mut robj,
1887 pub rpop: *mut robj,
1888 pub lpop: *mut robj,
1889 pub lpush: *mut robj,
1890 pub rpoplpush: *mut robj,
1891 pub lmove: *mut robj,
1892 pub blmove: *mut robj,
1893 pub zpopmin: *mut robj,
1894 pub zpopmax: *mut robj,
1895 pub emptyscan: *mut robj,
1896 pub multi: *mut robj,
1897 pub exec: *mut robj,
1898 pub left: *mut robj,
1899 pub right: *mut robj,
1900 pub hset: *mut robj,
1901 pub srem: *mut robj,
1902 pub xgroup: *mut robj,
1903 pub xclaim: *mut robj,
1904 pub script: *mut robj,
1905 pub replconf: *mut robj,
1906 pub eval: *mut robj,
1907 pub persist: *mut robj,
1908 pub set: *mut robj,
1909 pub pexpireat: *mut robj,
1910 pub pexpire: *mut robj,
1911 pub time: *mut robj,
1912 pub pxat: *mut robj,
1913 pub absttl: *mut robj,
1914 pub retrycount: *mut robj,
1915 pub force: *mut robj,
1916 pub justid: *mut robj,
1917 pub entriesread: *mut robj,
1918 pub lastid: *mut robj,
1919 pub ping: *mut robj,
1920 pub setid: *mut robj,
1921 pub keepttl: *mut robj,
1922 pub load: *mut robj,
1923 pub createconsumer: *mut robj,
1924 pub getack: *mut robj,
1925 pub special_asterick: *mut robj,
1926 pub special_equals: *mut robj,
1927 pub default_username: *mut robj,
1928 pub redacted: *mut robj,
1929 pub ssubscribebulk: *mut robj,
1930 pub sunsubscribebulk: *mut robj,
1931 pub smessagebulk: *mut robj,
1932 pub select: [*mut robj; 10],
1933 pub integers: [*mut robj; 10000],
1934 pub mbulkhdr: [*mut robj; 32],
1935 pub bulkhdr: [*mut robj; 32],
1936 pub maphdr: [*mut robj; 32],
1937 pub sethdr: [*mut robj; 32],
1938 pub minstring: sds,
1939 pub maxstring: sds,
1940}
1941#[derive(Copy, Clone)]
1942#[repr(C)]
1943pub struct zskiplistNode {
1944 pub ele: sds,
1945 pub score: libc::c_double,
1946 pub backward: *mut zskiplistNode,
1947 pub level: [zskiplistLevel; 0],
1948}
1949#[derive(Copy, Clone)]
1950#[repr(C)]
1951pub struct zskiplistLevel {
1952 pub forward: *mut zskiplistNode,
1953 pub span: libc::c_ulong,
1954}
1955#[derive(Copy, Clone)]
1956#[repr(C)]
1957pub struct zskiplist {
1958 pub header: *mut zskiplistNode,
1959 pub tail: *mut zskiplistNode,
1960 pub length: libc::c_ulong,
1961 pub level: libc::c_int,
1962}
1963#[derive(Copy, Clone)]
1964#[repr(C)]
1965pub struct zset {
1966 pub dict: *mut dict,
1967 pub zsl: *mut zskiplist,
1968}
1969#[derive(Copy, Clone)]
1970#[repr(C)]
1971pub struct clientBufferLimitsConfig {
1972 pub hard_limit_bytes: libc::c_ulonglong,
1973 pub soft_limit_bytes: libc::c_ulonglong,
1974 pub soft_limit_seconds: time_t,
1975}
1976#[derive(Copy, Clone)]
1977#[repr(C)]
1978pub struct redisOp {
1979 pub argv: *mut *mut robj,
1980 pub argc: libc::c_int,
1981 pub dbid: libc::c_int,
1982 pub target: libc::c_int,
1983}
1984#[derive(Copy, Clone)]
1985#[repr(C)]
1986pub struct redisOpArray {
1987 pub ops: *mut redisOp,
1988 pub numops: libc::c_int,
1989 pub capacity: libc::c_int,
1990}
1991#[derive(Copy, Clone)]
1992#[repr(C)]
1993pub struct rdbSaveInfo {
1994 pub repl_stream_db: libc::c_int,
1995 pub repl_id_is_set: libc::c_int,
1996 pub repl_id: [libc::c_char; 41],
1997 pub repl_offset: libc::c_longlong,
1998}
1999#[derive(Copy, Clone)]
2000#[repr(C)]
2001pub struct malloc_stats {
2002 pub zmalloc_used: size_t,
2003 pub process_rss: size_t,
2004 pub allocator_allocated: size_t,
2005 pub allocator_active: size_t,
2006 pub allocator_resident: size_t,
2007}
2008#[derive(Copy, Clone)]
2009#[repr(C)]
2010pub struct socketFds {
2011 pub fd: [libc::c_int; 16],
2012 pub count: libc::c_int,
2013}
2014#[derive(Copy, Clone)]
2015#[repr(C)]
2016pub struct redisTLSContextConfig {
2017 pub cert_file: *mut libc::c_char,
2018 pub key_file: *mut libc::c_char,
2019 pub key_file_pass: *mut libc::c_char,
2020 pub client_cert_file: *mut libc::c_char,
2021 pub client_key_file: *mut libc::c_char,
2022 pub client_key_file_pass: *mut libc::c_char,
2023 pub dh_params_file: *mut libc::c_char,
2024 pub ca_cert_file: *mut libc::c_char,
2025 pub ca_cert_dir: *mut libc::c_char,
2026 pub protocols: *mut libc::c_char,
2027 pub ciphers: *mut libc::c_char,
2028 pub ciphersuites: *mut libc::c_char,
2029 pub prefer_server_ciphers: libc::c_int,
2030 pub session_caching: libc::c_int,
2031 pub session_cache_size: libc::c_int,
2032 pub session_cache_timeout: libc::c_int,
2033}
2034pub type aof_file_type = libc::c_uint;
2035pub const AOF_FILE_TYPE_INCR: aof_file_type = 105;
2036pub const AOF_FILE_TYPE_HIST: aof_file_type = 104;
2037pub const AOF_FILE_TYPE_BASE: aof_file_type = 98;
2038#[derive(Copy, Clone)]
2039#[repr(C)]
2040pub struct aofInfo {
2041 pub file_name: sds,
2042 pub file_seq: libc::c_longlong,
2043 pub file_type: aof_file_type,
2044}
2045#[derive(Copy, Clone)]
2046#[repr(C)]
2047pub struct aofManifest {
2048 pub base_aof_info: *mut aofInfo,
2049 pub incr_aof_list: *mut list,
2050 pub history_aof_list: *mut list,
2051 pub curr_base_file_seq: libc::c_longlong,
2052 pub curr_incr_file_seq: libc::c_longlong,
2053 pub dirty: libc::c_int,
2054}
2055#[derive(Copy, Clone)]
2056#[repr(C)]
2057pub struct redisServer {
2058 pub pid: pid_t,
2059 pub main_thread_id: pthread_t,
2060 pub configfile: *mut libc::c_char,
2061 pub executable: *mut libc::c_char,
2062 pub exec_argv: *mut *mut libc::c_char,
2063 pub dynamic_hz: libc::c_int,
2064 pub config_hz: libc::c_int,
2065 pub umask: mode_t,
2066 pub hz: libc::c_int,
2067 pub in_fork_child: libc::c_int,
2068 pub db: *mut redisDb,
2069 pub commands: *mut dict,
2070 pub orig_commands: *mut dict,
2071 pub el: *mut aeEventLoop,
2072 pub errors: *mut rax,
2073 pub lruclock: atomic_uint,
2074 pub shutdown_asap: sig_atomic_t,
2075 pub shutdown_mstime: mstime_t,
2076 pub last_sig_received: libc::c_int,
2077 pub shutdown_flags: libc::c_int,
2078 pub activerehashing: libc::c_int,
2079 pub active_defrag_running: libc::c_int,
2080 pub pidfile: *mut libc::c_char,
2081 pub arch_bits: libc::c_int,
2082 pub cronloops: libc::c_int,
2083 pub runid: [libc::c_char; 41],
2084 pub sentinel_mode: libc::c_int,
2085 pub initial_memory_usage: size_t,
2086 pub always_show_logo: libc::c_int,
2087 pub in_exec: libc::c_int,
2088 pub busy_module_yield_flags: libc::c_int,
2089 pub busy_module_yield_reply: *const libc::c_char,
2090 pub core_propagates: libc::c_int,
2091 pub propagate_no_multi: libc::c_int,
2092 pub module_ctx_nesting: libc::c_int,
2093 pub ignore_warnings: *mut libc::c_char,
2094 pub client_pause_in_transaction: libc::c_int,
2095 pub thp_enabled: libc::c_int,
2096 pub page_size: size_t,
2097 pub moduleapi: *mut dict,
2098 pub sharedapi: *mut dict,
2099 pub module_configs_queue: *mut dict,
2100 pub loadmodule_queue: *mut list,
2101 pub module_pipe: [libc::c_int; 2],
2102 pub child_pid: pid_t,
2103 pub child_type: libc::c_int,
2104 pub port: libc::c_int,
2105 pub tls_port: libc::c_int,
2106 pub tcp_backlog: libc::c_int,
2107 pub bindaddr: [*mut libc::c_char; 16],
2108 pub bindaddr_count: libc::c_int,
2109 pub bind_source_addr: *mut libc::c_char,
2110 pub unixsocket: *mut libc::c_char,
2111 pub unixsocketperm: libc::c_uint,
2112 pub ipfd: socketFds,
2113 pub tlsfd: socketFds,
2114 pub sofd: libc::c_int,
2115 pub socket_mark_id: uint32_t,
2116 pub cfd: socketFds,
2117 pub clients: *mut list,
2118 pub clients_to_close: *mut list,
2119 pub clients_pending_write: *mut list,
2120 pub clients_pending_read: *mut list,
2121 pub slaves: *mut list,
2122 pub monitors: *mut list,
2123 pub current_client: *mut client,
2124 pub client_mem_usage_buckets: *mut clientMemUsageBucket,
2125 pub clients_timeout_table: *mut rax,
2126 pub fixed_time_expire: libc::c_long,
2127 pub in_nested_call: libc::c_int,
2128 pub clients_index: *mut rax,
2129 pub client_pause_type: pause_type,
2130 pub postponed_clients: *mut list,
2131 pub client_pause_end_time: mstime_t,
2132 pub client_pause_per_purpose: [*mut pause_event; 3],
2133 pub neterr: [libc::c_char; 256],
2134 pub migrate_cached_sockets: *mut dict,
2135 pub next_client_id: uint_least64_t,
2136 pub protected_mode: libc::c_int,
2137 pub io_threads_num: libc::c_int,
2138 pub io_threads_do_reads: libc::c_int,
2139 pub io_threads_active: libc::c_int,
2140 pub events_processed_while_blocked: libc::c_longlong,
2141 pub enable_protected_configs: libc::c_int,
2142 pub enable_debug_cmd: libc::c_int,
2143 pub enable_module_cmd: libc::c_int,
2144 pub loading: sig_atomic_t,
2145 pub async_loading: sig_atomic_t,
2146 pub loading_total_bytes: off_t,
2147 pub loading_rdb_used_mem: off_t,
2148 pub loading_loaded_bytes: off_t,
2149 pub loading_start_time: time_t,
2150 pub loading_process_events_interval_bytes: off_t,
2151 pub stat_starttime: time_t,
2152 pub stat_numcommands: libc::c_longlong,
2153 pub stat_numconnections: libc::c_longlong,
2154 pub stat_expiredkeys: libc::c_longlong,
2155 pub stat_expired_stale_perc: libc::c_double,
2156 pub stat_expired_time_cap_reached_count: libc::c_longlong,
2157 pub stat_expire_cycle_time_used: libc::c_longlong,
2158 pub stat_evictedkeys: libc::c_longlong,
2159 pub stat_evictedclients: libc::c_longlong,
2160 pub stat_total_eviction_exceeded_time: libc::c_longlong,
2161 pub stat_last_eviction_exceeded_time: monotime,
2162 pub stat_keyspace_hits: libc::c_longlong,
2163 pub stat_keyspace_misses: libc::c_longlong,
2164 pub stat_active_defrag_hits: libc::c_longlong,
2165 pub stat_active_defrag_misses: libc::c_longlong,
2166 pub stat_active_defrag_key_hits: libc::c_longlong,
2167 pub stat_active_defrag_key_misses: libc::c_longlong,
2168 pub stat_active_defrag_scanned: libc::c_longlong,
2169 pub stat_total_active_defrag_time: libc::c_longlong,
2170 pub stat_last_active_defrag_time: monotime,
2171 pub stat_peak_memory: size_t,
2172 pub stat_aof_rewrites: libc::c_longlong,
2173 pub stat_aofrw_consecutive_failures: libc::c_longlong,
2174 pub stat_rdb_saves: libc::c_longlong,
2175 pub stat_fork_time: libc::c_longlong,
2176 pub stat_fork_rate: libc::c_double,
2177 pub stat_total_forks: libc::c_longlong,
2178 pub stat_rejected_conn: libc::c_longlong,
2179 pub stat_sync_full: libc::c_longlong,
2180 pub stat_sync_partial_ok: libc::c_longlong,
2181 pub stat_sync_partial_err: libc::c_longlong,
2182 pub slowlog: *mut list,
2183 pub slowlog_entry_id: libc::c_longlong,
2184 pub slowlog_log_slower_than: libc::c_longlong,
2185 pub slowlog_max_len: libc::c_ulong,
2186 pub cron_malloc_stats: malloc_stats,
2187 pub stat_net_input_bytes: atomic_llong,
2188 pub stat_net_output_bytes: atomic_llong,
2189 pub stat_net_repl_input_bytes: atomic_llong,
2190 pub stat_net_repl_output_bytes: atomic_llong,
2191 pub stat_current_cow_peak: size_t,
2192 pub stat_current_cow_bytes: size_t,
2193 pub stat_current_cow_updated: monotime,
2194 pub stat_current_save_keys_processed: size_t,
2195 pub stat_current_save_keys_total: size_t,
2196 pub stat_rdb_cow_bytes: size_t,
2197 pub stat_aof_cow_bytes: size_t,
2198 pub stat_module_cow_bytes: size_t,
2199 pub stat_module_progress: libc::c_double,
2200 pub stat_clients_type_memory: [size_t; 4],
2201 pub stat_cluster_links_memory: size_t,
2202 pub stat_unexpected_error_replies: libc::c_longlong,
2203 pub stat_total_error_replies: libc::c_longlong,
2204 pub stat_dump_payload_sanitizations: libc::c_longlong,
2205 pub stat_io_reads_processed: libc::c_longlong,
2206 pub stat_io_writes_processed: libc::c_longlong,
2207 pub stat_total_reads_processed: atomic_llong,
2208 pub stat_total_writes_processed: atomic_llong,
2209 pub inst_metric: [C2RustUnnamed_25; 5],
2210 pub stat_reply_buffer_shrinks: libc::c_longlong,
2211 pub stat_reply_buffer_expands: libc::c_longlong,
2212 pub verbosity: libc::c_int,
2213 pub maxidletime: libc::c_int,
2214 pub tcpkeepalive: libc::c_int,
2215 pub active_expire_enabled: libc::c_int,
2216 pub active_expire_effort: libc::c_int,
2217 pub active_defrag_enabled: libc::c_int,
2218 pub sanitize_dump_payload: libc::c_int,
2219 pub skip_checksum_validation: libc::c_int,
2220 pub jemalloc_bg_thread: libc::c_int,
2221 pub active_defrag_ignore_bytes: size_t,
2222 pub active_defrag_threshold_lower: libc::c_int,
2223 pub active_defrag_threshold_upper: libc::c_int,
2224 pub active_defrag_cycle_min: libc::c_int,
2225 pub active_defrag_cycle_max: libc::c_int,
2226 pub active_defrag_max_scan_fields: libc::c_ulong,
2227 pub client_max_querybuf_len: size_t,
2228 pub dbnum: libc::c_int,
2229 pub supervised: libc::c_int,
2230 pub supervised_mode: libc::c_int,
2231 pub daemonize: libc::c_int,
2232 pub set_proc_title: libc::c_int,
2233 pub proc_title_template: *mut libc::c_char,
2234 pub client_obuf_limits: [clientBufferLimitsConfig; 3],
2235 pub pause_cron: libc::c_int,
2236 pub latency_tracking_enabled: libc::c_int,
2237 pub latency_tracking_info_percentiles: *mut libc::c_double,
2238 pub latency_tracking_info_percentiles_len: libc::c_int,
2239 pub aof_enabled: libc::c_int,
2240 pub aof_state: libc::c_int,
2241 pub aof_fsync: libc::c_int,
2242 pub aof_filename: *mut libc::c_char,
2243 pub aof_dirname: *mut libc::c_char,
2244 pub aof_no_fsync_on_rewrite: libc::c_int,
2245 pub aof_rewrite_perc: libc::c_int,
2246 pub aof_rewrite_min_size: off_t,
2247 pub aof_rewrite_base_size: off_t,
2248 pub aof_current_size: off_t,
2249 pub aof_last_incr_size: off_t,
2250 pub aof_fsync_offset: off_t,
2251 pub aof_flush_sleep: libc::c_int,
2252 pub aof_rewrite_scheduled: libc::c_int,
2253 pub aof_buf: sds,
2254 pub aof_fd: libc::c_int,
2255 pub aof_selected_db: libc::c_int,
2256 pub aof_flush_postponed_start: time_t,
2257 pub aof_last_fsync: time_t,
2258 pub aof_rewrite_time_last: time_t,
2259 pub aof_rewrite_time_start: time_t,
2260 pub aof_cur_timestamp: time_t,
2261 pub aof_timestamp_enabled: libc::c_int,
2262 pub aof_lastbgrewrite_status: libc::c_int,
2263 pub aof_delayed_fsync: libc::c_ulong,
2264 pub aof_rewrite_incremental_fsync: libc::c_int,
2265 pub rdb_save_incremental_fsync: libc::c_int,
2266 pub aof_last_write_status: libc::c_int,
2267 pub aof_last_write_errno: libc::c_int,
2268 pub aof_load_truncated: libc::c_int,
2269 pub aof_use_rdb_preamble: libc::c_int,
2270 pub aof_bio_fsync_status: atomic_int,
2271 pub aof_bio_fsync_errno: atomic_int,
2272 pub aof_manifest: *mut aofManifest,
2273 pub aof_disable_auto_gc: libc::c_int,
2274 pub dirty: libc::c_longlong,
2275 pub dirty_before_bgsave: libc::c_longlong,
2276 pub rdb_last_load_keys_expired: libc::c_longlong,
2277 pub rdb_last_load_keys_loaded: libc::c_longlong,
2278 pub saveparams: *mut saveparam,
2279 pub saveparamslen: libc::c_int,
2280 pub rdb_filename: *mut libc::c_char,
2281 pub rdb_compression: libc::c_int,
2282 pub rdb_checksum: libc::c_int,
2283 pub rdb_del_sync_files: libc::c_int,
2284 pub lastsave: time_t,
2285 pub lastbgsave_try: time_t,
2286 pub rdb_save_time_last: time_t,
2287 pub rdb_save_time_start: time_t,
2288 pub rdb_bgsave_scheduled: libc::c_int,
2289 pub rdb_child_type: libc::c_int,
2290 pub lastbgsave_status: libc::c_int,
2291 pub stop_writes_on_bgsave_err: libc::c_int,
2292 pub rdb_pipe_read: libc::c_int,
2293 pub rdb_child_exit_pipe: libc::c_int,
2294 pub rdb_pipe_conns: *mut *mut connection,
2295 pub rdb_pipe_numconns: libc::c_int,
2296 pub rdb_pipe_numconns_writing: libc::c_int,
2297 pub rdb_pipe_buff: *mut libc::c_char,
2298 pub rdb_pipe_bufflen: libc::c_int,
2299 pub rdb_key_save_delay: libc::c_int,
2300 pub key_load_delay: libc::c_int,
2301 pub child_info_pipe: [libc::c_int; 2],
2302 pub child_info_nread: libc::c_int,
2303 pub also_propagate: redisOpArray,
2304 pub replication_allowed: libc::c_int,
2305 pub logfile: *mut libc::c_char,
2306 pub syslog_enabled: libc::c_int,
2307 pub syslog_ident: *mut libc::c_char,
2308 pub syslog_facility: libc::c_int,
2309 pub crashlog_enabled: libc::c_int,
2310 pub memcheck_enabled: libc::c_int,
2311 pub use_exit_on_panic: libc::c_int,
2312 pub shutdown_timeout: libc::c_int,
2313 pub shutdown_on_sigint: libc::c_int,
2314 pub shutdown_on_sigterm: libc::c_int,
2315 pub replid: [libc::c_char; 41],
2316 pub replid2: [libc::c_char; 41],
2317 pub master_repl_offset: libc::c_longlong,
2318 pub second_replid_offset: libc::c_longlong,
2319 pub slaveseldb: libc::c_int,
2320 pub repl_ping_slave_period: libc::c_int,
2321 pub repl_backlog: *mut replBacklog,
2322 pub repl_backlog_size: libc::c_longlong,
2323 pub repl_backlog_time_limit: time_t,
2324 pub repl_no_slaves_since: time_t,
2325 pub repl_min_slaves_to_write: libc::c_int,
2326 pub repl_min_slaves_max_lag: libc::c_int,
2327 pub repl_good_slaves_count: libc::c_int,
2328 pub repl_diskless_sync: libc::c_int,
2329 pub repl_diskless_load: libc::c_int,
2330 pub repl_diskless_sync_delay: libc::c_int,
2331 pub repl_diskless_sync_max_replicas: libc::c_int,
2332 pub repl_buffer_mem: size_t,
2333 pub repl_buffer_blocks: *mut list,
2334 pub masteruser: *mut libc::c_char,
2335 pub masterauth: sds,
2336 pub masterhost: *mut libc::c_char,
2337 pub masterport: libc::c_int,
2338 pub repl_timeout: libc::c_int,
2339 pub master: *mut client,
2340 pub cached_master: *mut client,
2341 pub repl_syncio_timeout: libc::c_int,
2342 pub repl_state: libc::c_int,
2343 pub repl_transfer_size: off_t,
2344 pub repl_transfer_read: off_t,
2345 pub repl_transfer_last_fsync_off: off_t,
2346 pub repl_transfer_s: *mut connection,
2347 pub repl_transfer_fd: libc::c_int,
2348 pub repl_transfer_tmpfile: *mut libc::c_char,
2349 pub repl_transfer_lastio: time_t,
2350 pub repl_serve_stale_data: libc::c_int,
2351 pub repl_slave_ro: libc::c_int,
2352 pub repl_slave_ignore_maxmemory: libc::c_int,
2353 pub repl_down_since: time_t,
2354 pub repl_disable_tcp_nodelay: libc::c_int,
2355 pub slave_priority: libc::c_int,
2356 pub replica_announced: libc::c_int,
2357 pub slave_announce_port: libc::c_int,
2358 pub slave_announce_ip: *mut libc::c_char,
2359 pub propagation_error_behavior: libc::c_int,
2360 pub repl_ignore_disk_write_error: libc::c_int,
2361 pub master_replid: [libc::c_char; 41],
2362 pub master_initial_offset: libc::c_longlong,
2363 pub repl_slave_lazy_flush: libc::c_int,
2364 pub clients_waiting_acks: *mut list,
2365 pub get_ack_from_slaves: libc::c_int,
2366 pub maxclients: libc::c_uint,
2367 pub maxmemory: libc::c_ulonglong,
2368 pub maxmemory_clients: ssize_t,
2369 pub maxmemory_policy: libc::c_int,
2370 pub maxmemory_samples: libc::c_int,
2371 pub maxmemory_eviction_tenacity: libc::c_int,
2372 pub lfu_log_factor: libc::c_int,
2373 pub lfu_decay_time: libc::c_int,
2374 pub proto_max_bulk_len: libc::c_longlong,
2375 pub oom_score_adj_values: [libc::c_int; 3],
2376 pub oom_score_adj: libc::c_int,
2377 pub disable_thp: libc::c_int,
2378 pub blocked_clients: libc::c_uint,
2379 pub blocked_clients_by_type: [libc::c_uint; 8],
2380 pub unblocked_clients: *mut list,
2381 pub ready_keys: *mut list,
2382 pub tracking_clients: libc::c_uint,
2383 pub tracking_table_max_keys: size_t,
2384 pub tracking_pending_keys: *mut list,
2385 pub sort_desc: libc::c_int,
2386 pub sort_alpha: libc::c_int,
2387 pub sort_bypattern: libc::c_int,
2388 pub sort_store: libc::c_int,
2389 pub hash_max_listpack_entries: size_t,
2390 pub hash_max_listpack_value: size_t,
2391 pub set_max_intset_entries: size_t,
2392 pub zset_max_listpack_entries: size_t,
2393 pub zset_max_listpack_value: size_t,
2394 pub hll_sparse_max_bytes: size_t,
2395 pub stream_node_max_bytes: size_t,
2396 pub stream_node_max_entries: libc::c_longlong,
2397 pub list_max_listpack_size: libc::c_int,
2398 pub list_compress_depth: libc::c_int,
2399 pub unixtime: atomic_int,
2400 pub timezone: time_t,
2401 pub daylight_active: libc::c_int,
2402 pub mstime: mstime_t,
2403 pub ustime: ustime_t,
2404 pub blocking_op_nesting: size_t,
2405 pub blocked_last_cron: libc::c_longlong,
2406 pub pubsub_channels: *mut dict,
2407 pub pubsub_patterns: *mut dict,
2408 pub notify_keyspace_events: libc::c_int,
2409 pub pubsubshard_channels: *mut dict,
2410 pub cluster_enabled: libc::c_int,
2411 pub cluster_port: libc::c_int,
2412 pub cluster_node_timeout: mstime_t,
2413 pub cluster_configfile: *mut libc::c_char,
2414 pub cluster: *mut clusterState,
2415 pub cluster_migration_barrier: libc::c_int,
2416 pub cluster_allow_replica_migration: libc::c_int,
2417 pub cluster_slave_validity_factor: libc::c_int,
2418 pub cluster_require_full_coverage: libc::c_int,
2419 pub cluster_slave_no_failover: libc::c_int,
2420 pub cluster_announce_ip: *mut libc::c_char,
2421 pub cluster_announce_hostname: *mut libc::c_char,
2422 pub cluster_preferred_endpoint_type: libc::c_int,
2423 pub cluster_announce_port: libc::c_int,
2424 pub cluster_announce_tls_port: libc::c_int,
2425 pub cluster_announce_bus_port: libc::c_int,
2426 pub cluster_module_flags: libc::c_int,
2427 pub cluster_allow_reads_when_down: libc::c_int,
2428 pub cluster_config_file_lock_fd: libc::c_int,
2429 pub cluster_link_sendbuf_limit_bytes: libc::c_ulonglong,
2430 pub cluster_drop_packet_filter: libc::c_int,
2431 pub script_caller: *mut client,
2432 pub busy_reply_threshold: mstime_t,
2433 pub pre_command_oom_state: libc::c_int,
2434 pub script_disable_deny_script: libc::c_int,
2435 pub lazyfree_lazy_eviction: libc::c_int,
2436 pub lazyfree_lazy_expire: libc::c_int,
2437 pub lazyfree_lazy_server_del: libc::c_int,
2438 pub lazyfree_lazy_user_del: libc::c_int,
2439 pub lazyfree_lazy_user_flush: libc::c_int,
2440 pub latency_monitor_threshold: libc::c_longlong,
2441 pub latency_events: *mut dict,
2442 pub acl_filename: *mut libc::c_char,
2443 pub acllog_max_len: libc::c_ulong,
2444 pub requirepass: sds,
2445 pub acl_pubsub_default: libc::c_int,
2446 pub watchdog_period: libc::c_int,
2447 pub system_memory_size: size_t,
2448 pub tls_cluster: libc::c_int,
2449 pub tls_replication: libc::c_int,
2450 pub tls_auth_clients: libc::c_int,
2451 pub tls_ctx_config: redisTLSContextConfig,
2452 pub server_cpulist: *mut libc::c_char,
2453 pub bio_cpulist: *mut libc::c_char,
2454 pub aof_rewrite_cpulist: *mut libc::c_char,
2455 pub bgsave_cpulist: *mut libc::c_char,
2456 pub sentinel_config: *mut sentinelConfig,
2457 pub failover_end_time: mstime_t,
2458 pub force_failover: libc::c_int,
2459 pub target_replica_host: *mut libc::c_char,
2460 pub target_replica_port: libc::c_int,
2461 pub failover_state: libc::c_int,
2462 pub cluster_allow_pubsubshard_when_down: libc::c_int,
2463 pub reply_buffer_peak_reset_time: libc::c_long,
2464 pub reply_buffer_resizing_enabled: libc::c_int,
2465}
2466#[derive(Copy, Clone)]
2467#[repr(C)]
2468pub struct C2RustUnnamed_25 {
2469 pub last_sample_time: libc::c_longlong,
2470 pub last_sample_count: libc::c_longlong,
2471 pub samples: [libc::c_longlong; 16],
2472 pub idx: libc::c_int,
2473}
2474#[derive(Copy, Clone)]
2475#[repr(C)]
2476pub struct listTypeIterator {
2477 pub subject: *mut robj,
2478 pub encoding: libc::c_uchar,
2479 pub direction: libc::c_uchar,
2480 pub iter: *mut quicklistIter,
2481}
2482#[derive(Copy, Clone)]
2483#[repr(C)]
2484pub struct listTypeEntry {
2485 pub li: *mut listTypeIterator,
2486 pub entry: quicklistEntry,
2487}
2488#[derive(Copy, Clone)]
2489#[repr(C)]
2490pub struct setTypeIterator {
2491 pub subject: *mut robj,
2492 pub encoding: libc::c_int,
2493 pub ii: libc::c_int,
2494 pub di: *mut dictIterator,
2495}
2496#[derive(Copy, Clone)]
2497#[repr(C)]
2498pub struct hashTypeIterator {
2499 pub subject: *mut robj,
2500 pub encoding: libc::c_int,
2501 pub fptr: *mut libc::c_uchar,
2502 pub vptr: *mut libc::c_uchar,
2503 pub di: *mut dictIterator,
2504 pub de: *mut dictEntry,
2505}
2506#[derive(Copy, Clone)]
2507#[repr(C)]
2508pub struct streamID {
2509 pub ms: uint64_t,
2510 pub seq: uint64_t,
2511}
2512#[derive(Copy, Clone)]
2513#[repr(C)]
2514pub struct stream {
2515 pub rax: *mut rax,
2516 pub length: uint64_t,
2517 pub last_id: streamID,
2518 pub first_id: streamID,
2519 pub max_deleted_entry_id: streamID,
2520 pub entries_added: uint64_t,
2521 pub cgroups: *mut rax,
2522}
2523#[derive(Copy, Clone)]
2524#[repr(C)]
2525pub struct streamIterator {
2526 pub stream: *mut stream,
2527 pub master_id: streamID,
2528 pub master_fields_count: uint64_t,
2529 pub master_fields_start: *mut libc::c_uchar,
2530 pub master_fields_ptr: *mut libc::c_uchar,
2531 pub entry_flags: libc::c_int,
2532 pub rev: libc::c_int,
2533 pub skip_tombstones: libc::c_int,
2534 pub start_key: [uint64_t; 2],
2535 pub end_key: [uint64_t; 2],
2536 pub ri: raxIterator,
2537 pub lp: *mut libc::c_uchar,
2538 pub lp_ele: *mut libc::c_uchar,
2539 pub lp_flags: *mut libc::c_uchar,
2540 pub field_buf: [libc::c_uchar; 21],
2541 pub value_buf: [libc::c_uchar; 21],
2542}
2543#[derive(Copy, Clone)]
2544#[repr(C)]
2545pub struct Dl_info {
2546 pub dli_fname: *const libc::c_char,
2547 pub dli_fbase: *mut libc::c_void,
2548 pub dli_sname: *const libc::c_char,
2549 pub dli_saddr: *mut libc::c_void,
2550}
2551pub type invalidFunctionWasCalledType = Option::<unsafe extern "C" fn() -> ()>;
2552#[inline]
2553unsafe extern "C" fn __bswap_32(mut __bsx: __uint32_t) -> __uint32_t {
2554 return (__bsx & 0xff000000 as libc::c_uint) >> 24 as libc::c_int
2555 | (__bsx & 0xff0000 as libc::c_uint) >> 8 as libc::c_int
2556 | (__bsx & 0xff00 as libc::c_uint) << 8 as libc::c_int
2557 | (__bsx & 0xff as libc::c_uint) << 24 as libc::c_int;
2558}
2559#[inline]
2560unsafe extern "C" fn sdslen(s: sds) -> size_t {
2561 let mut flags: libc::c_uchar = *s.offset(-(1 as libc::c_int) as isize)
2562 as libc::c_uchar;
2563 match flags as libc::c_int & 7 as libc::c_int {
2564 0 => return (flags as libc::c_int >> 3 as libc::c_int) as size_t,
2565 1 => {
2566 return (*(s
2567 .offset(-(core::mem::size_of::<sdshdr8>() as libc::c_ulong as isize))
2568 as *mut sdshdr8))
2569 .len as size_t;
2570 }
2571 2 => {
2572 return (*(s
2573 .offset(-(core::mem::size_of::<sdshdr16>() as libc::c_ulong as isize))
2574 as *mut sdshdr16))
2575 .len as size_t;
2576 }
2577 3 => {
2578 return (*(s
2579 .offset(-(core::mem::size_of::<sdshdr32>() as libc::c_ulong as isize))
2580 as *mut sdshdr32))
2581 .len as size_t;
2582 }
2583 4 => {
2584 return (*(s
2585 .offset(-(core::mem::size_of::<sdshdr64>() as libc::c_ulong as isize))
2586 as *mut sdshdr64))
2587 .len;
2588 }
2589 _ => {}
2590 }
2591 return 0 as libc::c_int as size_t;
2592}
2593#[inline]
2594unsafe extern "C" fn sdsavail(s: sds) -> size_t {
2595 let mut flags: libc::c_uchar = *s.offset(-(1 as libc::c_int) as isize)
2596 as libc::c_uchar;
2597 match flags as libc::c_int & 7 as libc::c_int {
2598 0 => return 0 as libc::c_int as size_t,
2599 1 => {
2600 let mut sh: *mut sdshdr8 = s
2601 .offset(-(core::mem::size_of::<sdshdr8>() as libc::c_ulong as isize))
2602 as *mut libc::c_void as *mut sdshdr8;
2603 return ((*sh).alloc as libc::c_int - (*sh).len as libc::c_int) as size_t;
2604 }
2605 2 => {
2606 let mut sh_0: *mut sdshdr16 = s
2607 .offset(-(core::mem::size_of::<sdshdr16>() as libc::c_ulong as isize))
2608 as *mut libc::c_void as *mut sdshdr16;
2609 return ((*sh_0).alloc as libc::c_int - (*sh_0).len as libc::c_int) as size_t;
2610 }
2611 3 => {
2612 let mut sh_1: *mut sdshdr32 = s
2613 .offset(-(core::mem::size_of::<sdshdr32>() as libc::c_ulong as isize))
2614 as *mut libc::c_void as *mut sdshdr32;
2615 return ((*sh_1).alloc).wrapping_sub((*sh_1).len) as size_t;
2616 }
2617 4 => {
2618 let mut sh_2: *mut sdshdr64 = s
2619 .offset(-(core::mem::size_of::<sdshdr64>() as libc::c_ulong as isize))
2620 as *mut libc::c_void as *mut sdshdr64;
2621 return ((*sh_2).alloc).wrapping_sub((*sh_2).len);
2622 }
2623 _ => {}
2624 }
2625 return 0 as libc::c_int as size_t;
2626}
2627#[inline]
2628unsafe extern "C" fn atoi(mut __nptr: *const libc::c_char) -> libc::c_int {
2629 return strtol(
2630 __nptr,
2631 0 as *mut libc::c_void as *mut *mut libc::c_char,
2632 10 as libc::c_int,
2633 ) as libc::c_int;
2634}
2635static mut bug_report_start: libc::c_int = 0 as libc::c_int;
2636static mut bug_report_start_mutex: pthread_mutex_t = pthread_mutex_t {
2637 __data: {
2638 let mut init = __pthread_mutex_s {
2639 __lock: 0 as libc::c_int,
2640 __count: 0 as libc::c_int as libc::c_uint,
2641 __owner: 0 as libc::c_int,
2642 __nusers: 0 as libc::c_int as libc::c_uint,
2643 __kind: PTHREAD_MUTEX_TIMED_NP as libc::c_int,
2644 __spins: 0 as libc::c_int,
2645 __list: {
2646 let mut init = __pthread_internal_list {
2647 __prev: 0 as *const __pthread_internal_list
2648 as *mut __pthread_internal_list,
2649 __next: 0 as *const __pthread_internal_list
2650 as *mut __pthread_internal_list,
2651 };
2652 init
2653 },
2654 };
2655 init
2656 },
2657};
2658#[no_mangle]
2659pub unsafe extern "C" fn xorDigest(
2660 mut digest: *mut libc::c_uchar,
2661 mut ptr: *const libc::c_void,
2662 mut len: size_t,
2663) {
2664 let mut ctx: SHA1_CTX = SHA1_CTX {
2665 state: [0; 5],
2666 count: [0; 2],
2667 buffer: [0; 64],
2668 };
2669 let mut hash: [libc::c_uchar; 20] = [0; 20];
2670 let mut j: libc::c_int = 0;
2671 SHA1Init(&mut ctx);
2672 SHA1Update(&mut ctx, ptr as *const libc::c_uchar, len as uint32_t);
2673 SHA1Final(hash.as_mut_ptr(), &mut ctx);
2674 j = 0 as libc::c_int;
2675 while j < 20 as libc::c_int {
2676 let ref mut fresh0 = *digest.offset(j as isize);
2677 *fresh0 = (*fresh0 as libc::c_int ^ hash[j as usize] as libc::c_int)
2678 as libc::c_uchar;
2679 j += 1;
2680 }
2681}
2682#[no_mangle]
2683pub unsafe extern "C" fn xorStringObjectDigest(
2684 mut digest: *mut libc::c_uchar,
2685 mut o: *mut robj,
2686) {
2687 o = getDecodedObject(o);
2688 xorDigest(digest, (*o).ptr, sdslen((*o).ptr as sds));
2689 decrRefCount(o);
2690}
2691#[no_mangle]
2692pub unsafe extern "C" fn mixDigest(
2693 mut digest: *mut libc::c_uchar,
2694 mut ptr: *const libc::c_void,
2695 mut len: size_t,
2696) {
2697 let mut ctx: SHA1_CTX = SHA1_CTX {
2698 state: [0; 5],
2699 count: [0; 2],
2700 buffer: [0; 64],
2701 };
2702 xorDigest(digest, ptr, len);
2703 SHA1Init(&mut ctx);
2704 SHA1Update(&mut ctx, digest, 20 as libc::c_int as uint32_t);
2705 SHA1Final(digest, &mut ctx);
2706}
2707#[no_mangle]
2708pub unsafe extern "C" fn mixStringObjectDigest(
2709 mut digest: *mut libc::c_uchar,
2710 mut o: *mut robj,
2711) {
2712 o = getDecodedObject(o);
2713 mixDigest(digest, (*o).ptr, sdslen((*o).ptr as sds));
2714 decrRefCount(o);
2715}
2716#[no_mangle]
2717pub unsafe extern "C" fn xorObjectDigest(
2718 mut db: *mut redisDb,
2719 mut keyobj: *mut robj,
2720 mut digest: *mut libc::c_uchar,
2721 mut o: *mut robj,
2722) {
2723 let mut aux: uint32_t = __bswap_32((*o).type_0());
2724 mixDigest(
2725 digest,
2726 &mut aux as *mut uint32_t as *const libc::c_void,
2727 core::mem::size_of::<uint32_t>() as libc::c_ulong,
2728 );
2729 let mut expiretime: libc::c_longlong = getExpire(db, keyobj);
2730 let mut buf: [libc::c_char; 128] = [0; 128];
2731 if (*o).type_0() as libc::c_int == 0 as libc::c_int {
2732 mixStringObjectDigest(digest, o);
2733 } else if (*o).type_0() as libc::c_int == 1 as libc::c_int {
2734 let mut li: *mut listTypeIterator = listTypeInitIterator(
2735 o,
2736 0 as libc::c_int as libc::c_long,
2737 1 as libc::c_int as libc::c_uchar,
2738 );
2739 let mut entry: listTypeEntry = listTypeEntry {
2740 li: 0 as *mut listTypeIterator,
2741 entry: quicklistEntry {
2742 quicklist: 0 as *const quicklist,
2743 node: 0 as *mut quicklistNode,
2744 zi: 0 as *mut libc::c_uchar,
2745 value: 0 as *mut libc::c_uchar,
2746 longval: 0,
2747 sz: 0,
2748 offset: 0,
2749 },
2750 };
2751 while listTypeNext(li, &mut entry) != 0 {
2752 let mut eleobj: *mut robj = listTypeGet(&mut entry);
2753 mixStringObjectDigest(digest, eleobj);
2754 decrRefCount(eleobj);
2755 }
2756 listTypeReleaseIterator(li);
2757 } else if (*o).type_0() as libc::c_int == 2 as libc::c_int {
2758 let mut si: *mut setTypeIterator = setTypeInitIterator(o);
2759 let mut sdsele: sds = 0 as *mut libc::c_char;
2760 loop {
2761 sdsele = setTypeNextObject(si);
2762 if sdsele.is_null() {
2763 break;
2764 }
2765 xorDigest(digest, sdsele as *const libc::c_void, sdslen(sdsele));
2766 sdsfree(sdsele);
2767 }
2768 setTypeReleaseIterator(si);
2769 } else if (*o).type_0() as libc::c_int == 3 as libc::c_int {
2770 let mut eledigest: [libc::c_uchar; 20] = [0; 20];
2771 if (*o).encoding() as libc::c_int == 11 as libc::c_int {
2772 let mut zl: *mut libc::c_uchar = (*o).ptr as *mut libc::c_uchar;
2773 let mut eptr: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
2774 let mut sptr: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
2775 let mut vstr: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
2776 let mut vlen: libc::c_uint = 0;
2777 let mut vll: libc::c_longlong = 0;
2778 let mut score: libc::c_double = 0.;
2779 eptr = lpSeek(zl, 0 as libc::c_int as libc::c_long);
2780 if !eptr.is_null() {} else {
2781 _serverAssert(
2782 b"eptr != NULL\0" as *const u8 as *const libc::c_char,
2783 b"debug.c\0" as *const u8 as *const libc::c_char,
2784 176 as libc::c_int,
2785 );
2786 unreachable!();
2787 };
2788 sptr = lpNext(zl, eptr);
2789 if !sptr.is_null() {} else {
2790 _serverAssert(
2791 b"sptr != NULL\0" as *const u8 as *const libc::c_char,
2792 b"debug.c\0" as *const u8 as *const libc::c_char,
2793 178 as libc::c_int,
2794 );
2795 unreachable!();
2796 };
2797 while !eptr.is_null() {
2798 vstr = lpGetValue(eptr, &mut vlen, &mut vll);
2799 score = zzlGetScore(sptr);
2800 memset(
2801 eledigest.as_mut_ptr() as *mut libc::c_void,
2802 0 as libc::c_int,
2803 20 as libc::c_int as libc::c_ulong,
2804 );
2805 if !vstr.is_null() {
2806 mixDigest(
2807 eledigest.as_mut_ptr(),
2808 vstr as *const libc::c_void,
2809 vlen as size_t,
2810 );
2811 } else {
2812 ll2string(
2813 buf.as_mut_ptr(),
2814 core::mem::size_of::<[libc::c_char; 128]>() as libc::c_ulong,
2815 vll,
2816 );
2817 mixDigest(
2818 eledigest.as_mut_ptr(),
2819 buf.as_mut_ptr() as *const libc::c_void,
2820 strlen(buf.as_mut_ptr()),
2821 );
2822 }
2823 snprintf(
2824 buf.as_mut_ptr(),
2825 core::mem::size_of::<[libc::c_char; 128]>() as libc::c_ulong,
2826 b"%.17g\0" as *const u8 as *const libc::c_char,
2827 score,
2828 );
2829 mixDigest(
2830 eledigest.as_mut_ptr(),
2831 buf.as_mut_ptr() as *const libc::c_void,
2832 strlen(buf.as_mut_ptr()),
2833 );
2834 xorDigest(
2835 digest,
2836 eledigest.as_mut_ptr() as *const libc::c_void,
2837 20 as libc::c_int as size_t,
2838 );
2839 zzlNext(zl, &mut eptr, &mut sptr);
2840 }
2841 } else if (*o).encoding() as libc::c_int == 7 as libc::c_int {
2842 let mut zs: *mut zset = (*o).ptr as *mut zset;
2843 let mut di: *mut dictIterator = dictGetIterator((*zs).dict);
2844 let mut de: *mut dictEntry = 0 as *mut dictEntry;
2845 loop {
2846 de = dictNext(di);
2847 if de.is_null() {
2848 break;
2849 }
2850 let mut sdsele_0: sds = (*de).key as sds;
2851 let mut score_0: *mut libc::c_double = (*de).v.val
2852 as *mut libc::c_double;
2853 snprintf(
2854 buf.as_mut_ptr(),
2855 core::mem::size_of::<[libc::c_char; 128]>() as libc::c_ulong,
2856 b"%.17g\0" as *const u8 as *const libc::c_char,
2857 *score_0,
2858 );
2859 memset(
2860 eledigest.as_mut_ptr() as *mut libc::c_void,
2861 0 as libc::c_int,
2862 20 as libc::c_int as libc::c_ulong,
2863 );
2864 mixDigest(
2865 eledigest.as_mut_ptr(),
2866 sdsele_0 as *const libc::c_void,
2867 sdslen(sdsele_0),
2868 );
2869 mixDigest(
2870 eledigest.as_mut_ptr(),
2871 buf.as_mut_ptr() as *const libc::c_void,
2872 strlen(buf.as_mut_ptr()),
2873 );
2874 xorDigest(
2875 digest,
2876 eledigest.as_mut_ptr() as *const libc::c_void,
2877 20 as libc::c_int as size_t,
2878 );
2879 }
2880 dictReleaseIterator(di);
2881 } else {
2882 _serverPanic(
2883 b"debug.c\0" as *const u8 as *const libc::c_char,
2884 214 as libc::c_int,
2885 b"Unknown sorted set encoding\0" as *const u8 as *const libc::c_char,
2886 );
2887 unreachable!();
2888 }
2889 } else if (*o).type_0() as libc::c_int == 4 as libc::c_int {
2890 let mut hi: *mut hashTypeIterator = hashTypeInitIterator(o);
2891 while hashTypeNext(hi) != -(1 as libc::c_int) {
2892 let mut eledigest_0: [libc::c_uchar; 20] = [0; 20];
2893 let mut sdsele_1: sds = 0 as *mut libc::c_char;
2894 memset(
2895 eledigest_0.as_mut_ptr() as *mut libc::c_void,
2896 0 as libc::c_int,
2897 20 as libc::c_int as libc::c_ulong,
2898 );
2899 sdsele_1 = hashTypeCurrentObjectNewSds(hi, 1 as libc::c_int);
2900 mixDigest(
2901 eledigest_0.as_mut_ptr(),
2902 sdsele_1 as *const libc::c_void,
2903 sdslen(sdsele_1),
2904 );
2905 sdsfree(sdsele_1);
2906 sdsele_1 = hashTypeCurrentObjectNewSds(hi, 2 as libc::c_int);
2907 mixDigest(
2908 eledigest_0.as_mut_ptr(),
2909 sdsele_1 as *const libc::c_void,
2910 sdslen(sdsele_1),
2911 );
2912 sdsfree(sdsele_1);
2913 xorDigest(
2914 digest,
2915 eledigest_0.as_mut_ptr() as *const libc::c_void,
2916 20 as libc::c_int as size_t,
2917 );
2918 }
2919 hashTypeReleaseIterator(hi);
2920 } else if (*o).type_0() as libc::c_int == 6 as libc::c_int {
2921 let mut si_0: streamIterator = streamIterator {
2922 stream: 0 as *mut stream,
2923 master_id: streamID { ms: 0, seq: 0 },
2924 master_fields_count: 0,
2925 master_fields_start: 0 as *mut libc::c_uchar,
2926 master_fields_ptr: 0 as *mut libc::c_uchar,
2927 entry_flags: 0,
2928 rev: 0,
2929 skip_tombstones: 0,
2930 start_key: [0; 2],
2931 end_key: [0; 2],
2932 ri: raxIterator {
2933 flags: 0,
2934 rt: 0 as *mut rax,
2935 key: 0 as *mut libc::c_uchar,
2936 data: 0 as *mut libc::c_void,
2937 key_len: 0,
2938 key_max: 0,
2939 key_static_string: [0; 128],
2940 node: 0 as *mut raxNode,
2941 stack: raxStack {
2942 stack: 0 as *mut *mut libc::c_void,
2943 items: 0,
2944 maxitems: 0,
2945 static_items: [0 as *mut libc::c_void; 32],
2946 oom: 0,
2947 },
2948 node_cb: None,
2949 },
2950 lp: 0 as *mut libc::c_uchar,
2951 lp_ele: 0 as *mut libc::c_uchar,
2952 lp_flags: 0 as *mut libc::c_uchar,
2953 field_buf: [0; 21],
2954 value_buf: [0; 21],
2955 };
2956 streamIteratorStart(
2957 &mut si_0,
2958 (*o).ptr as *mut stream,
2959 0 as *mut streamID,
2960 0 as *mut streamID,
2961 0 as libc::c_int,
2962 );
2963 let mut id: streamID = streamID { ms: 0, seq: 0 };
2964 let mut numfields: int64_t = 0;
2965 while streamIteratorGetID(&mut si_0, &mut id, &mut numfields) != 0 {
2966 let mut itemid: sds = sdscatfmt(
2967 sdsempty(),
2968 b"%U.%U\0" as *const u8 as *const libc::c_char,
2969 id.ms,
2970 id.seq,
2971 );
2972 mixDigest(digest, itemid as *const libc::c_void, sdslen(itemid));
2973 sdsfree(itemid);
2974 loop {
2975 let fresh1 = numfields;
2976 numfields = numfields - 1;
2977 if !(fresh1 != 0) {
2978 break;
2979 }
2980 let mut field: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
2981 let mut value: *mut libc::c_uchar = 0 as *mut libc::c_uchar;
2982 let mut field_len: int64_t = 0;
2983 let mut value_len: int64_t = 0;
2984 streamIteratorGetField(
2985 &mut si_0,
2986 &mut field,
2987 &mut value,
2988 &mut field_len,
2989 &mut value_len,
2990 );
2991 mixDigest(digest, field as *const libc::c_void, field_len as size_t);
2992 mixDigest(digest, value as *const libc::c_void, value_len as size_t);
2993 }
2994 }
2995 streamIteratorStop(&mut si_0);
2996 } else if (*o).type_0() as libc::c_int == 5 as libc::c_int {
2997 let mut md: RedisModuleDigest = {
2998 let mut init = RedisModuleDigest {
2999 o: [
3000 0 as libc::c_int as libc::c_uchar,
3001 0,
3002 0,
3003 0,
3004 0,
3005 0,
3006 0,
3007 0,
3008 0,
3009 0,
3010 0,
3011 0,
3012 0,
3013 0,
3014 0,
3015 0,
3016 0,
3017 0,
3018 0,
3019 0,
3020 ],
3021 x: [
3022 0 as libc::c_int as libc::c_uchar,
3023 0,
3024 0,
3025 0,
3026 0,
3027 0,
3028 0,
3029 0,
3030 0,
3031 0,
3032 0,
3033 0,
3034 0,
3035 0,
3036 0,
3037 0,
3038 0,
3039 0,
3040 0,
3041 0,
3042 ],
3043 key: keyobj,
3044 dbid: (*db).id,
3045 };
3046 init
3047 };
3048 let mut mv: *mut moduleValue = (*o).ptr as *mut moduleValue;
3049 let mut mt: *mut moduleType = (*mv).type_0;
3050 memset(
3051 (md.o).as_mut_ptr() as *mut libc::c_void,
3052 0 as libc::c_int,
3053 core::mem::size_of::<[libc::c_uchar; 20]>() as libc::c_ulong,
3054 );
3055 memset(
3056 (md.x).as_mut_ptr() as *mut libc::c_void,
3057 0 as libc::c_int,
3058 core::mem::size_of::<[libc::c_uchar; 20]>() as libc::c_ulong,
3059 );
3060 if ((*mt).digest).is_some() {
3061 ((*mt).digest).expect("non-null function pointer")(&mut md, (*mv).value);
3062 xorDigest(
3063 digest,
3064 (md.x).as_mut_ptr() as *const libc::c_void,
3065 core::mem::size_of::<[libc::c_uchar; 20]>() as libc::c_ulong,
3066 );
3067 }
3068 } else {
3069 _serverPanic(
3070 b"debug.c\0" as *const u8 as *const libc::c_char,
3071 263 as libc::c_int,
3072 b"Unknown object type\0" as *const u8 as *const libc::c_char,
3073 );
3074 unreachable!();
3075 }
3076 if expiretime != -(1 as libc::c_int) as libc::c_longlong {
3077 xorDigest(
3078 digest,
3079 b"!!expire!!\0" as *const u8 as *const libc::c_char as *const libc::c_void,
3080 10 as libc::c_int as size_t,
3081 );
3082 }
3083}
3084#[no_mangle]
3085pub unsafe extern "C" fn computeDatasetDigest(mut final_0: *mut libc::c_uchar) {
3086 let mut digest: [libc::c_uchar; 20] = [0; 20];
3087 let mut di: *mut dictIterator = 0 as *mut dictIterator;
3088 let mut de: *mut dictEntry = 0 as *mut dictEntry;
3089 let mut j: libc::c_int = 0;
3090 let mut aux: uint32_t = 0;
3091 memset(
3092 final_0 as *mut libc::c_void,
3093 0 as libc::c_int,
3094 20 as libc::c_int as libc::c_ulong,
3095 );
3096 j = 0 as libc::c_int;
3097 while j < server.dbnum {
3098 let mut db: *mut redisDb = (server.db).offset(j as isize);
3099 if !(((*(*db).dict).ht_used[0 as libc::c_int as usize])
3100 .wrapping_add((*(*db).dict).ht_used[1 as libc::c_int as usize])
3101 == 0 as libc::c_int as libc::c_ulong)
3102 {
3103 di = dictGetSafeIterator((*db).dict);
3104 aux = __bswap_32(j as __uint32_t);
3105 mixDigest(
3106 final_0,
3107 &mut aux as *mut uint32_t as *const libc::c_void,
3108 core::mem::size_of::<uint32_t>() as libc::c_ulong,
3109 );
3110 loop {
3111 de = dictNext(di);
3112 if de.is_null() {
3113 break;
3114 }
3115 let mut key: sds = 0 as *mut libc::c_char;
3116 let mut keyobj: *mut robj = 0 as *mut robj;
3117 let mut o: *mut robj = 0 as *mut robj;
3118 memset(
3119 digest.as_mut_ptr() as *mut libc::c_void,
3120 0 as libc::c_int,
3121 20 as libc::c_int as libc::c_ulong,
3122 );
3123 key = (*de).key as sds;
3124 keyobj = createStringObject(key as *const libc::c_char, sdslen(key));
3125 mixDigest(digest.as_mut_ptr(), key as *const libc::c_void, sdslen(key));
3126 o = (*de).v.val as *mut robj;
3127 xorObjectDigest(db, keyobj, digest.as_mut_ptr(), o);
3128 xorDigest(
3129 final_0,
3130 digest.as_mut_ptr() as *const libc::c_void,
3131 20 as libc::c_int as size_t,
3132 );
3133 decrRefCount(keyobj);
3134 }
3135 dictReleaseIterator(di);
3136 }
3137 j += 1;
3138 }
3139}
3140#[no_mangle]
3141pub unsafe extern "C" fn mallctl_int(
3142 mut c: *mut client,
3143 mut argv: *mut *mut robj,
3144 mut argc: libc::c_int,
3145) {
3146 let mut ret: libc::c_int = 0;
3147 let mut old: int64_t = 0 as libc::c_int as int64_t;
3148 let mut val: int64_t = 0;
3149 if argc > 1 as libc::c_int {
3150 let mut ll: libc::c_longlong = 0;
3151 if getLongLongFromObjectOrReply(
3152 c,
3153 *argv.offset(1 as libc::c_int as isize),
3154 &mut ll,
3155 0 as *const libc::c_char,
3156 ) != 0 as libc::c_int
3157 {
3158 return;
3159 }
3160 val = ll as int64_t;
3161 }
3162 let mut sz: size_t = core::mem::size_of::<int64_t>() as libc::c_ulong;
3163 while sz > 0 as libc::c_int as libc::c_ulong {
3164 ret = je_mallctl(
3165 (**argv.offset(0 as libc::c_int as isize)).ptr as *const libc::c_char,
3166 &mut old as *mut int64_t as *mut libc::c_void,
3167 &mut sz,
3168 (if argc > 1 as libc::c_int {
3169 &mut val as *mut int64_t
3170 } else {
3171 0 as *mut int64_t
3172 }) as *mut libc::c_void,
3173 if argc > 1 as libc::c_int { sz } else { 0 as libc::c_int as libc::c_ulong },
3174 );
3175 if ret != 0 {
3176 if ret == 1 as libc::c_int && argc > 1 as libc::c_int {
3177 ret = je_mallctl(
3178 (**argv.offset(0 as libc::c_int as isize)).ptr
3179 as *const libc::c_char,
3180 0 as *mut libc::c_void,
3181 0 as *mut size_t,
3182 &mut val as *mut int64_t as *mut libc::c_void,
3183 sz,
3184 );
3185 if ret == 0 {
3186 addReply(c, shared.ok);
3187 return;
3188 }
3189 }
3190 if ret == 22 as libc::c_int {
3191 sz = (sz as libc::c_ulong)
3192 .wrapping_div(2 as libc::c_int as libc::c_ulong) as size_t as size_t;
3193 } else {
3194 addReplyErrorFormat(
3195 c,
3196 b"%s\0" as *const u8 as *const libc::c_char,
3197 strerror(ret),
3198 );
3199 return;
3200 }
3201 } else {
3202 addReplyLongLong(c, old as libc::c_longlong);
3203 return;
3204 }
3205 }
3206 addReplyErrorFormat(
3207 c,
3208 b"%s\0" as *const u8 as *const libc::c_char,
3209 strerror(22 as libc::c_int),
3210 );
3211}
3212#[no_mangle]
3213pub unsafe extern "C" fn mallctl_string(
3214 mut c: *mut client,
3215 mut argv: *mut *mut robj,
3216 mut argc: libc::c_int,
3217) {
3218 let mut rret: libc::c_int = 0;
3219 let mut wret: libc::c_int = 0;
3220 let mut old: *mut libc::c_char = 0 as *mut libc::c_char;
3221 let mut sz: size_t = core::mem::size_of::<*mut libc::c_char>() as libc::c_ulong;
3222 rret = je_mallctl(
3223 (**argv.offset(0 as libc::c_int as isize)).ptr as *const libc::c_char,
3224 &mut old as *mut *mut libc::c_char as *mut libc::c_void,
3225 &mut sz,
3226 0 as *mut libc::c_void,
3227 0 as libc::c_int as size_t,
3228 );
3229 if rret != 0 {
3230 if !(rret == 1 as libc::c_int && argc > 1 as libc::c_int) {
3231 addReplyErrorFormat(
3232 c,
3233 b"%s\0" as *const u8 as *const libc::c_char,
3234 strerror(rret),
3235 );
3236 return;
3237 }
3238 }
3239 if argc > 1 as libc::c_int {
3240 let mut val: *mut libc::c_char = (**argv.offset(1 as libc::c_int as isize)).ptr
3241 as *mut libc::c_char;
3242 let mut valref: *mut *mut libc::c_char = &mut val;
3243 if strcmp(val, b"VOID\0" as *const u8 as *const libc::c_char) == 0 {
3244 valref = 0 as *mut *mut libc::c_char;
3245 sz = 0 as libc::c_int as size_t;
3246 }
3247 wret = je_mallctl(
3248 (**argv.offset(0 as libc::c_int as isize)).ptr as *const libc::c_char,
3249 0 as *mut libc::c_void,
3250 0 as *mut size_t,
3251 valref as *mut libc::c_void,
3252 sz,
3253 );
3254 }
3255 if rret == 0 {
3256 addReplyBulkCString(c, old);
3257 } else if wret != 0 {
3258 addReplyErrorFormat(
3259 c,
3260 b"%s\0" as *const u8 as *const libc::c_char,
3261 strerror(wret),
3262 );
3263 } else {
3264 addReply(c, shared.ok);
3265 };
3266}
3267#[no_mangle]
3268pub unsafe extern "C" fn debugCommand(mut c: *mut client) {
3269 if (*c).argc == 2 as libc::c_int
3270 && strcasecmp(
3271 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3272 b"help\0" as *const u8 as *const libc::c_char,
3273 ) == 0
3274 {
3275 let mut help: [*const libc::c_char; 102] = [
3276 b"AOF-FLUSH-SLEEP <microsec>\0" as *const u8 as *const libc::c_char,
3277 b" Server will sleep before flushing the AOF, this is used for testing.\0"
3278 as *const u8 as *const libc::c_char,
3279 b"ASSERT\0" as *const u8 as *const libc::c_char,
3280 b" Crash by assertion failed.\0" as *const u8 as *const libc::c_char,
3281 b"CHANGE-REPL-ID\0" as *const u8 as *const libc::c_char,
3282 b" Change the replication IDs of the instance.\0" as *const u8
3283 as *const libc::c_char,
3284 b" Dangerous: should be used only for testing the replication subsystem.\0"
3285 as *const u8 as *const libc::c_char,
3286 b"CONFIG-REWRITE-FORCE-ALL\0" as *const u8 as *const libc::c_char,
3287 b" Like CONFIG REWRITE but writes all configuration options, including\0"
3288 as *const u8 as *const libc::c_char,
3289 b" keywords not listed in original configuration file or default values.\0"
3290 as *const u8 as *const libc::c_char,
3291 b"CRASH-AND-RECOVER [<milliseconds>]\0" as *const u8 as *const libc::c_char,
3292 b" Hard crash and restart after a <milliseconds> delay (default 0).\0"
3293 as *const u8 as *const libc::c_char,
3294 b"DIGEST\0" as *const u8 as *const libc::c_char,
3295 b" Output a hex signature representing the current DB content.\0"
3296 as *const u8 as *const libc::c_char,
3297 b"DIGEST-VALUE <key> [<key> ...]\0" as *const u8 as *const libc::c_char,
3298 b" Output a hex signature of the values of all the specified keys.\0"
3299 as *const u8 as *const libc::c_char,
3300 b"ERROR <string>\0" as *const u8 as *const libc::c_char,
3301 b" Return a Redis protocol error with <string> as message. Useful for clients\0"
3302 as *const u8 as *const libc::c_char,
3303 b" unit tests to simulate Redis errors.\0" as *const u8
3304 as *const libc::c_char,
3305 b"LEAK <string>\0" as *const u8 as *const libc::c_char,
3306 b" Create a memory leak of the input string.\0" as *const u8
3307 as *const libc::c_char,
3308 b"LOG <message>\0" as *const u8 as *const libc::c_char,
3309 b" Write <message> to the server log.\0" as *const u8
3310 as *const libc::c_char,
3311 b"HTSTATS <dbid>\0" as *const u8 as *const libc::c_char,
3312 b" Return hash table statistics of the specified Redis database.\0"
3313 as *const u8 as *const libc::c_char,
3314 b"HTSTATS-KEY <key>\0" as *const u8 as *const libc::c_char,
3315 b" Like HTSTATS but for the hash table stored at <key>'s value.\0"
3316 as *const u8 as *const libc::c_char,
3317 b"LOADAOF\0" as *const u8 as *const libc::c_char,
3318 b" Flush the AOF buffers on disk and reload the AOF in memory.\0"
3319 as *const u8 as *const libc::c_char,
3320 b"REPLICATE <string>\0" as *const u8 as *const libc::c_char,
3321 b" Replicates the provided string to replicas, allowing data divergence.\0"
3322 as *const u8 as *const libc::c_char,
3323 b"MALLCTL <key> [<val>]\0" as *const u8 as *const libc::c_char,
3324 b" Get or set a malloc tuning integer.\0" as *const u8
3325 as *const libc::c_char,
3326 b"MALLCTL-STR <key> [<val>]\0" as *const u8 as *const libc::c_char,
3327 b" Get or set a malloc tuning string.\0" as *const u8
3328 as *const libc::c_char,
3329 b"OBJECT <key>\0" as *const u8 as *const libc::c_char,
3330 b" Show low level info about `key` and associated value.\0" as *const u8
3331 as *const libc::c_char,
3332 b"DROP-CLUSTER-PACKET-FILTER <packet-type>\0" as *const u8
3333 as *const libc::c_char,
3334 b" Drop all packets that match the filtered type. Set to -1 allow all packets.\0"
3335 as *const u8 as *const libc::c_char,
3336 b"OOM\0" as *const u8 as *const libc::c_char,
3337 b" Crash the server simulating an out-of-memory error.\0" as *const u8
3338 as *const libc::c_char,
3339 b"PANIC\0" as *const u8 as *const libc::c_char,
3340 b" Crash the server simulating a panic.\0" as *const u8
3341 as *const libc::c_char,
3342 b"POPULATE <count> [<prefix>] [<size>]\0" as *const u8
3343 as *const libc::c_char,
3344 b" Create <count> string keys named key:<num>. If <prefix> is specified then\0"
3345 as *const u8 as *const libc::c_char,
3346 b" it is used instead of the 'key' prefix. These are not propagated to\0"
3347 as *const u8 as *const libc::c_char,
3348 b" replicas. Cluster slots are not respected so keys not belonging to the\0"
3349 as *const u8 as *const libc::c_char,
3350 b" current node can be created in cluster mode.\0" as *const u8
3351 as *const libc::c_char,
3352 b"PROTOCOL <type>\0" as *const u8 as *const libc::c_char,
3353 b" Reply with a test value of the specified type. <type> can be: string,\0"
3354 as *const u8 as *const libc::c_char,
3355 b" integer, double, bignum, null, array, set, map, attrib, push, verbatim,\0"
3356 as *const u8 as *const libc::c_char,
3357 b" true, false.\0" as *const u8 as *const libc::c_char,
3358 b"RELOAD [option ...]\0" as *const u8 as *const libc::c_char,
3359 b" Save the RDB on disk and reload it back to memory. Valid <option> values:\0"
3360 as *const u8 as *const libc::c_char,
3361 b" * MERGE: conflicting keys will be loaded from RDB.\0" as *const u8
3362 as *const libc::c_char,
3363 b" * NOFLUSH: the existing database will not be removed before load, but\0"
3364 as *const u8 as *const libc::c_char,
3365 b" conflicting keys will generate an exception and kill the server.\0"
3366 as *const u8 as *const libc::c_char,
3367 b" * NOSAVE: the database will be loaded from an existing RDB file.\0"
3368 as *const u8 as *const libc::c_char,
3369 b" Examples:\0" as *const u8 as *const libc::c_char,
3370 b" * DEBUG RELOAD: verify that the server is able to persist, flush and reload\0"
3371 as *const u8 as *const libc::c_char,
3372 b" the database.\0" as *const u8 as *const libc::c_char,
3373 b" * DEBUG RELOAD NOSAVE: replace the current database with the contents of an\0"
3374 as *const u8 as *const libc::c_char,
3375 b" existing RDB file.\0" as *const u8 as *const libc::c_char,
3376 b" * DEBUG RELOAD NOSAVE NOFLUSH MERGE: add the contents of an existing RDB\0"
3377 as *const u8 as *const libc::c_char,
3378 b" file to the database.\0" as *const u8 as *const libc::c_char,
3379 b"RESTART [<milliseconds>]\0" as *const u8 as *const libc::c_char,
3380 b" Graceful restart: save config, db, restart after a <milliseconds> delay (default 0).\0"
3381 as *const u8 as *const libc::c_char,
3382 b"SDSLEN <key>\0" as *const u8 as *const libc::c_char,
3383 b" Show low level SDS string info representing `key` and value.\0"
3384 as *const u8 as *const libc::c_char,
3385 b"SEGFAULT\0" as *const u8 as *const libc::c_char,
3386 b" Crash the server with sigsegv.\0" as *const u8 as *const libc::c_char,
3387 b"SET-ACTIVE-EXPIRE <0|1>\0" as *const u8 as *const libc::c_char,
3388 b" Setting it to 0 disables expiring keys in background when they are not\0"
3389 as *const u8 as *const libc::c_char,
3390 b" accessed (otherwise the Redis behavior). Setting it to 1 reenables back the\0"
3391 as *const u8 as *const libc::c_char,
3392 b" default.\0" as *const u8 as *const libc::c_char,
3393 b"QUICKLIST-PACKED-THRESHOLD <size>\0" as *const u8 as *const libc::c_char,
3394 b" Sets the threshold for elements to be inserted as plain vs packed nodes\0"
3395 as *const u8 as *const libc::c_char,
3396 b" Default value is 1GB, allows values up to 4GB. Setting to 0 restores to default.\0"
3397 as *const u8 as *const libc::c_char,
3398 b"SET-SKIP-CHECKSUM-VALIDATION <0|1>\0" as *const u8 as *const libc::c_char,
3399 b" Enables or disables checksum checks for RDB files and RESTORE's payload.\0"
3400 as *const u8 as *const libc::c_char,
3401 b"SLEEP <seconds>\0" as *const u8 as *const libc::c_char,
3402 b" Stop the server for <seconds>. Decimals allowed.\0" as *const u8
3403 as *const libc::c_char,
3404 b"STRINGMATCH-TEST\0" as *const u8 as *const libc::c_char,
3405 b" Run a fuzz tester against the stringmatchlen() function.\0"
3406 as *const u8 as *const libc::c_char,
3407 b"STRUCTSIZE\0" as *const u8 as *const libc::c_char,
3408 b" Return the size of different Redis core C structures.\0" as *const u8
3409 as *const libc::c_char,
3410 b"LISTPACK <key>\0" as *const u8 as *const libc::c_char,
3411 b" Show low level info about the listpack encoding of <key>.\0"
3412 as *const u8 as *const libc::c_char,
3413 b"QUICKLIST <key> [<0|1>]\0" as *const u8 as *const libc::c_char,
3414 b" Show low level info about the quicklist encoding of <key>.\0"
3415 as *const u8 as *const libc::c_char,
3416 b" The optional argument (0 by default) sets the level of detail\0"
3417 as *const u8 as *const libc::c_char,
3418 b"CLIENT-EVICTION\0" as *const u8 as *const libc::c_char,
3419 b" Show low level client eviction pools info (maxmemory-clients).\0"
3420 as *const u8 as *const libc::c_char,
3421 b"PAUSE-CRON <0|1>\0" as *const u8 as *const libc::c_char,
3422 b" Stop periodic cron job processing.\0" as *const u8
3423 as *const libc::c_char,
3424 b"REPLYBUFFER PEAK-RESET-TIME <NEVER||RESET|time>\0" as *const u8
3425 as *const libc::c_char,
3426 b" Sets the time (in milliseconds) to wait between client reply buffer peak resets.\0"
3427 as *const u8 as *const libc::c_char,
3428 b" In case NEVER is provided the last observed peak will never be reset\0"
3429 as *const u8 as *const libc::c_char,
3430 b" In case RESET is provided the peak reset time will be restored to the default value\0"
3431 as *const u8 as *const libc::c_char,
3432 b"REPLYBUFFER RESIZING <0|1>\0" as *const u8 as *const libc::c_char,
3433 b" Enable or disable the replay buffer resize cron job\0" as *const u8
3434 as *const libc::c_char,
3435 0 as *const libc::c_char,
3436 ];
3437 addReplyHelp(c, help.as_mut_ptr());
3438 } else if strcasecmp(
3439 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3440 b"segfault\0" as *const u8 as *const libc::c_char,
3441 ) == 0
3442 {
3443 let mut p: *mut libc::c_char = mmap(
3444 0 as *mut libc::c_void,
3445 4096 as libc::c_int as size_t,
3446 0x1 as libc::c_int,
3447 0x2 as libc::c_int | 0x20 as libc::c_int,
3448 -(1 as libc::c_int),
3449 0 as libc::c_int as __off64_t,
3450 ) as *mut libc::c_char;
3451 *p = 'x' as i32 as libc::c_char;
3452 } else if strcasecmp(
3453 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3454 b"panic\0" as *const u8 as *const libc::c_char,
3455 ) == 0
3456 {
3457 _serverPanic(
3458 b"debug.c\0" as *const u8 as *const libc::c_char,
3459 503 as libc::c_int,
3460 b"DEBUG PANIC called at Unix time %lld\0" as *const u8
3461 as *const libc::c_char,
3462 time(0 as *mut time_t) as libc::c_longlong,
3463 );
3464 unreachable!();
3465 } else if strcasecmp(
3466 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3467 b"restart\0" as *const u8 as *const libc::c_char,
3468 ) == 0
3469 || strcasecmp(
3470 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3471 b"crash-and-recover\0" as *const u8 as *const libc::c_char,
3472 ) == 0
3473 {
3474 let mut delay: libc::c_longlong = 0 as libc::c_int as libc::c_longlong;
3475 if (*c).argc >= 3 as libc::c_int {
3476 if getLongLongFromObjectOrReply(
3477 c,
3478 *((*c).argv).offset(2 as libc::c_int as isize),
3479 &mut delay,
3480 0 as *const libc::c_char,
3481 ) != 0 as libc::c_int
3482 {
3483 return;
3484 }
3485 if delay < 0 as libc::c_int as libc::c_longlong {
3486 delay = 0 as libc::c_int as libc::c_longlong;
3487 }
3488 }
3489 let mut flags: libc::c_int = if strcasecmp(
3490 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3491 b"restart\0" as *const u8 as *const libc::c_char,
3492 ) == 0
3493 {
3494 (1 as libc::c_int) << 0 as libc::c_int
3495 | (1 as libc::c_int) << 1 as libc::c_int
3496 } else {
3497 0 as libc::c_int
3498 };
3499 restartServer(flags, delay);
3500 addReplyError(
3501 c,
3502 b"failed to restart the server. Check server logs.\0" as *const u8
3503 as *const libc::c_char,
3504 );
3505 } else if strcasecmp(
3506 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3507 b"oom\0" as *const u8 as *const libc::c_char,
3508 ) == 0
3509 {
3510 let mut ptr: *mut libc::c_void = zmalloc(
3511 (9223372036854775807 as libc::c_long as libc::c_ulong)
3512 .wrapping_mul(2 as libc::c_ulong)
3513 .wrapping_add(1 as libc::c_ulong),
3514 );
3515 zfree(ptr);
3516 addReply(c, shared.ok);
3517 } else if strcasecmp(
3518 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3519 b"assert\0" as *const u8 as *const libc::c_char,
3520 ) == 0
3521 {
3522 if 1 as libc::c_int == 2 as libc::c_int {} else {
3523 _serverAssertWithInfo(
3524 c,
3525 *((*c).argv).offset(0 as libc::c_int as isize),
3526 b"1 == 2\0" as *const u8 as *const libc::c_char,
3527 b"debug.c\0" as *const u8 as *const libc::c_char,
3528 523 as libc::c_int,
3529 );
3530 unreachable!();
3531 };
3532 } else if strcasecmp(
3533 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3534 b"log\0" as *const u8 as *const libc::c_char,
3535 ) == 0 && (*c).argc == 3 as libc::c_int
3536 {
3537 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
3538 _serverLog(
3539 3 as libc::c_int,
3540 b"DEBUG LOG: %s\0" as *const u8 as *const libc::c_char,
3541 (**((*c).argv).offset(2 as libc::c_int as isize)).ptr
3542 as *mut libc::c_char,
3543 );
3544 }
3545 addReply(c, shared.ok);
3546 } else if strcasecmp(
3547 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3548 b"leak\0" as *const u8 as *const libc::c_char,
3549 ) == 0 && (*c).argc == 3 as libc::c_int
3550 {
3551 sdsdup((**((*c).argv).offset(2 as libc::c_int as isize)).ptr as sds);
3552 addReply(c, shared.ok);
3553 } else if strcasecmp(
3554 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3555 b"reload\0" as *const u8 as *const libc::c_char,
3556 ) == 0
3557 {
3558 let mut flush: libc::c_int = 1 as libc::c_int;
3559 let mut save: libc::c_int = 1 as libc::c_int;
3560 let mut flags_0: libc::c_int = 0 as libc::c_int;
3561 let mut j: libc::c_int = 2 as libc::c_int;
3562 while j < (*c).argc {
3563 let mut opt: *mut libc::c_char = (**((*c).argv).offset(j as isize)).ptr
3564 as *mut libc::c_char;
3565 if strcasecmp(opt, b"MERGE\0" as *const u8 as *const libc::c_char) == 0 {
3566 flags_0 |= (1 as libc::c_int) << 2 as libc::c_int;
3567 } else if strcasecmp(opt, b"NOFLUSH\0" as *const u8 as *const libc::c_char)
3568 == 0
3569 {
3570 flush = 0 as libc::c_int;
3571 } else if strcasecmp(opt, b"NOSAVE\0" as *const u8 as *const libc::c_char)
3572 == 0
3573 {
3574 save = 0 as libc::c_int;
3575 } else {
3576 addReplyError(
3577 c,
3578 b"DEBUG RELOAD only supports the MERGE, NOFLUSH and NOSAVE options.\0"
3579 as *const u8 as *const libc::c_char,
3580 );
3581 return;
3582 }
3583 j += 1;
3584 }
3585 if save != 0 {
3586 let mut rsi: rdbSaveInfo = rdbSaveInfo {
3587 repl_stream_db: 0,
3588 repl_id_is_set: 0,
3589 repl_id: [0; 41],
3590 repl_offset: 0,
3591 };
3592 let mut rsiptr: *mut rdbSaveInfo = 0 as *mut rdbSaveInfo;
3593 rsiptr = rdbPopulateSaveInfo(&mut rsi);
3594 if rdbSave(0 as libc::c_int, server.rdb_filename, rsiptr) != 0 as libc::c_int
3595 {
3596 addReplyErrorObject(c, shared.err);
3597 return;
3598 }
3599 }
3600 if flush != 0 {
3601 emptyData(-(1 as libc::c_int), 0 as libc::c_int, None);
3602 }
3603 protectClient(c);
3604 let mut ret: libc::c_int = rdbLoad(
3605 server.rdb_filename,
3606 0 as *mut rdbSaveInfo,
3607 flags_0,
3608 );
3609 unprotectClient(c);
3610 if ret != 0 as libc::c_int {
3611 addReplyError(
3612 c,
3613 b"Error trying to load the RDB dump\0" as *const u8
3614 as *const libc::c_char,
3615 );
3616 return;
3617 }
3618 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
3619 _serverLog(
3620 3 as libc::c_int,
3621 b"DB reloaded by DEBUG RELOAD\0" as *const u8 as *const libc::c_char,
3622 );
3623 }
3624 addReply(c, shared.ok);
3625 } else if strcasecmp(
3626 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3627 b"loadaof\0" as *const u8 as *const libc::c_char,
3628 ) == 0
3629 {
3630 if server.aof_state != 0 as libc::c_int {
3631 flushAppendOnlyFile(1 as libc::c_int);
3632 }
3633 emptyData(-(1 as libc::c_int), 0 as libc::c_int, None);
3634 protectClient(c);
3635 if !(server.aof_manifest).is_null() {
3636 aofManifestFree(server.aof_manifest);
3637 }
3638 aofLoadManifestFromDisk();
3639 aofDelHistoryFiles();
3640 let mut ret_0: libc::c_int = loadAppendOnlyFiles(server.aof_manifest);
3641 if ret_0 != 0 as libc::c_int && ret_0 != 2 as libc::c_int {
3642 exit(1 as libc::c_int);
3643 }
3644 unprotectClient(c);
3645 server.dirty = 0 as libc::c_int as libc::c_longlong;
3646 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
3647 _serverLog(
3648 3 as libc::c_int,
3649 b"Append Only File loaded by DEBUG LOADAOF\0" as *const u8
3650 as *const libc::c_char,
3651 );
3652 }
3653 addReply(c, shared.ok);
3654 } else if strcasecmp(
3655 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3656 b"drop-cluster-packet-filter\0" as *const u8 as *const libc::c_char,
3657 ) == 0 && (*c).argc == 3 as libc::c_int
3658 {
3659 let mut packet_type: libc::c_long = 0;
3660 if getLongFromObjectOrReply(
3661 c,
3662 *((*c).argv).offset(2 as libc::c_int as isize),
3663 &mut packet_type,
3664 0 as *const libc::c_char,
3665 ) != 0 as libc::c_int
3666 {
3667 return;
3668 }
3669 server.cluster_drop_packet_filter = packet_type as libc::c_int;
3670 addReply(c, shared.ok);
3671 } else if strcasecmp(
3672 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3673 b"object\0" as *const u8 as *const libc::c_char,
3674 ) == 0 && (*c).argc == 3 as libc::c_int
3675 {
3676 let mut de: *mut dictEntry = 0 as *mut dictEntry;
3677 let mut val: *mut robj = 0 as *mut robj;
3678 let mut strenc: *mut libc::c_char = 0 as *mut libc::c_char;
3679 de = dictFind(
3680 (*(*c).db).dict,
3681 (**((*c).argv).offset(2 as libc::c_int as isize)).ptr,
3682 );
3683 if de.is_null() {
3684 addReplyErrorObject(c, shared.nokeyerr);
3685 return;
3686 }
3687 val = (*de).v.val as *mut robj;
3688 strenc = strEncoding((*val).encoding() as libc::c_int);
3689 let mut extra: [libc::c_char; 138] = [
3690 0 as libc::c_int as libc::c_char,
3691 0,
3692 0,
3693 0,
3694 0,
3695 0,
3696 0,
3697 0,
3698 0,
3699 0,
3700 0,
3701 0,
3702 0,
3703 0,
3704 0,
3705 0,
3706 0,
3707 0,
3708 0,
3709 0,
3710 0,
3711 0,
3712 0,
3713 0,
3714 0,
3715 0,
3716 0,
3717 0,
3718 0,
3719 0,
3720 0,
3721 0,
3722 0,
3723 0,
3724 0,
3725 0,
3726 0,
3727 0,
3728 0,
3729 0,
3730 0,
3731 0,
3732 0,
3733 0,
3734 0,
3735 0,
3736 0,
3737 0,
3738 0,
3739 0,
3740 0,
3741 0,
3742 0,
3743 0,
3744 0,
3745 0,
3746 0,
3747 0,
3748 0,
3749 0,
3750 0,
3751 0,
3752 0,
3753 0,
3754 0,
3755 0,
3756 0,
3757 0,
3758 0,
3759 0,
3760 0,
3761 0,
3762 0,
3763 0,
3764 0,
3765 0,
3766 0,
3767 0,
3768 0,
3769 0,
3770 0,
3771 0,
3772 0,
3773 0,
3774 0,
3775 0,
3776 0,
3777 0,
3778 0,
3779 0,
3780 0,
3781 0,
3782 0,
3783 0,
3784 0,
3785 0,
3786 0,
3787 0,
3788 0,
3789 0,
3790 0,
3791 0,
3792 0,
3793 0,
3794 0,
3795 0,
3796 0,
3797 0,
3798 0,
3799 0,
3800 0,
3801 0,
3802 0,
3803 0,
3804 0,
3805 0,
3806 0,
3807 0,
3808 0,
3809 0,
3810 0,
3811 0,
3812 0,
3813 0,
3814 0,
3815 0,
3816 0,
3817 0,
3818 0,
3819 0,
3820 0,
3821 0,
3822 0,
3823 0,
3824 0,
3825 0,
3826 0,
3827 0,
3828 ];
3829 if (*val).encoding() as libc::c_int == 9 as libc::c_int {
3830 let mut nextra: *mut libc::c_char = extra.as_mut_ptr();
3831 let mut remaining: libc::c_int = core::mem::size_of::<
3832 [libc::c_char; 138],
3833 >() as libc::c_ulong as libc::c_int;
3834 let mut ql: *mut quicklist = (*val).ptr as *mut quicklist;
3835 let mut used: libc::c_int = snprintf(
3836 nextra,
3837 remaining as libc::c_ulong,
3838 b" ql_nodes:%lu\0" as *const u8 as *const libc::c_char,
3839 (*ql).len,
3840 );
3841 nextra = nextra.offset(used as isize);
3842 remaining -= used;
3843 let mut avg: libc::c_double = (*ql).count as libc::c_double
3844 / (*ql).len as libc::c_double;
3845 used = snprintf(
3846 nextra,
3847 remaining as libc::c_ulong,
3848 b" ql_avg_node:%.2f\0" as *const u8 as *const libc::c_char,
3849 avg,
3850 );
3851 nextra = nextra.offset(used as isize);
3852 remaining -= used;
3853 used = snprintf(
3854 nextra,
3855 remaining as libc::c_ulong,
3856 b" ql_listpack_max:%d\0" as *const u8 as *const libc::c_char,
3857 (*ql).fill(),
3858 );
3859 nextra = nextra.offset(used as isize);
3860 remaining -= used;
3861 let mut compressed: libc::c_int = ((*ql).compress() as libc::c_int
3862 != 0 as libc::c_int) as libc::c_int;
3863 used = snprintf(
3864 nextra,
3865 remaining as libc::c_ulong,
3866 b" ql_compressed:%d\0" as *const u8 as *const libc::c_char,
3867 compressed,
3868 );
3869 nextra = nextra.offset(used as isize);
3870 remaining -= used;
3871 let mut sz: libc::c_ulong = 0 as libc::c_int as libc::c_ulong;
3872 let mut node: *mut quicklistNode = (*ql).head;
3873 while !node.is_null() {
3874 sz = sz.wrapping_add((*node).sz);
3875 node = (*node).next;
3876 }
3877 used = snprintf(
3878 nextra,
3879 remaining as libc::c_ulong,
3880 b" ql_uncompressed_size:%lu\0" as *const u8 as *const libc::c_char,
3881 sz,
3882 );
3883 nextra = nextra.offset(used as isize);
3884 remaining -= used;
3885 }
3886 addReplyStatusFormat(
3887 c,
3888 b"Value at:%p refcount:%d encoding:%s serializedlength:%zu lru:%d lru_seconds_idle:%llu%s\0"
3889 as *const u8 as *const libc::c_char,
3890 val as *mut libc::c_void,
3891 (*val).refcount,
3892 strenc,
3893 rdbSavedObjectLen(
3894 val,
3895 *((*c).argv).offset(2 as libc::c_int as isize),
3896 (*(*c).db).id,
3897 ),
3898 (*val).lru() as libc::c_int,
3899 (estimateObjectIdleTime(val))
3900 .wrapping_div(1000 as libc::c_int as libc::c_ulonglong),
3901 extra.as_mut_ptr(),
3902 );
3903 } else if strcasecmp(
3904 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3905 b"sdslen\0" as *const u8 as *const libc::c_char,
3906 ) == 0 && (*c).argc == 3 as libc::c_int
3907 {
3908 let mut de_0: *mut dictEntry = 0 as *mut dictEntry;
3909 let mut val_0: *mut robj = 0 as *mut robj;
3910 let mut key: sds = 0 as *mut libc::c_char;
3911 de_0 = dictFind(
3912 (*(*c).db).dict,
3913 (**((*c).argv).offset(2 as libc::c_int as isize)).ptr,
3914 );
3915 if de_0.is_null() {
3916 addReplyErrorObject(c, shared.nokeyerr);
3917 return;
3918 }
3919 val_0 = (*de_0).v.val as *mut robj;
3920 key = (*de_0).key as sds;
3921 if (*val_0).type_0() as libc::c_int != 0 as libc::c_int
3922 || !((*val_0).encoding() as libc::c_int == 0 as libc::c_int
3923 || (*val_0).encoding() as libc::c_int == 8 as libc::c_int)
3924 {
3925 addReplyError(
3926 c,
3927 b"Not an sds encoded string.\0" as *const u8 as *const libc::c_char,
3928 );
3929 } else {
3930 addReplyStatusFormat(
3931 c,
3932 b"key_sds_len:%lld, key_sds_avail:%lld, key_zmalloc: %lld, val_sds_len:%lld, val_sds_avail:%lld, val_zmalloc: %lld\0"
3933 as *const u8 as *const libc::c_char,
3934 sdslen(key) as libc::c_longlong,
3935 sdsavail(key) as libc::c_longlong,
3936 sdsZmallocSize(key) as libc::c_longlong,
3937 sdslen((*val_0).ptr as sds) as libc::c_longlong,
3938 sdsavail((*val_0).ptr as sds) as libc::c_longlong,
3939 getStringObjectSdsUsedMemory(val_0) as libc::c_longlong,
3940 );
3941 }
3942 } else if strcasecmp(
3943 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3944 b"listpack\0" as *const u8 as *const libc::c_char,
3945 ) == 0 && (*c).argc == 3 as libc::c_int
3946 {
3947 let mut o: *mut robj = 0 as *mut robj;
3948 o = objectCommandLookupOrReply(
3949 c,
3950 *((*c).argv).offset(2 as libc::c_int as isize),
3951 shared.nokeyerr,
3952 );
3953 if o.is_null() {
3954 return;
3955 }
3956 if (*o).encoding() as libc::c_int != 11 as libc::c_int {
3957 addReplyError(
3958 c,
3959 b"Not a listpack encoded object.\0" as *const u8 as *const libc::c_char,
3960 );
3961 } else {
3962 lpRepr((*o).ptr as *mut libc::c_uchar);
3963 addReplyStatus(
3964 c,
3965 b"Listpack structure printed on stdout\0" as *const u8
3966 as *const libc::c_char,
3967 );
3968 }
3969 } else if strcasecmp(
3970 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
3971 b"quicklist\0" as *const u8 as *const libc::c_char,
3972 ) == 0 && ((*c).argc == 3 as libc::c_int || (*c).argc == 4 as libc::c_int)
3973 {
3974 let mut o_0: *mut robj = 0 as *mut robj;
3975 o_0 = objectCommandLookupOrReply(
3976 c,
3977 *((*c).argv).offset(2 as libc::c_int as isize),
3978 shared.nokeyerr,
3979 );
3980 if o_0.is_null() {
3981 return;
3982 }
3983 let mut full: libc::c_int = 0 as libc::c_int;
3984 if (*c).argc == 4 as libc::c_int {
3985 full = atoi(
3986 (**((*c).argv).offset(3 as libc::c_int as isize)).ptr
3987 as *const libc::c_char,
3988 );
3989 }
3990 if (*o_0).encoding() as libc::c_int != 9 as libc::c_int {
3991 addReplyError(
3992 c,
3993 b"Not a quicklist encoded object.\0" as *const u8 as *const libc::c_char,
3994 );
3995 } else {
3996 quicklistRepr((*o_0).ptr as *mut libc::c_uchar, full);
3997 addReplyStatus(
3998 c,
3999 b"Quicklist structure printed on stdout\0" as *const u8
4000 as *const libc::c_char,
4001 );
4002 }
4003 } else if strcasecmp(
4004 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4005 b"populate\0" as *const u8 as *const libc::c_char,
4006 ) == 0 && (*c).argc >= 3 as libc::c_int && (*c).argc <= 5 as libc::c_int
4007 {
4008 let mut keys: libc::c_long = 0;
4009 let mut j_0: libc::c_long = 0;
4010 let mut key_0: *mut robj = 0 as *mut robj;
4011 let mut val_1: *mut robj = 0 as *mut robj;
4012 let mut buf: [libc::c_char; 128] = [0; 128];
4013 if getPositiveLongFromObjectOrReply(
4014 c,
4015 *((*c).argv).offset(2 as libc::c_int as isize),
4016 &mut keys,
4017 0 as *const libc::c_char,
4018 ) != 0 as libc::c_int
4019 {
4020 return;
4021 }
4022 dictExpand((*(*c).db).dict, keys as libc::c_ulong);
4023 let mut valsize: libc::c_long = 0 as libc::c_int as libc::c_long;
4024 if (*c).argc == 5 as libc::c_int
4025 && getPositiveLongFromObjectOrReply(
4026 c,
4027 *((*c).argv).offset(4 as libc::c_int as isize),
4028 &mut valsize,
4029 0 as *const libc::c_char,
4030 ) != 0 as libc::c_int
4031 {
4032 return;
4033 }
4034 j_0 = 0 as libc::c_int as libc::c_long;
4035 while j_0 < keys {
4036 snprintf(
4037 buf.as_mut_ptr(),
4038 core::mem::size_of::<[libc::c_char; 128]>() as libc::c_ulong,
4039 b"%s:%lu\0" as *const u8 as *const libc::c_char,
4040 if (*c).argc == 3 as libc::c_int {
4041 b"key\0" as *const u8 as *const libc::c_char
4042 } else {
4043 (**((*c).argv).offset(3 as libc::c_int as isize)).ptr
4044 as *mut libc::c_char as *const libc::c_char
4045 },
4046 j_0,
4047 );
4048 key_0 = createStringObject(buf.as_mut_ptr(), strlen(buf.as_mut_ptr()));
4049 if !(lookupKeyWrite((*c).db, key_0)).is_null() {
4050 decrRefCount(key_0);
4051 } else {
4052 snprintf(
4053 buf.as_mut_ptr(),
4054 core::mem::size_of::<[libc::c_char; 128]>() as libc::c_ulong,
4055 b"value:%lu\0" as *const u8 as *const libc::c_char,
4056 j_0,
4057 );
4058 if valsize == 0 as libc::c_int as libc::c_long {
4059 val_1 = createStringObject(
4060 buf.as_mut_ptr(),
4061 strlen(buf.as_mut_ptr()),
4062 );
4063 } else {
4064 let mut buflen: libc::c_int = strlen(buf.as_mut_ptr())
4065 as libc::c_int;
4066 val_1 = createStringObject(
4067 0 as *const libc::c_char,
4068 valsize as size_t,
4069 );
4070 memcpy(
4071 (*val_1).ptr,
4072 buf.as_mut_ptr() as *const libc::c_void,
4073 (if valsize <= buflen as libc::c_long {
4074 valsize
4075 } else {
4076 buflen as libc::c_long
4077 }) as libc::c_ulong,
4078 );
4079 }
4080 dbAdd((*c).db, key_0, val_1);
4081 signalModifiedKey(c, (*c).db, key_0);
4082 decrRefCount(key_0);
4083 }
4084 j_0 += 1;
4085 }
4086 addReply(c, shared.ok);
4087 } else if strcasecmp(
4088 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4089 b"digest\0" as *const u8 as *const libc::c_char,
4090 ) == 0 && (*c).argc == 2 as libc::c_int
4091 {
4092 let mut digest: [libc::c_uchar; 20] = [0; 20];
4093 let mut d: sds = sdsempty();
4094 computeDatasetDigest(digest.as_mut_ptr());
4095 let mut i: libc::c_int = 0 as libc::c_int;
4096 while i < 20 as libc::c_int {
4097 d = sdscatprintf(
4098 d,
4099 b"%02x\0" as *const u8 as *const libc::c_char,
4100 digest[i as usize] as libc::c_int,
4101 );
4102 i += 1;
4103 }
4104 addReplyStatus(c, d as *const libc::c_char);
4105 sdsfree(d);
4106 } else if strcasecmp(
4107 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4108 b"digest-value\0" as *const u8 as *const libc::c_char,
4109 ) == 0 && (*c).argc >= 2 as libc::c_int
4110 {
4111 addReplyArrayLen(c, ((*c).argc - 2 as libc::c_int) as libc::c_long);
4112 let mut j_1: libc::c_int = 2 as libc::c_int;
4113 while j_1 < (*c).argc {
4114 let mut digest_0: [libc::c_uchar; 20] = [0; 20];
4115 memset(
4116 digest_0.as_mut_ptr() as *mut libc::c_void,
4117 0 as libc::c_int,
4118 20 as libc::c_int as libc::c_ulong,
4119 );
4120 let mut de_1: *mut dictEntry = 0 as *mut dictEntry;
4121 de_1 = dictFind((*(*c).db).dict, (**((*c).argv).offset(j_1 as isize)).ptr);
4122 let mut o_1: *mut robj = (if de_1.is_null() {
4123 0 as *mut libc::c_void
4124 } else {
4125 (*de_1).v.val
4126 }) as *mut robj;
4127 if !o_1.is_null() {
4128 xorObjectDigest(
4129 (*c).db,
4130 *((*c).argv).offset(j_1 as isize),
4131 digest_0.as_mut_ptr(),
4132 o_1,
4133 );
4134 }
4135 let mut d_0: sds = sdsempty();
4136 let mut i_0: libc::c_int = 0 as libc::c_int;
4137 while i_0 < 20 as libc::c_int {
4138 d_0 = sdscatprintf(
4139 d_0,
4140 b"%02x\0" as *const u8 as *const libc::c_char,
4141 digest_0[i_0 as usize] as libc::c_int,
4142 );
4143 i_0 += 1;
4144 }
4145 addReplyStatus(c, d_0 as *const libc::c_char);
4146 sdsfree(d_0);
4147 j_1 += 1;
4148 }
4149 } else if strcasecmp(
4150 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4151 b"protocol\0" as *const u8 as *const libc::c_char,
4152 ) == 0 && (*c).argc == 3 as libc::c_int
4153 {
4154 let mut name: *mut libc::c_char = (**((*c).argv)
4155 .offset(2 as libc::c_int as isize))
4156 .ptr as *mut libc::c_char;
4157 if strcasecmp(name, b"string\0" as *const u8 as *const libc::c_char) == 0 {
4158 addReplyBulkCString(c, b"Hello World\0" as *const u8 as *const libc::c_char);
4159 } else if strcasecmp(name, b"integer\0" as *const u8 as *const libc::c_char) == 0
4160 {
4161 addReplyLongLong(c, 12345 as libc::c_int as libc::c_longlong);
4162 } else if strcasecmp(name, b"double\0" as *const u8 as *const libc::c_char) == 0
4163 {
4164 addReplyDouble(c, 3.141f64);
4165 } else if strcasecmp(name, b"bignum\0" as *const u8 as *const libc::c_char) == 0
4166 {
4167 addReplyBigNum(
4168 c,
4169 b"1234567999999999999999999999999999999\0" as *const u8
4170 as *const libc::c_char,
4171 37 as libc::c_int as size_t,
4172 );
4173 } else if strcasecmp(name, b"null\0" as *const u8 as *const libc::c_char) == 0 {
4174 addReplyNull(c);
4175 } else if strcasecmp(name, b"array\0" as *const u8 as *const libc::c_char) == 0 {
4176 addReplyArrayLen(c, 3 as libc::c_int as libc::c_long);
4177 let mut j_2: libc::c_int = 0 as libc::c_int;
4178 while j_2 < 3 as libc::c_int {
4179 addReplyLongLong(c, j_2 as libc::c_longlong);
4180 j_2 += 1;
4181 }
4182 } else if strcasecmp(name, b"set\0" as *const u8 as *const libc::c_char) == 0 {
4183 addReplySetLen(c, 3 as libc::c_int as libc::c_long);
4184 let mut j_3: libc::c_int = 0 as libc::c_int;
4185 while j_3 < 3 as libc::c_int {
4186 addReplyLongLong(c, j_3 as libc::c_longlong);
4187 j_3 += 1;
4188 }
4189 } else if strcasecmp(name, b"map\0" as *const u8 as *const libc::c_char) == 0 {
4190 addReplyMapLen(c, 3 as libc::c_int as libc::c_long);
4191 let mut j_4: libc::c_int = 0 as libc::c_int;
4192 while j_4 < 3 as libc::c_int {
4193 addReplyLongLong(c, j_4 as libc::c_longlong);
4194 addReplyBool(c, (j_4 == 1 as libc::c_int) as libc::c_int);
4195 j_4 += 1;
4196 }
4197 } else if strcasecmp(name, b"attrib\0" as *const u8 as *const libc::c_char) == 0
4198 {
4199 if (*c).resp >= 3 as libc::c_int {
4200 addReplyAttributeLen(c, 1 as libc::c_int as libc::c_long);
4201 addReplyBulkCString(
4202 c,
4203 b"key-popularity\0" as *const u8 as *const libc::c_char,
4204 );
4205 addReplyArrayLen(c, 2 as libc::c_int as libc::c_long);
4206 addReplyBulkCString(c, b"key:123\0" as *const u8 as *const libc::c_char);
4207 addReplyLongLong(c, 90 as libc::c_int as libc::c_longlong);
4208 }
4209 addReplyBulkCString(
4210 c,
4211 b"Some real reply following the attribute\0" as *const u8
4212 as *const libc::c_char,
4213 );
4214 } else if strcasecmp(name, b"push\0" as *const u8 as *const libc::c_char) == 0 {
4215 if (*c).resp < 3 as libc::c_int {
4216 addReplyError(
4217 c,
4218 b"RESP2 is not supported by this command\0" as *const u8
4219 as *const libc::c_char,
4220 );
4221 return;
4222 }
4223 addReplyPushLen(c, 2 as libc::c_int as libc::c_long);
4224 addReplyBulkCString(
4225 c,
4226 b"server-cpu-usage\0" as *const u8 as *const libc::c_char,
4227 );
4228 addReplyLongLong(c, 42 as libc::c_int as libc::c_longlong);
4229 addReplyBulkCString(
4230 c,
4231 b"Some real reply following the push reply\0" as *const u8
4232 as *const libc::c_char,
4233 );
4234 } else if strcasecmp(name, b"true\0" as *const u8 as *const libc::c_char) == 0 {
4235 addReplyBool(c, 1 as libc::c_int);
4236 } else if strcasecmp(name, b"false\0" as *const u8 as *const libc::c_char) == 0 {
4237 addReplyBool(c, 0 as libc::c_int);
4238 } else if strcasecmp(name, b"verbatim\0" as *const u8 as *const libc::c_char)
4239 == 0
4240 {
4241 addReplyVerbatim(
4242 c,
4243 b"This is a verbatim\nstring\0" as *const u8 as *const libc::c_char,
4244 25 as libc::c_int as size_t,
4245 b"txt\0" as *const u8 as *const libc::c_char,
4246 );
4247 } else {
4248 addReplyError(
4249 c,
4250 b"Wrong protocol type name. Please use one of the following: string|integer|double|bignum|null|array|set|map|attrib|push|verbatim|true|false\0"
4251 as *const u8 as *const libc::c_char,
4252 );
4253 }
4254 } else if strcasecmp(
4255 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4256 b"sleep\0" as *const u8 as *const libc::c_char,
4257 ) == 0 && (*c).argc == 3 as libc::c_int
4258 {
4259 let mut dtime: libc::c_double = strtod(
4260 (**((*c).argv).offset(2 as libc::c_int as isize)).ptr as *const libc::c_char,
4261 0 as *mut *mut libc::c_char,
4262 );
4263 let mut utime: libc::c_longlong = (dtime
4264 * 1000000 as libc::c_int as libc::c_double) as libc::c_longlong;
4265 let mut tv: timespec = timespec { tv_sec: 0, tv_nsec: 0 };
4266 tv.tv_sec = (utime / 1000000 as libc::c_int as libc::c_longlong) as __time_t;
4267 tv
4268 .tv_nsec = (utime % 1000000 as libc::c_int as libc::c_longlong
4269 * 1000 as libc::c_int as libc::c_longlong) as __syscall_slong_t;
4270 nanosleep(&mut tv, 0 as *mut timespec);
4271 addReply(c, shared.ok);
4272 } else if strcasecmp(
4273 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4274 b"set-active-expire\0" as *const u8 as *const libc::c_char,
4275 ) == 0 && (*c).argc == 3 as libc::c_int
4276 {
4277 server
4278 .active_expire_enabled = atoi(
4279 (**((*c).argv).offset(2 as libc::c_int as isize)).ptr as *const libc::c_char,
4280 );
4281 addReply(c, shared.ok);
4282 } else if strcasecmp(
4283 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4284 b"quicklist-packed-threshold\0" as *const u8 as *const libc::c_char,
4285 ) == 0 && (*c).argc == 3 as libc::c_int
4286 {
4287 let mut memerr: libc::c_int = 0;
4288 let mut sz_0: libc::c_ulonglong = memtoull(
4289 (**((*c).argv).offset(2 as libc::c_int as isize)).ptr as *const libc::c_char,
4290 &mut memerr,
4291 );
4292 if memerr != 0 || quicklistisSetPackedThreshold(sz_0 as size_t) == 0 {
4293 addReplyError(
4294 c,
4295 b"argument must be a memory value bigger than 1 and smaller than 4gb\0"
4296 as *const u8 as *const libc::c_char,
4297 );
4298 } else {
4299 addReply(c, shared.ok);
4300 }
4301 } else if strcasecmp(
4302 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4303 b"set-skip-checksum-validation\0" as *const u8 as *const libc::c_char,
4304 ) == 0 && (*c).argc == 3 as libc::c_int
4305 {
4306 server
4307 .skip_checksum_validation = atoi(
4308 (**((*c).argv).offset(2 as libc::c_int as isize)).ptr as *const libc::c_char,
4309 );
4310 addReply(c, shared.ok);
4311 } else if strcasecmp(
4312 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4313 b"aof-flush-sleep\0" as *const u8 as *const libc::c_char,
4314 ) == 0 && (*c).argc == 3 as libc::c_int
4315 {
4316 server
4317 .aof_flush_sleep = atoi(
4318 (**((*c).argv).offset(2 as libc::c_int as isize)).ptr as *const libc::c_char,
4319 );
4320 addReply(c, shared.ok);
4321 } else if strcasecmp(
4322 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4323 b"replicate\0" as *const u8 as *const libc::c_char,
4324 ) == 0 && (*c).argc >= 3 as libc::c_int
4325 {
4326 replicationFeedSlaves(
4327 server.slaves,
4328 server.slaveseldb,
4329 ((*c).argv).offset(2 as libc::c_int as isize),
4330 (*c).argc - 2 as libc::c_int,
4331 );
4332 addReply(c, shared.ok);
4333 } else if strcasecmp(
4334 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4335 b"error\0" as *const u8 as *const libc::c_char,
4336 ) == 0 && (*c).argc == 3 as libc::c_int
4337 {
4338 let mut errstr: sds = sdsnewlen(
4339 b"-\0" as *const u8 as *const libc::c_char as *const libc::c_void,
4340 1 as libc::c_int as size_t,
4341 );
4342 errstr = sdscatsds(
4343 errstr,
4344 (**((*c).argv).offset(2 as libc::c_int as isize)).ptr as sds,
4345 );
4346 errstr = sdsmapchars(
4347 errstr,
4348 b"\n\r\0" as *const u8 as *const libc::c_char,
4349 b" \0" as *const u8 as *const libc::c_char,
4350 2 as libc::c_int as size_t,
4351 );
4352 errstr = sdscatlen(
4353 errstr,
4354 b"\r\n\0" as *const u8 as *const libc::c_char as *const libc::c_void,
4355 2 as libc::c_int as size_t,
4356 );
4357 addReplySds(c, errstr);
4358 } else if strcasecmp(
4359 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4360 b"structsize\0" as *const u8 as *const libc::c_char,
4361 ) == 0 && (*c).argc == 2 as libc::c_int
4362 {
4363 let mut sizes: sds = sdsempty();
4364 sizes = sdscatprintf(
4365 sizes,
4366 b"bits:%d \0" as *const u8 as *const libc::c_char,
4367 if core::mem::size_of::<*mut libc::c_void>() as libc::c_ulong
4368 == 8 as libc::c_int as libc::c_ulong
4369 {
4370 64 as libc::c_int
4371 } else {
4372 32 as libc::c_int
4373 },
4374 );
4375 sizes = sdscatprintf(
4376 sizes,
4377 b"robj:%d \0" as *const u8 as *const libc::c_char,
4378 core::mem::size_of::<robj>() as libc::c_ulong as libc::c_int,
4379 );
4380 sizes = sdscatprintf(
4381 sizes,
4382 b"dictentry:%d \0" as *const u8 as *const libc::c_char,
4383 core::mem::size_of::<dictEntry>() as libc::c_ulong as libc::c_int,
4384 );
4385 sizes = sdscatprintf(
4386 sizes,
4387 b"sdshdr5:%d \0" as *const u8 as *const libc::c_char,
4388 core::mem::size_of::<sdshdr5>() as libc::c_ulong as libc::c_int,
4389 );
4390 sizes = sdscatprintf(
4391 sizes,
4392 b"sdshdr8:%d \0" as *const u8 as *const libc::c_char,
4393 core::mem::size_of::<sdshdr8>() as libc::c_ulong as libc::c_int,
4394 );
4395 sizes = sdscatprintf(
4396 sizes,
4397 b"sdshdr16:%d \0" as *const u8 as *const libc::c_char,
4398 core::mem::size_of::<sdshdr16>() as libc::c_ulong as libc::c_int,
4399 );
4400 sizes = sdscatprintf(
4401 sizes,
4402 b"sdshdr32:%d \0" as *const u8 as *const libc::c_char,
4403 core::mem::size_of::<sdshdr32>() as libc::c_ulong as libc::c_int,
4404 );
4405 sizes = sdscatprintf(
4406 sizes,
4407 b"sdshdr64:%d \0" as *const u8 as *const libc::c_char,
4408 core::mem::size_of::<sdshdr64>() as libc::c_ulong as libc::c_int,
4409 );
4410 addReplyBulkSds(c, sizes);
4411 } else if strcasecmp(
4412 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4413 b"htstats\0" as *const u8 as *const libc::c_char,
4414 ) == 0 && (*c).argc == 3 as libc::c_int
4415 {
4416 let mut dbid: libc::c_long = 0;
4417 let mut stats: sds = sdsempty();
4418 let mut buf_0: [libc::c_char; 4096] = [0; 4096];
4419 if getLongFromObjectOrReply(
4420 c,
4421 *((*c).argv).offset(2 as libc::c_int as isize),
4422 &mut dbid,
4423 0 as *const libc::c_char,
4424 ) != 0 as libc::c_int
4425 {
4426 sdsfree(stats);
4427 return;
4428 }
4429 if dbid < 0 as libc::c_int as libc::c_long
4430 || dbid >= server.dbnum as libc::c_long
4431 {
4432 sdsfree(stats);
4433 addReplyError(
4434 c,
4435 b"Out of range database\0" as *const u8 as *const libc::c_char,
4436 );
4437 return;
4438 }
4439 stats = sdscatprintf(
4440 stats,
4441 b"[Dictionary HT]\n\0" as *const u8 as *const libc::c_char,
4442 );
4443 dictGetStats(
4444 buf_0.as_mut_ptr(),
4445 core::mem::size_of::<[libc::c_char; 4096]>() as libc::c_ulong,
4446 (*(server.db).offset(dbid as isize)).dict,
4447 );
4448 stats = sdscat(stats, buf_0.as_mut_ptr());
4449 stats = sdscatprintf(
4450 stats,
4451 b"[Expires HT]\n\0" as *const u8 as *const libc::c_char,
4452 );
4453 dictGetStats(
4454 buf_0.as_mut_ptr(),
4455 core::mem::size_of::<[libc::c_char; 4096]>() as libc::c_ulong,
4456 (*(server.db).offset(dbid as isize)).expires,
4457 );
4458 stats = sdscat(stats, buf_0.as_mut_ptr());
4459 addReplyVerbatim(
4460 c,
4461 stats as *const libc::c_char,
4462 sdslen(stats),
4463 b"txt\0" as *const u8 as *const libc::c_char,
4464 );
4465 sdsfree(stats);
4466 } else if strcasecmp(
4467 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4468 b"htstats-key\0" as *const u8 as *const libc::c_char,
4469 ) == 0 && (*c).argc == 3 as libc::c_int
4470 {
4471 let mut o_2: *mut robj = 0 as *mut robj;
4472 let mut ht: *mut dict = 0 as *mut dict;
4473 o_2 = objectCommandLookupOrReply(
4474 c,
4475 *((*c).argv).offset(2 as libc::c_int as isize),
4476 shared.nokeyerr,
4477 );
4478 if o_2.is_null() {
4479 return;
4480 }
4481 match (*o_2).encoding() as libc::c_int {
4482 7 => {
4483 let mut zs: *mut zset = (*o_2).ptr as *mut zset;
4484 ht = (*zs).dict;
4485 }
4486 2 => {
4487 ht = (*o_2).ptr as *mut dict;
4488 }
4489 _ => {}
4490 }
4491 if ht.is_null() {
4492 addReplyError(
4493 c,
4494 b"The value stored at the specified key is not represented using an hash table\0"
4495 as *const u8 as *const libc::c_char,
4496 );
4497 } else {
4498 let mut buf_1: [libc::c_char; 4096] = [0; 4096];
4499 dictGetStats(
4500 buf_1.as_mut_ptr(),
4501 core::mem::size_of::<[libc::c_char; 4096]>() as libc::c_ulong,
4502 ht,
4503 );
4504 addReplyVerbatim(
4505 c,
4506 buf_1.as_mut_ptr(),
4507 strlen(buf_1.as_mut_ptr()),
4508 b"txt\0" as *const u8 as *const libc::c_char,
4509 );
4510 }
4511 } else if strcasecmp(
4512 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4513 b"change-repl-id\0" as *const u8 as *const libc::c_char,
4514 ) == 0 && (*c).argc == 2 as libc::c_int
4515 {
4516 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4517 _serverLog(
4518 3 as libc::c_int,
4519 b"Changing replication IDs after receiving DEBUG change-repl-id\0"
4520 as *const u8 as *const libc::c_char,
4521 );
4522 }
4523 changeReplicationId();
4524 clearReplicationId2();
4525 addReply(c, shared.ok);
4526 } else if strcasecmp(
4527 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4528 b"stringmatch-test\0" as *const u8 as *const libc::c_char,
4529 ) == 0 && (*c).argc == 2 as libc::c_int
4530 {
4531 stringmatchlen_fuzz_test();
4532 addReplyStatus(
4533 c,
4534 b"Apparently Redis did not crash: test passed\0" as *const u8
4535 as *const libc::c_char,
4536 );
4537 } else if strcasecmp(
4538 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4539 b"set-disable-deny-scripts\0" as *const u8 as *const libc::c_char,
4540 ) == 0 && (*c).argc == 3 as libc::c_int
4541 {
4542 server
4543 .script_disable_deny_script = atoi(
4544 (**((*c).argv).offset(2 as libc::c_int as isize)).ptr as *const libc::c_char,
4545 );
4546 addReply(c, shared.ok);
4547 } else if strcasecmp(
4548 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4549 b"config-rewrite-force-all\0" as *const u8 as *const libc::c_char,
4550 ) == 0 && (*c).argc == 2 as libc::c_int
4551 {
4552 if rewriteConfig(server.configfile, 1 as libc::c_int) == -(1 as libc::c_int) {
4553 addReplyErrorFormat(
4554 c,
4555 b"CONFIG-REWRITE-FORCE-ALL failed: %s\0" as *const u8
4556 as *const libc::c_char,
4557 strerror(*__errno_location()),
4558 );
4559 } else {
4560 addReply(c, shared.ok);
4561 }
4562 } else if strcasecmp(
4563 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4564 b"client-eviction\0" as *const u8 as *const libc::c_char,
4565 ) == 0 && (*c).argc == 2 as libc::c_int
4566 {
4567 if (server.client_mem_usage_buckets).is_null() {
4568 addReplyError(
4569 c,
4570 b"maxmemory-clients is disabled.\0" as *const u8 as *const libc::c_char,
4571 );
4572 return;
4573 }
4574 let mut bucket_info: sds = sdsempty();
4575 let mut j_5: libc::c_int = 0 as libc::c_int;
4576 while j_5 < 1 as libc::c_int + 33 as libc::c_int - 15 as libc::c_int {
4577 if j_5 == 0 as libc::c_int {
4578 bucket_info = sdscatprintf(
4579 bucket_info,
4580 b"bucket 0\0" as *const u8 as *const libc::c_char,
4581 );
4582 } else {
4583 bucket_info = sdscatprintf(
4584 bucket_info,
4585 b"bucket %10zu\0" as *const u8 as *const libc::c_char,
4586 (1 as libc::c_int as size_t)
4587 << j_5 - 1 as libc::c_int + 15 as libc::c_int,
4588 );
4589 }
4590 if j_5
4591 == 1 as libc::c_int + 33 as libc::c_int - 15 as libc::c_int
4592 - 1 as libc::c_int
4593 {
4594 bucket_info = sdscatprintf(
4595 bucket_info,
4596 b"+ : \0" as *const u8 as *const libc::c_char,
4597 );
4598 } else {
4599 bucket_info = sdscatprintf(
4600 bucket_info,
4601 b" - %10zu: \0" as *const u8 as *const libc::c_char,
4602 ((1 as libc::c_int as size_t) << j_5 + 15 as libc::c_int)
4603 .wrapping_sub(1 as libc::c_int as libc::c_ulong),
4604 );
4605 }
4606 bucket_info = sdscatprintf(
4607 bucket_info,
4608 b"tot-mem: %10zu, clients: %lu\n\0" as *const u8 as *const libc::c_char,
4609 (*(server.client_mem_usage_buckets).offset(j_5 as isize)).mem_usage_sum,
4610 (*(*(server.client_mem_usage_buckets).offset(j_5 as isize)).clients).len,
4611 );
4612 j_5 += 1;
4613 }
4614 addReplyVerbatim(
4615 c,
4616 bucket_info as *const libc::c_char,
4617 sdslen(bucket_info),
4618 b"txt\0" as *const u8 as *const libc::c_char,
4619 );
4620 sdsfree(bucket_info);
4621 } else if strcasecmp(
4622 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4623 b"mallctl\0" as *const u8 as *const libc::c_char,
4624 ) == 0 && (*c).argc >= 3 as libc::c_int
4625 {
4626 mallctl_int(
4627 c,
4628 ((*c).argv).offset(2 as libc::c_int as isize),
4629 (*c).argc - 2 as libc::c_int,
4630 );
4631 return;
4632 } else {
4633 if strcasecmp(
4634 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr as *const libc::c_char,
4635 b"mallctl-str\0" as *const u8 as *const libc::c_char,
4636 ) == 0 && (*c).argc >= 3 as libc::c_int
4637 {
4638 mallctl_string(
4639 c,
4640 ((*c).argv).offset(2 as libc::c_int as isize),
4641 (*c).argc - 2 as libc::c_int,
4642 );
4643 return;
4644 } else {
4645 if strcasecmp(
4646 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr
4647 as *const libc::c_char,
4648 b"pause-cron\0" as *const u8 as *const libc::c_char,
4649 ) == 0 && (*c).argc == 3 as libc::c_int
4650 {
4651 server
4652 .pause_cron = atoi(
4653 (**((*c).argv).offset(2 as libc::c_int as isize)).ptr
4654 as *const libc::c_char,
4655 );
4656 addReply(c, shared.ok);
4657 } else if strcasecmp(
4658 (**((*c).argv).offset(1 as libc::c_int as isize)).ptr
4659 as *const libc::c_char,
4660 b"replybuffer\0" as *const u8 as *const libc::c_char,
4661 ) == 0 && (*c).argc == 4 as libc::c_int
4662 {
4663 if strcasecmp(
4664 (**((*c).argv).offset(2 as libc::c_int as isize)).ptr
4665 as *const libc::c_char,
4666 b"peak-reset-time\0" as *const u8 as *const libc::c_char,
4667 ) == 0
4668 {
4669 if strcasecmp(
4670 (**((*c).argv).offset(3 as libc::c_int as isize)).ptr
4671 as *const libc::c_char,
4672 b"never\0" as *const u8 as *const libc::c_char,
4673 ) == 0
4674 {
4675 server
4676 .reply_buffer_peak_reset_time = -(1 as libc::c_int)
4677 as libc::c_long;
4678 } else if strcasecmp(
4679 (**((*c).argv).offset(3 as libc::c_int as isize)).ptr
4680 as *const libc::c_char,
4681 b"reset\0" as *const u8 as *const libc::c_char,
4682 ) == 0
4683 {
4684 server
4685 .reply_buffer_peak_reset_time = 5000 as libc::c_int
4686 as libc::c_long;
4687 } else if getLongFromObjectOrReply(
4688 c,
4689 *((*c).argv).offset(3 as libc::c_int as isize),
4690 &mut server.reply_buffer_peak_reset_time,
4691 0 as *const libc::c_char,
4692 ) != 0 as libc::c_int
4693 {
4694 return
4695 }
4696 } else if strcasecmp(
4697 (**((*c).argv).offset(2 as libc::c_int as isize)).ptr
4698 as *const libc::c_char,
4699 b"resizing\0" as *const u8 as *const libc::c_char,
4700 ) == 0
4701 {
4702 server
4703 .reply_buffer_resizing_enabled = atoi(
4704 (**((*c).argv).offset(3 as libc::c_int as isize)).ptr
4705 as *const libc::c_char,
4706 );
4707 } else {
4708 addReplySubcommandSyntaxError(c);
4709 return;
4710 }
4711 addReply(c, shared.ok);
4712 } else {
4713 addReplySubcommandSyntaxError(c);
4714 return;
4715 }
4716 }
4717 };
4718}
4719#[no_mangle]
4720pub unsafe extern "C" fn _serverAssert(
4721 mut estr: *const libc::c_char,
4722 mut file: *const libc::c_char,
4723 mut line: libc::c_int,
4724) {
4725 bugReportStart();
4726 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4727 _serverLog(
4728 3 as libc::c_int,
4729 b"=== ASSERTION FAILED ===\0" as *const u8 as *const libc::c_char,
4730 );
4731 }
4732 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4733 _serverLog(
4734 3 as libc::c_int,
4735 b"==> %s:%d '%s' is not true\0" as *const u8 as *const libc::c_char,
4736 file,
4737 line,
4738 estr,
4739 );
4740 }
4741 if server.crashlog_enabled != 0 {
4742 logStackTrace(0 as *mut libc::c_void, 1 as libc::c_int);
4743 printCrashReport();
4744 }
4745 removeSignalHandlers();
4746 bugReportEnd(0 as libc::c_int, 0 as libc::c_int);
4747}
4748#[no_mangle]
4749pub unsafe extern "C" fn _serverAssertPrintClientInfo(mut c: *const client) {
4750 let mut j: libc::c_int = 0;
4751 let mut conninfo: [libc::c_char; 32] = [0; 32];
4752 bugReportStart();
4753 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4754 _serverLog(
4755 3 as libc::c_int,
4756 b"=== ASSERTION FAILED CLIENT CONTEXT ===\0" as *const u8
4757 as *const libc::c_char,
4758 );
4759 }
4760 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4761 _serverLog(
4762 3 as libc::c_int,
4763 b"client->flags = %llu\0" as *const u8 as *const libc::c_char,
4764 (*c).flags as libc::c_ulonglong,
4765 );
4766 }
4767 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4768 _serverLog(
4769 3 as libc::c_int,
4770 b"client->conn = %s\0" as *const u8 as *const libc::c_char,
4771 connGetInfo(
4772 (*c).conn,
4773 conninfo.as_mut_ptr(),
4774 core::mem::size_of::<[libc::c_char; 32]>() as libc::c_ulong,
4775 ),
4776 );
4777 }
4778 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4779 _serverLog(
4780 3 as libc::c_int,
4781 b"client->argc = %d\0" as *const u8 as *const libc::c_char,
4782 (*c).argc,
4783 );
4784 }
4785 j = 0 as libc::c_int;
4786 while j < (*c).argc {
4787 let mut buf: [libc::c_char; 128] = [0; 128];
4788 let mut arg: *mut libc::c_char = 0 as *mut libc::c_char;
4789 if (**((*c).argv).offset(j as isize)).type_0() as libc::c_int == 0 as libc::c_int
4790 && ((**((*c).argv).offset(j as isize)).encoding() as libc::c_int
4791 == 0 as libc::c_int
4792 || (**((*c).argv).offset(j as isize)).encoding() as libc::c_int
4793 == 8 as libc::c_int)
4794 {
4795 arg = (**((*c).argv).offset(j as isize)).ptr as *mut libc::c_char;
4796 } else {
4797 snprintf(
4798 buf.as_mut_ptr(),
4799 core::mem::size_of::<[libc::c_char; 128]>() as libc::c_ulong,
4800 b"Object type: %u, encoding: %u\0" as *const u8 as *const libc::c_char,
4801 (**((*c).argv).offset(j as isize)).type_0() as libc::c_int,
4802 (**((*c).argv).offset(j as isize)).encoding() as libc::c_int,
4803 );
4804 arg = buf.as_mut_ptr();
4805 }
4806 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4807 _serverLog(
4808 3 as libc::c_int,
4809 b"client->argv[%d] = \"%s\" (refcount: %d)\0" as *const u8
4810 as *const libc::c_char,
4811 j,
4812 arg,
4813 (**((*c).argv).offset(j as isize)).refcount,
4814 );
4815 }
4816 j += 1;
4817 }
4818}
4819#[no_mangle]
4820pub unsafe extern "C" fn serverLogObjectDebugInfo(mut o: *const robj) {
4821 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4822 _serverLog(
4823 3 as libc::c_int,
4824 b"Object type: %u\0" as *const u8 as *const libc::c_char,
4825 (*o).type_0() as libc::c_int,
4826 );
4827 }
4828 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4829 _serverLog(
4830 3 as libc::c_int,
4831 b"Object encoding: %u\0" as *const u8 as *const libc::c_char,
4832 (*o).encoding() as libc::c_int,
4833 );
4834 }
4835 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4836 _serverLog(
4837 3 as libc::c_int,
4838 b"Object refcount: %d\0" as *const u8 as *const libc::c_char,
4839 (*o).refcount,
4840 );
4841 }
4842}
4843#[no_mangle]
4844pub unsafe extern "C" fn _serverAssertPrintObject(mut o: *const robj) {
4845 bugReportStart();
4846 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4847 _serverLog(
4848 3 as libc::c_int,
4849 b"=== ASSERTION FAILED OBJECT CONTEXT ===\0" as *const u8
4850 as *const libc::c_char,
4851 );
4852 }
4853 serverLogObjectDebugInfo(o);
4854}
4855#[no_mangle]
4856pub unsafe extern "C" fn _serverAssertWithInfo(
4857 mut c: *const client,
4858 mut o: *const robj,
4859 mut estr: *const libc::c_char,
4860 mut file: *const libc::c_char,
4861 mut line: libc::c_int,
4862) {
4863 if !c.is_null() {
4864 _serverAssertPrintClientInfo(c);
4865 }
4866 if !o.is_null() {
4867 _serverAssertPrintObject(o);
4868 }
4869 _serverAssert(estr, file, line);
4870}
4871#[no_mangle]
4872pub unsafe extern "C" fn _serverPanic(
4873 mut file: *const libc::c_char,
4874 mut line: libc::c_int,
4875 mut msg: *const libc::c_char,
4876 mut args: ...
4877) {
4878 let mut ap: core::ffi::VaListImpl;
4879 ap = args.clone();
4880 let mut fmtmsg: [libc::c_char; 256] = [0; 256];
4881 vsnprintf(
4882 fmtmsg.as_mut_ptr(),
4883 core::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong,
4884 msg,
4885 ap.as_va_list(),
4886 );
4887 bugReportStart();
4888 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4889 _serverLog(
4890 3 as libc::c_int,
4891 b"------------------------------------------------\0" as *const u8
4892 as *const libc::c_char,
4893 );
4894 }
4895 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4896 _serverLog(
4897 3 as libc::c_int,
4898 b"!!! Software Failure. Press left mouse button to continue\0" as *const u8
4899 as *const libc::c_char,
4900 );
4901 }
4902 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4903 _serverLog(
4904 3 as libc::c_int,
4905 b"Guru Meditation: %s #%s:%d\0" as *const u8 as *const libc::c_char,
4906 fmtmsg.as_mut_ptr(),
4907 file,
4908 line,
4909 );
4910 }
4911 if server.crashlog_enabled != 0 {
4912 logStackTrace(0 as *mut libc::c_void, 1 as libc::c_int);
4913 printCrashReport();
4914 }
4915 removeSignalHandlers();
4916 bugReportEnd(0 as libc::c_int, 0 as libc::c_int);
4917}
4918#[no_mangle]
4919pub unsafe extern "C" fn bugReportStart() {
4920 pthread_mutex_lock(&mut bug_report_start_mutex);
4921 if bug_report_start == 0 as libc::c_int {
4922 serverLogRaw(
4923 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
4924 b"\n\n=== REDIS BUG REPORT START: Cut & paste starting from here ===\n\0"
4925 as *const u8 as *const libc::c_char,
4926 );
4927 bug_report_start = 1 as libc::c_int;
4928 }
4929 pthread_mutex_unlock(&mut bug_report_start_mutex);
4930}
4931unsafe extern "C" fn getAndSetMcontextEip(
4932 mut uc: *mut ucontext_t,
4933 mut eip: *mut libc::c_void,
4934) -> *mut libc::c_void {
4935 let mut old_val: *mut libc::c_void = (*uc).uc_mcontext.pc as *mut libc::c_void;
4936 if !eip.is_null() {
4937 let mut temp: *mut *mut libc::c_void = &mut (*uc).uc_mcontext.pc
4938 as *mut libc::c_ulonglong as *mut *mut libc::c_void;
4939 *temp = eip;
4940 }
4941 return old_val;
4942}
4943#[no_mangle]
4944pub unsafe extern "C" fn logStackContent(mut sp: *mut *mut libc::c_void) {
4945 let mut i: libc::c_int = 0;
4946 i = 15 as libc::c_int;
4947 while i >= 0 as libc::c_int {
4948 let mut addr: libc::c_ulong = (sp as libc::c_ulong)
4949 .wrapping_add(i as libc::c_ulong);
4950 let mut val: libc::c_ulong = *sp.offset(i as isize) as libc::c_ulong;
4951 if core::mem::size_of::<libc::c_long>() as libc::c_ulong
4952 == 4 as libc::c_int as libc::c_ulong
4953 {
4954 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4955 _serverLog(
4956 3 as libc::c_int,
4957 b"(%08lx) -> %08lx\0" as *const u8 as *const libc::c_char,
4958 addr,
4959 val,
4960 );
4961 }
4962 } else if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4963 _serverLog(
4964 3 as libc::c_int,
4965 b"(%016lx) -> %016lx\0" as *const u8 as *const libc::c_char,
4966 addr,
4967 val,
4968 );
4969 }
4970 i -= 1;
4971 }
4972}
4973#[no_mangle]
4974pub unsafe extern "C" fn logRegisters(mut uc: *mut ucontext_t) {
4975 if !(((3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int)
4976 & 0xff as libc::c_int) < server.verbosity)
4977 {
4978 _serverLog(
4979 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
4980 b"\n------ REGISTERS ------\n\0" as *const u8 as *const libc::c_char,
4981 );
4982 }
4983 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
4984 _serverLog(
4985 3 as libc::c_int,
4986 b"\nX18:%016lx X19:%016lx\nX20:%016lx X21:%016lx\nX22:%016lx X23:%016lx\nX24:%016lx X25:%016lx\nX26:%016lx X27:%016lx\nX28:%016lx X29:%016lx\nX30:%016lx\npc:%016lx sp:%016lx\npstate:%016lx fault_address:%016lx\n\0"
4987 as *const u8 as *const libc::c_char,
4988 (*uc).uc_mcontext.regs[18 as libc::c_int as usize] as libc::c_ulong,
4989 (*uc).uc_mcontext.regs[19 as libc::c_int as usize] as libc::c_ulong,
4990 (*uc).uc_mcontext.regs[20 as libc::c_int as usize] as libc::c_ulong,
4991 (*uc).uc_mcontext.regs[21 as libc::c_int as usize] as libc::c_ulong,
4992 (*uc).uc_mcontext.regs[22 as libc::c_int as usize] as libc::c_ulong,
4993 (*uc).uc_mcontext.regs[23 as libc::c_int as usize] as libc::c_ulong,
4994 (*uc).uc_mcontext.regs[24 as libc::c_int as usize] as libc::c_ulong,
4995 (*uc).uc_mcontext.regs[25 as libc::c_int as usize] as libc::c_ulong,
4996 (*uc).uc_mcontext.regs[26 as libc::c_int as usize] as libc::c_ulong,
4997 (*uc).uc_mcontext.regs[27 as libc::c_int as usize] as libc::c_ulong,
4998 (*uc).uc_mcontext.regs[28 as libc::c_int as usize] as libc::c_ulong,
4999 (*uc).uc_mcontext.regs[29 as libc::c_int as usize] as libc::c_ulong,
5000 (*uc).uc_mcontext.regs[30 as libc::c_int as usize] as libc::c_ulong,
5001 (*uc).uc_mcontext.pc as libc::c_ulong,
5002 (*uc).uc_mcontext.sp as libc::c_ulong,
5003 (*uc).uc_mcontext.pstate as libc::c_ulong,
5004 (*uc).uc_mcontext.fault_address as libc::c_ulong,
5005 );
5006 }
5007 logStackContent((*uc).uc_mcontext.sp as *mut *mut libc::c_void);
5008}
5009#[no_mangle]
5010pub unsafe extern "C" fn openDirectLogFiledes() -> libc::c_int {
5011 let mut log_to_stdout: libc::c_int = (*(server.logfile)
5012 .offset(0 as libc::c_int as isize) as libc::c_int == '\0' as i32) as libc::c_int;
5013 let mut fd: libc::c_int = if log_to_stdout != 0 {
5014 1 as libc::c_int
5015 } else {
5016 open(
5017 server.logfile,
5018 0o2000 as libc::c_int | 0o100 as libc::c_int | 0o1 as libc::c_int,
5019 0o644 as libc::c_int,
5020 )
5021 };
5022 return fd;
5023}
5024#[no_mangle]
5025pub unsafe extern "C" fn closeDirectLogFiledes(mut fd: libc::c_int) {
5026 let mut log_to_stdout: libc::c_int = (*(server.logfile)
5027 .offset(0 as libc::c_int as isize) as libc::c_int == '\0' as i32) as libc::c_int;
5028 if log_to_stdout == 0 {
5029 close(fd);
5030 }
5031}
5032#[no_mangle]
5033pub unsafe extern "C" fn logStackTrace(
5034 mut eip: *mut libc::c_void,
5035 mut uplevel: libc::c_int,
5036) {
5037 let mut trace: [*mut libc::c_void; 100] = [0 as *mut libc::c_void; 100];
5038 let mut trace_size: libc::c_int = 0 as libc::c_int;
5039 let mut fd: libc::c_int = openDirectLogFiledes();
5040 let mut msg: *mut libc::c_char = 0 as *mut libc::c_char;
5041 uplevel += 1;
5042 if fd == -(1 as libc::c_int) {
5043 return;
5044 }
5045 trace_size = backtrace(trace.as_mut_ptr(), 100 as libc::c_int);
5046 msg = b"\n------ STACK TRACE ------\n\0" as *const u8 as *const libc::c_char
5047 as *mut libc::c_char;
5048 write(fd, msg as *const libc::c_void, strlen(msg))
5049 == -(1 as libc::c_int) as libc::c_long;
5050 if !eip.is_null() {
5051 msg = b"EIP:\n\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
5052 write(fd, msg as *const libc::c_void, strlen(msg))
5053 == -(1 as libc::c_int) as libc::c_long;
5054 backtrace_symbols_fd(&mut eip, 1 as libc::c_int, fd);
5055 }
5056 msg = b"\nBacktrace:\n\0" as *const u8 as *const libc::c_char as *mut libc::c_char;
5057 write(fd, msg as *const libc::c_void, strlen(msg))
5058 == -(1 as libc::c_int) as libc::c_long;
5059 backtrace_symbols_fd(
5060 trace.as_mut_ptr().offset(uplevel as isize),
5061 trace_size - uplevel,
5062 fd,
5063 );
5064 closeDirectLogFiledes(fd);
5065}
5066#[no_mangle]
5067pub unsafe extern "C" fn logServerInfo() {
5068 let mut infostring: sds = 0 as *mut libc::c_char;
5069 let mut clients: sds = 0 as *mut libc::c_char;
5070 serverLogRaw(
5071 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5072 b"\n------ INFO OUTPUT ------\n\0" as *const u8 as *const libc::c_char,
5073 );
5074 let mut all: libc::c_int = 0 as libc::c_int;
5075 let mut everything: libc::c_int = 0 as libc::c_int;
5076 let mut argv: [*mut robj; 1] = [0 as *mut robj; 1];
5077 argv[0 as libc::c_int
5078 as usize] = createStringObject(
5079 b"all\0" as *const u8 as *const libc::c_char,
5080 strlen(b"all\0" as *const u8 as *const libc::c_char),
5081 );
5082 let mut section_dict: *mut dict = genInfoSectionDict(
5083 argv.as_mut_ptr(),
5084 1 as libc::c_int,
5085 0 as *mut *mut libc::c_char,
5086 &mut all,
5087 &mut everything,
5088 );
5089 infostring = genRedisInfoString(section_dict, all, everything);
5090 serverLogRaw(
5091 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5092 infostring as *const libc::c_char,
5093 );
5094 serverLogRaw(
5095 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5096 b"\n------ CLIENT LIST OUTPUT ------\n\0" as *const u8 as *const libc::c_char,
5097 );
5098 clients = getAllClientsInfoString(-(1 as libc::c_int));
5099 serverLogRaw(
5100 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5101 clients as *const libc::c_char,
5102 );
5103 sdsfree(infostring);
5104 sdsfree(clients);
5105 releaseInfoSectionDict(section_dict);
5106 decrRefCount(argv[0 as libc::c_int as usize]);
5107}
5108#[no_mangle]
5109pub unsafe extern "C" fn logConfigDebugInfo() {
5110 let mut configstring: sds = 0 as *mut libc::c_char;
5111 configstring = getConfigDebugInfo();
5112 serverLogRaw(
5113 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5114 b"\n------ CONFIG DEBUG OUTPUT ------\n\0" as *const u8 as *const libc::c_char,
5115 );
5116 serverLogRaw(
5117 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5118 configstring as *const libc::c_char,
5119 );
5120 sdsfree(configstring);
5121}
5122#[no_mangle]
5123pub unsafe extern "C" fn logModulesInfo() {
5124 serverLogRaw(
5125 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5126 b"\n------ MODULES INFO OUTPUT ------\n\0" as *const u8 as *const libc::c_char,
5127 );
5128 let mut infostring: sds = modulesCollectInfo(
5129 sdsempty(),
5130 0 as *mut dict,
5131 1 as libc::c_int,
5132 0 as libc::c_int,
5133 );
5134 serverLogRaw(
5135 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5136 infostring as *const libc::c_char,
5137 );
5138 sdsfree(infostring);
5139}
5140#[no_mangle]
5141pub unsafe extern "C" fn logCurrentClient() {
5142 if (server.current_client).is_null() {
5143 return;
5144 }
5145 let mut cc: *mut client = server.current_client;
5146 let mut client: sds = 0 as *mut libc::c_char;
5147 let mut j: libc::c_int = 0;
5148 serverLogRaw(
5149 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5150 b"\n------ CURRENT CLIENT INFO ------\n\0" as *const u8 as *const libc::c_char,
5151 );
5152 client = catClientInfoString(sdsempty(), cc);
5153 if !(((3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int)
5154 & 0xff as libc::c_int) < server.verbosity)
5155 {
5156 _serverLog(
5157 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5158 b"%s\n\0" as *const u8 as *const libc::c_char,
5159 client,
5160 );
5161 }
5162 sdsfree(client);
5163 j = 0 as libc::c_int;
5164 while j < (*cc).argc {
5165 let mut decoded: *mut robj = 0 as *mut robj;
5166 decoded = getDecodedObject(*((*cc).argv).offset(j as isize));
5167 let mut repr: sds = sdscatrepr(
5168 sdsempty(),
5169 (*decoded).ptr as *const libc::c_char,
5170 if sdslen((*decoded).ptr as sds) < 128 as libc::c_int as libc::c_ulong {
5171 sdslen((*decoded).ptr as sds)
5172 } else {
5173 128 as libc::c_int as libc::c_ulong
5174 },
5175 );
5176 if !(((3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int)
5177 & 0xff as libc::c_int) < server.verbosity)
5178 {
5179 _serverLog(
5180 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5181 b"argv[%d]: '%s'\n\0" as *const u8 as *const libc::c_char,
5182 j,
5183 repr,
5184 );
5185 }
5186 sdsfree(repr);
5187 decrRefCount(decoded);
5188 j += 1;
5189 }
5190 if (*cc).argc > 1 as libc::c_int {
5191 let mut val: *mut robj = 0 as *mut robj;
5192 let mut key: *mut robj = 0 as *mut robj;
5193 let mut de: *mut dictEntry = 0 as *mut dictEntry;
5194 key = getDecodedObject(*((*cc).argv).offset(1 as libc::c_int as isize));
5195 de = dictFind((*(*cc).db).dict, (*key).ptr);
5196 if !de.is_null() {
5197 val = (*de).v.val as *mut robj;
5198 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
5199 _serverLog(
5200 3 as libc::c_int,
5201 b"key '%s' found in DB containing the following object:\0"
5202 as *const u8 as *const libc::c_char,
5203 (*key).ptr as *mut libc::c_char,
5204 );
5205 }
5206 serverLogObjectDebugInfo(val);
5207 }
5208 decrRefCount(key);
5209 }
5210}
5211#[no_mangle]
5212pub unsafe extern "C" fn memtest_test_linux_anonymous_maps() -> libc::c_int {
5213 let mut fp: *mut FILE = 0 as *mut FILE;
5214 let mut line: [libc::c_char; 1024] = [0; 1024];
5215 let mut logbuf: [libc::c_char; 1024] = [0; 1024];
5216 let mut start_addr: size_t = 0;
5217 let mut end_addr: size_t = 0;
5218 let mut size: size_t = 0;
5219 let mut start_vect: [size_t; 128] = [0; 128];
5220 let mut size_vect: [size_t; 128] = [0; 128];
5221 let mut regions: libc::c_int = 0 as libc::c_int;
5222 let mut j: libc::c_int = 0;
5223 let mut fd: libc::c_int = openDirectLogFiledes();
5224 if fd == 0 {
5225 return 0 as libc::c_int;
5226 }
5227 fp = fopen(
5228 b"/proc/self/maps\0" as *const u8 as *const libc::c_char,
5229 b"r\0" as *const u8 as *const libc::c_char,
5230 );
5231 if fp.is_null() {
5232 closeDirectLogFiledes(fd);
5233 return 0 as libc::c_int;
5234 }
5235 while !(fgets(
5236 line.as_mut_ptr(),
5237 core::mem::size_of::<[libc::c_char; 1024]>() as libc::c_ulong as libc::c_int,
5238 fp,
5239 ))
5240 .is_null()
5241 {
5242 let mut start: *mut libc::c_char = 0 as *mut libc::c_char;
5243 let mut end: *mut libc::c_char = 0 as *mut libc::c_char;
5244 let mut p: *mut libc::c_char = line.as_mut_ptr();
5245 start = p;
5246 p = strchr(p, '-' as i32);
5247 if p.is_null() {
5248 continue;
5249 }
5250 let fresh2 = p;
5251 p = p.offset(1);
5252 *fresh2 = '\0' as i32 as libc::c_char;
5253 end = p;
5254 p = strchr(p, ' ' as i32);
5255 if p.is_null() {
5256 continue;
5257 }
5258 let fresh3 = p;
5259 p = p.offset(1);
5260 *fresh3 = '\0' as i32 as libc::c_char;
5261 if !(strstr(p, b"stack\0" as *const u8 as *const libc::c_char)).is_null()
5262 || !(strstr(p, b"vdso\0" as *const u8 as *const libc::c_char)).is_null()
5263 || !(strstr(p, b"vsyscall\0" as *const u8 as *const libc::c_char)).is_null()
5264 {
5265 continue;
5266 }
5267 if (strstr(p, b"00:00\0" as *const u8 as *const libc::c_char)).is_null() {
5268 continue;
5269 }
5270 if (strstr(p, b"rw\0" as *const u8 as *const libc::c_char)).is_null() {
5271 continue;
5272 }
5273 start_addr = strtoul(start, 0 as *mut *mut libc::c_char, 16 as libc::c_int);
5274 end_addr = strtoul(end, 0 as *mut *mut libc::c_char, 16 as libc::c_int);
5275 size = end_addr.wrapping_sub(start_addr);
5276 start_vect[regions as usize] = start_addr;
5277 size_vect[regions as usize] = size;
5278 snprintf(
5279 logbuf.as_mut_ptr(),
5280 core::mem::size_of::<[libc::c_char; 1024]>() as libc::c_ulong,
5281 b"*** Preparing to test memory region %lx (%lu bytes)\n\0" as *const u8
5282 as *const libc::c_char,
5283 start_vect[regions as usize],
5284 size_vect[regions as usize],
5285 );
5286 write(
5287 fd,
5288 logbuf.as_mut_ptr() as *const libc::c_void,
5289 strlen(logbuf.as_mut_ptr()),
5290 ) == -(1 as libc::c_int) as libc::c_long;
5291 regions += 1;
5292 }
5293 let mut errors: libc::c_int = 0 as libc::c_int;
5294 j = 0 as libc::c_int;
5295 while j < regions {
5296 write(
5297 fd,
5298 b".\0" as *const u8 as *const libc::c_char as *const libc::c_void,
5299 1 as libc::c_int as size_t,
5300 ) == -(1 as libc::c_int) as libc::c_long;
5301 errors
5302 += memtest_preserving_test(
5303 start_vect[j as usize] as *mut libc::c_void as *mut libc::c_ulong,
5304 size_vect[j as usize],
5305 1 as libc::c_int,
5306 );
5307 write(
5308 fd,
5309 (if errors != 0 {
5310 b"E\0" as *const u8 as *const libc::c_char
5311 } else {
5312 b"O\0" as *const u8 as *const libc::c_char
5313 }) as *const libc::c_void,
5314 1 as libc::c_int as size_t,
5315 ) == -(1 as libc::c_int) as libc::c_long;
5316 j += 1;
5317 }
5318 write(
5319 fd,
5320 b"\n\0" as *const u8 as *const libc::c_char as *const libc::c_void,
5321 1 as libc::c_int as size_t,
5322 ) == -(1 as libc::c_int) as libc::c_long;
5323 fclose(fp);
5324 closeDirectLogFiledes(fd);
5325 return errors;
5326}
5327unsafe extern "C" fn killMainThread() {
5328 let mut err: libc::c_int = 0;
5329 if pthread_self() != server.main_thread_id
5330 && pthread_cancel(server.main_thread_id) == 0 as libc::c_int
5331 {
5332 err = pthread_join(server.main_thread_id, 0 as *mut *mut libc::c_void);
5333 if err != 0 as libc::c_int {
5334 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
5335 _serverLog(
5336 3 as libc::c_int,
5337 b"main thread can not be joined: %s\0" as *const u8
5338 as *const libc::c_char,
5339 strerror(err),
5340 );
5341 }
5342 } else if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
5343 _serverLog(
5344 3 as libc::c_int,
5345 b"main thread terminated\0" as *const u8 as *const libc::c_char,
5346 );
5347 }
5348 }
5349}
5350#[no_mangle]
5351pub unsafe extern "C" fn killThreads() {
5352 killMainThread();
5353 bioKillThreads();
5354 killIOThreads();
5355}
5356#[no_mangle]
5357pub unsafe extern "C" fn doFastMemoryTest() {
5358 if server.memcheck_enabled != 0 {
5359 serverLogRaw(
5360 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5361 b"\n------ FAST MEMORY TEST ------\n\0" as *const u8 as *const libc::c_char,
5362 );
5363 killThreads();
5364 if memtest_test_linux_anonymous_maps() != 0 {
5365 serverLogRaw(
5366 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5367 b"!!! MEMORY ERROR DETECTED! Check your memory ASAP !!!\n\0" as *const u8
5368 as *const libc::c_char,
5369 );
5370 } else {
5371 serverLogRaw(
5372 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5373 b"Fast memory test PASSED, however your memory can still be broken. Please run a memory test for several hours if possible.\n\0"
5374 as *const u8 as *const libc::c_char,
5375 );
5376 }
5377 }
5378}
5379#[no_mangle]
5380pub unsafe extern "C" fn dumpX86Calls(mut addr: *mut libc::c_void, mut len: size_t) {
5381 let mut j: size_t = 0;
5382 let mut p: *mut libc::c_uchar = addr as *mut libc::c_uchar;
5383 let mut info: Dl_info = Dl_info {
5384 dli_fname: 0 as *const libc::c_char,
5385 dli_fbase: 0 as *mut libc::c_void,
5386 dli_sname: 0 as *const libc::c_char,
5387 dli_saddr: 0 as *mut libc::c_void,
5388 };
5389 let mut ht: [libc::c_ulong; 256] = [
5390 0 as libc::c_int as libc::c_ulong,
5391 0,
5392 0,
5393 0,
5394 0,
5395 0,
5396 0,
5397 0,
5398 0,
5399 0,
5400 0,
5401 0,
5402 0,
5403 0,
5404 0,
5405 0,
5406 0,
5407 0,
5408 0,
5409 0,
5410 0,
5411 0,
5412 0,
5413 0,
5414 0,
5415 0,
5416 0,
5417 0,
5418 0,
5419 0,
5420 0,
5421 0,
5422 0,
5423 0,
5424 0,
5425 0,
5426 0,
5427 0,
5428 0,
5429 0,
5430 0,
5431 0,
5432 0,
5433 0,
5434 0,
5435 0,
5436 0,
5437 0,
5438 0,
5439 0,
5440 0,
5441 0,
5442 0,
5443 0,
5444 0,
5445 0,
5446 0,
5447 0,
5448 0,
5449 0,
5450 0,
5451 0,
5452 0,
5453 0,
5454 0,
5455 0,
5456 0,
5457 0,
5458 0,
5459 0,
5460 0,
5461 0,
5462 0,
5463 0,
5464 0,
5465 0,
5466 0,
5467 0,
5468 0,
5469 0,
5470 0,
5471 0,
5472 0,
5473 0,
5474 0,
5475 0,
5476 0,
5477 0,
5478 0,
5479 0,
5480 0,
5481 0,
5482 0,
5483 0,
5484 0,
5485 0,
5486 0,
5487 0,
5488 0,
5489 0,
5490 0,
5491 0,
5492 0,
5493 0,
5494 0,
5495 0,
5496 0,
5497 0,
5498 0,
5499 0,
5500 0,
5501 0,
5502 0,
5503 0,
5504 0,
5505 0,
5506 0,
5507 0,
5508 0,
5509 0,
5510 0,
5511 0,
5512 0,
5513 0,
5514 0,
5515 0,
5516 0,
5517 0,
5518 0,
5519 0,
5520 0,
5521 0,
5522 0,
5523 0,
5524 0,
5525 0,
5526 0,
5527 0,
5528 0,
5529 0,
5530 0,
5531 0,
5532 0,
5533 0,
5534 0,
5535 0,
5536 0,
5537 0,
5538 0,
5539 0,
5540 0,
5541 0,
5542 0,
5543 0,
5544 0,
5545 0,
5546 0,
5547 0,
5548 0,
5549 0,
5550 0,
5551 0,
5552 0,
5553 0,
5554 0,
5555 0,
5556 0,
5557 0,
5558 0,
5559 0,
5560 0,
5561 0,
5562 0,
5563 0,
5564 0,
5565 0,
5566 0,
5567 0,
5568 0,
5569 0,
5570 0,
5571 0,
5572 0,
5573 0,
5574 0,
5575 0,
5576 0,
5577 0,
5578 0,
5579 0,
5580 0,
5581 0,
5582 0,
5583 0,
5584 0,
5585 0,
5586 0,
5587 0,
5588 0,
5589 0,
5590 0,
5591 0,
5592 0,
5593 0,
5594 0,
5595 0,
5596 0,
5597 0,
5598 0,
5599 0,
5600 0,
5601 0,
5602 0,
5603 0,
5604 0,
5605 0,
5606 0,
5607 0,
5608 0,
5609 0,
5610 0,
5611 0,
5612 0,
5613 0,
5614 0,
5615 0,
5616 0,
5617 0,
5618 0,
5619 0,
5620 0,
5621 0,
5622 0,
5623 0,
5624 0,
5625 0,
5626 0,
5627 0,
5628 0,
5629 0,
5630 0,
5631 0,
5632 0,
5633 0,
5634 0,
5635 0,
5636 0,
5637 0,
5638 0,
5639 0,
5640 0,
5641 0,
5642 0,
5643 0,
5644 0,
5645 0,
5646 ];
5647 if len < 5 as libc::c_int as libc::c_ulong {
5648 return;
5649 }
5650 j = 0 as libc::c_int as size_t;
5651 while j < len.wrapping_sub(4 as libc::c_int as libc::c_ulong) {
5652 if !(*p.offset(j as isize) as libc::c_int != 0xe8 as libc::c_int) {
5653 let mut target: libc::c_ulong = (addr as libc::c_ulong)
5654 .wrapping_add(j)
5655 .wrapping_add(5 as libc::c_int as libc::c_ulong);
5656 let mut tmp: uint32_t = 0;
5657 memcpy(
5658 &mut tmp as *mut uint32_t as *mut libc::c_void,
5659 p.offset(j as isize).offset(1 as libc::c_int as isize)
5660 as *const libc::c_void,
5661 core::mem::size_of::<uint32_t>() as libc::c_ulong,
5662 );
5663 target = target.wrapping_add(tmp as libc::c_ulong);
5664 if dladdr(target as *mut libc::c_void, &mut info) != 0 as libc::c_int
5665 && !(info.dli_sname).is_null()
5666 {
5667 if ht[(target & 0xff as libc::c_int as libc::c_ulong) as usize] != target
5668 {
5669 printf(
5670 b"Function at 0x%lx is %s\n\0" as *const u8
5671 as *const libc::c_char,
5672 target,
5673 info.dli_sname,
5674 );
5675 ht[(target & 0xff as libc::c_int as libc::c_ulong)
5676 as usize] = target;
5677 }
5678 j = (j as libc::c_ulong).wrapping_add(4 as libc::c_int as libc::c_ulong)
5679 as size_t as size_t;
5680 }
5681 }
5682 j = j.wrapping_add(1);
5683 }
5684}
5685#[no_mangle]
5686pub unsafe extern "C" fn dumpCodeAroundEIP(mut eip: *mut libc::c_void) {
5687 let mut info: Dl_info = Dl_info {
5688 dli_fname: 0 as *const libc::c_char,
5689 dli_fbase: 0 as *mut libc::c_void,
5690 dli_sname: 0 as *const libc::c_char,
5691 dli_saddr: 0 as *mut libc::c_void,
5692 };
5693 if dladdr(eip, &mut info) != 0 as libc::c_int {
5694 if !(((3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int)
5695 & 0xff as libc::c_int) < server.verbosity)
5696 {
5697 _serverLog(
5698 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5699 b"\n------ DUMPING CODE AROUND EIP ------\nSymbol: %s (base: %p)\nModule: %s (base %p)\n$ xxd -r -p /tmp/dump.hex /tmp/dump.bin\n$ objdump --adjust-vma=%p -D -b binary -m i386:x86-64 /tmp/dump.bin\n------\n\0"
5700 as *const u8 as *const libc::c_char,
5701 info.dli_sname,
5702 info.dli_saddr,
5703 info.dli_fname,
5704 info.dli_fbase,
5705 info.dli_saddr,
5706 );
5707 }
5708 let mut len: size_t = (eip as libc::c_long - info.dli_saddr as libc::c_long)
5709 as size_t;
5710 let mut sz: libc::c_ulong = sysconf(_SC_PAGESIZE as libc::c_int)
5711 as libc::c_ulong;
5712 if len < ((1 as libc::c_int) << 13 as libc::c_int) as libc::c_ulong {
5713 let mut base: *mut libc::c_void = info.dli_saddr;
5714 let mut next: libc::c_ulong = (eip as libc::c_ulong).wrapping_add(sz)
5715 & !sz.wrapping_sub(1 as libc::c_int as libc::c_ulong);
5716 let mut end: libc::c_ulong = (eip as libc::c_ulong)
5717 .wrapping_add(128 as libc::c_int as libc::c_ulong);
5718 if end > next {
5719 end = next;
5720 }
5721 len = end.wrapping_sub(base as libc::c_ulong);
5722 serverLogHexDump(
5723 3 as libc::c_int,
5724 b"dump of function\0" as *const u8 as *const libc::c_char
5725 as *mut libc::c_char,
5726 base,
5727 len,
5728 );
5729 dumpX86Calls(base, len);
5730 }
5731 }
5732}
5733#[no_mangle]
5734pub unsafe extern "C" fn invalidFunctionWasCalled() {}
5735#[no_mangle]
5736pub unsafe extern "C" fn sigsegvHandler(
5737 mut sig: libc::c_int,
5738 mut info: *mut siginfo_t,
5739 mut secret: *mut libc::c_void,
5740) {
5741 bugReportStart();
5742 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
5743 _serverLog(
5744 3 as libc::c_int,
5745 b"Redis %s crashed by signal: %d, si_code: %d\0" as *const u8
5746 as *const libc::c_char,
5747 b"7.0.8\0" as *const u8 as *const libc::c_char,
5748 sig,
5749 (*info).si_code,
5750 );
5751 }
5752 if sig == 11 as libc::c_int || sig == 7 as libc::c_int {
5753 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
5754 _serverLog(
5755 3 as libc::c_int,
5756 b"Accessing address: %p\0" as *const u8 as *const libc::c_char,
5757 (*info)._sifields._sigfault.si_addr,
5758 );
5759 }
5760 }
5761 if (*info).si_code == SI_USER as libc::c_int
5762 && (*info)._sifields._kill.si_pid != -(1 as libc::c_int)
5763 {
5764 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
5765 _serverLog(
5766 3 as libc::c_int,
5767 b"Killed by PID: %ld, UID: %d\0" as *const u8 as *const libc::c_char,
5768 (*info)._sifields._kill.si_pid as libc::c_long,
5769 (*info)._sifields._kill.si_uid,
5770 );
5771 }
5772 }
5773 let mut uc: *mut ucontext_t = secret as *mut ucontext_t;
5774 let mut eip: *mut libc::c_void = getAndSetMcontextEip(uc, 0 as *mut libc::c_void);
5775 if !eip.is_null() {
5776 if !((3 as libc::c_int & 0xff as libc::c_int) < server.verbosity) {
5777 _serverLog(
5778 3 as libc::c_int,
5779 b"Crashed running the instruction at: %p\0" as *const u8
5780 as *const libc::c_char,
5781 eip,
5782 );
5783 }
5784 }
5785 if eip == (*info)._sifields._sigfault.si_addr {
5786 let mut ptr: *mut libc::c_void = 0 as *mut libc::c_void;
5787 let mut ptr_ptr: *mut invalidFunctionWasCalledType = &mut ptr
5788 as *mut *mut libc::c_void as *mut invalidFunctionWasCalledType;
5789 *ptr_ptr = Some(
5790 core::mem::transmute::<
5791 unsafe extern "C" fn() -> (),
5792 unsafe extern "C" fn() -> (),
5793 >(invalidFunctionWasCalled),
5794 );
5795 getAndSetMcontextEip(uc, ptr);
5796 }
5797 logStackTrace(eip, 1 as libc::c_int);
5798 if eip == (*info)._sifields._sigfault.si_addr {
5799 getAndSetMcontextEip(uc, eip);
5800 }
5801 logRegisters(uc);
5802 printCrashReport();
5803 if !eip.is_null() {
5804 dumpCodeAroundEIP(eip);
5805 }
5806 bugReportEnd(1 as libc::c_int, sig);
5807}
5808#[no_mangle]
5809pub unsafe extern "C" fn printCrashReport() {
5810 logServerInfo();
5811 logCurrentClient();
5812 logModulesInfo();
5813 logConfigDebugInfo();
5814 doFastMemoryTest();
5815}
5816#[no_mangle]
5817pub unsafe extern "C" fn bugReportEnd(
5818 mut killViaSignal: libc::c_int,
5819 mut sig: libc::c_int,
5820) {
5821 let mut act: sigaction = sigaction {
5822 __sigaction_handler: C2RustUnnamed_17 {
5823 sa_handler: None,
5824 },
5825 sa_mask: __sigset_t { __val: [0; 16] },
5826 sa_flags: 0,
5827 sa_restorer: None,
5828 };
5829 serverLogRaw(
5830 3 as libc::c_int | (1 as libc::c_int) << 10 as libc::c_int,
5831 b"\n=== REDIS BUG REPORT END. Make sure to include from START to END. ===\n\n Please report the crash by opening an issue on github:\n\n http://github.com/redis/redis/issues\n\n If a Redis module was involved, please open in the module's repo instead.\n\n Suspect RAM error? Use redis-server --test-memory to verify it.\n\n Some other issues could be detected by redis-server --check-system\n\0"
5832 as *const u8 as *const libc::c_char,
5833 );
5834 if server.daemonize != 0 && server.supervised == 0 as libc::c_int
5835 && !(server.pidfile).is_null()
5836 {
5837 unlink(server.pidfile);
5838 }
5839 if killViaSignal == 0 {
5840 if server.use_exit_on_panic != 0 {
5841 fflush(stdout);
5842 _exit(1 as libc::c_int);
5843 }
5844 abort();
5845 }
5846 sigemptyset(&mut act.sa_mask);
5847 act
5848 .sa_flags = ((0x40000000 as libc::c_int | 0x8000000 as libc::c_int)
5849 as libc::c_uint | 0x80000000 as libc::c_uint) as libc::c_int;
5850 act.__sigaction_handler.sa_handler = None;
5851 sigaction(sig, &mut act, 0 as *mut sigaction);
5852 kill(getpid(), sig);
5853}
5854#[no_mangle]
5855pub unsafe extern "C" fn serverLogHexDump(
5856 mut level: libc::c_int,
5857 mut descr: *mut libc::c_char,
5858 mut value: *mut libc::c_void,
5859 mut len: size_t,
5860) {
5861 let mut buf: [libc::c_char; 65] = [0; 65];
5862 let mut b: *mut libc::c_char = 0 as *mut libc::c_char;
5863 let mut v: *mut libc::c_uchar = value as *mut libc::c_uchar;
5864 let charset: UnsafeCell<[libc::c_char; 17]> = UnsafeCell::new([0; 17]);
5869 unsafe {
5870 let charset_slice: &mut [u8] = std::slice::from_raw_parts_mut(
5871 charset.get() as *mut u8, 17
5872 );
5873 charset_slice.copy_from_slice(b"0123456789abcdef\0");
5874 }
5875 if !((level & 0xff as libc::c_int) < server.verbosity) {
5876 _serverLog(
5877 level,
5878 b"%s (hexdump of %zu bytes):\0" as *const u8 as *const libc::c_char,
5879 descr,
5880 len,
5881 );
5882 }
5883 b = buf.as_mut_ptr();
5884 while len != 0 {
5885 *b
5886 .offset(
5887 0 as libc::c_int as isize,
5888 ) = unsafe { &mut *charset.get() }[(*v as libc::c_int >> 4 as libc::c_int) as usize];
5889 *b
5890 .offset(
5891 1 as libc::c_int as isize,
5892 ) = unsafe { &mut *charset.get() }[(*v as libc::c_int & 0xf as libc::c_int) as usize];
5893 *b.offset(2 as libc::c_int as isize) = '\0' as i32 as libc::c_char;
5894 b = b.offset(2 as libc::c_int as isize);
5895 len = len.wrapping_sub(1);
5896 v = v.offset(1);
5897 if b.offset_from(buf.as_mut_ptr()) as libc::c_long
5898 == 64 as libc::c_int as libc::c_long
5899 || len == 0 as libc::c_int as libc::c_ulong
5900 {
5901 serverLogRaw(
5902 level | (1 as libc::c_int) << 10 as libc::c_int,
5903 buf.as_mut_ptr(),
5904 );
5905 b = buf.as_mut_ptr();
5906 }
5907 }
5908 serverLogRaw(
5909 level | (1 as libc::c_int) << 10 as libc::c_int,
5910 b"\n\0" as *const u8 as *const libc::c_char,
5911 );
5912}
5913#[no_mangle]
5914pub unsafe extern "C" fn watchdogSignalHandler(
5915 mut sig: libc::c_int,
5916 mut info: *mut siginfo_t,
5917 mut secret: *mut libc::c_void,
5918) {
5919 let mut uc: *mut ucontext_t = secret as *mut ucontext_t;
5920 serverLogFromHandler(
5921 3 as libc::c_int,
5922 b"\n--- WATCHDOG TIMER EXPIRED ---\0" as *const u8 as *const libc::c_char,
5923 );
5924 logStackTrace(getAndSetMcontextEip(uc, 0 as *mut libc::c_void), 1 as libc::c_int);
5925 serverLogFromHandler(
5926 3 as libc::c_int,
5927 b"--------\n\0" as *const u8 as *const libc::c_char,
5928 );
5929}
5930#[no_mangle]
5931pub unsafe extern "C" fn watchdogScheduleSignal(mut period: libc::c_int) {
5932 let mut it: itimerval = itimerval {
5933 it_interval: timeval { tv_sec: 0, tv_usec: 0 },
5934 it_value: timeval { tv_sec: 0, tv_usec: 0 },
5935 };
5936 it.it_value.tv_sec = (period / 1000 as libc::c_int) as __time_t;
5937 it
5938 .it_value
5939 .tv_usec = (period % 1000 as libc::c_int * 1000 as libc::c_int) as __suseconds_t;
5940 it.it_interval.tv_sec = 0 as libc::c_int as __time_t;
5941 it.it_interval.tv_usec = 0 as libc::c_int as __suseconds_t;
5942 setitimer(ITIMER_REAL, &mut it, 0 as *mut itimerval);
5943}
5944#[no_mangle]
5945pub unsafe extern "C" fn applyWatchdogPeriod() {
5946 let mut act: sigaction = sigaction {
5947 __sigaction_handler: C2RustUnnamed_17 {
5948 sa_handler: None,
5949 },
5950 sa_mask: __sigset_t { __val: [0; 16] },
5951 sa_flags: 0,
5952 sa_restorer: None,
5953 };
5954 if server.watchdog_period == 0 as libc::c_int {
5955 watchdogScheduleSignal(0 as libc::c_int);
5956 sigemptyset(&mut act.sa_mask);
5957 act.sa_flags = 0 as libc::c_int;
5958 act
5959 .__sigaction_handler
5960 .sa_handler = core::mem::transmute::<
5961 libc::intptr_t,
5962 __sighandler_t,
5963 >(1 as libc::c_int as libc::intptr_t);
5964 sigaction(14 as libc::c_int, &mut act, 0 as *mut sigaction);
5965 } else {
5966 sigemptyset(&mut act.sa_mask);
5967 act.sa_flags = 4 as libc::c_int;
5968 act
5969 .__sigaction_handler
5970 .sa_sigaction = Some(
5971 watchdogSignalHandler
5972 as unsafe extern "C" fn(
5973 libc::c_int,
5974 *mut siginfo_t,
5975 *mut libc::c_void,
5976 ) -> (),
5977 );
5978 sigaction(14 as libc::c_int, &mut act, 0 as *mut sigaction);
5979 let mut min_period: libc::c_int = 1000 as libc::c_int / server.hz
5980 * 2 as libc::c_int;
5981 if server.watchdog_period < min_period {
5982 server.watchdog_period = min_period;
5983 }
5984 watchdogScheduleSignal(server.watchdog_period);
5985 };
5986}
5987#[no_mangle]
5988pub unsafe extern "C" fn debugDelay(mut usec: libc::c_int) {
5989 if usec < 0 as libc::c_int {
5990 usec = if rand() % -usec == 0 as libc::c_int {
5991 1 as libc::c_int
5992 } else {
5993 0 as libc::c_int
5994 };
5995 }
5996 if usec != 0 {
5997 usleep(usec as __useconds_t);
5998 }
5999}