On 5/23/19 6:30 PM, enh via Toybox wrote: > Factor out the inotify code and add a kqueue equivalent. > > Specifically tested on macOS 10.14, but I assume this works for other > BSDs too, given that I worked from the FreeBSD man page...
I moved it to lib/portability.c to keep all the #ifdefs in one place. (Well, two counting both portability.h and .c.) And I got rid of the globals because I try to have all the globals be in "this" (per-commandb TT.blah) or "toys" (global context ala toys.optargs), plus libbbuf, toybuf, and toy_list. I don't 100% stick to that though: nm --size-sort generated/unstripped/toybox | grep -v ' [Ttr] ' | grep -v GLIBC 0000000000000001 b completed.6972 0000000000000008 b do_lines_bridge 0000000000000008 b grgidbuf.10485 0000000000000008 b pwuidbuf.10470 0000000000000008 b tempfile2zap 000000000000000c b gnum.10521 000000000000000c b unum.10516 0000000000000020 D confstrs 0000000000000020 d toy_paths.9901 0000000000000028 b chattr 0000000000000028 d cp_preserve 0000000000000030 D others 0000000000000038 D polnames 0000000000000050 B toys 00000000000000e0 D pathconfs 0000000000000150 d e2attrs 00000000000001a0 d signames 0000000000000230 d scan_key_list 00000000000002d0 d fstypes 0000000000000380 D limits 0000000000000570 d typos 00000000000007b0 D sysconfs 0000000000001000 B libbuf 0000000000001000 B toybuf 0000000000001960 D toy_list 0000000000002028 B this I should figure out how to convert more of that to rodata (without having to propagate "const" down through call chains: a char * points to a string constant that will segfault if you write to it half the time but if you pass a const to a non-const * the compiler FLIPS OUT)... Anyway, yet another thing on my 1.0-ish todo list. (Eventual cleanup.) Rob _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
