Increase buffers for hotplug and cmdline for UML
authorSteven Barth <steven@midlink.org>
Wed, 11 Jun 2014 13:23:39 +0000 (15:23 +0200)
committerSteven Barth <steven@midlink.org>
Wed, 11 Jun 2014 13:23:39 +0000 (15:23 +0200)
Thanks to Markus Stenberg for debugging and testing.

Signed-off-by: Steven Barth <steven@midlink.org>
initd/init.c
plug/hotplug.c

index 7621b3078913261bab03b488cb40a9b0ba08d96a..153b3c2d8efd21e5290d31ef7fc330a3da66f755 100644 (file)
@@ -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];
index 07abaf8ac8b651d960b23587d42a6b9b48f3d16c..075062b5dc023899d72c9a7a1bf73824f278c4ed 100644 (file)
@@ -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);