[SCM] Samba Shared Repository - branch master updated
Amitay Isaacs
amitay at samba.org
Thu Aug 17 17:46:02 UTC 2017
The branch, master has been updated
via c477124 util: Add documentation for PID file handling
via 16e6b56 ctdb-daemon: Fix a return value
via 776e9f5 ctdb-daemon: Fix default socket location
from 988a67d gencache: Simplify gencache_stabilize
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit c4771246b7b31302a32629dde3bbbe8f003b4857
Author: Martin Schwenke <martin at meltin.net>
Date: Wed Aug 2 12:10:18 2017 +1000
util: Add documentation for PID file handling
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Thu Aug 17 19:45:32 CEST 2017 on sn-devel-144
commit 16e6b56b413e9f0261451ae4de24760f20e091c4
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Aug 11 16:08:51 2017 +1000
ctdb-daemon: Fix a return value
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 776e9f56f1db69e9bb14319eaeab042d786e0cee
Author: Martin Schwenke <martin at meltin.net>
Date: Fri Aug 11 15:18:13 2017 +1000
ctdb-daemon: Fix default socket location
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
-----------------------------------------------------------------------
Summary of changes:
ctdb/server/ctdbd.c | 2 +-
ctdb/server/eventscript.c | 2 +-
lib/util/pidfile.c | 5 -----
lib/util/pidfile.h | 57 +++++++++++++++++++++++++++++++++++++++++++++--
4 files changed, 57 insertions(+), 9 deletions(-)
Changeset truncated at 500 lines:
diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c
index dcd54c2..ba6dd54 100644
--- a/ctdb/server/ctdbd.c
+++ b/ctdb/server/ctdbd.c
@@ -65,7 +65,7 @@ static struct {
int max_persistent_check_errors;
int torture;
} options = {
- .socket = CTDB_RUNDIR "/ctdbd.socket",
+ .socket = CTDB_SOCKET,
.debuglevel = "NOTICE",
.nlist = NULL,
.public_address_list = NULL,
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c
index 438fbbb..16d3b63 100644
--- a/ctdb/server/eventscript.c
+++ b/ctdb/server/eventscript.c
@@ -100,7 +100,7 @@ static bool eventd_context_init(TALLOC_CTX *mem_ctx,
socket = talloc_strdup(ectx, ctdb_get_socketname(ctdb));
if (socket == NULL) {
talloc_free(ectx);
- return NULL;
+ return false;
}
ectx->socket = talloc_asprintf(ectx, "%s/eventd.sock",
diff --git a/lib/util/pidfile.c b/lib/util/pidfile.c
index fdf9afb..5cd09ce 100644
--- a/lib/util/pidfile.c
+++ b/lib/util/pidfile.c
@@ -27,11 +27,6 @@
#include "lib/util/pidfile.h"
-/**
- * @file
- * @brief Pid file handling
- */
-
int pidfile_path_create(const char *path, int *outfd)
{
struct flock lck;
diff --git a/lib/util/pidfile.h b/lib/util/pidfile.h
index d51161a..b1b9f54 100644
--- a/lib/util/pidfile.h
+++ b/lib/util/pidfile.h
@@ -20,11 +20,64 @@
#ifndef _SAMBA_PIDFILE_H_
#define _SAMBA_PIDFILE_H_
+/**
+ * @file pidfile.h
+ *
+ * @brief PID file handling
+ */
+
+/**
+ * @brief Create a PID file
+ *
+ * Opens file, locks it, and writes PID. Returns EACCES or EAGAIN if
+ * another process has the PID file locked. Use unlink(2) and
+ * pidfile_fd_close() to remove the PID file.
+ *
+ * @param[in] path PID file name
+ * @param[out] outfd File descriptor of open/locked PID file
+ * @return 0 on success, errno on failure
+ */
int pidfile_path_create(const char *path, int *outfd);
+
+/**
+ * @brief Unlock and close a PID file
+ *
+ * @param[in] fd File descriptor of open/locked PID file
+ */
void pidfile_fd_close(int fd);
+/**
+ * @brief Check a PID file
+ *
+ * PID file name is <piddir>/<name>.pid
+ *
+ * @param[in] piddir Directory for PID file
+ * @param[in] name PID file process name
+ * @return PID of active process, 0 if PID file missing/stale/error
+ */
pid_t pidfile_pid(const char *piddir, const char *name);
-void pidfile_create(const char *piddir, const char *program_name);
-void pidfile_unlink(const char *piddir, const char *program_name);
+
+/**
+ * @brief Create a PID file
+ *
+ * Leave PID file open/locked on success, exit on failure. On
+ * success, use pidfile_unlink() to remove PID file before exiting.
+ *
+ * PID file name is <piddir>/<name>.pid
+ *
+ * @param[in] piddir Directory for PID file
+ * @param[in] name PID file process name
+ */
+void pidfile_create(const char *piddir, const char *name);
+
+/**
+ * @brief Remove a PID file
+ *
+ * PID file name is <piddir>/<name>.pid
+ *
+ * @param[in] piddir Directory for PID file
+ * @param[in] name PID file process name
+ */
+void pidfile_unlink(const char *piddir, const char *name);
#endif
--
Samba Shared Repository
More information about the samba-cvs
mailing list