Do not pass static zero IntPtr to epoll wait. Dispose driver in tests… #2291
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See here
This PR fixes a bug introduced by the merge of #2184.
The bug was introduced by an unintentional change in the behaviour of the SysFsDriver, that utilizes the native epoll_wait function to discard not needed events.
Originally the binding of
epoll_wait
was implemented aspublic static extern int epoll_wait(int epfd, out epoll_event events, int maxevents, int timeout);
which does not fully match the native function
int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout);
because
events
is a pointer to an array.Some new functionality in #2184 relies on epoll_wait, what prompted me to correct the binding.
As a consequence I had to update calls in the SysFsDriver, but mistakenly passed IntPtr.Zero to epoll_wait, which does not seem to result in the same behaviour. The fix is to pass an actual buffer instead.
This PR also includes some additional "using" statements in the GpioControllerTestBase because during testing, some sporadic occurrences of PermissionDeniedException occured. It complained about not having root permission for changing GPIO mode of used GPIOs. I'm pretty sure that was because of not yet disposed SysFsDriver instance/s.
Microsoft Reviewers: Open in CodeFlow