Page MenuHomeFreeBSD

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

Authored by ed on Aug 5 2015, 1:22 PM.
Tags
None
Referenced Files
F106033664: D3308.diff
Tue, Dec 24, 5:27 AM
Unknown Object (File)
Sun, Dec 1, 6:19 AM
Unknown Object (File)
Oct 23 2024, 5:09 PM
Unknown Object (File)
Oct 23 2024, 5:09 PM
Unknown Object (File)
Oct 23 2024, 5:08 PM
Unknown Object (File)
Oct 23 2024, 4:57 PM
Unknown Object (File)
Oct 2 2024, 2:47 AM
Unknown Object (File)
Sep 19 2024, 10:50 AM
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 Passed
Unit
No Test Coverage

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

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

98

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

I've added TODO() entries for this.

98

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.