On Sun, Jul 13, 2014 at 12:40 AM, Matthew Dempsky <matt...@dempsky.org> wrote:
> Currently there's a lot of redundancy between dopselect() and > doppoll(). This diff cleans them up in the following ways: > > - Better variable names. Instead of "rts", "ats", and "tts" they're > now called "deadline", "now", and "diff"; and "ncoll" is now > "selcookie". They're also all more minimally scoped. > > - Prefer loops over goto. > > - Loosely styled after kern_synch.c's sleep_{setup,finish}() APIs, > there are now selsetup(), selabort(), and selsleep() methods that > dopselect() and doppoll() are implemented in terms of. Moreover, > "P_SELECT", "nselcoll", and "selwait" are now only accessed within > sel{setup,record,abort,sleep,wakeup}(), making it easier to update > and review their interactions. > > - poll() and ppoll() now show up in "ps" as "select" instead of > "poll". This is just for simplicity because I don't think > distinguishing them offers much value when they're basically just > different APIs for the same underlying logic, but it's easy to > restore if people care. > > Other than the last point, this should be behavior preserving. > Followup changes will tweak things a bit further, but having this diff > in place should make them easier to review. > > ok? > Makes sense to me, though I would use a do {} while (error==0); loop instead of for(;;){<...> if (error) break;} Philip Guenther