diff options
author | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2009-12-02 13:17:12 +1100 |
---|---|---|
committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2009-12-02 13:17:12 +1100 |
commit | bf27dc2d53b8d10d8714aff4deaa2e0902e32f68 (patch) | |
tree | e2f013d0028ef45c0ed199e2b84691a6f3b8c656 /ctdb/server/ctdb_daemon.c | |
parent | 2b4fbe5c413384a81768e73bb14a93b74ba9b940 (diff) | |
download | samba-bf27dc2d53b8d10d8714aff4deaa2e0902e32f68.tar.gz samba-bf27dc2d53b8d10d8714aff4deaa2e0902e32f68.tar.xz samba-bf27dc2d53b8d10d8714aff4deaa2e0902e32f68.zip |
Use the PID we pick up from the domain socket when a client connects
and store this in the client structure.
There is no need to rely on the hack that samba sends some special message
handle registrations that encodes the pid in the srvid any more.
This might not work on AIX since I recall some issues to get the pid in
this way on that platform.
(This used to be ctdb commit b4a7efa7e53e060a91dea0e8e57b116e2aeacebf)
Diffstat (limited to 'ctdb/server/ctdb_daemon.c')
-rw-r--r-- | ctdb/server/ctdb_daemon.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index ab0437164e..8d85e76650 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -150,13 +150,6 @@ int daemon_register_message_handler(struct ctdb_context *ctdb, uint32_t client_i (unsigned long long)srvid)); } - /* this is a hack for Samba - we now know the pid of the Samba client */ - if ((srvid & 0xFFFFFFFF) == srvid && - kill(srvid, 0) == 0) { - client->pid = srvid; - DEBUG(DEBUG_INFO,(__location__ " Registered PID %u for client %u\n", - (unsigned)client->pid, client_id)); - } return res; } @@ -571,12 +564,13 @@ static void ctdb_accept_client(struct event_context *ev, struct fd_event *fde, #else if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &crl) == 0) { #endif - talloc_asprintf(client, "struct ctdb_client: pid:%u", (unsigned)cr.pid); + DEBUG(DEBUG_ERR,("Connected client with pid:%u\n", (unsigned)cr.pid)); } client->ctdb = ctdb; client->fd = fd; client->client_id = ctdb_reqid_new(ctdb, client); + client->pid = cr.pid; ctdb->statistics.num_clients++; client->queue = ctdb_queue_setup(ctdb, client, fd, CTDB_DS_ALIGNMENT, @@ -1156,3 +1150,5 @@ int32_t ctdb_control_deregister_notify(struct ctdb_context *ctdb, uint32_t clien return 0; } + + |