[libvirt PATCH 4/6] util: virPidFileAcquirePath: remove waitForLock argument

Ján Tomko jtomko at redhat.com
Tue Mar 7 16:16:00 UTC 2023


None of the callers need it anymore.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/locking/lock_daemon.c  | 4 ++--
 src/logging/log_daemon.c   | 4 ++--
 src/remote/remote_daemon.c | 2 +-
 src/util/vircommand.c      | 2 +-
 src/util/virpidfile.c      | 7 +++----
 src/util/virpidfile.h      | 1 -
 6 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index 5eed6b7c26..6b0a8220e5 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -648,7 +648,7 @@ virLockDaemonPostExecRestart(const char *state_file,
 
     /* Re-claim PID file now as we will not be daemonizing */
     if (pid_file &&
-        (*pid_file_fd = virPidFileAcquirePath(pid_file, false, getpid())) < 0)
+        (*pid_file_fd = virPidFileAcquirePath(pid_file, getpid())) < 0)
         return -1;
 
     if (!(lockDaemon = virLockDaemonNewPostExecRestart(object, privileged)))
@@ -1000,7 +1000,7 @@ int main(int argc, char **argv) {
         }
 
         /* If we have a pidfile set, claim it now, exiting if already taken */
-        if ((pid_file_fd = virPidFileAcquirePath(pid_file, false, getpid())) < 0) {
+        if ((pid_file_fd = virPidFileAcquirePath(pid_file, getpid())) < 0) {
             ret = VIR_DAEMON_ERR_PIDFILE;
             goto cleanup;
         }
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index 8025245350..b4db585810 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -468,7 +468,7 @@ virLogDaemonPostExecRestart(const char *state_file,
 
     /* Re-claim PID file now as we will not be daemonizing */
     if (pid_file &&
-        (*pid_file_fd = virPidFileAcquirePath(pid_file, false, getpid())) < 0)
+        (*pid_file_fd = virPidFileAcquirePath(pid_file, getpid())) < 0)
         return -1;
 
     if (!(logDaemon = virLogDaemonNewPostExecRestart(object,
@@ -803,7 +803,7 @@ int main(int argc, char **argv) {
         }
 
         /* If we have a pidfile set, claim it now, exiting if already taken */
-        if ((pid_file_fd = virPidFileAcquirePath(pid_file, false, getpid())) < 0) {
+        if ((pid_file_fd = virPidFileAcquirePath(pid_file, getpid())) < 0) {
             ret = VIR_DAEMON_ERR_PIDFILE;
             goto cleanup;
         }
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index dd9344168b..4f14187bef 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -990,7 +990,7 @@ int main(int argc, char **argv) {
     }
 
     /* Try to claim the pidfile, exiting if we can't */
-    if ((pid_file_fd = virPidFileAcquirePath(pid_file, false, getpid())) < 0) {
+    if ((pid_file_fd = virPidFileAcquirePath(pid_file, getpid())) < 0) {
         ret = VIR_DAEMON_ERR_PIDFILE;
         goto cleanup;
     }
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 0917bc9cfb..1144dfb597 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -828,7 +828,7 @@ virExec(virCommand *cmd)
         int pidfilefd = -1;
         char c;
 
-        pidfilefd = virPidFileAcquirePath(cmd->pidfile, false, pid);
+        pidfilefd = virPidFileAcquirePath(cmd->pidfile, pid);
         if (pidfilefd < 0)
             goto fork_error;
         if (virSetInherit(pidfilefd, true) < 0) {
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index 742531379e..252100cdc3 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -446,10 +446,9 @@ int virPidFileAcquirePathFull(const char *path,
 
 
 int virPidFileAcquirePath(const char *path,
-                          bool waitForLock,
                           pid_t pid)
 {
-    return virPidFileAcquirePathFull(path, waitForLock, pid);
+    return virPidFileAcquirePathFull(path, false, pid);
 }
 
 
@@ -465,7 +464,7 @@ int virPidFileAcquire(const char *dir,
     if (!(pidfile = virPidFileBuildPath(dir, name)))
         return -ENOMEM;
 
-    return virPidFileAcquirePath(pidfile, false, pid);
+    return virPidFileAcquirePath(pidfile, pid);
 }
 
 
@@ -566,7 +565,7 @@ virPidFileForceCleanupPathFull(const char *path, bool group)
     if (virPidFileReadPath(path, &pid) < 0)
         return -1;
 
-    fd = virPidFileAcquirePath(path, false, 0);
+    fd = virPidFileAcquirePath(path, 0);
     if (fd < 0) {
         virResetLastError();
 
diff --git a/src/util/virpidfile.h b/src/util/virpidfile.h
index 8c70f883be..6db0fb843f 100644
--- a/src/util/virpidfile.h
+++ b/src/util/virpidfile.h
@@ -60,7 +60,6 @@ int virPidFileAcquirePathFull(const char *path,
                               bool waitForLock,
                               pid_t pid) G_GNUC_WARN_UNUSED_RESULT;
 int virPidFileAcquirePath(const char *path,
-                          bool waitForLock,
                           pid_t pid) G_GNUC_WARN_UNUSED_RESULT;
 int virPidFileAcquire(const char *dir,
                       const char *name,
-- 
2.39.2



More information about the libvir-list mailing list