GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add wrapper for timerfd_create, timerfd_settime, and timerfd_gettime to `os` module · Issue #108277 · python/cpython

Add wrapper for timerfd_create, timerfd_settime, and timerfd_gettime to os module #108277

New issue
Copy link
New issue
Copy link
Closed
Closed
Add wrapper for timerfd_create, timerfd_settime, and timerfd_gettime to os module#108277
Copy link
Labels
type-featureA feature request or enhancementA feature request or enhancement

Description

@m-tmatma
m-tmatma
opened on Aug 22, 2023
Issue body actions

Feature or enhancement

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

Proposal:

eventfd is implemented at #20930 (#85173).
But timerfd is not implemented yet.

timerfd_create, timerfd_settime, and timerfd_gettime are Linux syscalls that create and operate on a timer that delivers timer expiration notifications via a file descriptor.

See https://man7.org/linux/man-pages/man2/timerfd_create.2.html

I propse to add those wrapper functions to os module.

Linked PRs

  • gh-108277: Add wrapper for timerfd_create, timerfd_settime, and timerfd_gettime to os module #108382
  • gh-108277: Fix test_os TimerfdTests #110515
  • gh-108277: test_os tolerates 1 ms diff for timerfd #110661
  • gh-108277: Make test_os tolerate 10 ms diff for timerfd on Android emulators #117223
  • gh-108277: Make test_os tolerate 10 ms diff for timerfd #117231

Activity

Next
  1. m-tmatma
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Aug 22, 2023
  2. m-tmatma
    added 9 commits that reference this issue on Aug 22, 2023

    pythongh-108277: Add wrapper for timerfd_create, timerfd_settime, and…

    8180d12

    pythongh-108277: Add wrapper for timerfd_create, timerfd_settime, and…

    3a25334

    pythongh-108277: Add wrapper functions for timerfd_create, timerfd_se…

    c6c6b99

    pythongh-108277: Add wrapper functions for timerfd_create, timerfd_se…

    49f81bc

    pythongh-108277: Add wrapper functions for timerfd_create, timerfd_se…

    dbf9c7a

    pythongh-108277: Add wrapper functions for timerfd_create, timerfd_se…

    5ecbf20

    pythongh-108277: Add wrapper functions for timerfd_create, timerfd_se…

    c192e22

    pythongh-108277: Add wrapper functions for timerfd_create, timerfd_se…

    8798c48

    pythongh-108277: Add wrapper functions for timerfd_create, timerfd_se…

    39ed6e4
  3. serhiy-storchaka commented on Aug 28, 2023

    @serhiy-storchaka
    serhiy-storchaka
    on Aug 28, 2023
    Member
    More actions

    Should not we first add POSIX conforming timer_create(), timer_settime(), timer_gettime(), timer_getoverrun()?

    Also, I'm not sure if we should add these low-level platform-specific functions in the os module, or if it's better to add platform-independent functions that hide the platform-specific implementation under the hood in the time module.

    What do you think about it, @vstinner?

  4. m-tmatma
    added a commit that references this issue on Aug 28, 2023

    pythongh-108277: Add wrapper functions for timerfd_create, timerfd_se…

    0f8aaf5
  5. vstinner commented on Aug 28, 2023

    @vstinner
    vstinner
    on Aug 28, 2023
    Member
    More actions

    IMO it's a good thin to expose the API in the os, thin wrapper to the C functions. Then anyone is free to write their own high-level API on top of it.

    Who is going to use these APIs? For which use case?

    Should not we first add POSIX conforming timer_create(), timer_settime(), timer_gettime(), timer_getoverrun()?

    Which platforms support these APIs?

    timerfd_create, timerfd_settime, and timerfd_gettime

    Only Linux support these APIs according to the doc.

  6. vstinner
    added 2 commits that reference this issue on Oct 7, 2023

    gh-108277: Add os.timerfd_create() function (#108382)

    de2a403

    pythongh-108277: Fix test_os TimerfdTests

    d2b621d
  7. 3 remaining items

  8. vstinner
    closed this as completedon Oct 8, 2023
  9. serhiy-storchaka commented on Oct 9, 2023

    @serhiy-storchaka
    serhiy-storchaka
    on Oct 9, 2023
    Member
    More actions
    ======================================================================
    FAIL: test_timerfd_TFD_TIMER_ABSTIME (test.test_os.TimerfdTests.test_timerfd_TFD_TIMER_ABSTIME)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/runner/work/cpython/cpython/Lib/test/test_os.py", line 4066, in test_timerfd_TFD_TIMER_ABSTIME
        self.assertGreater(t, offset - self.CLOCK_RES)
    AssertionError: 0.9999231210000517 not greater than 0.99995
    

    https://github.com/python/cpython/actions/runs/6454439770/job/17519998313?pr=110539

  10. vstinner
    added a commit that references this issue on Oct 11, 2023

    pythongh-108277: test_os tolerates 1 ms diff for timerfd

    5f44f4f
  11. vstinner commented on Oct 11, 2023

    @vstinner
    vstinner
    on Oct 11, 2023
    Member
    More actions

    AssertionError: 0.999 923 121 0000517 not greater than 0.99995

    Hum. When @m-tmatma wrote the test, the test expects >= 1.0. I modified the test to tolerate 50 us difference. I don't want to play this whack-a-mole game for too long, I wrote PR #110661 to tolerate 1 ms difference. I don't know which clocks are involved, but I don't think that Python should test the operating system itself, it should just test that it's thin wrapper to OS functions "seem to work".

    Reacted by Malcolm Smith
  12. vstinner
    added a commit that references this issue on Oct 11, 2023

    gh-108277: test_os tolerates 1 ms diff for timerfd (#110661)

    7ca4aaf
  13. mhsmith commented on Mar 20, 2024

    @mhsmith
    mhsmith
    on Mar 20, 2024
    Member
    More actions

    For future reference: I have two laptops I use for Android development, and to pass these tests reliably on the slower one, I had to increase the margin to 2 ms, and reduce the places arguments from 3 to 2. But I probably won't be creating a PR for this, because this laptop is really too slow to be a modern Android development machine, so I doubt it will affect anyone else.

  14. vstinner commented on Mar 21, 2024

    @vstinner
    vstinner
    on Mar 21, 2024
    Member
    More actions

    If you propose a PR, I will review it.

  15. vstinner
    added 2 commits that reference this issue on Mar 25, 2024

    pythongh-108277: Make test_os tolerate 10 ms diff for timerfd

    e56aac1

    gh-108277: Make test_os tolerate 10 ms diff for timerfd on Android em…

    eefff68
  16. NGRsoftlab
    added 2 commits that reference this issue on Apr 2, 2024

    Squashed commit of the following:

    1b5fe4c

    Squashed commit of the following:

    a016a54
  17. diegorusso
    added a commit that references this issue on Apr 17, 2024

    pythongh-108277: Make test_os tolerate 10 ms diff for timerfd on Andr…

    9f32d83
  18. Glyphack
    added 3 commits that reference this issue on Sep 2, 2024

    pythongh-108277: Add os.timerfd_create() function (python#108382)

    332d37b

    pythongh-108277: Fix test_os TimerfdTests (python#110515)

    01448b8

    pythongh-108277: test_os tolerates 1 ms diff for timerfd (python#110661)

    5e7566a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.