From: Steven Barth Date: Wed, 11 Jun 2014 13:23:39 +0000 (+0200) Subject: Increase buffers for hotplug and cmdline for UML X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=61e88ee49ade4fd8014bb11ca3166d93274c50e8;p=oweals%2Fprocd.git Increase buffers for hotplug and cmdline for UML Thanks to Markus Stenberg for debugging and testing. Signed-off-by: Steven Barth --- diff --git a/initd/init.c b/initd/init.c index 7621b30..153b3c2 100644 --- a/initd/init.c +++ b/initd/init.c @@ -53,7 +53,7 @@ static struct sigaction sa_shutdown = { static void cmdline(void) { - char line[256]; + char line[1024]; int r, fd = open("/proc/cmdline", O_RDONLY); regex_t pat_cmdline; regmatch_t matches[2]; diff --git a/plug/hotplug.c b/plug/hotplug.c index 07abaf8..075062b 100644 --- a/plug/hotplug.c +++ b/plug/hotplug.c @@ -453,6 +453,7 @@ void hotplug_last_event(uloop_timeout_handler handler) void hotplug(char *rules) { struct sockaddr_nl nls; + int nlbufsize = 512 * 1024; rule_file = strdup(rules); memset(&nls,0,sizeof(struct sockaddr_nl)); @@ -469,6 +470,11 @@ void hotplug(char *rules) exit(1); } + if (setsockopt(hotplug_fd.fd, SOL_SOCKET, SO_RCVBUFFORCE, &nlbufsize, sizeof(nlbufsize))) { + ERROR("Failed to resize receive buffer: %s\n", strerror(errno)); + exit(1); + } + json_script_init(&jctx); queue_proc.cb = queue_proc_cb; uloop_fd_add(&hotplug_fd, ULOOP_READ);