ソースを参照

s-s-d: Add a fallback pid_is_exec() implementation using pid_is_cmd()

This consolidates the fallback implementation into a single function that
can be modified centrally.
Guillem Jover 14 年 前
コミット
2e2410b4f6
共有1 個のファイルを変更した15 個の追加5 個の削除を含む
  1. 15 5
      utils/start-stop-daemon.c

+ 15 - 5
utils/start-stop-daemon.c

@@ -1056,6 +1056,20 @@ pid_is_exec(pid_t pid, const char *name)
 		return false;
 	return (strcmp(name, start_argv_0_p) == 0) ? 1 : 0;
 }
+#else
+/* XXX: Fallback implementation that uses pid_is_cmd(). We should use more
+ * reliable native implementations instead. */
+static bool pid_is_cmd(pid_t pid, const char *name);
+
+static bool
+pid_is_exec(pid_t pid, const char *name)
+{
+	bool ret;
+
+	ret = pid_is_cmd(pid, name);
+
+	return ret;
+}
 #endif
 
 #if defined(OSLinux)
@@ -1204,13 +1218,9 @@ pid_check(pid_t pid)
 #if defined(OSLinux) || defined(OShpux)
 	if (execname && !pid_is_exec(pid, &exec_stat))
 		return status_dead;
-#elif defined(HAVE_KVM_H)
+#else
 	if (execname && !pid_is_exec(pid, execname))
 		return status_dead;
-#elif defined(OSHurd) || defined(OSFreeBSD) || defined(OSNetBSD)
-	/* Let's try this to see if it works. */
-	if (execname && !pid_is_cmd(pid, execname))
-		return status_dead;
 #endif
 	if (userspec && !pid_is_user(pid, user_id))
 		return status_dead;