Opened 5 years ago

Last modified 5 years ago

#750 new enhancement

Additional libc .pxd definitions

Reported by: nikratio Owned by:
Priority: major Milestone: wishlist
Component: Library Keywords:
Cc: nikratio


It'd be great if the following definitions could be added to the .pxd files shipped with Cython:

cdef extern from "attr/xattr.h" nogil:
    int setxattr (char *path, char *name,
                  void *value, int size, int flags)
    int getxattr (char *path, char *name,
                  void *value, int size)


cdef extern from "dirent.h" nogil:
    ctypedef struct DIR:
    cdef struct dirent:
        char* d_name
    dirent* readdir(DIR* dirp)
    int readdir_r(DIR *dirp, dirent *entry, dirent **result)

cdef extern from "sys/types.h" nogil:
    DIR *opendir(char *name)
    int closedir(DIR* dirp)

from libc.sys.types cimport *
cdef extern from "sys/stat.h" nogil:
    enum st_mode_constants:

    struct stat:
        dev_t     st_dev
        ino_t     st_ino
        mode_t    st_mode
        nlink_t   st_nlink
        uid_t     st_uid
        gid_t     st_gid
        dev_t     st_rdev
        off_t     st_size
        blksize_t st_blksize
        blkcnt_t  st_blocks
        time_t    st_atime
        time_t    st_mtime
        time_t    st_ctime

cdef extern from "sys/statvfs.h" nogil:
    ctypedef int fsblkcnt_t
    ctypedef int fsfilcnt_t
    struct statvfs: 
        int f_bsize
        int f_frsize
        fsblkcnt_t     f_blocks
        fsblkcnt_t     f_bfree
        fsblkcnt_t     f_bavail
        fsfilcnt_t     f_files
        fsfilcnt_t     f_ffree
        fsfilcnt_t     f_favail
cdef extern from "sys/types.h" nogil:
    ctypedef int pid_t
    ctypedef int dev_t
    ctypedef int ino_t
    ctypedef int mode_t
    ctypedef int nlink_t
    ctypedef int uid_t
    ctypedef int gid_t
    ctypedef int dev_t
    ctypedef int off_t
    ctypedef int blksize_t
    ctypedef int blkcnt_t
    ctypedef int time_t

Also, the libc.stdio definitions lacks a

    FILE *fdopen(int fd, const_char *mode)

Change History (1)

comment:1 Changed 5 years ago by nikratio

  • Cc nikratio added
Note: See TracTickets for help on using tickets.