Commit-ID: b20b94b79c02787c1d5689c6db0d2732366540b0 Gitweb: http://git.kernel.org/tip/b20b94b79c02787c1d5689c6db0d2732366540b0 Author: Sasha Levin <levinsasha928@xxxxxxxxx> AuthorDate: Tue, 5 Jul 2011 12:35:44 +0300 Committer: Pekka Enberg <penberg@xxxxxxxxxx> CommitDate: Tue, 5 Jul 2011 21:58:26 +0300 kvm tools: Export kvm__remove_pidfile This will allow cleaning up ghost pid files outside of the module. Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx> Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx> --- tools/kvm/include/kvm/kvm.h | 1 + tools/kvm/kvm.c | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/kvm/include/kvm/kvm.h b/tools/kvm/include/kvm/kvm.h index da9e12c..5cfb0d8 100644 --- a/tools/kvm/include/kvm/kvm.h +++ b/tools/kvm/include/kvm/kvm.h @@ -68,6 +68,7 @@ void kvm__continue(void); void kvm__notify_paused(void); int kvm__get_pid_by_instance(const char *name); int kvm__enumerate_instances(void (*callback)(const char *name, int pid)); +void kvm__remove_pidfile(const char *name); /* * Debugging diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c index 075c8d8..cd3cb19 100644 --- a/tools/kvm/kvm.c +++ b/tools/kvm/kvm.c @@ -134,14 +134,11 @@ static void kvm__create_pidfile(struct kvm *kvm) close(fd); } -static void kvm__remove_pidfile(struct kvm *kvm) +void kvm__remove_pidfile(const char *name) { char full_name[PATH_MAX]; - if (!kvm->name) - return; - - sprintf(full_name, "%s/%s/%s.pid", HOME_DIR, KVM_PID_FILE_PATH, kvm->name); + sprintf(full_name, "%s/%s/%s.pid", HOME_DIR, KVM_PID_FILE_PATH, name); unlink(full_name); } @@ -194,7 +191,7 @@ void kvm__delete(struct kvm *kvm) kvm__stop_timer(kvm); munmap(kvm->ram_start, kvm->ram_size); - kvm__remove_pidfile(kvm); + kvm__remove_pidfile(kvm->name); free(kvm); } -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
![]() |