1 Index: linuxdoc/distcc.sgml
2 --- linuxdoc/distcc.sgml 28 Mar 2003 06:33:09 -0000 1.103
3 +++ linuxdoc/distcc.sgml 2 Apr 2003 02:42:26 -0000
5 volunteer machines are available to run jobs. This is a
6 space-separated list of host specifications, each of which
8 -<tscreen><verb>HOSTNAME[/MAX_JOBS][:PORT]</verb></tscreen>
11 - You can specify the maximum number of jobs that the host
12 - should receive by affixing a number after a slash (e.g.
14 +<tscreen><verb>HOSTNAME[:PORT][,OPT...]</verb></tscreen>
17 A numeric TCP port may optionally be specified after a
18 colon. If no port is specified, it uses the default, which
22 + You can specify one or more host-specific options at the end of the
23 + host-spec by appending each one after a comma. The current option
24 + is slots=N (abbreviated as just N, if desired).
25 + The "slots" option specifies the maximum number of jobs that the
26 + associated host should be given simultaneously (e.g. "localhost,2").
29 If only one invocation of distcc runs at a time, it will
31 --- src/distcc.c 31 Mar 2003 08:17:26 -0000 1.166
32 +++ src/distcc.c 2 Apr 2003 02:42:26 -0000
35 "Host specifications:\n"
36 " localhost run in place\n"
37 -" HOST TCP connection, port %d\n"
38 -" HOST:PORT TCP connection, specified port\n"
39 +" HOST[:PORT][,OPT...] TCP connection (default port=%d)\n"
42 +" slots=N Maximum of N simultaneous jobs allowed\n"
43 +" N Abbreviation of the slots=N option\n"
45 +"Hostname examples:\n"
46 +" foo foo:4242 foo,4 bar:4100,2 bar,slots=3\n"
48 "distcc distributes compilation jobs across volunteer machines running\n"
49 "distccd. Jobs that cannot be distributed, such as linking or \n"
51 --- src/hosts.c 31 Mar 2003 07:42:28 -0000 1.29
52 +++ src/hosts.c 2 Apr 2003 02:42:27 -0000
57 -static int dcc_parse_multiplier(const char **psrc, struct dcc_hostdef *hostdef)
58 +static int dcc_parse_options(const char **psrc, struct dcc_hostdef *hostdef)
61 - const char *token = *psrc;
66 - if ((*psrc)[0] == '/') {
68 - if ((ret = dcc_dup_part(psrc, &mul, "/: \t\n\f")) != 0)
69 + while ((*psrc)[0] == ',') {
71 + if ((ret = dcc_dup_part(psrc, &opt, ", \t\n\f")) != 0)
73 - if (!mul || atoi(mul) == 0) {
74 - rs_log_error("bad multiplier \"%s\" in host specification", token);
76 + if ((arg = strchr(opt, '=')) != NULL)
78 + else if (isdigit(*opt)) {
88 + rs_log_error("malformed option in host specification: \"%s\"", token);
89 + return EXIT_BAD_HOSTSPEC;
91 + if (!opt || strcmp(opt, "slots") == 0) {
92 + hostdef->n_slots = atoi(arg);
93 + if (hostdef->n_slots <= 0) {
94 + rs_log_error("invalid number of slots in host specification: \"%s\"", token);
95 + return EXIT_BAD_HOSTSPEC;
99 + rs_log_error("unknown option in host specification: \"%s\"", token);
100 return EXIT_BAD_HOSTSPEC;
102 - hostdef->n_slots = atoi(mul);
107 assert(token[0] == '@');
110 - if ((ret = dcc_dup_part(&token, &hostdef->hostname, "/: \t\n\f")) != 0)
111 + if ((ret = dcc_dup_part(&token, &hostdef->hostname, ",: \t\n\f")) != 0)
114 if (!hostdef->hostname) {
115 @@ -198,15 +220,15 @@
116 return EXIT_BAD_HOSTSPEC;
119 - if ((ret = dcc_parse_multiplier(&token, hostdef)) != 0)
122 if (token[0] == ':') {
124 - if ((ret = dcc_dup_part(&token, &hostdef->ssh_command, " \t\n\f")) != 0)
125 + if ((ret = dcc_dup_part(&token, &hostdef->ssh_command, ", \t\n\f")) != 0)
130 + if ((ret = dcc_parse_options(&token, hostdef)) != 0)
133 hostdef->mode = DCC_MODE_SSH;
138 const char *token = token_start;
140 - if ((ret = dcc_dup_part(&token, &hostdef->hostname, "/: \t\n\f")) != 0)
141 + if ((ret = dcc_dup_part(&token, &hostdef->hostname, ",: \t\n\f")) != 0)
144 if (!hostdef->hostname) {
145 @@ -228,14 +250,11 @@
146 return EXIT_BAD_HOSTSPEC;
149 - if ((ret = dcc_parse_multiplier(&token, hostdef)) != 0)
152 hostdef->port = dcc_default_port;
153 if (token[0] == ':') {
156 - if ((ret = dcc_dup_part(&token, &port_str, " \t\n\f")) != 0)
157 + if ((ret = dcc_dup_part(&token, &port_str, ", \t\n\f")) != 0)
167 + if ((ret = dcc_parse_options(&token, hostdef)) != 0)
170 hostdef->mode = DCC_MODE_TCP;
173 @@ -257,13 +279,13 @@
174 static int dcc_parse_localhost(struct dcc_hostdef *hostdef,
175 const char * token_start)
177 - const char *token = token_start + strlen("localhost");
178 + const char *token = token_start + (sizeof "localhost") - 1;
180 hostdef->mode = DCC_MODE_LOCAL;
181 hostdef->hostname = strdup("localhost");
182 hostdef->n_slots = 1;
184 - return dcc_parse_multiplier(&token, hostdef);
185 + return dcc_parse_options(&token, hostdef);
190 * definition. We then duplicate the relevant subcomponents into
191 * the relevant fields. */
194 + unsigned int token_len;
195 const char *token_start;
199 has_at = (memchr(token_start, '@', token_len) != NULL);
200 /* TODO: Call a separate function to split each type up, then
201 * link the result into the list. */
202 - if (!strncmp(token_start, "localhost", token_len)
203 - || !strncmp(token_start, "localhost/", strlen("localhost/"))) {
204 + if (token_len >= (sizeof "localhost")-1
205 + && strncmp(token_start, "localhost", (sizeof "localhost")-1) == 0
206 + && (token_len == (sizeof "localhost")-1
207 + || token_start[(sizeof "localhost")-1] == ',')) {
208 if ((ret = dcc_parse_localhost(curr, token_start)) != 0)