Lines Matching refs:s

51 	struct agent_info *s;  in agent_info_new()  local
54 s = zalloc(sizeof(struct agent_info)); in agent_info_new()
55 if (s == NULL) { in agent_info_new()
60 s->pipe_size = PIPE_INIT; in agent_info_new()
61 s->use_stdout = false; in agent_info_new()
62 s->cpus = get_total_cpus(); in agent_info_new()
63 s->ctl_fd = -1; in agent_info_new()
66 for (i = 0; i < s->cpus; i++) in agent_info_new()
67 s->rw_ti[i] = rw_thread_info_new(); in agent_info_new()
69 return s; in agent_info_new()
152 static void *agent_info_init(struct agent_info *s) in agent_info_init() argument
159 for (cpu = 0; cpu < s->cpus; cpu++) { in agent_info_init()
166 if (!s->use_stdout) { in agent_info_init()
174 rw_thread_init(cpu, in_path, out_path, s->use_stdout, in agent_info_init()
175 s->pipe_size, s->rw_ti[cpu]); in agent_info_init()
179 s->ctl_fd = rw_ctl_init((const char *)CTL_PATH); in agent_info_init()
187 static void *parse_args(int argc, char *argv[], struct agent_info *s) in parse_args() argument
196 s->use_stdout = true; in parse_args()
203 s->pipe_size = size; in parse_args()
212 agent_info_init(s); in parse_args()
220 static void agent_main_loop(struct agent_info *s) in agent_main_loop() argument
226 for (cpu = 0; cpu < s->cpus; cpu++) in agent_main_loop()
227 rw_thread_per_cpu[cpu] = rw_thread_run(s->rw_ti[cpu]); in agent_main_loop()
229 rw_ctl_loop(s->ctl_fd); in agent_main_loop()
232 for (cpu = 0; cpu < s->cpus; cpu++) { in agent_main_loop()
243 static void agent_info_free(struct agent_info *s) in agent_info_free() argument
247 close(s->ctl_fd); in agent_info_free()
248 for (i = 0; i < s->cpus; i++) { in agent_info_free()
249 close(s->rw_ti[i]->in_fd); in agent_info_free()
250 close(s->rw_ti[i]->out_fd); in agent_info_free()
251 close(s->rw_ti[i]->read_pipe); in agent_info_free()
252 close(s->rw_ti[i]->write_pipe); in agent_info_free()
253 free(s->rw_ti[i]); in agent_info_free()
255 free(s); in agent_info_free()
260 struct agent_info *s = NULL; in main() local
262 s = agent_info_new(); in main()
263 parse_args(argc, argv, s); in main()
265 agent_main_loop(s); in main()
267 agent_info_free(s); in main()