Skip to content

[ENH] Many posix declarations are missing in Cython/Includes/posix #4522

@GalaxySnail

Description

@GalaxySnail

Is your feature request related to a problem? Please describe.

I find that there is no wrapper for <sys/uio.h> in cython. After browsing the Cython/Includes/posix directory and POSIX.1-2017 basedefs, I realize that many posix declarations are not wrapped in cython. For example, <poll.h> has not been wrapped either.

And most of wrapped posix headers are from POSIX.1-2004, there are some new declarations in POSIX.1-2017 but not in POSIX.1-2004, such as F_DUPFD_CLOEXEC and O_CLOEXEC in <fcntl.h>.

Describe the solution you'd like

It is easy to add a wrapper for <sys/uio.h>.

# Cython/Includes/posix/uio.pxd
# https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_uio.h.html

cdef extern from "<sys/uio.h>" nogil:
    cdef struct iovec:
        void  *iov_base
        size_t iov_len
    ssize_t readv (int fd, const iovec *iov, int iovcnt)
    ssize_t writev(int fd, const iovec *iov, int iovcnt)

But it's not the most important thing.

Describe alternatives you've considered

There are two questions:

  1. Should we wrap all of posix declarations? Adding the missing headers and updating the old wrappers are possile, but are they useful? For example, should we wrap <aio.h> or <iconv.h>?
  2. Should we wrap some platform specific declarations? There are many of them in posix/mman.pxd. But maitaining many platform specific things is difficult and needs a lot of effort.

If the answer of the first question is "yes", we can just do it. If the answer is "no", how to determine which declarations should be wrapped?

If the answer of the second question is "no", how to deal with the existing platform specific declarations? If the answer is "yes", where should they be? Just in the Includes/posix folder? Or something like Includes/linux and Includes/bsd? If we choose the latter, the existing declarations need to be moved (they can be kept in the old places for compatibility). No matter what the answer is, it is still a problem to determine which declarations should be wrapped.

In brief, the promble is "Which delarations are worth being wrapped?".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions