1extern crate c2rust_bitfields;
2extern crate libc;
3extern crate core;
4extern "C" {
5 pub type _IO_wide_data;
6 pub type _IO_codecvt;
7 pub type _IO_marker;
8 pub type RedisModuleCommand;
9 pub type clusterSlotToKeyMapping;
10 pub type functionsLibCtx;
11 pub type clusterState;
12 fn init_genrand64(seed: libc::c_ulonglong);
13 static mut stderr: *mut FILE;
14 fn fclose(__stream: *mut FILE) -> libc::c_int;
15 fn fopen(_: *const libc::c_char, _: *const libc::c_char) -> *mut FILE;
16 fn fprintf(_: *mut FILE, _: *const libc::c_char, _: ...) -> libc::c_int;
17 fn printf(_: *const libc::c_char, _: ...) -> libc::c_int;
18 fn vsnprintf(
19 _: *mut libc::c_char,
20 _: libc::c_ulong,
21 _: *const libc::c_char,
22 _: core::ffi::VaList,
23 ) -> libc::c_int;
24 fn fileno(__stream: *mut FILE) -> libc::c_int;
25 fn sdsempty() -> sds;
26 fn sdsfree(s: sds);
27 fn sdscat(s: sds, t: *const libc::c_char) -> sds;
28 fn sdscatprintf(s: sds, fmt: *const libc::c_char, _: ...) -> sds;
29 fn rioInitWithFile(r: *mut rio, fp: *mut FILE);
30 fn strtol(
31 _: *const libc::c_char,
32 _: *mut *mut libc::c_char,
33 _: libc::c_int,
34 ) -> libc::c_long;
35 fn strtoll(
36 _: *const libc::c_char,
37 _: *mut *mut libc::c_char,
38 _: libc::c_int,
39 ) -> libc::c_longlong;
40 fn exit(_: libc::c_int) -> !;
41 fn memcmp(
42 _: *const libc::c_void,
43 _: *const libc::c_void,
44 _: libc::c_ulong,
45 ) -> libc::c_int;
46 fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
47 fn getpid() -> __pid_t;
48 fn sigemptyset(__set: *mut sigset_t) -> libc::c_int;
49 fn sigaction(
50 __sig: libc::c_int,
51 __act: *const sigaction,
52 __oact: *mut sigaction,
53 ) -> libc::c_int;
54 fn gettimeofday(__tv: *mut timeval, __tz: *mut libc::c_void) -> libc::c_int;
55 static mut server: redisServer;
56 static mut shared: sharedObjectsStruct;
57 fn moduleTypeNameByID(name: *mut libc::c_char, moduleid: uint64_t);
58 fn mstime() -> libc::c_longlong;
59 fn decrRefCount(o: *mut robj);
60 fn startLoadingFile(
61 size: size_t,
62 filename: *mut libc::c_char,
63 rdbflags: libc::c_int,
64 );
65 fn stopLoading(success: libc::c_int);
66 fn rdbLoadType(rdb: *mut rio) -> libc::c_int;
67 fn rdbLoadTime(rdb: *mut rio) -> time_t;
68 fn rdbLoadMillisecondTime(rdb: *mut rio, rdbver: libc::c_int) -> libc::c_longlong;
69 fn rdbLoadLen(rdb: *mut rio, isencoded: *mut libc::c_int) -> uint64_t;
70 fn rdbLoadObject(
71 type_0: libc::c_int,
72 rdb: *mut rio,
73 key: sds,
74 dbid: libc::c_int,
75 error: *mut libc::c_int,
76 ) -> *mut robj;
77 fn rdbLoadCheckModuleValue(
78 rdb: *mut rio,
79 modulename: *mut libc::c_char,
80 ) -> *mut robj;
81 fn rdbLoadStringObject(rdb: *mut rio) -> *mut robj;
82 fn rdbFunctionLoad(
83 rdb: *mut rio,
84 ver: libc::c_int,
85 lib_ctx: *mut functionsLibCtx,
86 type_0: libc::c_int,
87 rdbflags: libc::c_int,
88 err: *mut sds,
89 ) -> libc::c_int;
90 fn redisGitDirty() -> *mut libc::c_char;
91 fn redisGitSHA1() -> *mut libc::c_char;
92 fn __fxstat(
93 __ver: libc::c_int,
94 __fildes: libc::c_int,
95 __stat_buf: *mut stat,
96 ) -> libc::c_int;
97 fn createSharedObjects();
98 fn rdbLoadProgressCallback(r: *mut rio, buf: *const libc::c_void, len: size_t);
99}
100pub type __builtin_va_list = __va_list;
101#[derive(Copy, Clone)]
102#[repr(C)]
103pub struct __va_list {
104 pub __stack: *mut libc::c_void,
105 pub __gr_top: *mut libc::c_void,
106 pub __vr_top: *mut libc::c_void,
107 pub __gr_offs: libc::c_int,
108 pub __vr_offs: libc::c_int,
109}
110pub type __uint8_t = libc::c_uchar;
111pub type __int16_t = libc::c_short;
112pub type __int32_t = libc::c_int;
113pub type __uint32_t = libc::c_uint;
114pub type __int64_t = libc::c_long;
115pub type __uint64_t = libc::c_ulong;
116pub type __uint_least64_t = __uint64_t;
117pub type __dev_t = libc::c_ulong;
118pub type __uid_t = libc::c_uint;
119pub type __gid_t = libc::c_uint;
120pub type __ino64_t = libc::c_ulong;
121pub type __mode_t = libc::c_uint;
122pub type __nlink_t = libc::c_uint;
123pub type __off_t = libc::c_long;
124pub type __off64_t = libc::c_long;
125pub type __pid_t = libc::c_int;
126pub type __clock_t = libc::c_long;
127pub type __time_t = libc::c_long;
128pub type __suseconds_t = libc::c_long;
129pub type __blksize_t = libc::c_int;
130pub type __blkcnt64_t = libc::c_long;
131pub type __ssize_t = libc::c_long;
132pub type __syscall_slong_t = libc::c_long;
133pub type __sig_atomic_t = libc::c_int;
134pub type size_t = libc::c_ulong;
135#[derive(Copy, Clone)]
136#[repr(C)]
137pub struct iovec {
138 pub iov_base: *mut libc::c_void,
139 pub iov_len: size_t,
140}
141pub type mode_t = __mode_t;
142pub type off_t = __off64_t;
143pub type pid_t = __pid_t;
144#[derive(Copy, Clone)]
145#[repr(C)]
146pub struct timespec {
147 pub tv_sec: __time_t,
148 pub tv_nsec: __syscall_slong_t,
149}
150#[derive(Copy, Clone)]
151#[repr(C)]
152pub struct stat {
153 pub st_dev: __dev_t,
154 pub st_ino: __ino64_t,
155 pub st_mode: __mode_t,
156 pub st_nlink: __nlink_t,
157 pub st_uid: __uid_t,
158 pub st_gid: __gid_t,
159 pub st_rdev: __dev_t,
160 pub __pad1: __dev_t,
161 pub st_size: __off64_t,
162 pub st_blksize: __blksize_t,
163 pub __pad2: libc::c_int,
164 pub st_blocks: __blkcnt64_t,
165 pub st_atim: timespec,
166 pub st_mtim: timespec,
167 pub st_ctim: timespec,
168 pub __glibc_reserved: [libc::c_int; 2],
169}
170pub type ssize_t = __ssize_t;
171pub type time_t = __time_t;
172pub type int16_t = __int16_t;
173pub type int32_t = __int32_t;
174pub type int64_t = __int64_t;
175#[derive(Copy, Clone)]
176#[repr(C)]
177pub struct __sigset_t {
178 pub __val: [libc::c_ulong; 16],
179}
180pub type sigset_t = __sigset_t;
181#[derive(Copy, Clone)]
182#[repr(C)]
183pub struct timeval {
184 pub tv_sec: __time_t,
185 pub tv_usec: __suseconds_t,
186}
187pub type pthread_t = libc::c_ulong;
188pub type va_list = __builtin_va_list;
189#[derive(Copy, Clone)]
190#[repr(C)]
191pub struct _IO_FILE {
192 pub _flags: libc::c_int,
193 pub _IO_read_ptr: *mut libc::c_char,
194 pub _IO_read_end: *mut libc::c_char,
195 pub _IO_read_base: *mut libc::c_char,
196 pub _IO_write_base: *mut libc::c_char,
197 pub _IO_write_ptr: *mut libc::c_char,
198 pub _IO_write_end: *mut libc::c_char,
199 pub _IO_buf_base: *mut libc::c_char,
200 pub _IO_buf_end: *mut libc::c_char,
201 pub _IO_save_base: *mut libc::c_char,
202 pub _IO_backup_base: *mut libc::c_char,
203 pub _IO_save_end: *mut libc::c_char,
204 pub _markers: *mut _IO_marker,
205 pub _chain: *mut _IO_FILE,
206 pub _fileno: libc::c_int,
207 pub _flags2: libc::c_int,
208 pub _old_offset: __off_t,
209 pub _cur_column: libc::c_ushort,
210 pub _vtable_offset: libc::c_schar,
211 pub _shortbuf: [libc::c_char; 1],
212 pub _lock: *mut libc::c_void,
213 pub _offset: __off64_t,
214 pub _codecvt: *mut _IO_codecvt,
215 pub _wide_data: *mut _IO_wide_data,
216 pub _freeres_list: *mut _IO_FILE,
217 pub _freeres_buf: *mut libc::c_void,
218 pub __pad5: size_t,
219 pub _mode: libc::c_int,
220 pub _unused2: [libc::c_char; 20],
221}
222pub type _IO_lock_t = ();
223pub type FILE = _IO_FILE;
224pub type uint8_t = __uint8_t;
225pub type uint32_t = __uint32_t;
226pub type uint64_t = __uint64_t;
227pub type uint_least64_t = __uint_least64_t;
228pub type sds = *mut libc::c_char;
229#[derive(Copy, Clone)]
230#[repr(C)]
231pub struct aeEventLoop {
232 pub maxfd: libc::c_int,
233 pub setsize: libc::c_int,
234 pub timeEventNextId: libc::c_longlong,
235 pub events: *mut aeFileEvent,
236 pub fired: *mut aeFiredEvent,
237 pub timeEventHead: *mut aeTimeEvent,
238 pub stop: libc::c_int,
239 pub apidata: *mut libc::c_void,
240 pub beforesleep: Option::<aeBeforeSleepProc>,
241 pub aftersleep: Option::<aeBeforeSleepProc>,
242 pub flags: libc::c_int,
243}
244pub type aeBeforeSleepProc = unsafe extern "C" fn(*mut aeEventLoop) -> ();
245#[derive(Copy, Clone)]
246#[repr(C)]
247pub struct aeTimeEvent {
248 pub id: libc::c_longlong,
249 pub when: monotime,
250 pub timeProc: Option::<aeTimeProc>,
251 pub finalizerProc: Option::<aeEventFinalizerProc>,
252 pub clientData: *mut libc::c_void,
253 pub prev: *mut aeTimeEvent,
254 pub next: *mut aeTimeEvent,
255 pub refcount: libc::c_int,
256}
257pub type aeEventFinalizerProc = unsafe extern "C" fn(
258 *mut aeEventLoop,
259 *mut libc::c_void,
260) -> ();
261pub type aeTimeProc = unsafe extern "C" fn(
262 *mut aeEventLoop,
263 libc::c_longlong,
264 *mut libc::c_void,
265) -> libc::c_int;
266pub type monotime = uint64_t;
267#[derive(Copy, Clone)]
268#[repr(C)]
269pub struct aeFiredEvent {
270 pub fd: libc::c_int,
271 pub mask: libc::c_int,
272}
273#[derive(Copy, Clone)]
274#[repr(C)]
275pub struct aeFileEvent {
276 pub mask: libc::c_int,
277 pub rfileProc: Option::<aeFileProc>,
278 pub wfileProc: Option::<aeFileProc>,
279 pub clientData: *mut libc::c_void,
280}
281pub type aeFileProc = unsafe extern "C" fn(
282 *mut aeEventLoop,
283 libc::c_int,
284 *mut libc::c_void,
285 libc::c_int,
286) -> ();
287#[derive(Copy, Clone)]
288#[repr(C)]
289pub struct connection {
290 pub type_0: *mut ConnectionType,
291 pub state: ConnectionState,
292 pub flags: libc::c_short,
293 pub refs: libc::c_short,
294 pub last_errno: libc::c_int,
295 pub private_data: *mut libc::c_void,
296 pub conn_handler: ConnectionCallbackFunc,
297 pub write_handler: ConnectionCallbackFunc,
298 pub read_handler: ConnectionCallbackFunc,
299 pub fd: libc::c_int,
300}
301pub type ConnectionCallbackFunc = Option::<unsafe extern "C" fn(*mut connection) -> ()>;
302pub type ConnectionState = libc::c_uint;
303pub const CONN_STATE_ERROR: ConnectionState = 5;
304pub const CONN_STATE_CLOSED: ConnectionState = 4;
305pub const CONN_STATE_CONNECTED: ConnectionState = 3;
306pub const CONN_STATE_ACCEPTING: ConnectionState = 2;
307pub const CONN_STATE_CONNECTING: ConnectionState = 1;
308pub const CONN_STATE_NONE: ConnectionState = 0;
309#[derive(Copy, Clone)]
310#[repr(C)]
311pub struct ConnectionType {
312 pub ae_handler: Option::<
313 unsafe extern "C" fn(
314 *mut aeEventLoop,
315 libc::c_int,
316 *mut libc::c_void,
317 libc::c_int,
318 ) -> (),
319 >,
320 pub connect: Option::<
321 unsafe extern "C" fn(
322 *mut connection,
323 *const libc::c_char,
324 libc::c_int,
325 *const libc::c_char,
326 ConnectionCallbackFunc,
327 ) -> libc::c_int,
328 >,
329 pub write: Option::<
330 unsafe extern "C" fn(*mut connection, *const libc::c_void, size_t) -> libc::c_int,
331 >,
332 pub writev: Option::<
333 unsafe extern "C" fn(*mut connection, *const iovec, libc::c_int) -> libc::c_int,
334 >,
335 pub read: Option::<
336 unsafe extern "C" fn(*mut connection, *mut libc::c_void, size_t) -> libc::c_int,
337 >,
338 pub close: Option::<unsafe extern "C" fn(*mut connection) -> ()>,
339 pub accept: Option::<
340 unsafe extern "C" fn(*mut connection, ConnectionCallbackFunc) -> libc::c_int,
341 >,
342 pub set_write_handler: Option::<
343 unsafe extern "C" fn(
344 *mut connection,
345 ConnectionCallbackFunc,
346 libc::c_int,
347 ) -> libc::c_int,
348 >,
349 pub set_read_handler: Option::<
350 unsafe extern "C" fn(*mut connection, ConnectionCallbackFunc) -> libc::c_int,
351 >,
352 pub get_last_error: Option::<
353 unsafe extern "C" fn(*mut connection) -> *const libc::c_char,
354 >,
355 pub blocking_connect: Option::<
356 unsafe extern "C" fn(
357 *mut connection,
358 *const libc::c_char,
359 libc::c_int,
360 libc::c_longlong,
361 ) -> libc::c_int,
362 >,
363 pub sync_write: Option::<
364 unsafe extern "C" fn(
365 *mut connection,
366 *mut libc::c_char,
367 ssize_t,
368 libc::c_longlong,
369 ) -> ssize_t,
370 >,
371 pub sync_read: Option::<
372 unsafe extern "C" fn(
373 *mut connection,
374 *mut libc::c_char,
375 ssize_t,
376 libc::c_longlong,
377 ) -> ssize_t,
378 >,
379 pub sync_readline: Option::<
380 unsafe extern "C" fn(
381 *mut connection,
382 *mut libc::c_char,
383 ssize_t,
384 libc::c_longlong,
385 ) -> ssize_t,
386 >,
387 pub get_type: Option::<unsafe extern "C" fn(*mut connection) -> libc::c_int>,
388}
389#[derive(Copy, Clone)]
390#[repr(C)]
391pub struct _rio {
392 pub read: Option::<
393 unsafe extern "C" fn(*mut _rio, *mut libc::c_void, size_t) -> size_t,
394 >,
395 pub write: Option::<
396 unsafe extern "C" fn(*mut _rio, *const libc::c_void, size_t) -> size_t,
397 >,
398 pub tell: Option::<unsafe extern "C" fn(*mut _rio) -> off_t>,
399 pub flush: Option::<unsafe extern "C" fn(*mut _rio) -> libc::c_int>,
400 pub update_cksum: Option::<
401 unsafe extern "C" fn(*mut _rio, *const libc::c_void, size_t) -> (),
402 >,
403 pub cksum: uint64_t,
404 pub flags: uint64_t,
405 pub processed_bytes: size_t,
406 pub max_processing_chunk: size_t,
407 pub io: C2RustUnnamed,
408}
409#[derive(Copy, Clone)]
410#[repr(C)]
411pub union C2RustUnnamed {
412 pub buffer: C2RustUnnamed_3,
413 pub file: C2RustUnnamed_2,
414 pub conn: C2RustUnnamed_1,
415 pub fd: C2RustUnnamed_0,
416}
417#[derive(Copy, Clone)]
418#[repr(C)]
419pub struct C2RustUnnamed_0 {
420 pub fd: libc::c_int,
421 pub pos: off_t,
422 pub buf: sds,
423}
424#[derive(Copy, Clone)]
425#[repr(C)]
426pub struct C2RustUnnamed_1 {
427 pub conn: *mut connection,
428 pub pos: off_t,
429 pub buf: sds,
430 pub read_limit: size_t,
431 pub read_so_far: size_t,
432}
433#[derive(Copy, Clone)]
434#[repr(C)]
435pub struct C2RustUnnamed_2 {
436 pub fp: *mut FILE,
437 pub buffered: off_t,
438 pub autosync: off_t,
439}
440#[derive(Copy, Clone)]
441#[repr(C)]
442pub struct C2RustUnnamed_3 {
443 pub ptr: sds,
444 pub pos: off_t,
445}
446pub type rio = _rio;
447#[derive(Copy, Clone,c2rust_bitfields:: BitfieldStruct)]
448#[repr(C)]
449pub struct redisObject {
450 #[bitfield(name = "type_0", ty = "libc::c_uint", bits = "0..=3")]
451 #[bitfield(name = "encoding", ty = "libc::c_uint", bits = "4..=7")]
452 #[bitfield(name = "lru", ty = "libc::c_uint", bits = "8..=31")]
453 pub type_0_encoding_lru: [u8; 4],
454 pub refcount: libc::c_int,
455 pub ptr: *mut libc::c_void,
456}
457pub type __sigval_t = sigval;
458#[derive(Copy, Clone)]
459#[repr(C)]
460pub union sigval {
461 pub sival_int: libc::c_int,
462 pub sival_ptr: *mut libc::c_void,
463}
464pub type atomic_int = libc::c_int;
465pub type atomic_uint = libc::c_uint;
466pub type atomic_llong = libc::c_longlong;
467pub type sig_atomic_t = __sig_atomic_t;
468#[derive(Copy, Clone)]
469#[repr(C)]
470pub struct siginfo_t {
471 pub si_signo: libc::c_int,
472 pub si_errno: libc::c_int,
473 pub si_code: libc::c_int,
474 pub __pad0: libc::c_int,
475 pub _sifields: C2RustUnnamed_4,
476}
477#[derive(Copy, Clone)]
478#[repr(C)]
479pub union C2RustUnnamed_4 {
480 pub _pad: [libc::c_int; 28],
481 pub _kill: C2RustUnnamed_13,
482 pub _timer: C2RustUnnamed_12,
483 pub _rt: C2RustUnnamed_11,
484 pub _sigchld: C2RustUnnamed_10,
485 pub _sigfault: C2RustUnnamed_7,
486 pub _sigpoll: C2RustUnnamed_6,
487 pub _sigsys: C2RustUnnamed_5,
488}
489#[derive(Copy, Clone)]
490#[repr(C)]
491pub struct C2RustUnnamed_5 {
492 pub _call_addr: *mut libc::c_void,
493 pub _syscall: libc::c_int,
494 pub _arch: libc::c_uint,
495}
496#[derive(Copy, Clone)]
497#[repr(C)]
498pub struct C2RustUnnamed_6 {
499 pub si_band: libc::c_long,
500 pub si_fd: libc::c_int,
501}
502#[derive(Copy, Clone)]
503#[repr(C)]
504pub struct C2RustUnnamed_7 {
505 pub si_addr: *mut libc::c_void,
506 pub si_addr_lsb: libc::c_short,
507 pub _bounds: C2RustUnnamed_8,
508}
509#[derive(Copy, Clone)]
510#[repr(C)]
511pub union C2RustUnnamed_8 {
512 pub _addr_bnd: C2RustUnnamed_9,
513 pub _pkey: __uint32_t,
514}
515#[derive(Copy, Clone)]
516#[repr(C)]
517pub struct C2RustUnnamed_9 {
518 pub _lower: *mut libc::c_void,
519 pub _upper: *mut libc::c_void,
520}
521#[derive(Copy, Clone)]
522#[repr(C)]
523pub struct C2RustUnnamed_10 {
524 pub si_pid: __pid_t,
525 pub si_uid: __uid_t,
526 pub si_status: libc::c_int,
527 pub si_utime: __clock_t,
528 pub si_stime: __clock_t,
529}
530#[derive(Copy, Clone)]
531#[repr(C)]
532pub struct C2RustUnnamed_11 {
533 pub si_pid: __pid_t,
534 pub si_uid: __uid_t,
535 pub si_sigval: __sigval_t,
536}
537#[derive(Copy, Clone)]
538#[repr(C)]
539pub struct C2RustUnnamed_12 {
540 pub si_tid: libc::c_int,
541 pub si_overrun: libc::c_int,
542 pub si_sigval: __sigval_t,
543}
544#[derive(Copy, Clone)]
545#[repr(C)]
546pub struct C2RustUnnamed_13 {
547 pub si_pid: __pid_t,
548 pub si_uid: __uid_t,
549}
550pub type __sighandler_t = Option::<unsafe extern "C" fn(libc::c_int) -> ()>;
551#[derive(Copy, Clone)]
552#[repr(C)]
553pub struct sigaction {
554 pub __sigaction_handler: C2RustUnnamed_14,
555 pub sa_mask: __sigset_t,
556 pub sa_flags: libc::c_int,
557 pub sa_restorer: Option::<unsafe extern "C" fn() -> ()>,
558}
559#[derive(Copy, Clone)]
560#[repr(C)]
561pub union C2RustUnnamed_14 {
562 pub sa_handler: __sighandler_t,
563 pub sa_sigaction: Option::<
564 unsafe extern "C" fn(libc::c_int, *mut siginfo_t, *mut libc::c_void) -> (),
565 >,
566}
567#[derive(Copy, Clone)]
568#[repr(C)]
569pub struct hdr_histogram {
570 pub lowest_discernible_value: int64_t,
571 pub highest_trackable_value: int64_t,
572 pub unit_magnitude: int32_t,
573 pub significant_figures: int32_t,
574 pub sub_bucket_half_count_magnitude: int32_t,
575 pub sub_bucket_half_count: int32_t,
576 pub sub_bucket_mask: int64_t,
577 pub sub_bucket_count: int32_t,
578 pub bucket_count: int32_t,
579 pub min_value: int64_t,
580 pub max_value: int64_t,
581 pub normalizing_index_offset: int32_t,
582 pub conversion_ratio: libc::c_double,
583 pub counts_len: int32_t,
584 pub total_count: int64_t,
585 pub counts: *mut int64_t,
586}
587pub type mstime_t = libc::c_longlong;
588pub type ustime_t = libc::c_longlong;
589#[derive(Copy, Clone)]
590#[repr(C)]
591pub struct dictEntry {
592 pub key: *mut libc::c_void,
593 pub v: C2RustUnnamed_15,
594 pub next: *mut dictEntry,
595 pub metadata: [*mut libc::c_void; 0],
596}
597#[derive(Copy, Clone)]
598#[repr(C)]
599pub union C2RustUnnamed_15 {
600 pub val: *mut libc::c_void,
601 pub u64_0: uint64_t,
602 pub s64: int64_t,
603 pub d: libc::c_double,
604}
605#[derive(Copy, Clone)]
606#[repr(C)]
607pub struct dict {
608 pub type_0: *mut dictType,
609 pub ht_table: [*mut *mut dictEntry; 2],
610 pub ht_used: [libc::c_ulong; 2],
611 pub rehashidx: libc::c_long,
612 pub pauserehash: int16_t,
613 pub ht_size_exp: [libc::c_schar; 2],
614}
615#[derive(Copy, Clone)]
616#[repr(C)]
617pub struct dictType {
618 pub hashFunction: Option::<unsafe extern "C" fn(*const libc::c_void) -> uint64_t>,
619 pub keyDup: Option::<
620 unsafe extern "C" fn(*mut dict, *const libc::c_void) -> *mut libc::c_void,
621 >,
622 pub valDup: Option::<
623 unsafe extern "C" fn(*mut dict, *const libc::c_void) -> *mut libc::c_void,
624 >,
625 pub keyCompare: Option::<
626 unsafe extern "C" fn(
627 *mut dict,
628 *const libc::c_void,
629 *const libc::c_void,
630 ) -> libc::c_int,
631 >,
632 pub keyDestructor: Option::<
633 unsafe extern "C" fn(*mut dict, *mut libc::c_void) -> (),
634 >,
635 pub valDestructor: Option::<
636 unsafe extern "C" fn(*mut dict, *mut libc::c_void) -> (),
637 >,
638 pub expandAllowed: Option::<
639 unsafe extern "C" fn(size_t, libc::c_double) -> libc::c_int,
640 >,
641 pub dictEntryMetadataBytes: Option::<unsafe extern "C" fn(*mut dict) -> size_t>,
642}
643#[derive(Copy, Clone)]
644#[repr(C)]
645pub struct listNode {
646 pub prev: *mut listNode,
647 pub next: *mut listNode,
648 pub value: *mut libc::c_void,
649}
650#[derive(Copy, Clone)]
651#[repr(C)]
652pub struct list {
653 pub head: *mut listNode,
654 pub tail: *mut listNode,
655 pub dup: Option::<unsafe extern "C" fn(*mut libc::c_void) -> *mut libc::c_void>,
656 pub free: Option::<unsafe extern "C" fn(*mut libc::c_void) -> ()>,
657 pub match_0: Option::<
658 unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_void) -> libc::c_int,
659 >,
660 pub len: libc::c_ulong,
661}
662#[derive(Copy, Clone,c2rust_bitfields:: BitfieldStruct)]
663#[repr(C)]
664pub struct raxNode {
665 #[bitfield(name = "iskey", ty = "uint32_t", bits = "0..=0")]
666 #[bitfield(name = "isnull", ty = "uint32_t", bits = "1..=1")]
667 #[bitfield(name = "iscompr", ty = "uint32_t", bits = "2..=2")]
668 #[bitfield(name = "size", ty = "uint32_t", bits = "3..=31")]
669 pub iskey_isnull_iscompr_size: [u8; 4],
670 pub data: [libc::c_uchar; 0],
671}
672#[derive(Copy, Clone)]
673#[repr(C)]
674pub struct rax {
675 pub head: *mut raxNode,
676 pub numele: uint64_t,
677 pub numnodes: uint64_t,
678}
679pub type pause_type = libc::c_uint;
680pub const CLIENT_PAUSE_ALL: pause_type = 2;
681pub const CLIENT_PAUSE_WRITE: pause_type = 1;
682pub const CLIENT_PAUSE_OFF: pause_type = 0;
683#[derive(Copy, Clone)]
684#[repr(C)]
685pub struct pause_event {
686 pub type_0: pause_type,
687 pub end: mstime_t,
688}
689pub type robj = redisObject;
690pub type RedisModuleUserChangedFunc = Option::<
691 unsafe extern "C" fn(uint64_t, *mut libc::c_void) -> (),
692>;
693#[derive(Copy, Clone)]
694#[repr(C)]
695pub struct redisDb {
696 pub dict: *mut dict,
697 pub expires: *mut dict,
698 pub blocking_keys: *mut dict,
699 pub ready_keys: *mut dict,
700 pub watched_keys: *mut dict,
701 pub id: libc::c_int,
702 pub avg_ttl: libc::c_longlong,
703 pub expires_cursor: libc::c_ulong,
704 pub defrag_later: *mut list,
705 pub slots_to_keys: *mut clusterSlotToKeyMapping,
706}
707#[derive(Copy, Clone)]
708#[repr(C)]
709pub struct multiCmd {
710 pub argv: *mut *mut robj,
711 pub argv_len: libc::c_int,
712 pub argc: libc::c_int,
713 pub cmd: *mut redisCommand,
714}
715#[derive(Copy, Clone)]
716#[repr(C)]
717pub struct redisCommand {
718 pub declared_name: *const libc::c_char,
719 pub summary: *const libc::c_char,
720 pub complexity: *const libc::c_char,
721 pub since: *const libc::c_char,
722 pub doc_flags: libc::c_int,
723 pub replaced_by: *const libc::c_char,
724 pub deprecated_since: *const libc::c_char,
725 pub group: redisCommandGroup,
726 pub history: *mut commandHistory,
727 pub tips: *mut *const libc::c_char,
728 pub proc_0: Option::<redisCommandProc>,
729 pub arity: libc::c_int,
730 pub flags: uint64_t,
731 pub acl_categories: uint64_t,
732 pub key_specs_static: [keySpec; 4],
733 pub getkeys_proc: Option::<redisGetKeysProc>,
734 pub subcommands: *mut redisCommand,
735 pub args: *mut redisCommandArg,
736 pub microseconds: libc::c_longlong,
737 pub calls: libc::c_longlong,
738 pub rejected_calls: libc::c_longlong,
739 pub failed_calls: libc::c_longlong,
740 pub id: libc::c_int,
741 pub fullname: sds,
742 pub latency_histogram: *mut hdr_histogram,
743 pub key_specs: *mut keySpec,
744 pub legacy_range_key_spec: keySpec,
745 pub num_args: libc::c_int,
746 pub num_history: libc::c_int,
747 pub num_tips: libc::c_int,
748 pub key_specs_num: libc::c_int,
749 pub key_specs_max: libc::c_int,
750 pub subcommands_dict: *mut dict,
751 pub parent: *mut redisCommand,
752 pub module_cmd: *mut RedisModuleCommand,
753}
754#[derive(Copy, Clone)]
755#[repr(C)]
756pub struct keySpec {
757 pub notes: *const libc::c_char,
758 pub flags: uint64_t,
759 pub begin_search_type: kspec_bs_type,
760 pub bs: C2RustUnnamed_19,
761 pub find_keys_type: kspec_fk_type,
762 pub fk: C2RustUnnamed_16,
763}
764#[derive(Copy, Clone)]
765#[repr(C)]
766pub union C2RustUnnamed_16 {
767 pub range: C2RustUnnamed_18,
768 pub keynum: C2RustUnnamed_17,
769}
770#[derive(Copy, Clone)]
771#[repr(C)]
772pub struct C2RustUnnamed_17 {
773 pub keynumidx: libc::c_int,
774 pub firstkey: libc::c_int,
775 pub keystep: libc::c_int,
776}
777#[derive(Copy, Clone)]
778#[repr(C)]
779pub struct C2RustUnnamed_18 {
780 pub lastkey: libc::c_int,
781 pub keystep: libc::c_int,
782 pub limit: libc::c_int,
783}
784pub type kspec_fk_type = libc::c_uint;
785pub const KSPEC_FK_KEYNUM: kspec_fk_type = 3;
786pub const KSPEC_FK_RANGE: kspec_fk_type = 2;
787pub const KSPEC_FK_UNKNOWN: kspec_fk_type = 1;
788pub const KSPEC_FK_INVALID: kspec_fk_type = 0;
789#[derive(Copy, Clone)]
790#[repr(C)]
791pub union C2RustUnnamed_19 {
792 pub index: C2RustUnnamed_21,
793 pub keyword: C2RustUnnamed_20,
794}
795#[derive(Copy, Clone)]
796#[repr(C)]
797pub struct C2RustUnnamed_20 {
798 pub keyword: *const libc::c_char,
799 pub startfrom: libc::c_int,
800}
801#[derive(Copy, Clone)]
802#[repr(C)]
803pub struct C2RustUnnamed_21 {
804 pub pos: libc::c_int,
805}
806pub type kspec_bs_type = libc::c_uint;
807pub const KSPEC_BS_KEYWORD: kspec_bs_type = 3;
808pub const KSPEC_BS_INDEX: kspec_bs_type = 2;
809pub const KSPEC_BS_UNKNOWN: kspec_bs_type = 1;
810pub const KSPEC_BS_INVALID: kspec_bs_type = 0;
811#[derive(Copy, Clone)]
812#[repr(C)]
813pub struct redisCommandArg {
814 pub name: *const libc::c_char,
815 pub type_0: redisCommandArgType,
816 pub key_spec_index: libc::c_int,
817 pub token: *const libc::c_char,
818 pub summary: *const libc::c_char,
819 pub since: *const libc::c_char,
820 pub flags: libc::c_int,
821 pub deprecated_since: *const libc::c_char,
822 pub subargs: *mut redisCommandArg,
823 pub num_args: libc::c_int,
824}
825pub type redisCommandArgType = libc::c_uint;
826pub const ARG_TYPE_BLOCK: redisCommandArgType = 8;
827pub const ARG_TYPE_ONEOF: redisCommandArgType = 7;
828pub const ARG_TYPE_PURE_TOKEN: redisCommandArgType = 6;
829pub const ARG_TYPE_UNIX_TIME: redisCommandArgType = 5;
830pub const ARG_TYPE_PATTERN: redisCommandArgType = 4;
831pub const ARG_TYPE_KEY: redisCommandArgType = 3;
832pub const ARG_TYPE_DOUBLE: redisCommandArgType = 2;
833pub const ARG_TYPE_INTEGER: redisCommandArgType = 1;
834pub const ARG_TYPE_STRING: redisCommandArgType = 0;
835pub type redisGetKeysProc = unsafe extern "C" fn(
836 *mut redisCommand,
837 *mut *mut robj,
838 libc::c_int,
839 *mut getKeysResult,
840) -> libc::c_int;
841#[derive(Copy, Clone)]
842#[repr(C)]
843pub struct getKeysResult {
844 pub keysbuf: [keyReference; 256],
845 pub keys: *mut keyReference,
846 pub numkeys: libc::c_int,
847 pub size: libc::c_int,
848}
849#[derive(Copy, Clone)]
850#[repr(C)]
851pub struct keyReference {
852 pub pos: libc::c_int,
853 pub flags: libc::c_int,
854}
855pub type redisCommandProc = unsafe extern "C" fn(*mut client) -> ();
856#[derive(Copy, Clone)]
857#[repr(C)]
858pub struct client {
859 pub id: uint64_t,
860 pub flags: uint64_t,
861 pub conn: *mut connection,
862 pub resp: libc::c_int,
863 pub db: *mut redisDb,
864 pub name: *mut robj,
865 pub querybuf: sds,
866 pub qb_pos: size_t,
867 pub querybuf_peak: size_t,
868 pub argc: libc::c_int,
869 pub argv: *mut *mut robj,
870 pub argv_len: libc::c_int,
871 pub original_argc: libc::c_int,
872 pub original_argv: *mut *mut robj,
873 pub argv_len_sum: size_t,
874 pub cmd: *mut redisCommand,
875 pub lastcmd: *mut redisCommand,
876 pub realcmd: *mut redisCommand,
877 pub user: *mut user,
878 pub reqtype: libc::c_int,
879 pub multibulklen: libc::c_int,
880 pub bulklen: libc::c_long,
881 pub reply: *mut list,
882 pub reply_bytes: libc::c_ulonglong,
883 pub deferred_reply_errors: *mut list,
884 pub sentlen: size_t,
885 pub ctime: time_t,
886 pub duration: libc::c_long,
887 pub slot: libc::c_int,
888 pub cur_script: *mut dictEntry,
889 pub lastinteraction: time_t,
890 pub obuf_soft_limit_reached_time: time_t,
891 pub authenticated: libc::c_int,
892 pub replstate: libc::c_int,
893 pub repl_start_cmd_stream_on_ack: libc::c_int,
894 pub repldbfd: libc::c_int,
895 pub repldboff: off_t,
896 pub repldbsize: off_t,
897 pub replpreamble: sds,
898 pub read_reploff: libc::c_longlong,
899 pub reploff: libc::c_longlong,
900 pub repl_applied: libc::c_longlong,
901 pub repl_ack_off: libc::c_longlong,
902 pub repl_ack_time: libc::c_longlong,
903 pub repl_last_partial_write: libc::c_longlong,
904 pub psync_initial_offset: libc::c_longlong,
905 pub replid: [libc::c_char; 41],
906 pub slave_listening_port: libc::c_int,
907 pub slave_addr: *mut libc::c_char,
908 pub slave_capa: libc::c_int,
909 pub slave_req: libc::c_int,
910 pub mstate: multiState,
911 pub btype: libc::c_int,
912 pub bpop: blockingState,
913 pub woff: libc::c_longlong,
914 pub watched_keys: *mut list,
915 pub pubsub_channels: *mut dict,
916 pub pubsub_patterns: *mut list,
917 pub pubsubshard_channels: *mut dict,
918 pub peerid: sds,
919 pub sockname: sds,
920 pub client_list_node: *mut listNode,
921 pub postponed_list_node: *mut listNode,
922 pub pending_read_list_node: *mut listNode,
923 pub auth_callback: RedisModuleUserChangedFunc,
924 pub auth_callback_privdata: *mut libc::c_void,
925 pub auth_module: *mut libc::c_void,
926 pub client_tracking_redirection: uint64_t,
927 pub client_tracking_prefixes: *mut rax,
928 pub last_memory_usage: size_t,
929 pub last_memory_type: libc::c_int,
930 pub mem_usage_bucket_node: *mut listNode,
931 pub mem_usage_bucket: *mut clientMemUsageBucket,
932 pub ref_repl_buf_node: *mut listNode,
933 pub ref_block_pos: size_t,
934 pub buf_peak: size_t,
935 pub buf_peak_last_reset_time: mstime_t,
936 pub bufpos: libc::c_int,
937 pub buf_usable_size: size_t,
938 pub buf: *mut libc::c_char,
939}
940#[derive(Copy, Clone)]
941#[repr(C)]
942pub struct clientMemUsageBucket {
943 pub clients: *mut list,
944 pub mem_usage_sum: size_t,
945}
946#[derive(Copy, Clone)]
947#[repr(C)]
948pub struct blockingState {
949 pub count: libc::c_long,
950 pub timeout: mstime_t,
951 pub keys: *mut dict,
952 pub target: *mut robj,
953 pub blockpos: blockPos,
954 pub xread_count: size_t,
955 pub xread_group: *mut robj,
956 pub xread_consumer: *mut robj,
957 pub xread_group_noack: libc::c_int,
958 pub numreplicas: libc::c_int,
959 pub reploffset: libc::c_longlong,
960 pub module_blocked_handle: *mut libc::c_void,
961}
962#[derive(Copy, Clone)]
963#[repr(C)]
964pub struct blockPos {
965 pub wherefrom: libc::c_int,
966 pub whereto: libc::c_int,
967}
968#[derive(Copy, Clone)]
969#[repr(C)]
970pub struct multiState {
971 pub commands: *mut multiCmd,
972 pub count: libc::c_int,
973 pub cmd_flags: libc::c_int,
974 pub cmd_inv_flags: libc::c_int,
975 pub argv_len_sums: size_t,
976 pub alloc_count: libc::c_int,
977}
978#[derive(Copy, Clone)]
979#[repr(C)]
980pub struct user {
981 pub name: sds,
982 pub flags: uint32_t,
983 pub passwords: *mut list,
984 pub selectors: *mut list,
985 pub acl_string: *mut robj,
986}
987#[derive(Copy, Clone)]
988#[repr(C)]
989pub struct commandHistory {
990 pub since: *const libc::c_char,
991 pub changes: *const libc::c_char,
992}
993pub type redisCommandGroup = libc::c_uint;
994pub const COMMAND_GROUP_MODULE: redisCommandGroup = 17;
995pub const COMMAND_GROUP_BITMAP: redisCommandGroup = 16;
996pub const COMMAND_GROUP_STREAM: redisCommandGroup = 15;
997pub const COMMAND_GROUP_GEO: redisCommandGroup = 14;
998pub const COMMAND_GROUP_SENTINEL: redisCommandGroup = 13;
999pub const COMMAND_GROUP_CLUSTER: redisCommandGroup = 12;
1000pub const COMMAND_GROUP_HYPERLOGLOG: redisCommandGroup = 11;
1001pub const COMMAND_GROUP_SCRIPTING: redisCommandGroup = 10;
1002pub const COMMAND_GROUP_SERVER: redisCommandGroup = 9;
1003pub const COMMAND_GROUP_CONNECTION: redisCommandGroup = 8;
1004pub const COMMAND_GROUP_TRANSACTIONS: redisCommandGroup = 7;
1005pub const COMMAND_GROUP_PUBSUB: redisCommandGroup = 6;
1006pub const COMMAND_GROUP_HASH: redisCommandGroup = 5;
1007pub const COMMAND_GROUP_SORTED_SET: redisCommandGroup = 4;
1008pub const COMMAND_GROUP_SET: redisCommandGroup = 3;
1009pub const COMMAND_GROUP_LIST: redisCommandGroup = 2;
1010pub const COMMAND_GROUP_STRING: redisCommandGroup = 1;
1011pub const COMMAND_GROUP_GENERIC: redisCommandGroup = 0;
1012#[derive(Copy, Clone)]
1013#[repr(C)]
1014pub struct replBacklog {
1015 pub ref_repl_buf_node: *mut listNode,
1016 pub unindexed_count: size_t,
1017 pub blocks_index: *mut rax,
1018 pub histlen: libc::c_longlong,
1019 pub offset: libc::c_longlong,
1020}
1021#[derive(Copy, Clone)]
1022#[repr(C)]
1023pub struct saveparam {
1024 pub seconds: time_t,
1025 pub changes: libc::c_int,
1026}
1027#[derive(Copy, Clone)]
1028#[repr(C)]
1029pub struct sentinelConfig {
1030 pub pre_monitor_cfg: *mut list,
1031 pub monitor_cfg: *mut list,
1032 pub post_monitor_cfg: *mut list,
1033}
1034#[derive(Copy, Clone)]
1035#[repr(C)]
1036pub struct sharedObjectsStruct {
1037 pub crlf: *mut robj,
1038 pub ok: *mut robj,
1039 pub err: *mut robj,
1040 pub emptybulk: *mut robj,
1041 pub czero: *mut robj,
1042 pub cone: *mut robj,
1043 pub pong: *mut robj,
1044 pub space: *mut robj,
1045 pub queued: *mut robj,
1046 pub null: [*mut robj; 4],
1047 pub nullarray: [*mut robj; 4],
1048 pub emptymap: [*mut robj; 4],
1049 pub emptyset: [*mut robj; 4],
1050 pub emptyarray: *mut robj,
1051 pub wrongtypeerr: *mut robj,
1052 pub nokeyerr: *mut robj,
1053 pub syntaxerr: *mut robj,
1054 pub sameobjecterr: *mut robj,
1055 pub outofrangeerr: *mut robj,
1056 pub noscripterr: *mut robj,
1057 pub loadingerr: *mut robj,
1058 pub slowevalerr: *mut robj,
1059 pub slowscripterr: *mut robj,
1060 pub slowmoduleerr: *mut robj,
1061 pub bgsaveerr: *mut robj,
1062 pub masterdownerr: *mut robj,
1063 pub roslaveerr: *mut robj,
1064 pub execaborterr: *mut robj,
1065 pub noautherr: *mut robj,
1066 pub noreplicaserr: *mut robj,
1067 pub busykeyerr: *mut robj,
1068 pub oomerr: *mut robj,
1069 pub plus: *mut robj,
1070 pub messagebulk: *mut robj,
1071 pub pmessagebulk: *mut robj,
1072 pub subscribebulk: *mut robj,
1073 pub unsubscribebulk: *mut robj,
1074 pub psubscribebulk: *mut robj,
1075 pub punsubscribebulk: *mut robj,
1076 pub del: *mut robj,
1077 pub unlink: *mut robj,
1078 pub rpop: *mut robj,
1079 pub lpop: *mut robj,
1080 pub lpush: *mut robj,
1081 pub rpoplpush: *mut robj,
1082 pub lmove: *mut robj,
1083 pub blmove: *mut robj,
1084 pub zpopmin: *mut robj,
1085 pub zpopmax: *mut robj,
1086 pub emptyscan: *mut robj,
1087 pub multi: *mut robj,
1088 pub exec: *mut robj,
1089 pub left: *mut robj,
1090 pub right: *mut robj,
1091 pub hset: *mut robj,
1092 pub srem: *mut robj,
1093 pub xgroup: *mut robj,
1094 pub xclaim: *mut robj,
1095 pub script: *mut robj,
1096 pub replconf: *mut robj,
1097 pub eval: *mut robj,
1098 pub persist: *mut robj,
1099 pub set: *mut robj,
1100 pub pexpireat: *mut robj,
1101 pub pexpire: *mut robj,
1102 pub time: *mut robj,
1103 pub pxat: *mut robj,
1104 pub absttl: *mut robj,
1105 pub retrycount: *mut robj,
1106 pub force: *mut robj,
1107 pub justid: *mut robj,
1108 pub entriesread: *mut robj,
1109 pub lastid: *mut robj,
1110 pub ping: *mut robj,
1111 pub setid: *mut robj,
1112 pub keepttl: *mut robj,
1113 pub load: *mut robj,
1114 pub createconsumer: *mut robj,
1115 pub getack: *mut robj,
1116 pub special_asterick: *mut robj,
1117 pub special_equals: *mut robj,
1118 pub default_username: *mut robj,
1119 pub redacted: *mut robj,
1120 pub ssubscribebulk: *mut robj,
1121 pub sunsubscribebulk: *mut robj,
1122 pub smessagebulk: *mut robj,
1123 pub select: [*mut robj; 10],
1124 pub integers: [*mut robj; 10000],
1125 pub mbulkhdr: [*mut robj; 32],
1126 pub bulkhdr: [*mut robj; 32],
1127 pub maphdr: [*mut robj; 32],
1128 pub sethdr: [*mut robj; 32],
1129 pub minstring: sds,
1130 pub maxstring: sds,
1131}
1132#[derive(Copy, Clone)]
1133#[repr(C)]
1134pub struct clientBufferLimitsConfig {
1135 pub hard_limit_bytes: libc::c_ulonglong,
1136 pub soft_limit_bytes: libc::c_ulonglong,
1137 pub soft_limit_seconds: time_t,
1138}
1139#[derive(Copy, Clone)]
1140#[repr(C)]
1141pub struct redisOp {
1142 pub argv: *mut *mut robj,
1143 pub argc: libc::c_int,
1144 pub dbid: libc::c_int,
1145 pub target: libc::c_int,
1146}
1147#[derive(Copy, Clone)]
1148#[repr(C)]
1149pub struct redisOpArray {
1150 pub ops: *mut redisOp,
1151 pub numops: libc::c_int,
1152 pub capacity: libc::c_int,
1153}
1154#[derive(Copy, Clone)]
1155#[repr(C)]
1156pub struct malloc_stats {
1157 pub zmalloc_used: size_t,
1158 pub process_rss: size_t,
1159 pub allocator_allocated: size_t,
1160 pub allocator_active: size_t,
1161 pub allocator_resident: size_t,
1162}
1163#[derive(Copy, Clone)]
1164#[repr(C)]
1165pub struct socketFds {
1166 pub fd: [libc::c_int; 16],
1167 pub count: libc::c_int,
1168}
1169#[derive(Copy, Clone)]
1170#[repr(C)]
1171pub struct redisTLSContextConfig {
1172 pub cert_file: *mut libc::c_char,
1173 pub key_file: *mut libc::c_char,
1174 pub key_file_pass: *mut libc::c_char,
1175 pub client_cert_file: *mut libc::c_char,
1176 pub client_key_file: *mut libc::c_char,
1177 pub client_key_file_pass: *mut libc::c_char,
1178 pub dh_params_file: *mut libc::c_char,
1179 pub ca_cert_file: *mut libc::c_char,
1180 pub ca_cert_dir: *mut libc::c_char,
1181 pub protocols: *mut libc::c_char,
1182 pub ciphers: *mut libc::c_char,
1183 pub ciphersuites: *mut libc::c_char,
1184 pub prefer_server_ciphers: libc::c_int,
1185 pub session_caching: libc::c_int,
1186 pub session_cache_size: libc::c_int,
1187 pub session_cache_timeout: libc::c_int,
1188}
1189pub type aof_file_type = libc::c_uint;
1190pub const AOF_FILE_TYPE_INCR: aof_file_type = 105;
1191pub const AOF_FILE_TYPE_HIST: aof_file_type = 104;
1192pub const AOF_FILE_TYPE_BASE: aof_file_type = 98;
1193#[derive(Copy, Clone)]
1194#[repr(C)]
1195pub struct aofInfo {
1196 pub file_name: sds,
1197 pub file_seq: libc::c_longlong,
1198 pub file_type: aof_file_type,
1199}
1200#[derive(Copy, Clone)]
1201#[repr(C)]
1202pub struct aofManifest {
1203 pub base_aof_info: *mut aofInfo,
1204 pub incr_aof_list: *mut list,
1205 pub history_aof_list: *mut list,
1206 pub curr_base_file_seq: libc::c_longlong,
1207 pub curr_incr_file_seq: libc::c_longlong,
1208 pub dirty: libc::c_int,
1209}
1210#[derive(Copy, Clone)]
1211#[repr(C)]
1212pub struct redisServer {
1213 pub pid: pid_t,
1214 pub main_thread_id: pthread_t,
1215 pub configfile: *mut libc::c_char,
1216 pub executable: *mut libc::c_char,
1217 pub exec_argv: *mut *mut libc::c_char,
1218 pub dynamic_hz: libc::c_int,
1219 pub config_hz: libc::c_int,
1220 pub umask: mode_t,
1221 pub hz: libc::c_int,
1222 pub in_fork_child: libc::c_int,
1223 pub db: *mut redisDb,
1224 pub commands: *mut dict,
1225 pub orig_commands: *mut dict,
1226 pub el: *mut aeEventLoop,
1227 pub errors: *mut rax,
1228 pub lruclock: atomic_uint,
1229 pub shutdown_asap: sig_atomic_t,
1230 pub shutdown_mstime: mstime_t,
1231 pub last_sig_received: libc::c_int,
1232 pub shutdown_flags: libc::c_int,
1233 pub activerehashing: libc::c_int,
1234 pub active_defrag_running: libc::c_int,
1235 pub pidfile: *mut libc::c_char,
1236 pub arch_bits: libc::c_int,
1237 pub cronloops: libc::c_int,
1238 pub runid: [libc::c_char; 41],
1239 pub sentinel_mode: libc::c_int,
1240 pub initial_memory_usage: size_t,
1241 pub always_show_logo: libc::c_int,
1242 pub in_exec: libc::c_int,
1243 pub busy_module_yield_flags: libc::c_int,
1244 pub busy_module_yield_reply: *const libc::c_char,
1245 pub core_propagates: libc::c_int,
1246 pub propagate_no_multi: libc::c_int,
1247 pub module_ctx_nesting: libc::c_int,
1248 pub ignore_warnings: *mut libc::c_char,
1249 pub client_pause_in_transaction: libc::c_int,
1250 pub thp_enabled: libc::c_int,
1251 pub page_size: size_t,
1252 pub moduleapi: *mut dict,
1253 pub sharedapi: *mut dict,
1254 pub module_configs_queue: *mut dict,
1255 pub loadmodule_queue: *mut list,
1256 pub module_pipe: [libc::c_int; 2],
1257 pub child_pid: pid_t,
1258 pub child_type: libc::c_int,
1259 pub port: libc::c_int,
1260 pub tls_port: libc::c_int,
1261 pub tcp_backlog: libc::c_int,
1262 pub bindaddr: [*mut libc::c_char; 16],
1263 pub bindaddr_count: libc::c_int,
1264 pub bind_source_addr: *mut libc::c_char,
1265 pub unixsocket: *mut libc::c_char,
1266 pub unixsocketperm: libc::c_uint,
1267 pub ipfd: socketFds,
1268 pub tlsfd: socketFds,
1269 pub sofd: libc::c_int,
1270 pub socket_mark_id: uint32_t,
1271 pub cfd: socketFds,
1272 pub clients: *mut list,
1273 pub clients_to_close: *mut list,
1274 pub clients_pending_write: *mut list,
1275 pub clients_pending_read: *mut list,
1276 pub slaves: *mut list,
1277 pub monitors: *mut list,
1278 pub current_client: *mut client,
1279 pub client_mem_usage_buckets: *mut clientMemUsageBucket,
1280 pub clients_timeout_table: *mut rax,
1281 pub fixed_time_expire: libc::c_long,
1282 pub in_nested_call: libc::c_int,
1283 pub clients_index: *mut rax,
1284 pub client_pause_type: pause_type,
1285 pub postponed_clients: *mut list,
1286 pub client_pause_end_time: mstime_t,
1287 pub client_pause_per_purpose: [*mut pause_event; 3],
1288 pub neterr: [libc::c_char; 256],
1289 pub migrate_cached_sockets: *mut dict,
1290 pub next_client_id: uint_least64_t,
1291 pub protected_mode: libc::c_int,
1292 pub io_threads_num: libc::c_int,
1293 pub io_threads_do_reads: libc::c_int,
1294 pub io_threads_active: libc::c_int,
1295 pub events_processed_while_blocked: libc::c_longlong,
1296 pub enable_protected_configs: libc::c_int,
1297 pub enable_debug_cmd: libc::c_int,
1298 pub enable_module_cmd: libc::c_int,
1299 pub loading: sig_atomic_t,
1300 pub async_loading: sig_atomic_t,
1301 pub loading_total_bytes: off_t,
1302 pub loading_rdb_used_mem: off_t,
1303 pub loading_loaded_bytes: off_t,
1304 pub loading_start_time: time_t,
1305 pub loading_process_events_interval_bytes: off_t,
1306 pub stat_starttime: time_t,
1307 pub stat_numcommands: libc::c_longlong,
1308 pub stat_numconnections: libc::c_longlong,
1309 pub stat_expiredkeys: libc::c_longlong,
1310 pub stat_expired_stale_perc: libc::c_double,
1311 pub stat_expired_time_cap_reached_count: libc::c_longlong,
1312 pub stat_expire_cycle_time_used: libc::c_longlong,
1313 pub stat_evictedkeys: libc::c_longlong,
1314 pub stat_evictedclients: libc::c_longlong,
1315 pub stat_total_eviction_exceeded_time: libc::c_longlong,
1316 pub stat_last_eviction_exceeded_time: monotime,
1317 pub stat_keyspace_hits: libc::c_longlong,
1318 pub stat_keyspace_misses: libc::c_longlong,
1319 pub stat_active_defrag_hits: libc::c_longlong,
1320 pub stat_active_defrag_misses: libc::c_longlong,
1321 pub stat_active_defrag_key_hits: libc::c_longlong,
1322 pub stat_active_defrag_key_misses: libc::c_longlong,
1323 pub stat_active_defrag_scanned: libc::c_longlong,
1324 pub stat_total_active_defrag_time: libc::c_longlong,
1325 pub stat_last_active_defrag_time: monotime,
1326 pub stat_peak_memory: size_t,
1327 pub stat_aof_rewrites: libc::c_longlong,
1328 pub stat_aofrw_consecutive_failures: libc::c_longlong,
1329 pub stat_rdb_saves: libc::c_longlong,
1330 pub stat_fork_time: libc::c_longlong,
1331 pub stat_fork_rate: libc::c_double,
1332 pub stat_total_forks: libc::c_longlong,
1333 pub stat_rejected_conn: libc::c_longlong,
1334 pub stat_sync_full: libc::c_longlong,
1335 pub stat_sync_partial_ok: libc::c_longlong,
1336 pub stat_sync_partial_err: libc::c_longlong,
1337 pub slowlog: *mut list,
1338 pub slowlog_entry_id: libc::c_longlong,
1339 pub slowlog_log_slower_than: libc::c_longlong,
1340 pub slowlog_max_len: libc::c_ulong,
1341 pub cron_malloc_stats: malloc_stats,
1342 pub stat_net_input_bytes: atomic_llong,
1343 pub stat_net_output_bytes: atomic_llong,
1344 pub stat_net_repl_input_bytes: atomic_llong,
1345 pub stat_net_repl_output_bytes: atomic_llong,
1346 pub stat_current_cow_peak: size_t,
1347 pub stat_current_cow_bytes: size_t,
1348 pub stat_current_cow_updated: monotime,
1349 pub stat_current_save_keys_processed: size_t,
1350 pub stat_current_save_keys_total: size_t,
1351 pub stat_rdb_cow_bytes: size_t,
1352 pub stat_aof_cow_bytes: size_t,
1353 pub stat_module_cow_bytes: size_t,
1354 pub stat_module_progress: libc::c_double,
1355 pub stat_clients_type_memory: [size_t; 4],
1356 pub stat_cluster_links_memory: size_t,
1357 pub stat_unexpected_error_replies: libc::c_longlong,
1358 pub stat_total_error_replies: libc::c_longlong,
1359 pub stat_dump_payload_sanitizations: libc::c_longlong,
1360 pub stat_io_reads_processed: libc::c_longlong,
1361 pub stat_io_writes_processed: libc::c_longlong,
1362 pub stat_total_reads_processed: atomic_llong,
1363 pub stat_total_writes_processed: atomic_llong,
1364 pub inst_metric: [C2RustUnnamed_22; 5],
1365 pub stat_reply_buffer_shrinks: libc::c_longlong,
1366 pub stat_reply_buffer_expands: libc::c_longlong,
1367 pub verbosity: libc::c_int,
1368 pub maxidletime: libc::c_int,
1369 pub tcpkeepalive: libc::c_int,
1370 pub active_expire_enabled: libc::c_int,
1371 pub active_expire_effort: libc::c_int,
1372 pub active_defrag_enabled: libc::c_int,
1373 pub sanitize_dump_payload: libc::c_int,
1374 pub skip_checksum_validation: libc::c_int,
1375 pub jemalloc_bg_thread: libc::c_int,
1376 pub active_defrag_ignore_bytes: size_t,
1377 pub active_defrag_threshold_lower: libc::c_int,
1378 pub active_defrag_threshold_upper: libc::c_int,
1379 pub active_defrag_cycle_min: libc::c_int,
1380 pub active_defrag_cycle_max: libc::c_int,
1381 pub active_defrag_max_scan_fields: libc::c_ulong,
1382 pub client_max_querybuf_len: size_t,
1383 pub dbnum: libc::c_int,
1384 pub supervised: libc::c_int,
1385 pub supervised_mode: libc::c_int,
1386 pub daemonize: libc::c_int,
1387 pub set_proc_title: libc::c_int,
1388 pub proc_title_template: *mut libc::c_char,
1389 pub client_obuf_limits: [clientBufferLimitsConfig; 3],
1390 pub pause_cron: libc::c_int,
1391 pub latency_tracking_enabled: libc::c_int,
1392 pub latency_tracking_info_percentiles: *mut libc::c_double,
1393 pub latency_tracking_info_percentiles_len: libc::c_int,
1394 pub aof_enabled: libc::c_int,
1395 pub aof_state: libc::c_int,
1396 pub aof_fsync: libc::c_int,
1397 pub aof_filename: *mut libc::c_char,
1398 pub aof_dirname: *mut libc::c_char,
1399 pub aof_no_fsync_on_rewrite: libc::c_int,
1400 pub aof_rewrite_perc: libc::c_int,
1401 pub aof_rewrite_min_size: off_t,
1402 pub aof_rewrite_base_size: off_t,
1403 pub aof_current_size: off_t,
1404 pub aof_last_incr_size: off_t,
1405 pub aof_fsync_offset: off_t,
1406 pub aof_flush_sleep: libc::c_int,
1407 pub aof_rewrite_scheduled: libc::c_int,
1408 pub aof_buf: sds,
1409 pub aof_fd: libc::c_int,
1410 pub aof_selected_db: libc::c_int,
1411 pub aof_flush_postponed_start: time_t,
1412 pub aof_last_fsync: time_t,
1413 pub aof_rewrite_time_last: time_t,
1414 pub aof_rewrite_time_start: time_t,
1415 pub aof_cur_timestamp: time_t,
1416 pub aof_timestamp_enabled: libc::c_int,
1417 pub aof_lastbgrewrite_status: libc::c_int,
1418 pub aof_delayed_fsync: libc::c_ulong,
1419 pub aof_rewrite_incremental_fsync: libc::c_int,
1420 pub rdb_save_incremental_fsync: libc::c_int,
1421 pub aof_last_write_status: libc::c_int,
1422 pub aof_last_write_errno: libc::c_int,
1423 pub aof_load_truncated: libc::c_int,
1424 pub aof_use_rdb_preamble: libc::c_int,
1425 pub aof_bio_fsync_status: atomic_int,
1426 pub aof_bio_fsync_errno: atomic_int,
1427 pub aof_manifest: *mut aofManifest,
1428 pub aof_disable_auto_gc: libc::c_int,
1429 pub dirty: libc::c_longlong,
1430 pub dirty_before_bgsave: libc::c_longlong,
1431 pub rdb_last_load_keys_expired: libc::c_longlong,
1432 pub rdb_last_load_keys_loaded: libc::c_longlong,
1433 pub saveparams: *mut saveparam,
1434 pub saveparamslen: libc::c_int,
1435 pub rdb_filename: *mut libc::c_char,
1436 pub rdb_compression: libc::c_int,
1437 pub rdb_checksum: libc::c_int,
1438 pub rdb_del_sync_files: libc::c_int,
1439 pub lastsave: time_t,
1440 pub lastbgsave_try: time_t,
1441 pub rdb_save_time_last: time_t,
1442 pub rdb_save_time_start: time_t,
1443 pub rdb_bgsave_scheduled: libc::c_int,
1444 pub rdb_child_type: libc::c_int,
1445 pub lastbgsave_status: libc::c_int,
1446 pub stop_writes_on_bgsave_err: libc::c_int,
1447 pub rdb_pipe_read: libc::c_int,
1448 pub rdb_child_exit_pipe: libc::c_int,
1449 pub rdb_pipe_conns: *mut *mut connection,
1450 pub rdb_pipe_numconns: libc::c_int,
1451 pub rdb_pipe_numconns_writing: libc::c_int,
1452 pub rdb_pipe_buff: *mut libc::c_char,
1453 pub rdb_pipe_bufflen: libc::c_int,
1454 pub rdb_key_save_delay: libc::c_int,
1455 pub key_load_delay: libc::c_int,
1456 pub child_info_pipe: [libc::c_int; 2],
1457 pub child_info_nread: libc::c_int,
1458 pub also_propagate: redisOpArray,
1459 pub replication_allowed: libc::c_int,
1460 pub logfile: *mut libc::c_char,
1461 pub syslog_enabled: libc::c_int,
1462 pub syslog_ident: *mut libc::c_char,
1463 pub syslog_facility: libc::c_int,
1464 pub crashlog_enabled: libc::c_int,
1465 pub memcheck_enabled: libc::c_int,
1466 pub use_exit_on_panic: libc::c_int,
1467 pub shutdown_timeout: libc::c_int,
1468 pub shutdown_on_sigint: libc::c_int,
1469 pub shutdown_on_sigterm: libc::c_int,
1470 pub replid: [libc::c_char; 41],
1471 pub replid2: [libc::c_char; 41],
1472 pub master_repl_offset: libc::c_longlong,
1473 pub second_replid_offset: libc::c_longlong,
1474 pub slaveseldb: libc::c_int,
1475 pub repl_ping_slave_period: libc::c_int,
1476 pub repl_backlog: *mut replBacklog,
1477 pub repl_backlog_size: libc::c_longlong,
1478 pub repl_backlog_time_limit: time_t,
1479 pub repl_no_slaves_since: time_t,
1480 pub repl_min_slaves_to_write: libc::c_int,
1481 pub repl_min_slaves_max_lag: libc::c_int,
1482 pub repl_good_slaves_count: libc::c_int,
1483 pub repl_diskless_sync: libc::c_int,
1484 pub repl_diskless_load: libc::c_int,
1485 pub repl_diskless_sync_delay: libc::c_int,
1486 pub repl_diskless_sync_max_replicas: libc::c_int,
1487 pub repl_buffer_mem: size_t,
1488 pub repl_buffer_blocks: *mut list,
1489 pub masteruser: *mut libc::c_char,
1490 pub masterauth: sds,
1491 pub masterhost: *mut libc::c_char,
1492 pub masterport: libc::c_int,
1493 pub repl_timeout: libc::c_int,
1494 pub master: *mut client,
1495 pub cached_master: *mut client,
1496 pub repl_syncio_timeout: libc::c_int,
1497 pub repl_state: libc::c_int,
1498 pub repl_transfer_size: off_t,
1499 pub repl_transfer_read: off_t,
1500 pub repl_transfer_last_fsync_off: off_t,
1501 pub repl_transfer_s: *mut connection,
1502 pub repl_transfer_fd: libc::c_int,
1503 pub repl_transfer_tmpfile: *mut libc::c_char,
1504 pub repl_transfer_lastio: time_t,
1505 pub repl_serve_stale_data: libc::c_int,
1506 pub repl_slave_ro: libc::c_int,
1507 pub repl_slave_ignore_maxmemory: libc::c_int,
1508 pub repl_down_since: time_t,
1509 pub repl_disable_tcp_nodelay: libc::c_int,
1510 pub slave_priority: libc::c_int,
1511 pub replica_announced: libc::c_int,
1512 pub slave_announce_port: libc::c_int,
1513 pub slave_announce_ip: *mut libc::c_char,
1514 pub propagation_error_behavior: libc::c_int,
1515 pub repl_ignore_disk_write_error: libc::c_int,
1516 pub master_replid: [libc::c_char; 41],
1517 pub master_initial_offset: libc::c_longlong,
1518 pub repl_slave_lazy_flush: libc::c_int,
1519 pub clients_waiting_acks: *mut list,
1520 pub get_ack_from_slaves: libc::c_int,
1521 pub maxclients: libc::c_uint,
1522 pub maxmemory: libc::c_ulonglong,
1523 pub maxmemory_clients: ssize_t,
1524 pub maxmemory_policy: libc::c_int,
1525 pub maxmemory_samples: libc::c_int,
1526 pub maxmemory_eviction_tenacity: libc::c_int,
1527 pub lfu_log_factor: libc::c_int,
1528 pub lfu_decay_time: libc::c_int,
1529 pub proto_max_bulk_len: libc::c_longlong,
1530 pub oom_score_adj_values: [libc::c_int; 3],
1531 pub oom_score_adj: libc::c_int,
1532 pub disable_thp: libc::c_int,
1533 pub blocked_clients: libc::c_uint,
1534 pub blocked_clients_by_type: [libc::c_uint; 8],
1535 pub unblocked_clients: *mut list,
1536 pub ready_keys: *mut list,
1537 pub tracking_clients: libc::c_uint,
1538 pub tracking_table_max_keys: size_t,
1539 pub tracking_pending_keys: *mut list,
1540 pub sort_desc: libc::c_int,
1541 pub sort_alpha: libc::c_int,
1542 pub sort_bypattern: libc::c_int,
1543 pub sort_store: libc::c_int,
1544 pub hash_max_listpack_entries: size_t,
1545 pub hash_max_listpack_value: size_t,
1546 pub set_max_intset_entries: size_t,
1547 pub zset_max_listpack_entries: size_t,
1548 pub zset_max_listpack_value: size_t,
1549 pub hll_sparse_max_bytes: size_t,
1550 pub stream_node_max_bytes: size_t,
1551 pub stream_node_max_entries: libc::c_longlong,
1552 pub list_max_listpack_size: libc::c_int,
1553 pub list_compress_depth: libc::c_int,
1554 pub unixtime: atomic_int,
1555 pub timezone: time_t,
1556 pub daylight_active: libc::c_int,
1557 pub mstime: mstime_t,
1558 pub ustime: ustime_t,
1559 pub blocking_op_nesting: size_t,
1560 pub blocked_last_cron: libc::c_longlong,
1561 pub pubsub_channels: *mut dict,
1562 pub pubsub_patterns: *mut dict,
1563 pub notify_keyspace_events: libc::c_int,
1564 pub pubsubshard_channels: *mut dict,
1565 pub cluster_enabled: libc::c_int,
1566 pub cluster_port: libc::c_int,
1567 pub cluster_node_timeout: mstime_t,
1568 pub cluster_configfile: *mut libc::c_char,
1569 pub cluster: *mut clusterState,
1570 pub cluster_migration_barrier: libc::c_int,
1571 pub cluster_allow_replica_migration: libc::c_int,
1572 pub cluster_slave_validity_factor: libc::c_int,
1573 pub cluster_require_full_coverage: libc::c_int,
1574 pub cluster_slave_no_failover: libc::c_int,
1575 pub cluster_announce_ip: *mut libc::c_char,
1576 pub cluster_announce_hostname: *mut libc::c_char,
1577 pub cluster_preferred_endpoint_type: libc::c_int,
1578 pub cluster_announce_port: libc::c_int,
1579 pub cluster_announce_tls_port: libc::c_int,
1580 pub cluster_announce_bus_port: libc::c_int,
1581 pub cluster_module_flags: libc::c_int,
1582 pub cluster_allow_reads_when_down: libc::c_int,
1583 pub cluster_config_file_lock_fd: libc::c_int,
1584 pub cluster_link_sendbuf_limit_bytes: libc::c_ulonglong,
1585 pub cluster_drop_packet_filter: libc::c_int,
1586 pub script_caller: *mut client,
1587 pub busy_reply_threshold: mstime_t,
1588 pub pre_command_oom_state: libc::c_int,
1589 pub script_disable_deny_script: libc::c_int,
1590 pub lazyfree_lazy_eviction: libc::c_int,
1591 pub lazyfree_lazy_expire: libc::c_int,
1592 pub lazyfree_lazy_server_del: libc::c_int,
1593 pub lazyfree_lazy_user_del: libc::c_int,
1594 pub lazyfree_lazy_user_flush: libc::c_int,
1595 pub latency_monitor_threshold: libc::c_longlong,
1596 pub latency_events: *mut dict,
1597 pub acl_filename: *mut libc::c_char,
1598 pub acllog_max_len: libc::c_ulong,
1599 pub requirepass: sds,
1600 pub acl_pubsub_default: libc::c_int,
1601 pub watchdog_period: libc::c_int,
1602 pub system_memory_size: size_t,
1603 pub tls_cluster: libc::c_int,
1604 pub tls_replication: libc::c_int,
1605 pub tls_auth_clients: libc::c_int,
1606 pub tls_ctx_config: redisTLSContextConfig,
1607 pub server_cpulist: *mut libc::c_char,
1608 pub bio_cpulist: *mut libc::c_char,
1609 pub aof_rewrite_cpulist: *mut libc::c_char,
1610 pub bgsave_cpulist: *mut libc::c_char,
1611 pub sentinel_config: *mut sentinelConfig,
1612 pub failover_end_time: mstime_t,
1613 pub force_failover: libc::c_int,
1614 pub target_replica_host: *mut libc::c_char,
1615 pub target_replica_port: libc::c_int,
1616 pub failover_state: libc::c_int,
1617 pub cluster_allow_pubsubshard_when_down: libc::c_int,
1618 pub reply_buffer_peak_reset_time: libc::c_long,
1619 pub reply_buffer_resizing_enabled: libc::c_int,
1620}
1621#[derive(Copy, Clone)]
1622#[repr(C)]
1623pub struct C2RustUnnamed_22 {
1624 pub last_sample_time: libc::c_longlong,
1625 pub last_sample_count: libc::c_longlong,
1626 pub samples: [libc::c_longlong; 16],
1627 pub idx: libc::c_int,
1628}
1629#[derive(Copy, Clone)]
1630#[repr(C)]
1631pub struct C2RustUnnamed_23 {
1632 pub rio: *mut rio,
1633 pub key: *mut robj,
1634 pub key_type: libc::c_int,
1635 pub keys: libc::c_ulong,
1636 pub expires: libc::c_ulong,
1637 pub already_expired: libc::c_ulong,
1638 pub doing: libc::c_int,
1639 pub error_set: libc::c_int,
1640 pub error: [libc::c_char; 1024],
1641}
1642#[inline]
1643unsafe extern "C" fn rioRead(
1644 mut r: *mut rio,
1645 mut buf: *mut libc::c_void,
1646 mut len: size_t,
1647) -> size_t {
1648 if (*r).flags & ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_ulong != 0 {
1649 return 0 as libc::c_int as size_t;
1650 }
1651 while len != 0 {
1652 let mut bytes_to_read: size_t = if (*r).max_processing_chunk != 0
1653 && (*r).max_processing_chunk < len
1654 {
1655 (*r).max_processing_chunk
1656 } else {
1657 len
1658 };
1659 if ((*r).read).expect("non-null function pointer")(r, buf, bytes_to_read)
1660 == 0 as libc::c_int as libc::c_ulong
1661 {
1662 (*r).flags |= ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_ulong;
1663 return 0 as libc::c_int as size_t;
1664 }
1665 if ((*r).update_cksum).is_some() {
1666 ((*r).update_cksum)
1667 .expect("non-null function pointer")(r, buf, bytes_to_read);
1668 }
1669 buf = (buf as *mut libc::c_char).offset(bytes_to_read as isize)
1670 as *mut libc::c_void;
1671 len = (len as libc::c_ulong).wrapping_sub(bytes_to_read) as size_t as size_t;
1672 (*r)
1673 .processed_bytes = ((*r).processed_bytes as libc::c_ulong)
1674 .wrapping_add(bytes_to_read) as size_t as size_t;
1675 }
1676 return 1 as libc::c_int as size_t;
1677}
1678#[inline]
1679unsafe extern "C" fn rioGetReadError(mut r: *mut rio) -> libc::c_int {
1680 return ((*r).flags & ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_ulong
1681 != 0 as libc::c_int as libc::c_ulong) as libc::c_int;
1682}
1683#[inline]
1684unsafe extern "C" fn atoi(mut __nptr: *const libc::c_char) -> libc::c_int {
1685 return strtol(
1686 __nptr,
1687 0 as *mut libc::c_void as *mut *mut libc::c_char,
1688 10 as libc::c_int,
1689 ) as libc::c_int;
1690}
1691#[inline]
1692unsafe extern "C" fn fstat(
1693 mut __fd: libc::c_int,
1694 mut __statbuf: *mut stat,
1695) -> libc::c_int {
1696 return __fxstat(0 as libc::c_int, __fd, __statbuf);
1697}
1698#[no_mangle]
1699pub static mut rdbCheckMode: libc::c_int = 0 as libc::c_int;
1700#[no_mangle]
1701pub static mut rdbstate: C2RustUnnamed_23 = C2RustUnnamed_23 {
1702 rio: 0 as *const rio as *mut rio,
1703 key: 0 as *const robj as *mut robj,
1704 key_type: 0,
1705 keys: 0,
1706 expires: 0,
1707 already_expired: 0,
1708 doing: 0,
1709 error_set: 0,
1710 error: [0; 1024],
1711};
1712#[no_mangle]
1713pub static mut rdb_check_doing_string: [*mut libc::c_char; 10] = [
1714 b"start\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1715 b"read-type\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1716 b"read-expire\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1717 b"read-key\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1718 b"read-object-value\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1719 b"check-sum\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1720 b"read-len\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1721 b"read-aux\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1722 b"read-module-aux\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1723 b"read-functions\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1724];
1725#[no_mangle]
1726pub static mut rdb_type_string: [*mut libc::c_char; 19] = [
1727 b"string\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1728 b"list-linked\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1729 b"set-hashtable\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1730 b"zset-v1\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1731 b"hash-hashtable\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1732 b"zset-v2\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1733 b"module-value\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1734 b"\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1735 b"\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1736 b"hash-zipmap\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1737 b"list-ziplist\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1738 b"set-intset\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1739 b"zset-ziplist\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1740 b"hash-ziplist\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1741 b"quicklist\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1742 b"stream\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1743 b"hash-listpack\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1744 b"zset-listpack\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1745 b"quicklist-v2\0" as *const u8 as *const libc::c_char as *mut libc::c_char,
1746];
1747#[no_mangle]
1748pub unsafe extern "C" fn rdbShowGenericInfo() {
1749 printf(
1750 b"[info] %lu keys read\n\0" as *const u8 as *const libc::c_char,
1751 rdbstate.keys,
1752 );
1753 printf(
1754 b"[info] %lu expires\n\0" as *const u8 as *const libc::c_char,
1755 rdbstate.expires,
1756 );
1757 printf(
1758 b"[info] %lu already expired\n\0" as *const u8 as *const libc::c_char,
1759 rdbstate.already_expired,
1760 );
1761}
1762#[no_mangle]
1763pub unsafe extern "C" fn rdbCheckError(mut fmt: *const libc::c_char, mut args: ...) {
1764 let mut msg: [libc::c_char; 1024] = [0; 1024];
1765 let mut ap: core::ffi::VaListImpl;
1766 ap = args.clone();
1767 vsnprintf(
1768 msg.as_mut_ptr(),
1769 core::mem::size_of::<[libc::c_char; 1024]>() as libc::c_ulong,
1770 fmt,
1771 ap.as_va_list(),
1772 );
1773 printf(b"--- RDB ERROR DETECTED ---\n\0" as *const u8 as *const libc::c_char);
1774 printf(
1775 b"[offset %llu] %s\n\0" as *const u8 as *const libc::c_char,
1776 (if !(rdbstate.rio).is_null() {
1777 (*rdbstate.rio).processed_bytes
1778 } else {
1779 0 as libc::c_int as libc::c_ulong
1780 }) as libc::c_ulonglong,
1781 msg.as_mut_ptr(),
1782 );
1783 printf(
1784 b"[additional info] While doing: %s\n\0" as *const u8 as *const libc::c_char,
1785 rdb_check_doing_string[rdbstate.doing as usize],
1786 );
1787 if !(rdbstate.key).is_null() {
1788 printf(
1789 b"[additional info] Reading key '%s'\n\0" as *const u8
1790 as *const libc::c_char,
1791 (*rdbstate.key).ptr as *mut libc::c_char,
1792 );
1793 }
1794 if rdbstate.key_type != -(1 as libc::c_int) {
1795 printf(
1796 b"[additional info] Reading type %d (%s)\n\0" as *const u8
1797 as *const libc::c_char,
1798 rdbstate.key_type,
1799 if (rdbstate.key_type as libc::c_uint as libc::c_ulong)
1800 < (core::mem::size_of::<[*mut libc::c_char; 19]>() as libc::c_ulong)
1801 .wrapping_div(
1802 core::mem::size_of::<*mut libc::c_char>() as libc::c_ulong,
1803 )
1804 {
1805 rdb_type_string[rdbstate.key_type as usize] as *const libc::c_char
1806 } else {
1807 b"unknown\0" as *const u8 as *const libc::c_char
1808 },
1809 );
1810 }
1811 rdbShowGenericInfo();
1812}
1813#[no_mangle]
1814pub unsafe extern "C" fn rdbCheckInfo(mut fmt: *const libc::c_char, mut args: ...) {
1815 let mut msg: [libc::c_char; 1024] = [0; 1024];
1816 let mut ap: core::ffi::VaListImpl;
1817 ap = args.clone();
1818 vsnprintf(
1819 msg.as_mut_ptr(),
1820 core::mem::size_of::<[libc::c_char; 1024]>() as libc::c_ulong,
1821 fmt,
1822 ap.as_va_list(),
1823 );
1824 printf(
1825 b"[offset %llu] %s\n\0" as *const u8 as *const libc::c_char,
1826 (if !(rdbstate.rio).is_null() {
1827 (*rdbstate.rio).processed_bytes
1828 } else {
1829 0 as libc::c_int as libc::c_ulong
1830 }) as libc::c_ulonglong,
1831 msg.as_mut_ptr(),
1832 );
1833}
1834#[no_mangle]
1835pub unsafe extern "C" fn rdbCheckSetError(mut fmt: *const libc::c_char, mut args: ...) {
1836 let mut ap: core::ffi::VaListImpl;
1837 ap = args.clone();
1838 vsnprintf(
1839 (rdbstate.error).as_mut_ptr(),
1840 core::mem::size_of::<[libc::c_char; 1024]>() as libc::c_ulong,
1841 fmt,
1842 ap.as_va_list(),
1843 );
1844 rdbstate.error_set = 1 as libc::c_int;
1845}
1846#[no_mangle]
1847pub unsafe extern "C" fn rdbCheckHandleCrash(
1848 mut sig: libc::c_int,
1849 mut info: *mut siginfo_t,
1850 mut secret: *mut libc::c_void,
1851) {
1852 rdbCheckError(
1853 b"Server crash checking the specified RDB file!\0" as *const u8
1854 as *const libc::c_char,
1855 );
1856 exit(1 as libc::c_int);
1857}
1858#[no_mangle]
1859pub unsafe extern "C" fn rdbCheckSetupSignals() {
1860 let mut act: sigaction = sigaction {
1861 __sigaction_handler: C2RustUnnamed_14 {
1862 sa_handler: None,
1863 },
1864 sa_mask: __sigset_t { __val: [0; 16] },
1865 sa_flags: 0,
1866 sa_restorer: None,
1867 };
1868 sigemptyset(&mut act.sa_mask);
1869 act
1870 .sa_flags = (0x40000000 as libc::c_int as libc::c_uint
1871 | 0x80000000 as libc::c_uint | 4 as libc::c_int as libc::c_uint) as libc::c_int;
1872 act
1873 .__sigaction_handler
1874 .sa_sigaction = Some(
1875 rdbCheckHandleCrash
1876 as unsafe extern "C" fn(libc::c_int, *mut siginfo_t, *mut libc::c_void) -> (),
1877 );
1878 sigaction(11 as libc::c_int, &mut act, 0 as *mut sigaction);
1879 sigaction(7 as libc::c_int, &mut act, 0 as *mut sigaction);
1880 sigaction(8 as libc::c_int, &mut act, 0 as *mut sigaction);
1881 sigaction(4 as libc::c_int, &mut act, 0 as *mut sigaction);
1882 sigaction(6 as libc::c_int, &mut act, 0 as *mut sigaction);
1883}
1884#[no_mangle]
1885pub unsafe extern "C" fn redis_check_rdb(
1886 mut rdbfilename: *mut libc::c_char,
1887 mut fp: *mut FILE,
1888) -> libc::c_int {
1889 let mut current_block: u64;
1890 let mut dbid: uint64_t = 0;
1891 let mut selected_dbid: libc::c_int = -(1 as libc::c_int);
1892 let mut type_0: libc::c_int = 0;
1893 let mut rdbver: libc::c_int = 0;
1894 let mut buf: [libc::c_char; 1024] = [0; 1024];
1895 let mut expiretime: libc::c_longlong = 0;
1896 let mut now: libc::c_longlong = mstime();
1897 static mut rdb: rio = rio {
1898 read: None,
1899 write: None,
1900 tell: None,
1901 flush: None,
1902 update_cksum: None,
1903 cksum: 0,
1904 flags: 0,
1905 processed_bytes: 0,
1906 max_processing_chunk: 0,
1907 io: C2RustUnnamed {
1908 buffer: C2RustUnnamed_3 {
1909 ptr: 0 as *const libc::c_char as *mut libc::c_char,
1910 pos: 0,
1911 },
1912 },
1913 };
1914 let mut sb: stat = stat {
1915 st_dev: 0,
1916 st_ino: 0,
1917 st_mode: 0,
1918 st_nlink: 0,
1919 st_uid: 0,
1920 st_gid: 0,
1921 st_rdev: 0,
1922 __pad1: 0,
1923 st_size: 0,
1924 st_blksize: 0,
1925 __pad2: 0,
1926 st_blocks: 0,
1927 st_atim: timespec { tv_sec: 0, tv_nsec: 0 },
1928 st_mtim: timespec { tv_sec: 0, tv_nsec: 0 },
1929 st_ctim: timespec { tv_sec: 0, tv_nsec: 0 },
1930 __glibc_reserved: [0; 2],
1931 };
1932 let mut closefile: libc::c_int = (fp == 0 as *mut libc::c_void as *mut FILE)
1933 as libc::c_int;
1934 if fp.is_null()
1935 && {
1936 fp = fopen(rdbfilename, b"r\0" as *const u8 as *const libc::c_char);
1937 fp.is_null()
1938 }
1939 {
1940 return 1 as libc::c_int;
1941 }
1942 if fstat(fileno(fp), &mut sb) == -(1 as libc::c_int) {
1943 sb.st_size = 0 as libc::c_int as __off64_t;
1944 }
1945 startLoadingFile(sb.st_size as size_t, rdbfilename, 0 as libc::c_int);
1946 rioInitWithFile(&mut rdb, fp);
1947 rdbstate.rio = &mut rdb;
1948 rdb
1949 .update_cksum = Some(
1950 rdbLoadProgressCallback
1951 as unsafe extern "C" fn(*mut rio, *const libc::c_void, size_t) -> (),
1952 );
1953 if rioRead(
1954 &mut rdb,
1955 buf.as_mut_ptr() as *mut libc::c_void,
1956 9 as libc::c_int as size_t,
1957 ) == 0 as libc::c_int as libc::c_ulong
1958 {
1959 current_block = 6512628852423894791;
1960 } else {
1961 buf[9 as libc::c_int as usize] = '\0' as i32 as libc::c_char;
1962 if memcmp(
1963 buf.as_mut_ptr() as *const libc::c_void,
1964 b"REDIS\0" as *const u8 as *const libc::c_char as *const libc::c_void,
1965 5 as libc::c_int as libc::c_ulong,
1966 ) != 0 as libc::c_int
1967 {
1968 rdbCheckError(
1969 b"Wrong signature trying to load DB from file\0" as *const u8
1970 as *const libc::c_char,
1971 );
1972 current_block = 12507377084108038387;
1973 } else {
1974 rdbver = atoi(buf.as_mut_ptr().offset(5 as libc::c_int as isize));
1975 if rdbver < 1 as libc::c_int || rdbver > 10 as libc::c_int {
1976 rdbCheckError(
1977 b"Can't handle RDB format version %d\0" as *const u8
1978 as *const libc::c_char,
1979 rdbver,
1980 );
1981 current_block = 12507377084108038387;
1982 } else {
1983 expiretime = -(1 as libc::c_int) as libc::c_longlong;
1984 loop {
1985 let mut key: *mut robj = 0 as *mut robj;
1986 let mut val: *mut robj = 0 as *mut robj;
1987 rdbstate.doing = 1 as libc::c_int;
1988 type_0 = rdbLoadType(&mut rdb);
1989 if type_0 == -(1 as libc::c_int) {
1990 current_block = 6512628852423894791;
1991 break;
1992 }
1993 if type_0 == 253 as libc::c_int {
1994 rdbstate.doing = 2 as libc::c_int;
1995 expiretime = rdbLoadTime(&mut rdb) as libc::c_longlong;
1996 expiretime *= 1000 as libc::c_int as libc::c_longlong;
1997 if rioGetReadError(&mut rdb) != 0 {
1998 current_block = 6512628852423894791;
1999 break;
2000 }
2001 } else if type_0 == 252 as libc::c_int {
2002 rdbstate.doing = 2 as libc::c_int;
2003 expiretime = rdbLoadMillisecondTime(&mut rdb, rdbver);
2004 if rioGetReadError(&mut rdb) != 0 {
2005 current_block = 6512628852423894791;
2006 break;
2007 }
2008 } else if type_0 == 249 as libc::c_int {
2009 let mut byte: uint8_t = 0;
2010 if rioRead(
2011 &mut rdb,
2012 &mut byte as *mut uint8_t as *mut libc::c_void,
2013 1 as libc::c_int as size_t,
2014 ) == 0 as libc::c_int as libc::c_ulong
2015 {
2016 current_block = 6512628852423894791;
2017 break;
2018 }
2019 } else if type_0 == 248 as libc::c_int {
2020 if rdbLoadLen(&mut rdb, 0 as *mut libc::c_int)
2021 == 18446744073709551615 as libc::c_ulong
2022 {
2023 current_block = 6512628852423894791;
2024 break;
2025 }
2026 } else if type_0 == 255 as libc::c_int {
2027 current_block = 10007731352114176167;
2028 break;
2029 } else if type_0 == 254 as libc::c_int {
2030 rdbstate.doing = 6 as libc::c_int;
2031 dbid = rdbLoadLen(&mut rdb, 0 as *mut libc::c_int);
2032 if dbid == 18446744073709551615 as libc::c_ulong {
2033 current_block = 6512628852423894791;
2034 break;
2035 }
2036 rdbCheckInfo(
2037 b"Selecting DB ID %llu\0" as *const u8
2038 as *const libc::c_char,
2039 dbid as libc::c_ulonglong,
2040 );
2041 selected_dbid = dbid as libc::c_int;
2042 } else if type_0 == 251 as libc::c_int {
2043 let mut db_size: uint64_t = 0;
2044 let mut expires_size: uint64_t = 0;
2045 rdbstate.doing = 6 as libc::c_int;
2046 db_size = rdbLoadLen(&mut rdb, 0 as *mut libc::c_int);
2047 if db_size == 18446744073709551615 as libc::c_ulong {
2048 current_block = 6512628852423894791;
2049 break;
2050 }
2051 expires_size = rdbLoadLen(&mut rdb, 0 as *mut libc::c_int);
2052 if expires_size == 18446744073709551615 as libc::c_ulong {
2053 current_block = 6512628852423894791;
2054 break;
2055 }
2056 } else if type_0 == 250 as libc::c_int {
2057 let mut auxkey: *mut robj = 0 as *mut robj;
2058 let mut auxval: *mut robj = 0 as *mut robj;
2059 rdbstate.doing = 7 as libc::c_int;
2060 auxkey = rdbLoadStringObject(&mut rdb);
2061 if auxkey.is_null() {
2062 current_block = 6512628852423894791;
2063 break;
2064 }
2065 auxval = rdbLoadStringObject(&mut rdb);
2066 if auxval.is_null() {
2067 decrRefCount(auxkey);
2068 current_block = 6512628852423894791;
2069 break;
2070 } else {
2071 rdbCheckInfo(
2072 b"AUX FIELD %s = '%s'\0" as *const u8
2073 as *const libc::c_char,
2074 (*auxkey).ptr as *mut libc::c_char,
2075 (*auxval).ptr as *mut libc::c_char,
2076 );
2077 decrRefCount(auxkey);
2078 decrRefCount(auxval);
2079 }
2080 } else if type_0 == 247 as libc::c_int {
2081 let mut moduleid: uint64_t = 0;
2082 let mut when_opcode: uint64_t = 0;
2083 let mut when: uint64_t = 0;
2084 rdbstate.doing = 8 as libc::c_int;
2085 moduleid = rdbLoadLen(&mut rdb, 0 as *mut libc::c_int);
2086 if moduleid == 18446744073709551615 as libc::c_ulong {
2087 current_block = 6512628852423894791;
2088 break;
2089 }
2090 when_opcode = rdbLoadLen(&mut rdb, 0 as *mut libc::c_int);
2091 if when_opcode == 18446744073709551615 as libc::c_ulong {
2092 current_block = 6512628852423894791;
2093 break;
2094 }
2095 when = rdbLoadLen(&mut rdb, 0 as *mut libc::c_int);
2096 if when == 18446744073709551615 as libc::c_ulong {
2097 current_block = 6512628852423894791;
2098 break;
2099 }
2100 if when_opcode != 2 as libc::c_int as libc::c_ulong {
2101 rdbCheckError(
2102 b"bad when_opcode\0" as *const u8 as *const libc::c_char,
2103 );
2104 current_block = 12507377084108038387;
2105 break;
2106 } else {
2107 let mut name: [libc::c_char; 10] = [0; 10];
2108 moduleTypeNameByID(name.as_mut_ptr(), moduleid);
2109 rdbCheckInfo(
2110 b"MODULE AUX for: %s\0" as *const u8 as *const libc::c_char,
2111 name.as_mut_ptr(),
2112 );
2113 let mut o: *mut robj = rdbLoadCheckModuleValue(
2114 &mut rdb,
2115 name.as_mut_ptr(),
2116 );
2117 decrRefCount(o);
2118 }
2119 } else if type_0 == 246 as libc::c_int
2120 || type_0 == 245 as libc::c_int
2121 {
2122 let mut err: sds = 0 as sds;
2123 rdbstate.doing = 9 as libc::c_int;
2124 if !(rdbFunctionLoad(
2125 &mut rdb,
2126 rdbver,
2127 0 as *mut functionsLibCtx,
2128 type_0,
2129 0 as libc::c_int,
2130 &mut err,
2131 ) != 0 as libc::c_int)
2132 {
2133 continue;
2134 }
2135 rdbCheckError(
2136 b"Failed loading library, %s\0" as *const u8
2137 as *const libc::c_char,
2138 err,
2139 );
2140 sdsfree(err);
2141 current_block = 12507377084108038387;
2142 break;
2143 } else if !(type_0 >= 0 as libc::c_int && type_0 <= 7 as libc::c_int
2144 || type_0 >= 9 as libc::c_int && type_0 <= 19 as libc::c_int)
2145 {
2146 rdbCheckError(
2147 b"Invalid object type: %d\0" as *const u8
2148 as *const libc::c_char,
2149 type_0,
2150 );
2151 current_block = 12507377084108038387;
2152 break;
2153 } else {
2154 rdbstate.key_type = type_0;
2155 rdbstate.doing = 3 as libc::c_int;
2156 key = rdbLoadStringObject(&mut rdb);
2157 if key.is_null() {
2158 current_block = 6512628852423894791;
2159 break;
2160 }
2161 rdbstate.key = key;
2162 rdbstate.keys = (rdbstate.keys).wrapping_add(1);
2163 rdbstate.doing = 4 as libc::c_int;
2164 val = rdbLoadObject(
2165 type_0,
2166 &mut rdb,
2167 (*key).ptr as sds,
2168 selected_dbid,
2169 0 as *mut libc::c_int,
2170 );
2171 if val.is_null() {
2172 current_block = 6512628852423894791;
2173 break;
2174 }
2175 if expiretime != -(1 as libc::c_int) as libc::c_longlong
2176 && expiretime < now
2177 {
2178 rdbstate
2179 .already_expired = (rdbstate.already_expired)
2180 .wrapping_add(1);
2181 }
2182 if expiretime != -(1 as libc::c_int) as libc::c_longlong {
2183 rdbstate.expires = (rdbstate.expires).wrapping_add(1);
2184 }
2185 rdbstate.key = 0 as *mut robj;
2186 decrRefCount(key);
2187 decrRefCount(val);
2188 rdbstate.key_type = -(1 as libc::c_int);
2189 expiretime = -(1 as libc::c_int) as libc::c_longlong;
2190 }
2191 }
2192 match current_block {
2193 6512628852423894791 => {}
2194 12507377084108038387 => {}
2195 _ => {
2196 if rdbver >= 5 as libc::c_int && server.rdb_checksum != 0 {
2197 let mut cksum: uint64_t = 0;
2198 let mut expected: uint64_t = rdb.cksum;
2199 rdbstate.doing = 5 as libc::c_int;
2200 if rioRead(
2201 &mut rdb,
2202 &mut cksum as *mut uint64_t as *mut libc::c_void,
2203 8 as libc::c_int as size_t,
2204 ) == 0 as libc::c_int as libc::c_ulong
2205 {
2206 current_block = 6512628852423894791;
2207 } else if cksum == 0 as libc::c_int as libc::c_ulong {
2208 rdbCheckInfo(
2209 b"RDB file was saved with checksum disabled: no check performed.\0"
2210 as *const u8 as *const libc::c_char,
2211 );
2212 current_block = 11869735117417356968;
2213 } else if cksum != expected {
2214 rdbCheckError(
2215 b"RDB CRC error\0" as *const u8 as *const libc::c_char,
2216 );
2217 current_block = 12507377084108038387;
2218 } else {
2219 rdbCheckInfo(
2220 b"Checksum OK\0" as *const u8 as *const libc::c_char,
2221 );
2222 current_block = 11869735117417356968;
2223 }
2224 } else {
2225 current_block = 11869735117417356968;
2226 }
2227 match current_block {
2228 12507377084108038387 => {}
2229 6512628852423894791 => {}
2230 _ => {
2231 if closefile != 0 {
2232 fclose(fp);
2233 }
2234 stopLoading(1 as libc::c_int);
2235 return 0 as libc::c_int;
2236 }
2237 }
2238 }
2239 }
2240 }
2241 }
2242 }
2243 match current_block {
2244 6512628852423894791 => {
2245 if rdbstate.error_set != 0 {
2246 rdbCheckError((rdbstate.error).as_mut_ptr());
2247 } else {
2248 rdbCheckError(
2249 b"Unexpected EOF reading RDB file\0" as *const u8
2250 as *const libc::c_char,
2251 );
2252 }
2253 }
2254 _ => {}
2255 }
2256 if closefile != 0 {
2257 fclose(fp);
2258 }
2259 stopLoading(0 as libc::c_int);
2260 return 1 as libc::c_int;
2261}
2262unsafe extern "C" fn checkRdbVersion() -> sds {
2263 let mut version: sds = 0 as *mut libc::c_char;
2264 version = sdscatprintf(
2265 sdsempty(),
2266 b"%s\0" as *const u8 as *const libc::c_char,
2267 b"7.0.8\0" as *const u8 as *const libc::c_char,
2268 );
2269 if strtoll(redisGitSHA1(), 0 as *mut *mut libc::c_char, 16 as libc::c_int) != 0 {
2270 version = sdscatprintf(
2271 version,
2272 b" (git:%s\0" as *const u8 as *const libc::c_char,
2273 redisGitSHA1(),
2274 );
2275 if strtoll(redisGitDirty(), 0 as *mut *mut libc::c_char, 10 as libc::c_int) != 0
2276 {
2277 version = sdscatprintf(
2278 version,
2279 b"-dirty\0" as *const u8 as *const libc::c_char,
2280 );
2281 }
2282 version = sdscat(version, b")\0" as *const u8 as *const libc::c_char);
2283 }
2284 return version;
2285}
2286#[no_mangle]
2287pub unsafe extern "C" fn redis_check_rdb_main(
2288 mut argc: libc::c_int,
2289 mut argv: *mut *mut libc::c_char,
2290 mut fp: *mut FILE,
2291) -> libc::c_int {
2292 let mut tv: timeval = timeval { tv_sec: 0, tv_usec: 0 };
2293 if argc != 2 as libc::c_int && fp.is_null() {
2294 fprintf(
2295 stderr,
2296 b"Usage: %s <rdb-file-name>\n\0" as *const u8 as *const libc::c_char,
2297 *argv.offset(0 as libc::c_int as isize),
2298 );
2299 exit(1 as libc::c_int);
2300 } else {
2301 if strcmp(
2302 *argv.offset(1 as libc::c_int as isize),
2303 b"-v\0" as *const u8 as *const libc::c_char,
2304 ) == 0
2305 || strcmp(
2306 *argv.offset(1 as libc::c_int as isize),
2307 b"--version\0" as *const u8 as *const libc::c_char,
2308 ) == 0
2309 {
2310 let mut version: sds = checkRdbVersion();
2311 printf(
2312 b"redis-check-rdb %s\n\0" as *const u8 as *const libc::c_char,
2313 version,
2314 );
2315 sdsfree(version);
2316 exit(0 as libc::c_int);
2317 }
2318 }
2319 gettimeofday(&mut tv, 0 as *mut libc::c_void);
2320 init_genrand64(
2321 (tv.tv_sec as libc::c_longlong * 1000000 as libc::c_int as libc::c_longlong
2322 + tv.tv_usec as libc::c_longlong ^ getpid() as libc::c_longlong)
2323 as libc::c_ulonglong,
2324 );
2325 if (shared.integers[0 as libc::c_int as usize]).is_null() {
2326 createSharedObjects();
2327 }
2328 server.loading_process_events_interval_bytes = 0 as libc::c_int as off_t;
2329 server.sanitize_dump_payload = 1 as libc::c_int;
2330 rdbCheckMode = 1 as libc::c_int;
2331 rdbCheckInfo(
2332 b"Checking RDB file %s\0" as *const u8 as *const libc::c_char,
2333 *argv.offset(1 as libc::c_int as isize),
2334 );
2335 rdbCheckSetupSignals();
2336 let mut retval: libc::c_int = redis_check_rdb(
2337 *argv.offset(1 as libc::c_int as isize),
2338 fp,
2339 );
2340 if retval == 0 as libc::c_int {
2341 rdbCheckInfo(b"\\o/ RDB looks OK! \\o/\0" as *const u8 as *const libc::c_char);
2342 rdbShowGenericInfo();
2343 }
2344 if !fp.is_null() {
2345 return if retval == 0 as libc::c_int {
2346 0 as libc::c_int
2347 } else {
2348 -(1 as libc::c_int)
2349 };
2350 }
2351 exit(retval);
2352}