Beispiel #1
0
static int trace_disable(int argc, char **argv)
{
	const char *tracer = argv[optind];
	int ret;
	struct sd_req hdr;
	struct sd_rsp *rsp = (struct sd_rsp *)&hdr;

	sd_init_req(&hdr, SD_OP_TRACE_DISABLE);
	hdr.flags = SD_FLAG_CMD_WRITE;
	hdr.data_length = strlen(tracer) + 1;

	ret = dog_exec_req(&sd_nid, &hdr, (void *)tracer);
	if (ret < 0)
		return EXIT_SYSFAIL;

	switch (rsp->result) {
	case SD_RES_SUCCESS:
		break;
	case SD_RES_NO_SUPPORT:
		sd_err("no such tracer %s", tracer);
		return EXIT_FAILURE;
	case SD_RES_INVALID_PARMS:
		sd_err("tracer %s is not enabled", tracer);
		return EXIT_FAILURE;
	default:
		sd_err("unknown error (%s)", sd_strerror(rsp->result));
		return EXIT_SYSFAIL;
	}

	return trace_read_buffer();
}
Beispiel #2
0
static int trace_stop(int argc, char **argv)
{
	int ret;
	struct sd_req hdr;
	struct sd_rsp *rsp = (struct sd_rsp *)&hdr;

	sd_init_req(&hdr, SD_OP_TRACE);
	hdr.data_length = 0;

	ret = send_light_req(&hdr, sdhost, sdport);
	if (ret) {
		fprintf(stderr, "Trace stop failed: %s\n",
				sd_strerror(rsp->result));
		return EXIT_FAILURE;
	}

	return trace_read_buffer();
}