remove periodic reseeding entirely.
[trinity.git] / include / shm.h
blob153c2d33095e13dda2924f5f9995b6275c7a9071
1 #pragma once
3 #include <sys/time.h>
4 #include <sys/types.h>
6 #include <stdio.h>
8 #include "constants.h"
9 #include "exit.h"
10 #include "locks.h"
11 #include "net.h"
12 #include "types.h"
14 void create_shm(void);
15 void create_shm_arrays(void);
16 void init_shm(void);
18 struct syscallrecord {
19 unsigned int nr; /* protected by syscall_lock */
20 unsigned long a1;
21 unsigned long a2;
22 unsigned long a3;
23 unsigned long a4;
24 unsigned long a5;
25 unsigned long a6;
26 unsigned long retval;
27 bool do32bit; /* protected by syscall_lock */
30 struct shm_s {
31 unsigned long total_syscalls_done;
32 unsigned long successes;
33 unsigned long failures;
34 unsigned long previous_count;
35 unsigned long *child_syscall_count;
37 unsigned long regenerate;
38 unsigned int seed;
39 unsigned int *seeds;
41 /* Indices of syscall in syscall table that are active.
42 * All indices shifted by +1. Empty index equals to 0.
44 * 'active_syscalls' is only used on uniarch. The other two
45 * are only used on biarch. FIXME: Make this compile-time somehow? */
46 int active_syscalls32[MAX_NR_SYSCALL];
47 int active_syscalls64[MAX_NR_SYSCALL];
48 int active_syscalls[MAX_NR_SYSCALL];
49 unsigned int nr_active_syscalls;
50 unsigned int nr_active_32bit_syscalls;
51 unsigned int nr_active_64bit_syscalls;
53 pid_t mainpid;
54 pid_t *pids;
55 unsigned char *child_type;
57 pid_t last_reaped;
58 bool spawn_no_more;
59 unsigned char *kill_count;
61 unsigned int running_childs;
62 struct timeval *tv;
63 struct timeval taint_tv;
65 FILE **logfiles;
67 int pipe_fds[MAX_PIPE_FDS*2];
68 int file_fds[NR_FILE_FDS]; /* All children inherit these */
69 int perf_fds[MAX_PERF_FDS];
70 int epoll_fds[MAX_EPOLL_FDS];
71 int eventfd_fds[MAX_EPOLL_FDS];
73 struct socketinfo sockets[NR_SOCKET_FDS];
75 struct syscallrecord *syscall; /* FIXME: protect all accesses with syscall_lock */
76 struct syscallrecord *previous;
78 unsigned long *scratch;
80 int current_fd;
81 unsigned int fd_lifetime;
83 /* per-child mmaps */
84 struct map **mappings;
85 unsigned int *num_mappings;
87 /* various flags. */
88 bool do_make_it_fail;
89 enum exit_reasons exit_reason;
91 /* locks */
92 volatile unsigned char regenerating;
93 lock_t reaper_lock;
94 lock_t syscall_lock;
96 bool ready;
98 extern struct shm_s *shm;
100 #define SHM_OK 0
101 #define SHM_CORRUPT 1