OK this is from kqueue man page: "kevent() returns the number of events placed in the eventlist, up to the value given by nevents"
What I find confusing is that kevent() returns int data type, however the length of eventlist given by nevents can be up to size_t. Suppose you have more than INT_MAX events in kqueue, what are the semantics of kevent()? 1. kevent() returns up to INT_MAX events, and advances internal pointer to the next segment of up to INT_MAX events. or 2. kevent() overflows int and returns a negative number. This also begs another question: is there some sort of internal limit on the total number of events supported by kqueue, or it can be as big as your RAM allows?