Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add basic support a linux-like syscall evendfd #1052

Merged
merged 8 commits into from
Feb 13, 2024

Conversation

stlankes
Copy link
Contributor

@stlankes stlankes commented Feb 8, 2024

eventfd creates an linux-like "eventfd object" that can be used as an event wait/notify mechanism by user-space applications, and by the kernel to notify user-space applications of events. The object contains an unsigned 64-bit integer counter that is maintained by the kernel. This counter is initialized with the value specified in the argument initval.

As its return value, eventfd returns a new file descriptor that can be used to refer to the eventfd object.

The following values may be bitwise set in flags to change the behavior of eventfd:

  • EFD_NONBLOCK: Set the file descriptor in non-blocking mode
  • EFD_SEMAPHORE: Provide semaphore-like semantics for reads from the new file descriptor.

In addition, the PR includes some fine-tuning of the IP stack and the behavior of the system call poll. This should increase the compatibility to Unix.

@stlankes stlankes marked this pull request as draft February 8, 2024 07:14
To avoid debug messages of unhandled interrupts, a handler for COM1
is registerted.
fine-tuning of the TCP stack and the behavior of the
system call `poll`
increasing the event counter blocks, if a overflow is possible
src/syscalls/net.rs Outdated Show resolved Hide resolved
@jounathaen
Copy link
Member

Can we add some kind of test for this functionality?

@mkroening
Copy link
Member

Can we add some kind of test for this functionality?

There will be one on the user space side of things.

Revamping integration tests in this repo is another thing that I should move up on my list. Then, we could test those things easily here as well: #418

if smoltcp leaves the state LISTEN, the poll function returns
Poll::Ready. Just to give the user space the option to call
accept.
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

I have two comments that I will address after merging.
I also opened #1060 since we don't need async locks in numerous instances.

src/fd/eventfd.rs Show resolved Hide resolved
src/fd/eventfd.rs Show resolved Hide resolved
@stlankes
Copy link
Contributor Author

I merge this PR. Just to release a new abi and to publish some ci test.

@stlankes stlankes added this pull request to the merge queue Feb 13, 2024
Merged via the queue into hermit-os:main with commit b24a802 Feb 13, 2024
39 checks passed
@stlankes stlankes deleted the eventfd branch February 13, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants