runsvdir: shrink

Denys Vlasenko vda.linux at googlemail.com
Sat Sep 20 17:08:59 UTC 2008


On Friday 19 September 2008 18:41, dronnikov at gmail.com wrote:
> The patch provides:
> 
> * drifted to linked list to hold services: -100 bytes.

But this is likely to require more memory at runtime?

+			service_t *sv = malloc(sizeof(service_t));
+			memset(sv, 0, sizeof(service_t));
+			if (!sv) {

if sv == NULL, this will segfault.

> * runsvdir used to periodically log timestamps. Now it is made FEATUREd: another -500 bytes if not used.

Yes, stupid feature (and not well documented too)

> Please, consider applying.

Can you split it into two patches, with logging FEATUREd first?


-	struct pollfd pfd[1];
+	struct pollfd pfd;

I like the former variant. Since poll takes a vector of pfd's,
it makes sense to give it a one-elment vector. This way,
if you will ever need to add another fd to block on,
you won't need to edit many places
with s/pfd./pfd->/ and s/&pfd/pfd/.

--
vda



More information about the busybox mailing list