[sheepdog] [PATCH 05/10] collie: show error message of tracer

MORITA Kazutaka morita.kazutaka at gmail.com
Wed Aug 7 17:49:03 CEST 2013


From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 collie/debug.c |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/collie/debug.c b/collie/debug.c
index 34f2a69..41d03d1 100644
--- a/collie/debug.c
+++ b/collie/debug.c
@@ -129,6 +129,21 @@ static int trace_start(int argc, char **argv)
 		return EXIT_FAILURE;
 	}
 
+	switch (rsp->result) {
+	case SD_RES_SUCCESS:
+		break;
+	case SD_RES_NO_SUPPORT:
+		fprintf(stderr, "tracer is not supported\n");
+		return EXIT_FAILURE;
+	case SD_RES_INVALID_PARMS:
+		fprintf(stderr, "tracer is already started\n");
+		return EXIT_FAILURE;
+	default:
+		fprintf(stderr, "unknown error (%s)\n",
+			sd_strerror(rsp->result));
+		return EXIT_SYSFAIL;
+	}
+
 	return EXIT_SUCCESS;
 }
 
@@ -148,6 +163,21 @@ static int trace_stop(int argc, char **argv)
 		return EXIT_FAILURE;
 	}
 
+	switch (rsp->result) {
+	case SD_RES_SUCCESS:
+		break;
+	case SD_RES_NO_SUPPORT:
+		fprintf(stderr, "tracer is not supported\n");
+		return EXIT_FAILURE;
+	case SD_RES_INVALID_PARMS:
+		fprintf(stderr, "tracer is not running\n");
+		return EXIT_FAILURE;
+	default:
+		fprintf(stderr, "unknown error (%s)\n",
+			sd_strerror(rsp->result));
+		return EXIT_SYSFAIL;
+	}
+
 	return trace_read_buffer();
 }
 
-- 
1.7.9.5




More information about the sheepdog mailing list