From: teigland@sourceware.org <teigland@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/group/gfs_controld main.c
Date: 6 Oct 2006 14:43:59 -0000 [thread overview]
Message-ID: <20061006144359.10114.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-10-06 14:43:59
Modified files:
group/gfs_controld: main.c
Log message:
make the number of clients a global variable so it will be easier
to add clients later
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/main.c.diff?cvsroot=cluster&r1=1.14&r2=1.15
--- cluster/group/gfs_controld/main.c 2006/09/08 22:44:33 1.14
+++ cluster/group/gfs_controld/main.c 2006/10/06 14:43:58 1.15
@@ -20,6 +20,7 @@
char type[32];
};
+static int client_maxi;
static int client_size = 0;
static struct client *client = NULL;
static struct pollfd *pollfd = NULL;
@@ -107,7 +108,7 @@
return rp;
}
-static int client_add(int fd, int *maxi)
+static int client_add(int fd)
{
int i;
@@ -118,8 +119,8 @@
client[i].fd = fd;
pollfd[i].fd = fd;
pollfd[i].events = POLLIN;
- if (i > *maxi)
- *maxi = i;
+ if (i > client_maxi)
+ client_maxi = i;
return i;
}
}
@@ -380,42 +381,42 @@
int loop(void)
{
- int rv, i, f, maxi = 0;
+ int rv, i, f;
rv = listen_fd = setup_listen();
if (rv < 0)
goto out;
- client_add(listen_fd, &maxi);
+ client_add(listen_fd);
rv = cman_fd = setup_cman();
if (rv < 0)
goto out;
- client_add(cman_fd, &maxi);
+ client_add(cman_fd);
rv = cpg_fd = setup_cpg();
if (rv < 0)
goto out;
- client_add(cpg_fd, &maxi);
+ client_add(cpg_fd);
rv = groupd_fd = setup_groupd();
if (rv < 0)
goto out;
- client_add(groupd_fd, &maxi);
+ client_add(groupd_fd);
rv = uevent_fd = setup_uevent();
if (rv < 0)
goto out;
- client_add(uevent_fd, &maxi);
+ client_add(uevent_fd);
rv = plocks_fd = setup_plocks();
if (rv < 0)
goto out;
- client_add(plocks_fd, &maxi);
+ client_add(plocks_fd);
log_debug("setup done");
for (;;) {
- rv = poll(pollfd, maxi + 1, -1);
+ rv = poll(pollfd, client_maxi + 1, -1);
if (rv < 0)
log_error("poll error %d errno %d", rv, errno);
@@ -426,10 +427,10 @@
if (f < 0)
log_debug("accept error %d %d", f, errno);
else
- client_add(f, &maxi);
+ client_add(f);
}
- for (i = 1; i <= maxi; i++) {
+ for (i = 1; i <= client_maxi; i++) {
if (client[i].fd < 0)
continue;
next reply other threads:[~2006-10-06 14:43 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-06 14:43 teigland [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-12-05 17:26 [Cluster-devel] cluster/group/gfs_controld main.c teigland
2006-12-05 17:26 teigland
2006-12-05 16:59 teigland
2006-12-01 15:29 teigland
2006-12-01 15:29 teigland
2006-12-01 15:28 teigland
2006-11-28 20:52 teigland
2006-11-28 20:52 teigland
2006-11-28 20:52 teigland
2006-11-27 22:43 teigland
2006-11-27 22:43 teigland
2006-11-27 22:42 teigland
2006-11-15 14:32 teigland
2006-11-14 21:06 teigland
2006-11-14 20:37 teigland
2006-10-20 19:32 teigland
2006-08-31 18:46 teigland
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=20061006144359.10114.qmail@sourceware.org \
--to=teigland@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 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).