summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Björklund <anders.f.bjorklund@gmail.com>2018-02-27 16:42:19 +0100
committerShawn Landden <slandden@gmail.com>2018-02-27 07:42:19 -0800
commit2488c28d7f08bdfe3ad558f321d383d633a55699 (patch)
tree7da33b32b78fd29be23ff64bde35e55b82e775c3
parentd3e06745d62119095a2e03be2e228ad32919c891 (diff)
downloaddistcc-git-2488c28d7f08bdfe3ad558f321d383d633a55699.tar.gz
Localslots with gcc -E (#161)
* Make sure to read localslots for running locally Currently the --localslots are only read when distributing, not when running locally. Make sure to always parse the hosts configuration, for --localslots and --localslots_cpp settings. * Use --localslots_cpp from $DISTCC_HOSTS for gcc -E We want to use --localslots_cpp for running gcc -E, so use a special exit code to signal this to the local run. * Fix documentation, there's only 8 slots and not 16
-rw-r--r--man/distcc.17
-rw-r--r--src/arg.c2
-rw-r--r--src/compile.c7
-rw-r--r--src/exitcode.h7
-rw-r--r--src/where.c16
-rw-r--r--src/where.h1
6 files changed, 32 insertions, 8 deletions
diff --git a/man/distcc.1 b/man/distcc.1
index fb93615..eb5bd49 100644
--- a/man/distcc.1
+++ b/man/distcc.1
@@ -77,12 +77,12 @@ For example, concurrent linking should be severely curtailed using auxiliary
locks. The effect of other build activity, such as Java compilation when
building mixed code, should be considered. The
.B --localslots_cpp
-parameter is by default set to 16.
+parameter is by default set to 8.
This limits the number of concurrent processes that do preprocessing in
plain distcc (non-pump) mode.
Therefore, larger
.B -j
-values than 16 may be used without overloading a single-CPU
+values than 8 may be used without overloading a single-CPU
client due to preprocessing. Such large values may speed up parts of the build
that do not involve C compilations, but they may not be useful to distcc
efficiency in plain mode.
@@ -733,6 +733,9 @@ Timeout.
.TP
119
GSS-API - Catchall error code for GSS-API related errors.
+.TP
+120
+Called for preprocessing, which needs to be done locally.
.SH "FILES"
If $DISTCC_HOSTS is not set, distcc reads a host list from either
diff --git a/src/arg.c b/src/arg.c
index cd82bf0..8edd9ba 100644
--- a/src/arg.c
+++ b/src/arg.c
@@ -158,7 +158,7 @@ int dcc_scan_args(char *argv[], char **input_file, char **output_file,
if (a[0] == '-') {
if (!strcmp(a, "-E")) {
rs_trace("-E call for cpp must be local");
- return EXIT_DISTCC_FAILED;
+ return EXIT_LOCAL_CPP;
} else if (!strcmp(a, "-MD") || !strcmp(a, "-MMD")) {
/* These two generate dependencies as a side effect. They
* should work with the way we call cpp. */
diff --git a/src/compile.c b/src/compile.c
index b1d2fd9..3dc5a75 100644
--- a/src/compile.c
+++ b/src/compile.c
@@ -921,7 +921,12 @@ dcc_build_somewhere(char *argv[],
}
lock_local:
- dcc_lock_local(&cpu_lock_fd);
+ dcc_read_localslots_configuration();
+ if (ret == EXIT_LOCAL_CPP) {
+ dcc_lock_local_cpp(&local_cpu_lock_fd);
+ } else {
+ dcc_lock_local(&cpu_lock_fd);
+ }
run_local:
/* Either compile locally, after remote failure, or simply do other cc tasks
diff --git a/src/exitcode.h b/src/exitcode.h
index dde0810..0313a6f 100644
--- a/src/exitcode.h
+++ b/src/exitcode.h
@@ -59,12 +59,11 @@ enum dcc_exitcode {
EXIT_NO_SUCH_FILE = 115,
EXIT_NO_HOSTS = 116,
EXIT_GONE = 117, /**< No longer relevant */
-#ifdef HAVE_GSSAPI
EXIT_TIMEOUT = 118,
- EXIT_GSSAPI_FAILED = 119 /**< GSS-API - Catchall error code for GSS-API related errors. */
-#else
- EXIT_TIMEOUT = 118
+#ifdef HAVE_GSSAPI
+ EXIT_GSSAPI_FAILED = 119, /**< GSS-API - Catchall error code for GSS-API related errors. */
#endif
+ EXIT_LOCAL_CPP = 120
};
diff --git a/src/where.c b/src/where.c
index 2071de6..e279f00 100644
--- a/src/where.c
+++ b/src/where.c
@@ -83,6 +83,22 @@ static int dcc_lock_one(struct dcc_hostdef *hostlist,
int *cpu_lock_fd);
+void dcc_read_localslots_configuration()
+{
+ struct dcc_hostdef *hostlist;
+ int ret;
+ int n_hosts;
+
+ if ((ret = dcc_get_hostlist(&hostlist, &n_hosts)) == 0) {
+ while (hostlist) {
+ struct dcc_hostdef *l = hostlist;
+ hostlist = hostlist->next;
+ dcc_free_hostdef(l);
+ }
+ }
+}
+
+
int dcc_pick_host_from_list_and_lock_it(struct dcc_hostdef **buildhost,
int *cpu_lock_fd)
{
diff --git a/src/where.h b/src/where.h
index 4969a7c..acce220 100644
--- a/src/where.h
+++ b/src/where.h
@@ -22,6 +22,7 @@
*/
/* where.c */
+void dcc_read_localslots_configuration(void);
int dcc_pick_host_from_list_and_lock_it(struct dcc_hostdef **,
int *cpu_lock_fd);