]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Use correct data type for pid
authorSasha Levin <levinsasha928@gmail.com>
Mon, 15 Aug 2011 14:33:00 +0000 (17:33 +0300)
committerPekka Enberg <penberg@kernel.org>
Mon, 15 Aug 2011 14:53:40 +0000 (17:53 +0300)
This patch fixes an error where pids used u64 instead of pid_t, causing them
to never be negative.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/builtin-balloon.c
tools/kvm/builtin-debug.c
tools/kvm/builtin-pause.c
tools/kvm/builtin-resume.c
tools/kvm/builtin-stat.c
tools/kvm/builtin-stop.c
tools/kvm/include/kvm/kvm.h
tools/kvm/kvm.c

index cb7d552f33e538940a875fdcd6dfb7eaab37161c..73290635a92a9fd8a9c50a804053ed360f1bda4b 100644 (file)
@@ -8,7 +8,7 @@
 #include <kvm/parse-options.h>
 #include <kvm/kvm.h>
 
-static u64 instance_pid;
+static pid_t instance_pid;
 static const char *instance_name;
 static u64 inflate;
 static u64 deflate;
@@ -21,7 +21,7 @@ static const char * const balloon_usage[] = {
 static const struct option balloon_options[] = {
        OPT_GROUP("Instance options:"),
        OPT_STRING('n', "name", &instance_name, "name", "Instance name"),
-       OPT_U64('p', "pid", &instance_pid, "Instance pid"),
+       OPT_INTEGER('p', "pid", &instance_pid, "Instance pid"),
        OPT_GROUP("Balloon options:"),
        OPT_U64('i', "inflate", &inflate, "Amount to inflate"),
        OPT_U64('d', "deflate", &deflate, "Amount to deflate"),
index 43da16d2d62d3263aa15cc51b12810df631df8b7..4be12cce6a72f6f3104a0fb3d9969d627d1fef6b 100644 (file)
@@ -9,7 +9,7 @@
 #include <signal.h>
 
 static bool all;
-static u64 instance_pid;
+static pid_t instance_pid;
 static const char *instance_name;
 
 static const char * const debug_usage[] = {
@@ -21,7 +21,7 @@ static const struct option debug_options[] = {
        OPT_GROUP("General options:"),
        OPT_BOOLEAN('a', "all", &all, "Debug all instances"),
        OPT_STRING('n', "name", &instance_name, "name", "Instance name"),
-       OPT_U64('p', "pid", &instance_pid, "Instance pid"),
+       OPT_INTEGER('p', "pid", &instance_pid, "Instance pid"),
        OPT_END()
 };
 
index e4efb082f481947028d3979a790eca59c695a932..7b644ff923853264b915628f3a9930d3b1930085 100644 (file)
@@ -9,7 +9,7 @@
 #include <signal.h>
 
 static bool all;
-static u64 instance_pid;
+static pid_t instance_pid;
 static const char *instance_name;
 
 static const char * const pause_usage[] = {
@@ -21,7 +21,7 @@ static const struct option pause_options[] = {
        OPT_GROUP("General options:"),
        OPT_BOOLEAN('a', "all", &all, "Pause all instances"),
        OPT_STRING('n', "name", &instance_name, "name", "Instance name"),
-       OPT_U64('p', "pid", &instance_pid, "Instance pid"),
+       OPT_INTEGER('p', "pid", &instance_pid, "Instance pid"),
        OPT_END()
 };
 
index 0c11cecae2d5f49191a81628f7788a10e6375e3c..70de0fc26e1c4c4e8bd47fec71e2e480eebcd7d5 100644 (file)
@@ -9,7 +9,7 @@
 #include <signal.h>
 
 static bool all;
-static u64 instance_pid;
+static pid_t instance_pid;
 static const char *instance_name;
 
 static const char * const resume_usage[] = {
@@ -21,7 +21,7 @@ static const struct option resume_options[] = {
        OPT_GROUP("General options:"),
        OPT_BOOLEAN('a', "all", &all, "Resume all instances"),
        OPT_STRING('n', "name", &instance_name, "name", "Instance name"),
-       OPT_U64('p', "pid", &instance_pid, "Instance pid"),
+       OPT_INTEGER('p', "pid", &instance_pid, "Instance pid"),
        OPT_END()
 };
 
index d9bc75ddaccec0d234dad607880e005d8a5e9dc1..be12d15a16aeeef023a00a38669d9755163e298c 100644 (file)
@@ -10,7 +10,7 @@
 
 static bool mem;
 static bool all;
-static u64 instance_pid;
+static pid_t instance_pid;
 static const char *instance_name;
 
 static const char * const stat_usage[] = {
@@ -24,7 +24,7 @@ static const struct option stat_options[] = {
        OPT_GROUP("Instance options:"),
        OPT_BOOLEAN('a', "all", &all, "All instances"),
        OPT_STRING('n', "name", &instance_name, "name", "Instance name"),
-       OPT_U64('p', "pid", &instance_pid, "Instance pid"),
+       OPT_INTEGER('p', "pid", &instance_pid, "Instance pid"),
        OPT_END()
 };
 
index d16618a0e6961db77f20ae8ce66ed95278b75d27..fd0500e9c2ede837e6253f8ed0c96354ff383f8d 100644 (file)
@@ -9,7 +9,7 @@
 #include <signal.h>
 
 static bool all;
-static u64 instance_pid;
+static pid_t instance_pid;
 static const char *instance_name;
 
 static const char * const stop_usage[] = {
@@ -21,7 +21,7 @@ static const struct option stop_options[] = {
        OPT_GROUP("General options:"),
        OPT_BOOLEAN('a', "all", &all, "Stop all instances"),
        OPT_STRING('n', "name", &instance_name, "name", "Instance name"),
-       OPT_U64('p', "pid", &instance_pid, "Instance pid"),
+       OPT_INTEGER('p', "pid", &instance_pid, "Instance pid"),
        OPT_END()
 };
 
index c2d815c7e0f85314e7419c1c1eec8c809cc62940..d471cee5d60a8f08e5226764a8cb337b661b8a6a 100644 (file)
@@ -73,7 +73,7 @@ bool kvm__deregister_mmio(struct kvm *kvm, u64 phys_addr);
 void kvm__pause(void);
 void kvm__continue(void);
 void kvm__notify_paused(void);
-int kvm__get_pid_by_instance(const char *name);
+pid_t kvm__get_pid_by_instance(const char *name);
 int kvm__enumerate_instances(int (*callback)(const char *name, int pid));
 void kvm__remove_pidfile(const char *name);
 
index 30aef3a48ecbf6e33f44c37858bf8f6f85d40964..bbfdea25588ed031e97eb9a0f8584a33f44ff3ef 100644 (file)
@@ -142,9 +142,10 @@ void kvm__remove_pidfile(const char *name)
        unlink(full_name);
 }
 
-int kvm__get_pid_by_instance(const char *name)
+pid_t kvm__get_pid_by_instance(const char *name)
 {
-       int fd, pid;
+       int fd;
+       pid_t pid;
        char pid_str[10], pid_file[PATH_MAX];
 
        sprintf(pid_file, "%s/%s/%s.pid", HOME_DIR, KVM_PID_FILE_PATH, name);