From 7a45a4e7d035c384d84050e5446f2813986e31c1 Mon Sep 17 00:00:00 2001
From: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
Date: Wed, 24 Sep 2014 11:38:25 +0800
Subject: [PATCH v3 09/21] modify set -c to hide offline cpu

With this patch and crash variable "offline" is hide(check command "set -v"),
"set -c" is not able to set to an offline cpu and message like below will be
printed.

<cut>
crash> set -c 2
set invalid cpu number: cpu 2 is OFFLINE
<cut>

Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com>
---
 kernel.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel.c b/kernel.c
index 90e6f79..6dd6daf 100755
--- a/kernel.c
+++ b/kernel.c
@@ -5486,6 +5486,10 @@ set_cpu(int cpu)
 	if (cpu >= kt->cpus)
 		error(FATAL, "invalid cpu number: system has only %d cpu%s\n", 
 			kt->cpus, kt->cpus > 1 ? "s" : "");
+
+	if (hide_offline_cpu(cpu))
+		error(FATAL, "invalid cpu number: cpu %d is OFFLINE\n", cpu);
+
 	if ((task = get_active_task(cpu))) 
 		set_context(task, NO_PID);
 	else
-- 
1.8.5.3

