X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=plug%2Fhotplug.c;h=c8bea1b75b958284968fd6663a8fcb0c9a9fab2a;hb=HEAD;hp=9aeb1c17dc7fd97d3532177b0efc7faa99ec162e;hpb=7f12c89d0b99a2f04e91b2327e74c049f6362b67;p=project%2Fprocd.git diff --git a/plug/hotplug.c b/plug/hotplug.c index 9aeb1c1..53f3383 100644 --- a/plug/hotplug.c +++ b/plug/hotplug.c @@ -231,7 +231,7 @@ static void handle_firmware(struct blob_attr *msg, struct blob_attr *data) int fw, src, load, len; static char buf[4096]; - DEBUG(2, "Firmware request for %s/%s\n", dir, file); + P_DEBUG(2, "Firmware request for %s/%s\n", dir, file); if (!file || !dir || !dev) { ERROR("Request for unknown firmware %s/%s\n", dir, file); @@ -296,7 +296,7 @@ send_to_kernel: ERROR("failed to write to %s: %m\n", loadpath); close(load); - DEBUG(2, "Done loading %s\n", path); + P_DEBUG(2, "Done loading %s\n", path); exit(EXIT_FAILURE); } @@ -305,12 +305,12 @@ static void handle_start_console(struct blob_attr *msg, struct blob_attr *data) { char *dev = blobmsg_get_string(blobmsg_data(data)); - DEBUG(2, "Start console request for %s\n", dev); + P_DEBUG(2, "Start console request for %s\n", dev); procd_inittab_run("respawn"); procd_inittab_run("askfirst"); - DEBUG(2, "Done starting console for %s\n", dev); + P_DEBUG(2, "Done starting console for %s\n", dev); exit(EXIT_FAILURE); } @@ -390,12 +390,12 @@ static void queue_next(void) uloop_process_add(&queue_proc); - DEBUG(4, "Launched hotplug exec instance, pid=%d\n", (int) queue_proc.pid); + P_DEBUG(4, "Launched hotplug exec instance, pid=%d\n", (int) queue_proc.pid); } static void queue_proc_cb(struct uloop_process *c, int ret) { - DEBUG(4, "Finished hotplug exec instance, pid=%d\n", (int) c->pid); + P_DEBUG(4, "Finished hotplug exec instance, pid=%d\n", (int) c->pid); if (current) { current->complete(current->msg, current->data, ret); @@ -513,13 +513,13 @@ static void rule_handle_command(struct json_script_ctx *ctx, const char *name, int rem, i; if (debug > 3) { - DEBUG(4, "Command: %s\n", name); + P_DEBUG(4, "Command: %s\n", name); blobmsg_for_each_attr(cur, data, rem) - DEBUG(4, " %s\n", (char *) blobmsg_data(cur)); + P_DEBUG(4, " %s\n", (char *) blobmsg_data(cur)); - DEBUG(4, "Message:\n"); + P_DEBUG(4, "Message:\n"); blobmsg_for_each_attr(cur, vars, rem) - DEBUG(4, " %s=%s\n", blobmsg_name(cur), (char *) blobmsg_data(cur)); + P_DEBUG(4, " %s=%s\n", blobmsg_name(cur), (char *) blobmsg_data(cur)); } for (i = 0; i < ARRAY_SIZE(handlers); i++) @@ -560,7 +560,7 @@ static void hotplug_handler_debug(struct blob_attr *data) return; str = blobmsg_format_json(data, true); - DEBUG(3, "%s\n", str); + P_DEBUG(3, "%s\n", str); free(str); } @@ -612,7 +612,7 @@ void hotplug(char *rules) rule_file = strdup(rules); nls.nl_family = AF_NETLINK; - nls.nl_pid = getpid(); + nls.nl_pid = 0; nls.nl_groups = -1; if ((hotplug_fd.fd = socket(PF_NETLINK, SOCK_DGRAM | SOCK_CLOEXEC, NETLINK_KOBJECT_UEVENT)) == -1) {