Skip to content
This repository was archived by the owner on Jul 16, 2022. It is now read-only.
This repository was archived by the owner on Jul 16, 2022. It is now read-only.

Use Linux' O_TMPFILE for tmpfiles #2

Open

Description

@untitaker

Activity

  1. changed the title [-]Use Linux' API for tmpfiles[/-] [+]Use Linux' O_TMPFILE for tmpfiles[/+] on Feb 6, 2015
  2. untitaker commented on Feb 6, 2015

    @untitaker
    OwnerAuthor

    Unsure how to call linkat in Python.

  3. jwilk commented on Jul 15, 2016

    @jwilk
    Contributor

    Something like this seems to work since Python 3.4:

    import os
    fd = os.open('.', os.O_TMPFILE | os.O_RDWR)
    path = '/proc/self/fd/{0}'.format(fd)
    os.link(path, 'spam', src_dir_fd=0, follow_symlinks=True)
  4. untitaker commented on Jul 28, 2016

    @untitaker
    OwnerAuthor

    @jwilk That doesn't seem particularly performant or elegant though. It seems that there is a package on PyPI that provides bindings for this call, however, that would be quite a microdependency.

  5. earonesty commented on Dec 6, 2017

    @earonesty

    AFAICT NamedTemporaryFile already sets this flag

  6. jwilk commented on Dec 6, 2017

    @jwilk
    Contributor

    I think you meant (unnamed) TemporaryFile, which indeed tries to use O_TMPFILE since Python 3.5:
    https://bugs.python.org/issue21515

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions