Page MenuHomeFreeBSD

Make poll() and kqueue() on CloudABI work.
ClosedPublic

Authored by ed on Aug 5 2015, 1:22 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 5 2024, 6:11 AM
Unknown Object (File)
Jan 9 2024, 9:31 PM
Unknown Object (File)
Dec 19 2023, 4:38 PM
Unknown Object (File)
Dec 14 2023, 9:46 AM
Unknown Object (File)
Oct 22 2023, 10:23 PM
Unknown Object (File)
Oct 20 2023, 8:12 AM
Unknown Object (File)
Oct 19 2023, 10:20 PM
Unknown Object (File)
Aug 31 2023, 10:52 PM
Subscribers

Details

Summary

This change implements two functions, cloudabi64_kevent_copyin() and
cloudabi64_kevent_copyout(), that convert CloudABI structures to
FreeBSD's struct kevent. CloudABI uses two structures: subscription_t
and event_t. The former is used for input, whereas the latter is used
for output. Unlike struct kevent, fields aren't overloaded for multiple
purposes or for separate event types.

For poll() we call into the newly introduced kern_kevent_anonymous()
function that allows us to poll without a file descriptor. This function
is not only used by poll(), but also by functions such as
sleep() and clock_nanosleep().

Test Plan

These system calls pass a whole set of unit tests that are part of
cloudlibc.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ed retitled this revision from to Make poll() and kqueue() on CloudABI work..
ed updated this object.
ed edited the test plan for this revision. (Show Details)
ed added a reviewer: jmg.
jmg edited edge metadata.

Comments are not required to be addressed.

sys/compat/cloudabi64/cloudabi64_poll.c
94 ↗(On Diff #7674)

iirc, copyin is a relatively expensive operation, so, maybe creating an array, doing the copyin, and then processing would be faster/better.

98 ↗(On Diff #7674)

personal preference is to spell this either (I prefer no parens around vars for sizeof, but that's me):
memset(kevp, 0, sizeof(kevp));

or
*kevp = (struct kevent){};

But that's just my opinion.

This revision is now accepted and ready to land.Aug 11 2015, 7:38 PM
sys/compat/cloudabi64/cloudabi64_poll.c
94 ↗(On Diff #7674)

I've added TODO() entries for this.

98 ↗(On Diff #7674)

I also like the use of compound literals, but it looks like we don't use it that often in the FreeBSD codebase.

Let's stick to the memset() for now for consistency. I've changed it to use 0 instead of '\0'.

This revision was automatically updated to reflect the committed changes.