summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2015-01-22 18:21:26 +0100
committerAndrew Gregory <andrew.gregory.8@gmail.com>2017-05-11 06:45:30 +0200
commit286ff380575699e743f4b595fb020cb37b7d5e8c (patch)
tree5e94aa7b33b7aba005c5f30191fca79d484d83fe /src
parenta391c54eb3df2d8de32c6ce4d5e2b05c46dbf487 (diff)
downloadpacman-286ff380575699e743f4b595fb020cb37b7d5e8c.tar.gz
pacman-286ff380575699e743f4b595fb020cb37b7d5e8c.tar.xz
add threads option
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/conf.c20
-rw-r--r--src/pacman/conf.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index a283d7f4..59c38696 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -606,6 +606,26 @@ static int _parse_options(const char *key, char *value,
return 1;
}
FREELIST(values);
+ } else if(strcmp(key, "Threads") == 0) {
+ unsigned long threads;
+ char *endptr;
+
+ if(!(alpm_capabilities() & ALPM_CAPABILITY_THREADS)) {
+ pm_printf(ALPM_LOG_ERROR,
+ _("config file %s, line %d: '%s' option invalid, no thread support\n"),
+ file, linenum, "Threads");
+ return 1;
+ }
+
+ threads = strtoul(value, &endptr, 10);
+ if(*endptr != '\0' || threads < 0) {
+ pm_printf(ALPM_LOG_ERROR,
+ _("config file %s, line %d: invalid value for '%s' : '%s'\n"),
+ file, linenum, "Threads", value);
+ return 1;
+ }
+ config->threads = threads;
+ pm_printf(ALPM_LOG_DEBUG, "config: Threads = %f\n", threads);
} else {
pm_printf(ALPM_LOG_WARNING,
_("config file %s, line %d: directive '%s' in section '%s' not recognized.\n"),
diff --git a/src/pacman/conf.h b/src/pacman/conf.h
index 53b44be6..23cb1e52 100644
--- a/src/pacman/conf.h
+++ b/src/pacman/conf.h
@@ -126,6 +126,7 @@ typedef struct __config_t {
alpm_list_t *noextract;
alpm_list_t *overwrite_files;
char *xfercommand;
+ unsigned int threads;
/* our connection to libalpm */
alpm_handle_t *handle;