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"
23 #define WRITE_PATH_FMT "/dev/virtio-ports/trace-path-cpu%d"
24 #define CTL_PATH "/dev/virtio-ports/agent-ctl-path"
58 s->pipe_size = PIPE_INIT; in agent_info_new()
59 s->use_stdout = false; in agent_info_new()
60 s->cpus = get_total_cpus(); in agent_info_new()
61 s->ctl_fd = -1; in agent_info_new()
64 for (i = 0; i < s->cpus; i++) in agent_info_new()
65 s->rw_ti[i] = rw_thread_info_new(); in agent_info_new()
96 round = value & (PAGE_SIZE - 1); in parse_size()
97 value = value - round; in parse_size()
106 pr_err("usage: %s [-h] [-o] [-s <size of pipe>]\n", prg); in usage()
121 /* write(output) path */ in make_path()
124 /* read(input) path */ in make_path()
128 pr_err("Failed to generate %s path(CPU#%d):%d\n", in make_path()
157 for (cpu = 0; cpu < s->cpus; cpu++) { in agent_info_init()
158 /* set read(input) path per read/write thread */ in agent_info_init()
163 /* set write(output) path per read/write thread*/ in agent_info_init()
164 if (!s->use_stdout) { in agent_info_init()
169 /* stdout mode */ in agent_info_init()
170 pr_debug("stdout mode\n"); in agent_info_init()
172 rw_thread_init(cpu, in_path, out_path, s->use_stdout, in agent_info_init()
173 s->pipe_size, s->rw_ti[cpu]); in agent_info_init()
177 s->ctl_fd = rw_ctl_init((const char *)CTL_PATH); in agent_info_init()
190 while ((cmd = getopt(argc, argv, "hos:")) != -1) { in parse_args()
192 /* stdout mode */ in parse_args()
194 s->use_stdout = true; in parse_args()
201 s->pipe_size = size; in parse_args()
224 for (cpu = 0; cpu < s->cpus; cpu++) in agent_main_loop()
225 rw_thread_per_cpu[cpu] = rw_thread_run(s->rw_ti[cpu]); in agent_main_loop()
227 rw_ctl_loop(s->ctl_fd); in agent_main_loop()
230 for (cpu = 0; cpu < s->cpus; cpu++) { in agent_main_loop()
245 close(s->ctl_fd); in agent_info_free()
246 for (i = 0; i < s->cpus; i++) { in agent_info_free()
247 close(s->rw_ti[i]->in_fd); in agent_info_free()
248 close(s->rw_ti[i]->out_fd); in agent_info_free()
249 close(s->rw_ti[i]->read_pipe); in agent_info_free()
250 close(s->rw_ti[i]->write_pipe); in agent_info_free()
251 free(s->rw_ti[i]); in agent_info_free()