Well, I've poked at this a little this evening.

See
https://github.com/idunham/busybox
(in branch mdev) if you're curious about details.

 Hi Isaac,
 Nice job!

 A few comments:

 - Original mdev relies on getenv/putenv to handle environment
variables; that's okay, because it's a short-lived program.
But mdev -i is a long-lived program, so using and modifying its
own environment for every event is conceptually unsatisfying, and
ends up in a lot of unnecessary malloc/free/reallocs. It would be
faster and more memory-efficient to allow handle_event to work with
the raw string containing the VAR=VALUE\0 pairs.
 I realize it may require modifying all the getenv() invocations in
the rest of mdev, but I believe it's worth it. (Heavy getenv()
usage in mdev was one of the parts that made me postpone my plans of
modifying it myself...)

 - Why do you need to memset practically the whole buffer every
poll() iteration ? You know where you read and how many bytes you
read, it should be possible to be unaffected by irrelevant data in
the part of the buffer you're not using.
(It would also be nicer to have real circular buffer management,
but that's a lot of code, with struct iovecs and such; not sure if
it's worth, considering very few busybox applets would benefit from
it.)

 Thanks for getting to the dirty work, I really appreciate it!

--
 Laurent

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to