On 05/29/14 03:59, Ashwini Sharma wrote: > Hi Rob, > > Attached are new toys > killall5 - kill all the processes not in its session. > makedevs - making devices/nodes in a range. Supports reading the tabled > entry from file. > strings - print the strings in the file.
Applied. (Fairly likely to merge killall5 with killall, but we'll see how cleanup goes when we get there...) > Your inputs are welcome. > > PS: I know there is generic add function for double list, but it will be > good to > have a generic __common__ add function for single list. There are many > instances that single list is used and everybody adds their own add > function. What did you have in mind? The reason I haven't done it yet is that adding to a reverse order single list is basically: node->next = list; list = node; Pushing two arguments onto the stack and making a function call is going to be about as big as two assignments and a dereference anyway, so we might as well be explicit. Adding to an in-order list is probably best done with double_list (or at least that's how I've been doing it in patch and such) because iterating to find the end each time is O(N^2). Or you can do a single pass at the end to reverse the list, which is O(N), but mostly I've been using a single list when I don't care about the order (or _want_ it reversed). You can have a second variable to track the end of the list, but it's kind of fiddly and error-prone, and again I'm not sure how a function there would help. You'd have to pass the second variable in to the append, but initialize the first for the first node (so pass both or special case list creation). I note that I just added dlist_terminate(list). The normal dlist_add_nomalloc() stuff creates a circular list, this splits said list and returns the pointer to the end of the list (in case you want to traverse it in reverse order). That's easy enough to do I've been doing it inline, but a function for it is slightly clearer and more convenient so I did that when I turned mtab_list into a double_list and had to adapt df and umount to match... > regards, > Ashwini Rob _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
