Lines Matching +full:stdout +full:- +full:path
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Guest agent for virtio-trace
15 #include "trace-agent.h"
24 #define WRITE_PATH_FMT "/dev/virtio-ports/trace-path-cpu%d"
25 #define CTL_PATH "/dev/virtio-ports/agent-ctl-path"
59 s->pipe_size = PIPE_INIT; in agent_info_new()
60 s->use_stdout = false; in agent_info_new()
61 s->cpus = get_total_cpus(); in agent_info_new()
62 s->ctl_fd = -1; in agent_info_new()
65 for (i = 0; i < s->cpus; i++) in agent_info_new()
66 s->rw_ti[i] = rw_thread_info_new(); in agent_info_new()
97 round = value & (PAGE_SIZE - 1); in parse_size()
98 value = value - round; in parse_size()
107 pr_err("usage: %s [-h] [-o] [-s <size of pipe>]\n", prg); in usage()
122 /* write(output) path */ in make_path()
125 /* read(input) path */ in make_path()
132 pr_err("Failed to generate %s path(CPU#%d):%d\n", in make_path()
161 for (cpu = 0; cpu < s->cpus; cpu++) { in agent_info_init()
162 /* set read(input) path per read/write thread */ in agent_info_init()
167 /* set write(output) path per read/write thread*/ in agent_info_init()
168 if (!s->use_stdout) { in agent_info_init()
173 /* stdout mode */ in agent_info_init()
174 pr_debug("stdout mode\n"); in agent_info_init()
176 rw_thread_init(cpu, in_path, out_path, s->use_stdout, in agent_info_init()
177 s->pipe_size, s->rw_ti[cpu]); in agent_info_init()
181 s->ctl_fd = rw_ctl_init((const char *)CTL_PATH); in agent_info_init()
194 while ((cmd = getopt(argc, argv, "hos:")) != -1) { in parse_args()
196 /* stdout mode */ in parse_args()
198 s->use_stdout = true; in parse_args()
205 s->pipe_size = size; in parse_args()
228 for (cpu = 0; cpu < s->cpus; cpu++) in agent_main_loop()
229 rw_thread_per_cpu[cpu] = rw_thread_run(s->rw_ti[cpu]); in agent_main_loop()
231 rw_ctl_loop(s->ctl_fd); in agent_main_loop()
234 for (cpu = 0; cpu < s->cpus; cpu++) { in agent_main_loop()
249 close(s->ctl_fd); in agent_info_free()
250 for (i = 0; i < s->cpus; i++) { in agent_info_free()
251 close(s->rw_ti[i]->in_fd); in agent_info_free()
252 close(s->rw_ti[i]->out_fd); in agent_info_free()
253 close(s->rw_ti[i]->read_pipe); in agent_info_free()
254 close(s->rw_ti[i]->write_pipe); in agent_info_free()
255 free(s->rw_ti[i]); in agent_info_free()