* [Cluster-devel] cluster/group/tool main.c
@ 2006-12-01 15:26 teigland
0 siblings, 0 replies; 12+ messages in thread
From: teigland @ 2006-12-01 15:26 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-12-01 15:26:06
Modified files:
group/tool : main.c
Log message:
group_tool dump doesn't handle partial reads/writes,
now we always dump entire fixed size debug buffer
bz 214540
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&r1=1.23&r2=1.24
--- cluster/group/tool/main.c 2006/11/09 16:22:34 1.23
+++ cluster/group/tool/main.c 2006/12/01 15:26:05 1.24
@@ -52,6 +52,42 @@
static int opt_ind;
static int verbose;
+static int do_write(int fd, void *buf, size_t count)
+{
+ int rv, off = 0;
+
+ retry:
+ rv = write(fd, buf + off, count);
+ if (rv == -1 && errno == EINTR)
+ goto retry;
+ if (rv < 0)
+ return rv;
+
+ if (rv != count) {
+ count -= rv;
+ off += rv;
+ goto retry;
+ }
+ return 0;
+}
+
+static int do_read(int fd, void *buf, size_t count)
+{
+ int rv, off = 0;
+
+ while (off < count) {
+ rv = read(fd, buf + off, count - off);
+ if (rv == 0)
+ return -1;
+ if (rv == -1 && errno == EINTR)
+ continue;
+ if (rv == -1)
+ return -1;
+ off += rv;
+ }
+ return 0;
+}
+
static void print_usage(void)
{
printf("Usage:\n");
@@ -337,23 +373,16 @@
sprintf(outbuf, "dump");
- rv = write(fd, outbuf, sizeof(outbuf));
- if (rv != sizeof(outbuf)) {
- printf("dump write error %d errno %d\n", rv, errno);;
+ rv = do_write(fd, outbuf, sizeof(outbuf));
+ if (rv < 0) {
+ printf("dump write error %d errno %d\n", rv, errno);
return -1;
}
- while (1) {
- rv = read(fd, inbuf, sizeof(inbuf));
- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
- if (rv <= 0) {
- if (errno != EAGAIN)
- printf("dump read returned %d errno %d\n", rv, errno);
- break;
- }
- else
- write(STDOUT_FILENO, inbuf, rv);
- }
+ rv = do_read(fd, inbuf, sizeof(inbuf));
+ if (rv < 0)
+ printf("dump read error %d errno %d\n", rv, errno);
+ do_write(STDOUT_FILENO, inbuf, sizeof(inbuf));
close(fd);
return 0;
@@ -370,23 +399,16 @@
sprintf(outbuf, "dump");
- rv = write(fd, outbuf, sizeof(outbuf));
- if (rv != sizeof(outbuf)) {
- printf("dump write error %d errno %d\n", rv, errno);;
+ rv = do_write(fd, outbuf, sizeof(outbuf));
+ if (rv < 0) {
+ printf("dump write error %d errno %d\n", rv, errno);
return -1;
}
- while (1) {
- rv = read(fd, inbuf, sizeof(inbuf));
- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
- if (rv <= 0) {
- if (errno != EAGAIN)
- printf("dump read returned %d errno %d\n", rv, errno);
- break;
- }
- else
- write(STDOUT_FILENO, inbuf, rv);
- }
+ rv = do_read(fd, inbuf, sizeof(inbuf));
+ if (rv < 0)
+ printf("dump read error %d errno %d\n", rv, errno);
+ do_write(STDOUT_FILENO, inbuf, sizeof(inbuf));
close(fd);
return 0;
@@ -407,8 +429,8 @@
sprintf(outbuf, "plocks %s", argv[opt_ind + 1]);
- rv = write(fd, outbuf, sizeof(outbuf));
- if (rv != sizeof(outbuf)) {
+ rv = do_write(fd, outbuf, sizeof(outbuf));
+ if (rv < 0) {
printf("dump write error %d errno %d\n", rv, errno);;
return -1;
}
^ permalink raw reply [flat|nested] 12+ messages in thread* [Cluster-devel] cluster/group/tool main.c
@ 2006-12-01 15:26 teigland
0 siblings, 0 replies; 12+ messages in thread
From: teigland @ 2006-12-01 15:26 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL50
Changes by: teigland at sourceware.org 2006-12-01 15:26:52
Modified files:
group/tool : main.c
Log message:
group_tool dump doesn't handle partial reads/writes,
now we always dump entire fixed size debug buffer
bz 214540
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.21.4.2&r2=1.21.4.3
--- cluster/group/tool/main.c 2006/11/20 22:36:55 1.21.4.2
+++ cluster/group/tool/main.c 2006/12/01 15:26:51 1.21.4.3
@@ -52,6 +52,42 @@
static int opt_ind;
static int verbose;
+static int do_write(int fd, void *buf, size_t count)
+{
+ int rv, off = 0;
+
+ retry:
+ rv = write(fd, buf + off, count);
+ if (rv == -1 && errno == EINTR)
+ goto retry;
+ if (rv < 0)
+ return rv;
+
+ if (rv != count) {
+ count -= rv;
+ off += rv;
+ goto retry;
+ }
+ return 0;
+}
+
+static int do_read(int fd, void *buf, size_t count)
+{
+ int rv, off = 0;
+
+ while (off < count) {
+ rv = read(fd, buf + off, count - off);
+ if (rv == 0)
+ return -1;
+ if (rv == -1 && errno == EINTR)
+ continue;
+ if (rv == -1)
+ return -1;
+ off += rv;
+ }
+ return 0;
+}
+
static void print_usage(void)
{
printf("Usage:\n");
@@ -337,23 +373,16 @@
sprintf(outbuf, "dump");
- rv = write(fd, outbuf, sizeof(outbuf));
- if (rv != sizeof(outbuf)) {
- printf("dump write error %d errno %d\n", rv, errno);;
+ rv = do_write(fd, outbuf, sizeof(outbuf));
+ if (rv < 0) {
+ printf("dump write error %d errno %d\n", rv, errno);
return -1;
}
- while (1) {
- rv = read(fd, inbuf, sizeof(inbuf));
- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
- if (rv <= 0) {
- if (errno != EAGAIN)
- printf("dump read returned %d errno %d\n", rv, errno);
- break;
- }
- else
- write(STDOUT_FILENO, inbuf, rv);
- }
+ rv = do_read(fd, inbuf, sizeof(inbuf));
+ if (rv < 0)
+ printf("dump read error %d errno %d\n", rv, errno);
+ do_write(STDOUT_FILENO, inbuf, sizeof(inbuf));
close(fd);
return 0;
@@ -370,23 +399,16 @@
sprintf(outbuf, "dump");
- rv = write(fd, outbuf, sizeof(outbuf));
- if (rv != sizeof(outbuf)) {
- printf("dump write error %d errno %d\n", rv, errno);;
+ rv = do_write(fd, outbuf, sizeof(outbuf));
+ if (rv < 0) {
+ printf("dump write error %d errno %d\n", rv, errno);
return -1;
}
- while (1) {
- rv = read(fd, inbuf, sizeof(inbuf));
- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
- if (rv <= 0) {
- if (errno != EAGAIN)
- printf("dump read returned %d errno %d\n", rv, errno);
- break;
- }
- else
- write(STDOUT_FILENO, inbuf, rv);
- }
+ rv = do_read(fd, inbuf, sizeof(inbuf));
+ if (rv < 0)
+ printf("dump read error %d errno %d\n", rv, errno);
+ do_write(STDOUT_FILENO, inbuf, sizeof(inbuf));
close(fd);
return 0;
@@ -407,8 +429,8 @@
sprintf(outbuf, "plocks %s", argv[opt_ind + 1]);
- rv = write(fd, outbuf, sizeof(outbuf));
- if (rv != sizeof(outbuf)) {
+ rv = do_write(fd, outbuf, sizeof(outbuf));
+ if (rv < 0) {
printf("dump write error %d errno %d\n", rv, errno);;
return -1;
}
^ permalink raw reply [flat|nested] 12+ messages in thread* [Cluster-devel] cluster/group/tool main.c
@ 2006-12-01 15:26 teigland
0 siblings, 0 replies; 12+ messages in thread
From: teigland @ 2006-12-01 15:26 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: teigland at sourceware.org 2006-12-01 15:26:40
Modified files:
group/tool : main.c
Log message:
group_tool dump doesn't handle partial reads/writes,
now we always dump entire fixed size debug buffer
bz 214540
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.21.2.2&r2=1.21.2.3
--- cluster/group/tool/main.c 2006/11/09 16:23:41 1.21.2.2
+++ cluster/group/tool/main.c 2006/12/01 15:26:40 1.21.2.3
@@ -52,6 +52,42 @@
static int opt_ind;
static int verbose;
+static int do_write(int fd, void *buf, size_t count)
+{
+ int rv, off = 0;
+
+ retry:
+ rv = write(fd, buf + off, count);
+ if (rv == -1 && errno == EINTR)
+ goto retry;
+ if (rv < 0)
+ return rv;
+
+ if (rv != count) {
+ count -= rv;
+ off += rv;
+ goto retry;
+ }
+ return 0;
+}
+
+static int do_read(int fd, void *buf, size_t count)
+{
+ int rv, off = 0;
+
+ while (off < count) {
+ rv = read(fd, buf + off, count - off);
+ if (rv == 0)
+ return -1;
+ if (rv == -1 && errno == EINTR)
+ continue;
+ if (rv == -1)
+ return -1;
+ off += rv;
+ }
+ return 0;
+}
+
static void print_usage(void)
{
printf("Usage:\n");
@@ -337,23 +373,16 @@
sprintf(outbuf, "dump");
- rv = write(fd, outbuf, sizeof(outbuf));
- if (rv != sizeof(outbuf)) {
- printf("dump write error %d errno %d\n", rv, errno);;
+ rv = do_write(fd, outbuf, sizeof(outbuf));
+ if (rv < 0) {
+ printf("dump write error %d errno %d\n", rv, errno);
return -1;
}
- while (1) {
- rv = read(fd, inbuf, sizeof(inbuf));
- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
- if (rv <= 0) {
- if (errno != EAGAIN)
- printf("dump read returned %d errno %d\n", rv, errno);
- break;
- }
- else
- write(STDOUT_FILENO, inbuf, rv);
- }
+ rv = do_read(fd, inbuf, sizeof(inbuf));
+ if (rv < 0)
+ printf("dump read error %d errno %d\n", rv, errno);
+ do_write(STDOUT_FILENO, inbuf, sizeof(inbuf));
close(fd);
return 0;
@@ -370,23 +399,16 @@
sprintf(outbuf, "dump");
- rv = write(fd, outbuf, sizeof(outbuf));
- if (rv != sizeof(outbuf)) {
- printf("dump write error %d errno %d\n", rv, errno);;
+ rv = do_write(fd, outbuf, sizeof(outbuf));
+ if (rv < 0) {
+ printf("dump write error %d errno %d\n", rv, errno);
return -1;
}
- while (1) {
- rv = read(fd, inbuf, sizeof(inbuf));
- fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
- if (rv <= 0) {
- if (errno != EAGAIN)
- printf("dump read returned %d errno %d\n", rv, errno);
- break;
- }
- else
- write(STDOUT_FILENO, inbuf, rv);
- }
+ rv = do_read(fd, inbuf, sizeof(inbuf));
+ if (rv < 0)
+ printf("dump read error %d errno %d\n", rv, errno);
+ do_write(STDOUT_FILENO, inbuf, sizeof(inbuf));
close(fd);
return 0;
@@ -407,8 +429,8 @@
sprintf(outbuf, "plocks %s", argv[opt_ind + 1]);
- rv = write(fd, outbuf, sizeof(outbuf));
- if (rv != sizeof(outbuf)) {
+ rv = do_write(fd, outbuf, sizeof(outbuf));
+ if (rv < 0) {
printf("dump write error %d errno %d\n", rv, errno);;
return -1;
}
^ permalink raw reply [flat|nested] 12+ messages in thread* [Cluster-devel] cluster/group/tool main.c
@ 2006-11-20 22:36 rpeterso
0 siblings, 0 replies; 12+ messages in thread
From: rpeterso @ 2006-11-20 22:36 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL50
Changes by: rpeterso at sourceware.org 2006-11-20 22:36:55
Modified files:
group/tool : main.c
Log message:
Resolves: bz214524: group_tool dump can give short output.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.21.4.1&r2=1.21.4.2
--- cluster/group/tool/main.c 2006/11/20 22:31:52 1.21.4.1
+++ cluster/group/tool/main.c 2006/11/20 22:36:55 1.21.4.2
@@ -343,11 +343,17 @@
return -1;
}
- rv = read(fd, inbuf, sizeof(inbuf));
- if (rv <= 0)
- printf("dump read returned %d errno %d\n", rv, errno);
- else
- write(STDOUT_FILENO, inbuf, rv);
+ while (1) {
+ rv = read(fd, inbuf, sizeof(inbuf));
+ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
+ if (rv <= 0) {
+ if (errno != EAGAIN)
+ printf("dump read returned %d errno %d\n", rv, errno);
+ break;
+ }
+ else
+ write(STDOUT_FILENO, inbuf, rv);
+ }
close(fd);
return 0;
@@ -370,11 +376,17 @@
return -1;
}
- rv = read(fd, inbuf, sizeof(inbuf));
- if (rv <= 0)
- printf("dump read returned %d errno %d\n", rv, errno);
- else
- write(STDOUT_FILENO, inbuf, rv);
+ while (1) {
+ rv = read(fd, inbuf, sizeof(inbuf));
+ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
+ if (rv <= 0) {
+ if (errno != EAGAIN)
+ printf("dump read returned %d errno %d\n", rv, errno);
+ break;
+ }
+ else
+ write(STDOUT_FILENO, inbuf, rv);
+ }
close(fd);
return 0;
^ permalink raw reply [flat|nested] 12+ messages in thread* [Cluster-devel] cluster/group/tool main.c
@ 2006-11-09 16:23 rpeterso
0 siblings, 0 replies; 12+ messages in thread
From: rpeterso @ 2006-11-09 16:23 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: rpeterso at sourceware.org 2006-11-09 16:23:41
Modified files:
group/tool : main.c
Log message:
This is the fix for Bugzilla Bug 214524: group_tool dump can give
short output.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.21.2.1&r2=1.21.2.2
--- cluster/group/tool/main.c 2006/11/09 15:51:01 1.21.2.1
+++ cluster/group/tool/main.c 2006/11/09 16:23:41 1.21.2.2
@@ -343,11 +343,17 @@
return -1;
}
- rv = read(fd, inbuf, sizeof(inbuf));
- if (rv <= 0)
- printf("dump read returned %d errno %d\n", rv, errno);
- else
- write(STDOUT_FILENO, inbuf, rv);
+ while (1) {
+ rv = read(fd, inbuf, sizeof(inbuf));
+ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
+ if (rv <= 0) {
+ if (errno != EAGAIN)
+ printf("dump read returned %d errno %d\n", rv, errno);
+ break;
+ }
+ else
+ write(STDOUT_FILENO, inbuf, rv);
+ }
close(fd);
return 0;
@@ -370,11 +376,17 @@
return -1;
}
- rv = read(fd, inbuf, sizeof(inbuf));
- if (rv <= 0)
- printf("dump read returned %d errno %d\n", rv, errno);
- else
- write(STDOUT_FILENO, inbuf, rv);
+ while (1) {
+ rv = read(fd, inbuf, sizeof(inbuf));
+ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
+ if (rv <= 0) {
+ if (errno != EAGAIN)
+ printf("dump read returned %d errno %d\n", rv, errno);
+ break;
+ }
+ else
+ write(STDOUT_FILENO, inbuf, rv);
+ }
close(fd);
return 0;
^ permalink raw reply [flat|nested] 12+ messages in thread* [Cluster-devel] cluster/group/tool main.c
@ 2006-11-09 16:22 rpeterso
0 siblings, 0 replies; 12+ messages in thread
From: rpeterso @ 2006-11-09 16:22 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: rpeterso at sourceware.org 2006-11-09 16:22:34
Modified files:
group/tool : main.c
Log message:
This is the fix for Bugzilla Bug 214524: group_tool dump can give
short output.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&r1=1.22&r2=1.23
--- cluster/group/tool/main.c 2006/11/09 15:47:29 1.22
+++ cluster/group/tool/main.c 2006/11/09 16:22:34 1.23
@@ -343,11 +343,17 @@
return -1;
}
- rv = read(fd, inbuf, sizeof(inbuf));
- if (rv <= 0)
- printf("dump read returned %d errno %d\n", rv, errno);
- else
- write(STDOUT_FILENO, inbuf, rv);
+ while (1) {
+ rv = read(fd, inbuf, sizeof(inbuf));
+ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
+ if (rv <= 0) {
+ if (errno != EAGAIN)
+ printf("dump read returned %d errno %d\n", rv, errno);
+ break;
+ }
+ else
+ write(STDOUT_FILENO, inbuf, rv);
+ }
close(fd);
return 0;
@@ -370,11 +376,17 @@
return -1;
}
- rv = read(fd, inbuf, sizeof(inbuf));
- if (rv <= 0)
- printf("dump read returned %d errno %d\n", rv, errno);
- else
- write(STDOUT_FILENO, inbuf, rv);
+ while (1) {
+ rv = read(fd, inbuf, sizeof(inbuf));
+ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
+ if (rv <= 0) {
+ if (errno != EAGAIN)
+ printf("dump read returned %d errno %d\n", rv, errno);
+ break;
+ }
+ else
+ write(STDOUT_FILENO, inbuf, rv);
+ }
close(fd);
return 0;
^ permalink raw reply [flat|nested] 12+ messages in thread* [Cluster-devel] cluster/group/tool main.c
@ 2006-08-14 19:38 teigland
0 siblings, 0 replies; 12+ messages in thread
From: teigland @ 2006-08-14 19:38 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-08-14 20:38:20
Modified files:
group/tool : main.c
Log message:
show all options in help output
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&r1=1.19&r2=1.20
--- cluster/group/tool/main.c 2006/07/31 18:38:33 1.19
+++ cluster/group/tool/main.c 2006/08/14 19:38:20 1.20
@@ -55,13 +55,23 @@
{
printf("Usage:\n");
printf("\n");
- printf("%s [options]\n", prog_name);
+ printf("%s [options] [ls|dump]\n", prog_name);
printf("\n");
printf("Options:\n");
- printf("\n");
printf(" -v Verbose output, extra event information\n");
printf(" -h Print this help, then exit\n");
printf(" -V Print program version information, then exit\n");
+ printf("\n");
+ printf("Display group information from groupd\n");
+ printf("ls Show information for all groups\n");
+ printf("ls <level> <name> Show information one group\n");
+ printf("\n");
+ printf("Display debugging information\n");
+ printf("dump Show debug log from groupd\n");
+ printf("dump fence Show debug log from fenced\n");
+ 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");
}
static void decode_arguments(int argc, char **argv)
^ permalink raw reply [flat|nested] 12+ messages in thread* [Cluster-devel] cluster/group/tool main.c
@ 2006-07-31 18:38 teigland
0 siblings, 0 replies; 12+ messages in thread
From: teigland @ 2006-07-31 18:38 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-07-31 18:38:33
Modified files:
group/tool : main.c
Log message:
'group_tool dump plocks <fsname>' can now be used to display all
plocks held in the fs
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&r1=1.18&r2=1.19
--- cluster/group/tool/main.c 2006/07/25 20:09:58 1.18
+++ cluster/group/tool/main.c 2006/07/31 18:38:33 1.19
@@ -359,6 +359,39 @@
return 0;
}
+int do_plock_dump(int argc, char **argv, int fd)
+{
+ char inbuf[MAXLINE];
+ char outbuf[MAXLINE];
+ int rv;
+
+ memset(outbuf, 0, sizeof(outbuf));
+
+ if (opt_ind + 1 >= argc) {
+ printf("plocks option requires a group name\n");
+ return -1;
+ }
+
+ sprintf(outbuf, "plocks %s", argv[opt_ind + 1]);
+
+ rv = write(fd, outbuf, sizeof(outbuf));
+ if (rv != sizeof(outbuf)) {
+ printf("dump write error %d errno %d\n", rv, errno);;
+ return -1;
+ }
+
+ while (1) {
+ memset(&inbuf, 0, sizeof(inbuf));
+ rv = read(fd, inbuf, sizeof(inbuf));
+ if (rv <= 0)
+ break;
+ write(STDOUT_FILENO, inbuf, rv);
+ }
+
+ close(fd);
+ return 0;
+}
+
int main(int argc, char **argv)
{
int fd;
@@ -385,6 +418,13 @@
return -1;
return do_maxline_dump(argc, argv, fd);
}
+
+ if (!strncmp(argv[opt_ind], "plocks", 5)) {
+ fd = connect_daemon(LOCK_DLM_SOCK_PATH);
+ if (fd < 0)
+ return -1;
+ return do_plock_dump(argc, argv, fd);
+ }
}
fd = connect_daemon(GROUPD_SOCK_PATH);
^ permalink raw reply [flat|nested] 12+ messages in thread* [Cluster-devel] cluster/group/tool main.c
@ 2006-07-25 20:10 teigland
0 siblings, 0 replies; 12+ messages in thread
From: teigland @ 2006-07-25 20:10 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-07-25 20:09:58
Modified files:
group/tool : main.c
Log message:
'group_tool dump fence' will dump fenced's debug buffer
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&r1=1.17&r2=1.18
--- cluster/group/tool/main.c 2006/07/14 18:57:25 1.17
+++ cluster/group/tool/main.c 2006/07/25 20:09:58 1.18
@@ -32,8 +32,11 @@
/* copied from cluster/group/gfs_controld/lock_dlm.h */
#define LOCK_DLM_SOCK_PATH "gfs_controld_sock"
+/* copied from cluster/fence/fenced/fd.h */
+#define FENCED_SOCK_PATH "fenced_socket"
+
/* needs to match the same in cluster/group/daemon/gd_internal.h and
- cluster/group/gfs_controld/lock_dlm.h */
+ cluster/group/gfs_controld/lock_dlm.h and cluster/fence/fenced/fd.h */
#define DUMP_SIZE (1024 * 1024)
/* needs to match the same in cluster/group/gfs_controld/lock_dlm.h,
@@ -329,7 +332,7 @@
return 0;
}
-int do_gfsdump(int argc, char **argv, int fd)
+int do_maxline_dump(int argc, char **argv, int fd)
{
char inbuf[DUMP_SIZE];
char outbuf[MAXLINE];
@@ -373,7 +376,14 @@
fd = connect_daemon(LOCK_DLM_SOCK_PATH);
if (fd < 0)
return -1;
- return do_gfsdump(argc, argv, fd);
+ return do_maxline_dump(argc, argv, fd);
+ }
+
+ if (!strncmp(argv[opt_ind], "fence", 5)) {
+ fd = connect_daemon(FENCED_SOCK_PATH);
+ if (fd < 0)
+ return -1;
+ return do_maxline_dump(argc, argv, fd);
}
}
^ permalink raw reply [flat|nested] 12+ messages in thread* [Cluster-devel] cluster/group/tool main.c
@ 2006-07-14 18:57 teigland
0 siblings, 0 replies; 12+ messages in thread
From: teigland @ 2006-07-14 18:57 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-07-14 18:57:25
Modified files:
group/tool : main.c
Log message:
add option to dump debug messages from gfs_controld using
'group_tool dump gfs', 'group_tool dump' still dumps debug
messages from groupd.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&r1=1.16&r2=1.17
--- cluster/group/tool/main.c 2006/07/13 18:15:43 1.16
+++ cluster/group/tool/main.c 2006/07/14 18:57:25 1.17
@@ -28,8 +28,18 @@
#define MAX_GROUPS 64
#define OPTION_STRING "hVv"
+
+/* copied from cluster/group/gfs_controld/lock_dlm.h */
+#define LOCK_DLM_SOCK_PATH "gfs_controld_sock"
+
+/* needs to match the same in cluster/group/daemon/gd_internal.h and
+ cluster/group/gfs_controld/lock_dlm.h */
#define DUMP_SIZE (1024 * 1024)
+/* needs to match the same in cluster/group/gfs_controld/lock_dlm.h,
+ it's the message size that gfs_controld takes */
+#define MAXLINE 256
+
#define OP_LS 1
#define OP_DUMP 2
@@ -268,7 +278,7 @@
return 0;
}
-static int connect_groupd(void)
+static int connect_daemon(char *path)
{
struct sockaddr_un sun;
socklen_t addrlen;
@@ -280,7 +290,7 @@
memset(&sun, 0, sizeof(sun));
sun.sun_family = AF_UNIX;
- strcpy(&sun.sun_path[1], GROUPD_SOCK_PATH);
+ strcpy(&sun.sun_path[1], path);
addrlen = sizeof(sa_family_t) + strlen(sun.sun_path+1) + 1;
rv = connect(fd, (struct sockaddr *) &sun, addrlen);
@@ -292,11 +302,38 @@
return fd;
}
-int do_dump(int argc, char **argv)
+int do_dump(int argc, char **argv, int fd)
{
char inbuf[DUMP_SIZE];
char outbuf[GROUPD_MSGLEN];
- int rv, fd = connect_groupd();
+ int rv;
+
+ memset(inbuf, 0, sizeof(inbuf));
+ memset(outbuf, 0, sizeof(outbuf));
+
+ sprintf(outbuf, "dump");
+
+ rv = write(fd, outbuf, sizeof(outbuf));
+ if (rv != sizeof(outbuf)) {
+ printf("dump write error %d errno %d\n", rv, errno);;
+ return -1;
+ }
+
+ rv = read(fd, inbuf, sizeof(inbuf));
+ if (rv <= 0)
+ printf("dump read returned %d errno %d\n", rv, errno);
+ else
+ write(STDOUT_FILENO, inbuf, rv);
+
+ close(fd);
+ return 0;
+}
+
+int do_gfsdump(int argc, char **argv, int fd)
+{
+ char inbuf[DUMP_SIZE];
+ char outbuf[MAXLINE];
+ int rv;
memset(inbuf, 0, sizeof(inbuf));
memset(outbuf, 0, sizeof(outbuf));
@@ -321,14 +358,29 @@
int main(int argc, char **argv)
{
+ int fd;
+
prog_name = argv[0];
decode_arguments(argc, argv);
switch (operation) {
case OP_LS:
return do_ls(argc, argv);
+
case OP_DUMP:
- return do_dump(argc, argv);
+ if (opt_ind && opt_ind < argc) {
+ if (!strncmp(argv[opt_ind], "gfs", 3)) {
+ fd = connect_daemon(LOCK_DLM_SOCK_PATH);
+ if (fd < 0)
+ return -1;
+ return do_gfsdump(argc, argv, fd);
+ }
+ }
+
+ fd = connect_daemon(GROUPD_SOCK_PATH);
+ if (fd < 0)
+ break;
+ return do_dump(argc, argv, fd);
}
return 0;
^ permalink raw reply [flat|nested] 12+ messages in thread* [Cluster-devel] cluster/group/tool main.c
@ 2006-07-13 18:15 teigland
0 siblings, 0 replies; 12+ messages in thread
From: teigland @ 2006-07-13 18:15 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-07-13 18:15:43
Modified files:
group/tool : main.c
Log message:
fix up group_tool dump which was broken
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&r1=1.15&r2=1.16
--- cluster/group/tool/main.c 2006/06/28 19:58:32 1.15
+++ cluster/group/tool/main.c 2006/07/13 18:15:43 1.16
@@ -20,6 +20,7 @@
#include <stddef.h>
#include <fcntl.h>
#include <string.h>
+#include <errno.h>
#include <netinet/in.h>
#include "libgroup.h"
@@ -293,20 +294,26 @@
int do_dump(int argc, char **argv)
{
- char buf[DUMP_SIZE];
+ char inbuf[DUMP_SIZE];
+ char outbuf[GROUPD_MSGLEN];
int rv, fd = connect_groupd();
- rv = write(fd, "dump", 4);
- if (rv != 4)
- return -1;
+ memset(inbuf, 0, sizeof(inbuf));
+ memset(outbuf, 0, sizeof(outbuf));
- memset(buf, 0, sizeof(buf));
+ sprintf(outbuf, "dump");
- rv = read(fd, buf, sizeof(buf));
- if (rv <= 0)
- return rv;
+ rv = write(fd, outbuf, sizeof(outbuf));
+ if (rv != sizeof(outbuf)) {
+ printf("dump write error %d errno %d\n", rv, errno);;
+ return -1;
+ }
- write(STDOUT_FILENO, buf, rv);
+ rv = read(fd, inbuf, sizeof(inbuf));
+ if (rv <= 0)
+ printf("dump read returned %d errno %d\n", rv, errno);
+ else
+ write(STDOUT_FILENO, inbuf, rv);
close(fd);
return 0;
^ permalink raw reply [flat|nested] 12+ messages in thread* [Cluster-devel] cluster/group/tool main.c
@ 2006-06-28 19:58 teigland
0 siblings, 0 replies; 12+ messages in thread
From: teigland @ 2006-06-28 19:58 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-06-28 19:58:32
Modified files:
group/tool : main.c
Log message:
fix compiler warnings
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&r1=1.14&r2=1.15
--- cluster/group/tool/main.c 2006/03/10 22:13:15 1.14
+++ cluster/group/tool/main.c 2006/06/28 19:58:32 1.15
@@ -35,7 +35,6 @@
static char *prog_name;
static int operation;
static int opt_ind;
-static char *ls_name;
static int verbose;
static void print_usage(void)
@@ -265,14 +264,14 @@
}
printf("]\n");
}
-
+ return 0;
}
static int connect_groupd(void)
{
struct sockaddr_un sun;
socklen_t addrlen;
- int i, rv, fd;
+ int rv, fd;
fd = socket(PF_UNIX, SOCK_STREAM, 0);
if (fd < 0)
@@ -295,7 +294,7 @@
int do_dump(int argc, char **argv)
{
char buf[DUMP_SIZE];
- int i, rv, fd = connect_groupd();
+ int rv, fd = connect_groupd();
rv = write(fd, "dump", 4);
if (rv != 4)
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2006-12-01 15:26 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-01 15:26 [Cluster-devel] cluster/group/tool main.c teigland
-- strict thread matches above, loose matches on Subject: below --
2006-12-01 15:26 teigland
2006-12-01 15:26 teigland
2006-11-20 22:36 rpeterso
2006-11-09 16:23 rpeterso
2006-11-09 16:22 rpeterso
2006-08-14 19:38 teigland
2006-07-31 18:38 teigland
2006-07-25 20:10 teigland
2006-07-14 18:57 teigland
2006-07-13 18:15 teigland
2006-06-28 19:58 teigland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).