From: rpeterso@sourceware.org <rpeterso@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/group daemon/main.c tool/main.c
Date: 20 Nov 2006 22:31:52 -0000 [thread overview]
Message-ID: <20061120223152.14353.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL50
Changes by: rpeterso at sourceware.org 2006-11-20 22:31:52
Modified files:
group/daemon : main.c
group/tool : main.c
Log message:
Resolves: bz214625: Add group_tool log function to group_tool and
groupd.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/main.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.51.4.1&r2=1.51.4.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.21&r2=1.21.4.1
--- cluster/group/daemon/main.c 2006/11/15 14:44:12 1.51.4.1
+++ cluster/group/daemon/main.c 2006/11/20 22:31:51 1.51.4.2
@@ -320,6 +320,7 @@
DO_GET_GROUPS,
DO_GET_GROUP,
DO_DUMP,
+ DO_LOG,
};
int get_action(char *buf)
@@ -367,6 +368,9 @@
if (!strncmp(act, "dump", 16))
return DO_DUMP;
+ if (!strncmp(act, "log", 16))
+ return DO_LOG;
+
return -1;
}
@@ -561,6 +565,13 @@
return 0;
}
+static int do_log(int fd, const char *comment)
+{
+
+ log_print("%s", comment);
+ return 0;
+}
+
static void do_send(char *name, int level, int len, char *data)
{
group_t *g;
@@ -655,6 +666,10 @@
do_dump(client[ci].fd);
break;
+ case DO_LOG:
+ do_log(client[ci].fd, &buf[4]);
+ break;
+
default:
log_print("unknown action %d client %d bytes %d", act, ci, rv);
log_print("invalid message: \"%s\"", buf);
--- cluster/group/tool/main.c 2006/10/21 17:15:12 1.21
+++ cluster/group/tool/main.c 2006/11/20 22:31:52 1.21.4.1
@@ -45,6 +45,7 @@
#define OP_LS 1
#define OP_DUMP 2
+#define OP_LOG 3
static char *prog_name;
static int operation;
@@ -72,6 +73,8 @@
printf("dump gfs Show debug log from gfs_controld\n");
printf("dump plocks <name> Show posix locks for gfs with given name\n");
printf("\n");
+ printf("log <comments> Add information to the groupd log.\n");
+ printf("\n");
}
static void decode_arguments(int argc, char **argv)
@@ -126,6 +129,10 @@
operation = OP_LS;
opt_ind = optind + 1;
break;
+ } else if (strcmp(argv[optind], "log") == 0) {
+ operation = OP_LOG;
+ opt_ind = optind + 1;
+ break;
}
optind++;
}
@@ -406,6 +413,21 @@
return 0;
}
+int do_log(char *comment)
+{
+ char buf[GROUPD_MSGLEN];
+ int fd, rv;
+
+ fd = connect_daemon(GROUPD_SOCK_PATH);
+ if (fd < 0)
+ return fd;
+ memset(buf, 0, sizeof(buf));
+ snprintf(buf, sizeof(buf), "log %s", comment);
+ rv = write(fd, &buf, GROUPD_MSGLEN);
+ close(fd);
+ return rv;
+}
+
int main(int argc, char **argv)
{
int fd;
@@ -445,6 +467,11 @@
if (fd < 0)
break;
return do_dump(argc, argv, fd);
+
+ case OP_LOG:
+ if (opt_ind && opt_ind < argc) {
+ return do_log(argv[opt_ind]);
+ }
}
return 0;
next reply other threads:[~2006-11-20 22:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-20 22:31 rpeterso [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-11-09 15:51 [Cluster-devel] cluster/group daemon/main.c tool/main.c rpeterso
2006-11-09 15:47 rpeterso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061120223152.14353.qmail@sourceware.org \
--to=rpeterso@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.