home: hub: mkinitfs

Download patch

ref: 6e60376d7096e8d1d74a90a571513a487a188f35
parent: 2aeed4fdf55d94f2fdb08107108a3e79fda1aee9
author: Natanael Copa <ncopa@alpinelinux.org>
date: Fri Oct 9 03:00:44 CDT 2015

nlplug-findfs: allow user to override timeout with -t option

--- a/nlplug-findfs.c
+++ b/nlplug-findfs.c
@@ -37,7 +37,7 @@
 
 #include "arg.h"
 
-#define EVENT_TIMEOUT 2000
+#define DEFAULT_EVENT_TIMEOUT 250
 
 #define FOUND_DEVICE	0x1
 #define FOUND_BOOTREPO	0x2
@@ -87,6 +87,7 @@
 	int fork_count;
 	char *bootrepos;
 	char *apkovls;
+	int timeout;
 };
 
 
@@ -604,6 +605,7 @@
 	" -d              enable debugging ouput\n"
 	" -f SUBSYSTEM    filter subsystem\n"
 	" -p PROGRAM      use PROGRAM as handler for every event with DEVNAME\n"
+	" -t TIMEOUT      timeout after TIMEOUT milliseconds without uevents\n"
 	"\n", argv0);
 
 	exit(rc);
@@ -623,6 +625,7 @@
 
 	memset(&conf, 0, sizeof(conf));
 	conf.program_argv = program_argv;
+	conf.timeout = DEFAULT_EVENT_TIMEOUT;
 	argv0 = strrchr(argv[0], '/');
 	if (argv0++ == NULL)
 		argv0 = argv[0];
@@ -652,6 +655,9 @@
 	case 'p':
 		conf.program_argv[0] = EARGF(usage(1));
 		break;
+	case 't':
+		conf.timeout = atoi(EARGF(usage(1)));
+		break;
 	default:
 		usage(1);
 	} ARGEND;
@@ -669,7 +675,7 @@
 
 	pthread_create(&tid, NULL, trigger_thread, &fds[1].fd);
 
-	while ((r = poll(fds, numfds, EVENT_TIMEOUT)) > 0) {
+	while ((r = poll(fds, numfds, conf.timeout)) > 0) {
 		size_t len;
 		struct iovec iov;
 		char cbuf[CMSG_SPACE(sizeof(struct ucred))];