diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-07-10 08:06:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:59:20 -0500 |
commit | 6504900f1f52927adab3489b8d04b6644ceaee7d (patch) | |
tree | 893cadba231a529f320046429767cedf8b0eec30 /source4/cluster/ctdb/tools/ctdb_status.c | |
parent | d4e2d157cbce5a1cdc75efb5ced75d9608a0f7df (diff) | |
download | samba-6504900f1f52927adab3489b8d04b6644ceaee7d.tar.gz samba-6504900f1f52927adab3489b8d04b6644ceaee7d.tar.bz2 samba-6504900f1f52927adab3489b8d04b6644ceaee7d.zip |
r23806: update Samba4 with the latest ctdb code.
This doesn't get the ctdb code fully working in Samba4, it just gets
it building and not breaking non-clustered use of Samba. It will take
a bit longer to update some of the calling ctdb_cluster.c code to make
it work correctly in Samba4.
Note also that Samba4 now only links to the client portion of
ctdb. For the moment I am leaving the ctdbd as a separate daemon,
which you install separately from http://ctdb.samba.org/.
(This used to be commit b196077cbb55cbecad87065133c2d67198e31066)
Diffstat (limited to 'source4/cluster/ctdb/tools/ctdb_status.c')
-rw-r--r-- | source4/cluster/ctdb/tools/ctdb_status.c | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/source4/cluster/ctdb/tools/ctdb_status.c b/source4/cluster/ctdb/tools/ctdb_status.c deleted file mode 100644 index ffb1fc7716..0000000000 --- a/source4/cluster/ctdb/tools/ctdb_status.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - ctdb status tool - - Copyright (C) Andrew Tridgell 2007 - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include "includes.h" -#include "lib/events/events.h" -#include "system/filesys.h" -#include "popt.h" -#include "cmdline.h" -#include "../include/ctdb_private.h" - - -/* - display status structure - */ -static void show_status(struct ctdb_status *s) -{ - printf(" client_packets_sent %u\n", s->client_packets_sent); - printf(" client_packets_recv %u\n", s->client_packets_recv); - printf(" req_call %u\n", s->client.req_call); - printf(" req_message %u\n", s->client.req_message); - printf(" req_finished %u\n", s->client.req_finished); - printf(" req_register %u\n", s->client.req_register); - printf(" req_connect_wait %u\n", s->client.req_connect_wait); - printf(" req_shutdown %u\n", s->client.req_shutdown); - printf(" req_status %u\n", s->client.req_status); - printf(" node_packets_sent %u\n", s->node_packets_sent); - printf(" node_packets_recv %u\n", s->node_packets_recv); - printf(" req_call %u\n", s->client.req_call); - printf(" reply_call %u\n", s->count.reply_call); - printf(" reply_redirect %u\n", s->count.reply_redirect); - printf(" req_dmaster %u\n", s->count.req_dmaster); - printf(" reply_dmaster %u\n", s->count.reply_dmaster); - printf(" reply_error %u\n", s->count.reply_error); - printf(" reply_redirect %u\n", s->count.reply_redirect); - printf(" req_message %u\n", s->count.req_message); - printf(" req_finished %u\n", s->count.req_finished); - printf(" total_calls %u\n", s->total_calls); - printf(" pending_calls %u\n", s->pending_calls); - printf(" lockwait_calls %u\n", s->lockwait_calls); - printf(" pending_lockwait_calls %u\n", s->pending_lockwait_calls); - printf(" max_call_latency %.6f seconds\n", s->max_call_latency); - printf(" max_lockwait_latency %.6f seconds\n", s->max_lockwait_latency); -} - -/* - show usage message - */ -static void usage(void) -{ - printf("Usage: ctdb_status <socketpath>\n"); - exit(1); -} - -/* - main program -*/ -int main(int argc, const char *argv[]) -{ - struct ctdb_context *ctdb; - struct poptOption popt_options[] = { - POPT_AUTOHELP - POPT_CTDB_CMDLINE - POPT_TABLEEND - }; - int opt; - const char **extra_argv; - int extra_argc = 0; - int ret; - poptContext pc; - struct event_context *ev; - const char *ctdb_socket; - struct ctdb_status status; - - pc = poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST); - - while ((opt = poptGetNextOpt(pc)) != -1) { - switch (opt) { - default: - fprintf(stderr, "Invalid option %s: %s\n", - poptBadOption(pc, 0), poptStrerror(opt)); - exit(1); - } - } - - /* setup the remaining options for the main program to use */ - extra_argv = poptGetArgs(pc); - if (extra_argv) { - extra_argv++; - while (extra_argv[extra_argc]) extra_argc++; - } - - if (extra_argc < 1) { - usage(); - } - - ctdb_socket = extra_argv[0]; - - ev = event_context_init(NULL); - - /* initialise ctdb */ - ctdb = ctdb_cmdline_client(ev, ctdb_socket); - if (ctdb == NULL) { - printf("Failed to init ctdb\n"); - exit(1); - } - - ret = ctdb_status(ctdb, &status); - if (ret != 0) { - printf("Failed to get ctdb status\n"); - exit(1); - } - - show_status(&status); - - return 0; -} |