summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-07-19 16:36:18 -0700
committerJeremy Allison <jra@samba.org>2012-07-19 16:36:18 -0700
commite8dbf2889f0f5c6d213e92cbfd97b6a874aedb03 (patch)
tree21f7c585011d551de323c74faac8f545d7f90857
parentf58d8feabc4b2c75681af1effeb4fb062cee74bd (diff)
downloadsamba-e8dbf2889f0f5c6d213e92cbfd97b6a874aedb03.tar.gz
samba-e8dbf2889f0f5c6d213e92cbfd97b6a874aedb03.tar.bz2
samba-e8dbf2889f0f5c6d213e92cbfd97b6a874aedb03.zip
Move everything to use the common pidfile functions.
The extra code in source3/lib/pidfile.c is no longer needed.
-rw-r--r--source3/libsmb/clidgram.c3
-rw-r--r--source3/nmbd/nmbd.c5
-rw-r--r--source3/smbd/server.c3
-rw-r--r--source3/smbd/server_exit.c3
-rw-r--r--source3/utils/smbcontrol.c3
-rw-r--r--source3/web/startstop.c8
-rw-r--r--source3/web/statuspage.c3
-rw-r--r--source3/winbindd/winbindd.c5
8 files changed, 20 insertions, 13 deletions
diff --git a/source3/libsmb/clidgram.c b/source3/libsmb/clidgram.c
index d9de99eb04..6e3ecb3865 100644
--- a/source3/libsmb/clidgram.c
+++ b/source3/libsmb/clidgram.c
@@ -26,6 +26,7 @@
#include "libsmb/nmblib.h"
#include "messages.h"
#include "librpc/gen_ndr/samr.h"
+#include "../lib/util/pidfile.h"
/*
* cli_send_mailslot, send a mailslot for client code ...
@@ -327,7 +328,7 @@ struct tevent_req *nbt_getdc_send(TALLOC_CTX *mem_ctx,
if (tevent_req_nomem(state->my_mailslot, req)) {
return tevent_req_post(req, ev);
}
- state->nmbd_pid = pidfile_pid_s3("nmbd");
+ state->nmbd_pid = pidfile_pid(lp_piddir(), "nmbd");
if (state->nmbd_pid == 0) {
DEBUG(3, ("No nmbd found\n"));
tevent_req_nterror(req, NT_STATUS_NOT_SUPPORTED);
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index df12405ada..a28ed7c393 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -25,6 +25,7 @@
#include "nmbd/nmbd.h"
#include "serverid.h"
#include "messages.h"
+#include "../lib/util/pidfile.h"
int ClientNMB = -1;
int ClientDGRAM = -1;
@@ -70,7 +71,7 @@ static void terminate(struct messaging_context *msg)
gencache_stabilize();
serverid_deregister(messaging_server_id(msg));
- pidfile_unlink_s3("nmbd");
+ pidfile_unlink(lp_piddir(), "nmbd");
exit(0);
}
@@ -942,7 +943,7 @@ static bool open_sockets(bool isdaemon, int port)
mkdir(lp_piddir(), 0755);
}
- pidfile_create_s3("nmbd");
+ pidfile_create(lp_piddir(), "nmbd");
status = reinit_after_fork(msg, nmbd_event_context(),
false);
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index ee1eafb0dc..63edf0020a 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -43,6 +43,7 @@
#include "lib/param/param.h"
#include "lib/background.h"
#include "lib/conn_tdb.h"
+#include "../lib/util/pidfile.h"
struct smbd_open_socket;
struct smbd_child_pid;
@@ -1285,7 +1286,7 @@ extern void build_options(bool screen);
mkdir(lp_piddir(), 0755);
if (is_daemon)
- pidfile_create_s3("smbd");
+ pidfile_create(lp_piddir(), "smbd");
status = reinit_after_fork(msg_ctx,
ev_ctx,
diff --git a/source3/smbd/server_exit.c b/source3/smbd/server_exit.c
index ab64b9c8a9..517d4c27da 100644
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -44,6 +44,7 @@
#include "printing.h"
#include "serverid.h"
#include "messages.h"
+#include "../lib/util/pidfile.h"
static struct files_struct *log_writeable_file_fn(
struct files_struct *fsp, void *private_data)
@@ -216,7 +217,7 @@ static void exit_server_common(enum server_exit_reason how,
DEBUG(3,("Server exit (%s)\n",
(reason ? reason : "normal exit")));
if (am_parent) {
- pidfile_unlink_s3("smbd");
+ pidfile_unlink(lp_piddir(), "smbd");
}
gencache_stabilize();
}
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index dbbd8049de..54c5d62c97 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -32,6 +32,7 @@
#include "libsmb/nmblib.h"
#include "messages.h"
#include "util_tdb.h"
+#include "../lib/util/pidfile.h"
#if HAVE_LIBUNWIND_H
#include <libunwind.h>
@@ -1365,7 +1366,7 @@ static struct server_id parse_dest(struct messaging_context *msg,
/* Look up other destinations in pidfile directory */
- if ((pid = pidfile_pid_s3(dest)) != 0) {
+ if ((pid = pidfile_pid(lp_piddir(), dest)) != 0) {
return pid_to_procid(pid);
}
diff --git a/source3/web/startstop.c b/source3/web/startstop.c
index ef2871ccd3..ec8f802ae9 100644
--- a/source3/web/startstop.c
+++ b/source3/web/startstop.c
@@ -20,7 +20,7 @@
#include "includes.h"
#include "web/swat_proto.h"
#include "dynconfig/dynconfig.h"
-
+#include "../lib/util/pidfile.h"
/** Startup smbd from web interface. */
void start_smbd(void)
@@ -86,7 +86,7 @@ void start_winbindd(void)
/* stop smbd */
void stop_smbd(void)
{
- pid_t pid = pidfile_pid_s3("smbd");
+ pid_t pid = pidfile_pid(lp_piddir(), "smbd");
if (geteuid() != 0) return;
@@ -98,7 +98,7 @@ void stop_smbd(void)
/* stop nmbd */
void stop_nmbd(void)
{
- pid_t pid = pidfile_pid_s3("nmbd");
+ pid_t pid = pidfile_pid(lp_piddir(), "nmbd");
if (geteuid() != 0) return;
@@ -110,7 +110,7 @@ void stop_nmbd(void)
/* stop winbindd */
void stop_winbindd(void)
{
- pid_t pid = pidfile_pid_s3("winbindd");
+ pid_t pid = pidfile_pid(lp_piddir(), "winbindd");
if (geteuid() != 0) return;
diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c
index d04554901c..d257970643 100644
--- a/source3/web/statuspage.c
+++ b/source3/web/statuspage.c
@@ -23,6 +23,7 @@
#include "locking/proto.h"
#include "librpc/gen_ndr/open_files.h"
#include "lib/conn_tdb.h"
+#include "../lib/util/pidfile.h"
#define _(x) lang_msg_rotate(talloc_tos(),x)
@@ -253,7 +254,7 @@ void status_page(void)
TALLOC_CTX *ctx = talloc_stackframe();
const char form_name[] = "status";
- smbd_pid = pid_to_procid(pidfile_pid_s3("smbd"));
+ smbd_pid = pid_to_procid(pidfile_pid(lp_piddir(), "smbd"));
if (!verify_xsrf_token(form_name)) {
goto output_page;
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index c2ac2e0032..685ef48881 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -36,6 +36,7 @@
#include "serverid.h"
#include "auth.h"
#include "messages.h"
+#include "../lib/util/pidfile.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_WINBIND
@@ -184,7 +185,7 @@ static void terminate(bool is_parent)
if (is_parent) {
serverid_deregister(procid_self());
- pidfile_unlink_s3("winbindd");
+ pidfile_unlink(lp_piddir(), "winbindd");
}
exit(0);
@@ -1449,7 +1450,7 @@ int main(int argc, char **argv, char **envp)
if (!interactive)
become_daemon(Fork, no_process_group, log_stdout);
- pidfile_create_s3("winbindd");
+ pidfile_create(lp_piddir(), "winbindd");
#if HAVE_SETPGID
/*