bool unclean_shutdown)
{
struct smbd_child_pid *child;
- struct server_id child_id;
struct iovec iov[2];
NTSTATUS status;
- child_id = pid_to_procid(pid);
-
iov[0] = (struct iovec) { .iov_base = (uint8_t *)&pid,
.iov_len = sizeof(pid) };
iov[1] = (struct iovec) { .iov_base = (uint8_t *)&unclean_shutdown,
DEBUG(1,("Scheduled cleanup of brl and lock database after unclean shutdown\n"));
}
}
-
- if (!serverid_deregister(child_id)) {
- DEBUG(1, ("Could not remove pid %d from serverid.tdb\n",
- (int)pid));
- }
}
/****************************************************************************
#include "replace.h"
#include "smbd_cleanupd.h"
+#include "lib/util_procid.h"
#include "lib/util/tevent_ntstatus.h"
#include "lib/util/debug.h"
#include "smbprofile.h"
+#include "serverid.h"
struct smbd_cleanupd_state {
pid_t parent_pid;
struct smbd_cleanupd_state *state = tevent_req_data(
req, struct smbd_cleanupd_state);
pid_t pid;
+ struct server_id child_id;
bool unclean_shutdown;
int ret;
DBG_DEBUG("%d exited %sclean\n", (int)pid,
unclean_shutdown ? "un" : "");
+ /*
+ * Get child_id before messaging_cleanup which wipes the
+ * unique_id. Not that it really matters here for functionality (the
+ * child should have properly cleaned up :-)) though, but it looks
+ * nicer.
+ */
+ child_id = pid_to_procid(pid);
+
smbprofile_cleanup(pid, state->parent_pid);
ret = messaging_cleanup(msg, pid);
if ((ret != 0) && (ret != ENOENT)) {
DBG_DEBUG("messaging_cleanup returned %s\n", strerror(ret));
}
+
+ if (!serverid_deregister(child_id)) {
+ DEBUG(1, ("Could not remove pid %d from serverid.tdb\n",
+ (int)pid));
+ }
}
NTSTATUS smbd_cleanupd_recv(struct tevent_req *req)