diff options
Diffstat (limited to 'package/hotplug2/patches/.svn')
7 files changed, 605 insertions, 0 deletions
diff --git a/package/hotplug2/patches/.svn/entries b/package/hotplug2/patches/.svn/entries new file mode 100644 index 0000000..7c324f1 --- /dev/null +++ b/package/hotplug2/patches/.svn/entries @@ -0,0 +1,232 @@ +10 + +dir +36060 +svn://svn.openwrt.org/openwrt/trunk/package/hotplug2/patches +svn://svn.openwrt.org/openwrt + + + +2013-03-03T17:05:05.482112Z +35863 +juhosg + + + + + + + + + + + + + + +3c298f89-4303-0410-b956-a3cf2f4a3e73 + +100-env_memleak.patch +file + + + + +2013-03-17T12:13:21.000000Z +143e755de44bf28ae52666f277a5decb +2010-03-26T14:28:25.844871Z +20462 +juhosg + + + + + + + + + + + + + + + + + + + + + +1469 + +140-worker_fork_fix.patch +file + + + + +2013-03-17T12:13:21.000000Z +53077ddc1a80a0a05b3c10c615e61dbf +2013-03-03T13:56:36.282605Z +35857 +nbd + + + + + + + + + + + + + + + + + + + + + +6479 + +130-cancel_download_fix.patch +file + + + + +2013-03-17T12:13:21.000000Z +d9f895e49237290879e3a19cee3bea59 +2010-04-03T18:29:37.614307Z +20685 +acinonyx + + + + + + + + + + + + + + + + + + + + + +465 + +120-sysfs_path_fix.patch +file + + + + +2013-03-17T12:13:21.000000Z +83bb9f76c4c4de8dc9f41055f2e4e34f +2010-04-03T18:29:37.614307Z +20685 +acinonyx + + + + + + + + + + + + + + + + + + + + + +591 + +170-non_fatal_include.patch +file + + + + +2013-03-17T12:13:21.000000Z +85a0e5eb0c9066c31736c6d7ee205de0 +2013-03-03T17:05:05.482112Z +35863 +juhosg + + + + + + + + + + + + + + + + + + + + + +576 + +110-static_worker.patch +file + + + + +2013-03-17T12:13:21.000000Z +e79c2340ba22792a2cf04df44fe9329a +2010-03-26T14:28:25.844871Z +20462 +juhosg + + + + + + + + + + + + + + + + + + + + + +309 + diff --git a/package/hotplug2/patches/.svn/text-base/100-env_memleak.patch.svn-base b/package/hotplug2/patches/.svn/text-base/100-env_memleak.patch.svn-base new file mode 100644 index 0000000..28a3e25 --- /dev/null +++ b/package/hotplug2/patches/.svn/text-base/100-env_memleak.patch.svn-base @@ -0,0 +1,63 @@ +--- a/action.c ++++ b/action.c +@@ -31,6 +31,30 @@ static void action_dumb(const struct set + } + + /** ++ * Creates a "key=value" string from the given key and value ++ * ++ * @1 Key ++ * @2 Value ++ * ++ * Returns: Newly allocated string in "key=value" form ++ * ++ */ ++static char* alloc_env(const char *key, const char *value) { ++ size_t keylen, vallen; ++ char *combined; ++ ++ keylen = strlen(key); ++ vallen = strlen(value) + 1; ++ ++ combined = xmalloc(keylen + vallen + 1); ++ memcpy(combined, key, keylen); ++ combined[keylen] = '='; ++ memcpy(&combined[keylen + 1], value, vallen); ++ ++ return combined; ++} ++ ++/** + * Choose what action should be taken according to passed settings. + * + * @1 Hotplug settings +@@ -41,16 +65,25 @@ static void action_dumb(const struct set + */ + void action_perform(struct settings_t *settings, struct uevent_t *event) { + int i; ++ char **env; ++ ++ env = xmalloc(sizeof(char *) * event->env_vars_c); ++ ++ for (i = 0; i < event->env_vars_c; i++) { ++ env[i] = alloc_env(event->env_vars[i].key, event->env_vars[i].value); ++ putenv(env[i]); ++ } + +- for (i = 0; i < event->env_vars_c; i++) +- setenv(event->env_vars[i].key, event->env_vars[i].value, 1); +- + if (settings->dumb == 0) { + ruleset_execute(&settings->rules, event, settings); + } else { + action_dumb(settings, event); + } + +- for (i = 0; i < event->env_vars_c; i++) ++ for (i = 0; i < event->env_vars_c; i++) { + unsetenv(event->env_vars[i].key); ++ free(env[i]); ++ } ++ ++ free(env); + } diff --git a/package/hotplug2/patches/.svn/text-base/110-static_worker.patch.svn-base b/package/hotplug2/patches/.svn/text-base/110-static_worker.patch.svn-base new file mode 100644 index 0000000..3a5181f --- /dev/null +++ b/package/hotplug2/patches/.svn/text-base/110-static_worker.patch.svn-base @@ -0,0 +1,20 @@ +--- a/common.mak ++++ b/common.mak +@@ -1,7 +1,7 @@ + # vim:set sw=8 nosta: + + COPTS=-Os -Wall -g +-LDFLAGS=-g -ldl ++LDFLAGS=-g + + CFLAGS=$(COPTS) + FPIC=-fPIC +--- a/Makefile ++++ b/Makefile +@@ -40,5 +40,6 @@ ifdef STATIC_WORKER + CFLAGS += -DSTATIC_WORKER=1 + else + CFLAGS += $(FPIC) ++ LDFLAGS += -ldl + endif + diff --git a/package/hotplug2/patches/.svn/text-base/120-sysfs_path_fix.patch.svn-base b/package/hotplug2/patches/.svn/text-base/120-sysfs_path_fix.patch.svn-base new file mode 100644 index 0000000..0903057 --- /dev/null +++ b/package/hotplug2/patches/.svn/text-base/120-sysfs_path_fix.patch.svn-base @@ -0,0 +1,14 @@ +--- a/rules/command.c ++++ b/rules/command.c +@@ -374,9 +374,9 @@ RULES_COMMAND_F(cmd_firmware) { + if (firmware == NULL) + return -1; + +- if (snprintf(sysfs_path_loading, PATH_MAX, "/sysfs%s/loading", devpath) >= PATH_MAX) ++ if (snprintf(sysfs_path_loading, PATH_MAX, "/sys%s/loading", devpath) >= PATH_MAX) + return -1; +- if (snprintf(sysfs_path_data, PATH_MAX, "/sysfs%s/data", devpath) >= PATH_MAX) ++ if (snprintf(sysfs_path_data, PATH_MAX, "/sys%s/data", devpath) >= PATH_MAX) + return -1; + if (snprintf(firmware_path, PATH_MAX, "%s/%s", argv[0], firmware) >= PATH_MAX) + return -1; diff --git a/package/hotplug2/patches/.svn/text-base/130-cancel_download_fix.patch.svn-base b/package/hotplug2/patches/.svn/text-base/130-cancel_download_fix.patch.svn-base new file mode 100644 index 0000000..c94000d --- /dev/null +++ b/package/hotplug2/patches/.svn/text-base/130-cancel_download_fix.patch.svn-base @@ -0,0 +1,18 @@ +--- a/rules/command.c ++++ b/rules/command.c +@@ -385,13 +385,13 @@ RULES_COMMAND_F(cmd_firmware) { + + infp = fopen(firmware_path, "r"); + if (infp == NULL) { +- echo_to_file(sysfs_path_loading, "0\n", 2); ++ echo_to_file(sysfs_path_loading, "-1\n", 2); + return -1; + } + outfp = fopen(sysfs_path_data, "w"); + if (outfp == NULL) { + fclose(infp); +- echo_to_file(sysfs_path_loading, "0\n", 2); ++ echo_to_file(sysfs_path_loading, "-1\n", 2); + return -1; + } + diff --git a/package/hotplug2/patches/.svn/text-base/140-worker_fork_fix.patch.svn-base b/package/hotplug2/patches/.svn/text-base/140-worker_fork_fix.patch.svn-base new file mode 100644 index 0000000..5e288ae --- /dev/null +++ b/package/hotplug2/patches/.svn/text-base/140-worker_fork_fix.patch.svn-base @@ -0,0 +1,237 @@ +--- a/action.c ++++ b/action.c +@@ -39,7 +39,7 @@ static void action_dumb(const struct set + * Returns: Newly allocated string in "key=value" form + * + */ +-static char* alloc_env(const char *key, const char *value) { ++char* alloc_env(const char *key, const char *value) { + size_t keylen, vallen; + char *combined; + +--- a/action.h ++++ b/action.h +@@ -12,5 +12,6 @@ + #include "settings.h" + + void action_perform(struct settings_t *, struct uevent_t *); ++char* alloc_env(const char *, const char *); + #endif /* ifndef ACTION_H */ + +--- a/workers/worker_fork.c ++++ b/workers/worker_fork.c +@@ -1,6 +1,69 @@ + #include "worker_fork.h" + + static struct worker_fork_ctx_t *global_ctx; ++static struct worker_fork_uevent_t *uevent_list; ++ ++static void worker_fork_uevent_free(struct worker_fork_uevent_t *node) { ++ uevent_free(node->uevent); ++ free(node); ++} ++ ++static void worker_fork_uevent_add(void *in_ctx, struct uevent_t *uevent) { ++ char **env; ++ int i; ++ struct worker_fork_ctx_t *ctx = in_ctx; ++ struct worker_fork_uevent_t *node, *walker; ++ ++ node = malloc(sizeof (struct worker_fork_uevent_t)); ++ node->uevent = uevent_dup(uevent); ++ node->next = NULL; ++ ++ if (!uevent_list) uevent_list = node; ++ else { ++ /* ++ * Put events that need to fork first and in reverse order ++ */ ++ env = xmalloc(sizeof(char *) * node->uevent->env_vars_c); ++ for (i = 0; i < node->uevent->env_vars_c; i++) { ++ env[i] = alloc_env(node->uevent->env_vars[i].key, node->uevent->env_vars[i].value); ++ putenv(env[i]); ++ } ++ if (ruleset_flags(&ctx->settings->rules, uevent) & FLAG_SLOW) { ++ node->next = uevent_list; ++ uevent_list = node; ++ } ++ else { ++ for (walker = uevent_list; walker->next; walker = walker->next); ++ walker->next = node; ++ } ++ for (i = 0; i < node->uevent->env_vars_c; i++) { ++ unsetenv(node->uevent->env_vars[i].key); ++ free(env[i]); ++ } ++ free(env); ++ } ++} ++ ++static void worker_fork_uevent_del(struct worker_fork_uevent_t *node) { ++ struct worker_fork_uevent_t *walker; ++ ++ if (node == uevent_list) { ++ uevent_list = node->next; ++ } ++ else { ++ for (walker = uevent_list; walker->next; walker = walker->next) ++ if (walker->next == node) walker->next = node->next; ++ } ++ worker_fork_uevent_free(node); ++} ++ ++static void worker_fork_uevent_empty(void) { ++ struct worker_fork_uevent_t *walker; ++ ++ if (!uevent_list) return; ++ for (walker = uevent_list; walker->next; walker = walker->next) worker_fork_uevent_free(walker); ++ uevent_list = NULL; ++} + + /** + * Destroys data structures related to the given child ID (not PID). +@@ -315,6 +378,8 @@ static void *worker_fork_init(struct set + struct worker_fork_ctx_t *ctx; + PRINTFUNC(); + ++ uevent_list = NULL; ++ + ctx = malloc(sizeof(struct worker_fork_ctx_t)); + ctx->children = NULL; + ctx->children_count = 0; +@@ -376,26 +441,39 @@ static void worker_fork_deinit(void *in_ + free(ctx->children); + free(ctx); + global_ctx = NULL; ++ worker_fork_uevent_empty(); + } + + + static int worker_fork_process(void *in_ctx, struct uevent_t *uevent) { ++ char **env; + int i; + struct worker_fork_child_t *child; + struct worker_fork_ctx_t *ctx = in_ctx; ++ struct worker_fork_uevent_t *node, *walker; ++ event_seqnum_t seqnum; ++ ++ worker_fork_uevent_add(ctx, uevent); ++ walker = uevent_list; + + /* +- * A big loop, because if we fail to process the event, ++ * A big loop, because if we fail to process the events, + * we don't want to give up. + * + * TODO: Decide if we want to limit the number of attempts + * or set a time limit before reporting terminal failure. + */ + do { ++ /* ++ * If more events are waiting, return to receive them ++ */ ++ if (!seqnum_get(&seqnum) && seqnum > uevent->seqnum) break; ++ ++ node = walker; + worker_fork_update_children(ctx); + + child = NULL; +- for (i = 0; i < ctx->children_count; i++) { ++ for (i = 0; i < ctx->children_count && i < ctx->max_children; i++) { + if (ctx->children[i]->busy == 0) { + child = ctx->children[i]; + break; +@@ -406,21 +484,40 @@ static int worker_fork_process(void *in_ + * No child process is currently available. + */ + if (child == NULL) { ++ bool is_slow; ++ ++ env = xmalloc(sizeof(char *) * node->uevent->env_vars_c); ++ for (i = 0; i < node->uevent->env_vars_c; i++) { ++ env[i] = alloc_env(node->uevent->env_vars[i].key, node->uevent->env_vars[i].value); ++ putenv(env[i]); ++ } ++ ++ is_slow = !!(ruleset_flags(&ctx->settings->rules, node->uevent) & FLAG_MASK_SLOW); ++ ++ for (i = 0; i < node->uevent->env_vars_c; i++) { ++ unsetenv(node->uevent->env_vars[i].key); ++ free(env[i]); ++ } ++ free(env); ++ + /* + * Are the matching rules trivial enough that we + * can execute them in the main process? + */ +- if (ctx->always_fork == 0 && ctx->settings->dumb == 0 && +- (ruleset_flags(&ctx->settings->rules, uevent) & FLAG_MASK_SLOW) == 0) { +- action_perform(ctx->settings, uevent); ++ if (ctx->always_fork == 0 && ctx->settings->dumb == 0 && !is_slow) { ++ action_perform(ctx->settings, node->uevent); ++ walker = walker->next; ++ worker_fork_uevent_del(node); ++ if (walker) continue; + break; + } +- ++ + /* + * We have to fork off a new child. + */ + if (ctx->children_count < ctx->max_children) + child = worker_fork_spawn(ctx); ++ + } + + /* +@@ -428,9 +525,14 @@ static int worker_fork_process(void *in_ + */ + if (child != NULL) { + child->busy = 1; +- if (!worker_fork_relay_event(child->event_fd, uevent)); +- break; +- child->busy = 0; ++ if (worker_fork_relay_event(child->event_fd, node->uevent)) { ++ child->busy = 0; ++ continue; ++ } ++ walker = walker->next; ++ worker_fork_uevent_del(node); ++ if (walker) continue; ++ break; + } + + /* +--- a/uevent.c ++++ b/uevent.c +@@ -132,6 +132,8 @@ struct uevent_t *uevent_dup(const struct + + dest = xmalloc(sizeof(struct uevent_t)); + dest->action = src->action; ++ dest->seqnum = src->seqnum; ++ dest->action_str = strdup(src->action_str); + dest->env_vars_c = src->env_vars_c; + dest->env_vars = xmalloc(sizeof(struct env_var_t) * dest->env_vars_c); + dest->plain_s = src->plain_s; +--- a/workers/worker_fork.h ++++ b/workers/worker_fork.h +@@ -5,6 +5,7 @@ + #include <sys/types.h> + #include <sys/select.h> + #include <unistd.h> ++#include <stdbool.h> + + #include "../rules/execution.h" + +@@ -35,4 +36,9 @@ struct worker_fork_ctx_t { + struct settings_t *settings; + }; + ++struct worker_fork_uevent_t { ++ struct uevent_t *uevent; ++ struct worker_fork_uevent_t *next; ++}; ++ + #endif diff --git a/package/hotplug2/patches/.svn/text-base/170-non_fatal_include.patch.svn-base b/package/hotplug2/patches/.svn/text-base/170-non_fatal_include.patch.svn-base new file mode 100644 index 0000000..0b8e852 --- /dev/null +++ b/package/hotplug2/patches/.svn/text-base/170-non_fatal_include.patch.svn-base @@ -0,0 +1,21 @@ +Index: hotplug2-201/parser/parser.c +=================================================================== +--- hotplug2-201.orig/parser/parser.c 2009-12-09 19:44:13.000000000 +0100 ++++ hotplug2-201/parser/parser.c 2011-02-08 18:06:44.681213713 +0100 +@@ -1,5 +1,7 @@ + #include "parser.h" + ++#include <errno.h> ++ + /* + * Grammar: + * input => directive // TOKEN_ROOTKW +@@ -578,7 +580,7 @@ + ctx.lexer.fp = fopen(filename, "r"); + if (ctx.lexer.fp == NULL) { + parser_clear(&ctx); +- return -1; ++ return (errno == ENOENT) ? 0 : -1; + } + ctx.lexer.filename = strdup(filename); + |