#include "includes.h"
#include "system/filesys.h"
-#include "smbd/pidfile.h"
+#include "lib/util/pidfile.h"
/**
* @file
--- /dev/null
+/*
+ Unix SMB/CIFS implementation.
+ Samba utility functions
+ Copyright (C) Jeremy Allison 2012.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _SAMBA_PIDFILE_H_
+#define _SAMBA_PIDFILE_H_
+
+pid_t pidfile_pid(const char *piddir, const char *name);
+void pidfile_create(const char *piddir, const char *program_name);
+
+#endif
signal.c system.c params.c util.c util_id.c util_net.c
util_strlist.c util_paths.c idtree.c debug.c fault.c base64.c
util_str.c util_str_common.c substitute.c ms_fnmatch.c
- server_id.c dprintf.c parmlist.c bitmap.c''',
+ server_id.c dprintf.c parmlist.c bitmap.c pidfile.c''',
deps='DYNCONFIG',
public_deps='talloc execinfo uid_wrapper pthread LIBCRYPTO charset util_setid',
public_headers='debug.h attr.h byteorder.h data_blob.h memory.h safe_string.h time.h talloc_stack.h xfile.h dlinklist.h samba_util.h string_wrappers.h',
/* The following definitions come from lib/pidfile.c */
-pid_t pidfile_pid(const char *name);
-void pidfile_create(const char *program_name);
-void pidfile_unlink(void);
+pid_t pidfile_pid_s3(const char *name);
+void pidfile_create_s3(const char *program_name);
+void pidfile_unlink_s3(void);
/* The following definitions come from lib/recvfile.c */
/* return the pid in a pidfile. return 0 if the process (or pidfile)
does not exist */
-pid_t pidfile_pid(const char *program_name)
+pid_t pidfile_pid_s3(const char *program_name)
{
int fd;
char pidstr[20];
}
/* create a pid file in the pid directory. open it and leave it locked */
-void pidfile_create(const char *program_name)
+void pidfile_create_s3(const char *program_name)
{
int fd;
char buf[20];
smb_panic("asprintf failed");
}
- pid = pidfile_pid(program_name);
+ pid = pidfile_pid_s3(program_name);
if (pid != 0) {
DEBUG(0,("ERROR: %s is already running. File %s exists and process id %d is running.\n",
name, pidFile_name, (int)pid));
fcntl(fd, F_SETFD, FD_CLOEXEC);
}
-void pidfile_unlink(void)
+void pidfile_unlink_s3(void)
{
if (pidFile_name == NULL) {
return;
if (tevent_req_nomem(state->my_mailslot, req)) {
return tevent_req_post(req, ev);
}
- state->nmbd_pid = pidfile_pid("nmbd");
+ state->nmbd_pid = pidfile_pid_s3("nmbd");
if (state->nmbd_pid == 0) {
DEBUG(3, ("No nmbd found\n"));
tevent_req_nterror(req, NT_STATUS_NOT_SUPPORTED);
gencache_stabilize();
serverid_deregister(messaging_server_id(msg));
- pidfile_unlink();
+ pidfile_unlink_s3();
exit(0);
}
mkdir(lp_piddir(), 0755);
}
- pidfile_create("nmbd");
+ pidfile_create_s3("nmbd");
status = reinit_after_fork(msg, nmbd_event_context(),
false);
mkdir(lp_piddir(), 0755);
if (is_daemon)
- pidfile_create("smbd");
+ pidfile_create_s3("smbd");
status = reinit_after_fork(msg_ctx,
ev_ctx,
DEBUG(3,("Server exit (%s)\n",
(reason ? reason : "normal exit")));
if (am_parent) {
- pidfile_unlink();
+ pidfile_unlink_s3();
}
gencache_stabilize();
}
/* Look up other destinations in pidfile directory */
- if ((pid = pidfile_pid(dest)) != 0) {
+ if ((pid = pidfile_pid_s3(dest)) != 0) {
return pid_to_procid(pid);
}
/* stop smbd */
void stop_smbd(void)
{
- pid_t pid = pidfile_pid("smbd");
+ pid_t pid = pidfile_pid_s3("smbd");
if (geteuid() != 0) return;
/* stop nmbd */
void stop_nmbd(void)
{
- pid_t pid = pidfile_pid("nmbd");
+ pid_t pid = pidfile_pid_s3("nmbd");
if (geteuid() != 0) return;
/* stop winbindd */
void stop_winbindd(void)
{
- pid_t pid = pidfile_pid("winbindd");
+ pid_t pid = pidfile_pid_s3("winbindd");
if (geteuid() != 0) return;
TALLOC_CTX *ctx = talloc_stackframe();
const char form_name[] = "status";
- smbd_pid = pid_to_procid(pidfile_pid("smbd"));
+ smbd_pid = pid_to_procid(pidfile_pid_s3("smbd"));
if (!verify_xsrf_token(form_name)) {
goto output_page;
if (is_parent) {
serverid_deregister(procid_self());
- pidfile_unlink();
+ pidfile_unlink_s3();
}
exit(0);
if (!interactive)
become_daemon(Fork, no_process_group, log_stdout);
- pidfile_create("winbindd");
+ pidfile_create_s3("winbindd");
#if HAVE_SETPGID
/*
#include "libcli/auth/schannel.h"
#include "smbd/process_model.h"
#include "param/secrets.h"
-#include "smbd/pidfile.h"
+#include "lib/util/pidfile.h"
#include "param/param.h"
#include "dsdb/samdb/samdb.h"
#include "auth/session.h"
)
-bld.SAMBA_SUBSYSTEM('PIDFILE',
- source='pidfile.c',
- deps='talloc',
- autoproto='pidfile.h'
- )
-
bld.SAMBA_LIBRARY('process_model',
source='process_model.c',
autoproto='process_model_proto.h',
source='server.c',
manpages='samba.8',
subsystem_name='service',
- deps='''events process_model service samba-hostconfig samba-util POPT_SAMBA PIDFILE
+ deps='''events process_model service samba-hostconfig samba-util POPT_SAMBA
popt gensec registry ntptr ntvfs share cluster COMMON_SCHANNEL SECRETS''',
pyembed=True,
install_path='${SBINDIR}',