struct server_id *pid);
NTSTATUS g_lock_do(const char *name, enum g_lock_type lock_type,
- struct timeval timeout, struct server_id self,
+ struct timeval timeout,
void (*fn)(void *private_data), void *private_data);
int g_lock_locks(struct g_lock_ctx *ctx,
int *n_sent);
struct event_context *messaging_event_context(struct messaging_context *msg_ctx);
struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
- struct server_id server_id,
struct event_context *ev);
struct server_id messaging_server_id(const struct messaging_context *msg_ctx);
/*
* re-init after a fork
*/
-NTSTATUS messaging_reinit(struct messaging_context *msg_ctx,
- struct server_id id);
+NTSTATUS messaging_reinit(struct messaging_context *msg_ctx);
NTSTATUS messaging_register(struct messaging_context *msg_ctx,
void *private_data,
int set_blocking(int fd, bool set);
NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
struct event_context *ev_ctx,
- struct server_id id,
bool parent_longlived);
void *malloc_(size_t size);
void *memalign_array(size_t el_size, size_t align, unsigned int count);
static bool g_lock_init_all(TALLOC_CTX *mem_ctx,
struct tevent_context **pev,
struct messaging_context **pmsg,
- const struct server_id self,
struct g_lock_ctx **pg_ctx)
{
struct tevent_context *ev = NULL;
d_fprintf(stderr, "ERROR: could not init event context\n");
goto fail;
}
- msg = messaging_init(mem_ctx, self, ev);
+ msg = messaging_init(mem_ctx, ev);
if (msg == NULL) {
d_fprintf(stderr, "ERROR: could not init messaging context\n");
goto fail;
}
NTSTATUS g_lock_do(const char *name, enum g_lock_type lock_type,
- struct timeval timeout, const struct server_id self,
+ struct timeval timeout,
void (*fn)(void *private_data), void *private_data)
{
struct tevent_context *ev = NULL;
struct g_lock_ctx *g_ctx = NULL;
NTSTATUS status;
- if (!g_lock_init_all(talloc_tos(), &ev, &msg, self, &g_ctx)) {
+ if (!g_lock_init_all(talloc_tos(), &ev, &msg, &g_ctx)) {
status = NT_STATUS_ACCESS_DENIED;
goto done;
}
}
struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
- struct server_id server_id,
struct event_context *ev)
{
struct messaging_context *ctx;
return NULL;
}
- ctx->id = server_id;
+ ctx->id = procid_self();
ctx->event_ctx = ev;
status = messaging_tdb_init(ctx, ctx, &ctx->local);
/*
* re-init after a fork
*/
-NTSTATUS messaging_reinit(struct messaging_context *msg_ctx,
- struct server_id id)
+NTSTATUS messaging_reinit(struct messaging_context *msg_ctx)
{
NTSTATUS status;
TALLOC_FREE(msg_ctx->local);
- msg_ctx->id = id;
+ msg_ctx->id = procid_self();
status = messaging_tdb_init(msg_ctx, msg_ctx, &msg_ctx->local);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("event_context_init failed\n"));
}
- msg = messaging_init(NULL, procid_self(), ev);
+ msg = messaging_init(NULL, ev);
if (!msg) {
DEBUG(0,("messaging_init failed\n"));
return NULL;
* children exiting.
*/
server_msg_ctx = messaging_init(NULL,
- procid_self(),
server_event_context());
}
return server_msg_ctx;
NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
struct event_context *ev_ctx,
- struct server_id id,
bool parent_longlived)
{
NTSTATUS status = NT_STATUS_OK;
* For clustering, we need to re-init our ctdbd connection after the
* fork
*/
- status = messaging_reinit(msg_ctx, id);
+ status = messaging_reinit(msg_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("messaging_reinit() failed: %s\n",
nt_errstr(status)));
NT_STATUS_HAVE_NO_MEMORY(ctx->domain_sid_str);
}
- ctx->msg_ctx = messaging_init(ctx, procid_self(),
- event_context_init(ctx));
+ ctx->msg_ctx = messaging_init(ctx, event_context_init(ctx));
NT_STATUS_HAVE_NO_MEMORY(ctx->msg_ctx);
*ctx_p = ctx;
status = reinit_after_fork(nmbd_messaging_context(),
nmbd_event_context(),
- procid_self(), true);
+ true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
status = reinit_after_fork(nmbd_messaging_context(),
nmbd_event_context(),
- procid_self(), false);
+ false);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
close_all_print_db();
- status = reinit_after_fork(msg_ctx, ev, procid_self(), true);
+ status = reinit_after_fork(msg_ctx, ev, true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("cups_pcap_load_async: reinit_after_fork() failed\n"));
smb_panic("cups_pcap_load_async: reinit_after_fork() failed");
close(pause_pipe[0]);
pause_pipe[0] = -1;
- status = reinit_after_fork(msg_ctx, ev, procid_self(), true);
+ status = reinit_after_fork(msg_ctx, ev, true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
bool ok;
status = reinit_after_fork(msg_ctx, ev_ctx,
- procid_self(), true);
+ true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
smb_panic("reinit_after_fork() failed");
status = reinit_after_fork(msg_ctx,
ev_ctx,
- procid_self(), true);
+ true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
smb_panic("reinit_after_fork() failed");
status = reinit_after_fork(msg_ctx,
ev_ctx,
- procid_self(),
true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
bool ok;
status = reinit_after_fork(msg_ctx, ev_ctx,
- procid_self(), true);
+ true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
smb_panic("reinit_after_fork() failed");
status = reinit_after_fork(msg_ctx,
ev_ctx,
- procid_self(), true);
+ true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
smb_panic("reinit_after_fork() failed");
status = reinit_after_fork(sconn->msg_ctx,
sconn->ev_ctx,
- procid_self(), false);
+ false);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("reinit_after_fork failed: %s\n",
nt_errstr(status)));
status = reinit_after_fork(msg_ctx,
ev,
- procid_self(),
true);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status,
status = reinit_after_fork(msg_ctx,
ev_ctx,
- procid_self(), false);
+ false);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
exit(1);
lp_load_global(get_dyn_CONFIGFILE());
if (!(evt_ctx = tevent_context_init(NULL)) ||
- !(msg_ctx = messaging_init(NULL, procid_self(), evt_ctx))) {
+ !(msg_ctx = messaging_init(NULL, evt_ctx))) {
fprintf(stderr, "could not init messaging context\n");
exit(1);
}
goto done;
}
- msg_ctx = messaging_init(mem_ctx, procid_self(), evt_ctx);
+ msg_ctx = messaging_init(mem_ctx, evt_ctx);
if (msg_ctx == NULL) {
d_fprintf(stderr, "ERROR: could not init messaging context\n");
goto done;
goto done;
}
- msg_ctx = messaging_init(mem_ctx, procid_self(), ev_ctx);
+ msg_ctx = messaging_init(mem_ctx, ev_ctx);
if (msg_ctx == NULL) {
d_fprintf(stderr, "ERROR: could not init messaging context\n");
goto done;
/* Failing to init the msg_ctx isn't a fatal error. Only
root-level things (joining/leaving domains etc.) will be denied. */
- c->msg_ctx = messaging_init(c, procid_self(),
- event_context_init(c));
+ c->msg_ctx = messaging_init(c, event_context_init(c));
rc = net_run_function(c, argc_new-1, argv_new+1, "net", net_func);
d_fprintf(stderr, "ERROR: could not init event context\n");
goto fail;
}
- msg = messaging_init(mem_ctx, procid_self(), ev);
+ msg = messaging_init(mem_ctx, ev);
if (msg == NULL) {
d_fprintf(stderr, "ERROR: could not init messaging context\n");
goto fail;
status = g_lock_do(name, G_LOCK_WRITE,
timeval_set(timeout / 1000, timeout % 1000),
- procid_self(), net_g_lock_do_fn, &state);
+ net_g_lock_do_fn, &state);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, "ERROR: g_lock_do failed: %s\n",
nt_errstr(status));
}
status = g_lock_do("registry_increment_lock", G_LOCK_WRITE,
- timeval_set(600, 0), procid_self(),
+ timeval_set(600, 0),
net_registry_increment_fn, &state);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, _("g_lock_do failed: %s\n"),
* shell needs 0. */
if (!(evt_ctx = tevent_context_init(NULL)) ||
- !(msg_ctx = messaging_init(NULL, procid_self(), evt_ctx))) {
+ !(msg_ctx = messaging_init(NULL, evt_ctx))) {
fprintf(stderr, "could not init messaging context\n");
TALLOC_FREE(frame);
exit(1);
* connection, usable by the db_open() calls further
* down.
*/
- msg_ctx = messaging_init(NULL, procid_self(),
- event_context_init(NULL));
+ msg_ctx = messaging_init(NULL, event_context_init(NULL));
if (msg_ctx == NULL) {
fprintf(stderr, "messaging_init failed\n");
ret = -1;
status = reinit_after_fork(winbind_messaging_context(),
winbind_event_context(),
- procid_self(), false);
+ false);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
exit(1);
status = reinit_after_fork(
winbind_messaging_context(),
winbind_event_context(),
- procid_self(),
true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));