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

Adding an implementation for timerfd. #1261

Merged
merged 1 commit into from Jul 24, 2020
Merged

Commits on Jul 7, 2020

  1. Adding an implementation and some basic tests for timerfd.

    Removed support for timerfd on Android as it seems to have been deprecated? See https://android.googlesource.com/platform/development/+/73a5a3b/ndk/platforms/android-20/include/sys/timerfd.h or rust-lang/libc#1589
    
    Removed the public status of `TimerSpec`, as it should not be exposed to the user.
    
    Implemented `FromRawFd` for `TimerFd` as it already implements `AsRawFd`.
    
    Addressed comments from the latest code review:
      - Removed upper bound assertions on timer expirations in tests.
      - Made the main example runnable and added code to show how to wait for the timer.
      - Refactored `ClockId` to use `libc_enum`.
      - Added comments for all public parts of the module.
      - Wrapped to 80 cols.
      - Changed the size of the buffer in the tests to the minimum required.
    
    * Ran rustfmt.
    * Added a `From` implementation for `libc::timespec` -> `TimeSpec`.
    * Reworked the example with the new changes and changed the timer from 5 to 1 second.
    * Added a constructor for a 0-initialized `TimerSpec`.
    * Added a new method to get the timer configured expiration (based on timerfd_gettime).
    * Added an helper method to unset the expiration of the timer.
    * Added a `wait` method to actually read from the timer.
    * Renamed `settime` into just `set`.
    * Refactored the tests and added a new one that tests both the `unset` and the `get` method.
    
    Modified CHANGELOG.
    vdagonneau-anssi committed Jul 7, 2020
    Copy the full SHA
    f3bd6ed View commit details
    Browse the repository at this point in the history