diff options
author | Kevin Cheng <kevcheng@google.com> | 2019-04-18 11:31:16 -0700 |
---|---|---|
committer | Kevin Cheng <kevcheng@google.com> | 2019-05-02 13:59:40 -0700 |
commit | 757c264bc10ebc71074ee3f5fb66d670667a09bc (patch) | |
tree | 26c7f7b74c752db99d9b0ac1f94fc592aca1e53a /demo/readdir2_build.py | |
parent | 99013222844839c42437f16eace25f4e6a8a8b20 (diff) | |
download | cffi-757c264bc10ebc71074ee3f5fb66d670667a09bc.tar.gz |
Add in cffi 1.12.2 (e0c7666)
Since this is a mercurial repo, d/led zip of src:
https://bitbucket.org/cffi/cffi/get/v1.12.2.zip
Also add in misc METADATA/NOTICE/Android.bp/etc files.
Bug: 122778810
Test: None
Change-Id: I36c58ed07a2cdd4d9d11831908175a5c988f33c1
Diffstat (limited to 'demo/readdir2_build.py')
-rw-r--r-- | demo/readdir2_build.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/demo/readdir2_build.py b/demo/readdir2_build.py new file mode 100644 index 0000000..5cfd872 --- /dev/null +++ b/demo/readdir2_build.py @@ -0,0 +1,36 @@ +from cffi import FFI + +ffi = FFI() +ffi.cdef(""" + + typedef ... DIR; + + struct dirent { + unsigned char d_type; /* type of file; not supported + by all file system types */ + char d_name[...]; /* filename */ + ...; + }; + + int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); + int openat(int dirfd, const char *pathname, int flags); + DIR *fdopendir(int fd); + int closedir(DIR *dirp); + + static const int DT_DIR; + +""") +ffi.set_source("_readdir2_cffi", """ +#ifndef _ATFILE_SOURCE +# define _ATFILE_SOURCE +#endif +#ifndef _BSD_SOURCE +# define _BSD_SOURCE +#endif +#include <fcntl.h> +#include <sys/types.h> +#include <dirent.h> +""") + +if __name__ == '__main__': + ffi.compile() |