Commit | Line | Data |
---|---|---|
59f0d218 FF |
1 | diff -u -r ../Python-3.4.1/Modules/posixmodule.c ./Modules/posixmodule.c |
2 | --- ../Python-3.4.1/Modules/posixmodule.c 2014-05-19 07:19:39.000000000 +0200 | |
3 | +++ ./Modules/posixmodule.c 2014-06-25 21:42:11.191524129 +0200 | |
4 | @@ -6048,7 +6048,7 @@ | |
5 | if (_Py_set_inheritable(master_fd, 0, NULL) < 0) | |
6 | goto posix_error; | |
7 | ||
8 | -#if !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC) | |
9 | +#if !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC) && !defined(__ANDROID__) | |
10 | ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */ | |
11 | ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm */ | |
12 | #ifndef __hpux | |
13 | @@ -9162,7 +9162,12 @@ | |
14 | needed definitions in sys/statvfs.h */ | |
15 | #define _SVID3 | |
16 | #endif | |
17 | -#include <sys/statvfs.h> | |
18 | +#ifdef __ANDROID__ | |
19 | +# include <sys/vfs.h> | |
20 | +# define statvfs statfs | |
21 | +#else | |
22 | +# include <sys/statvfs.h> | |
23 | +#endif | |
24 | ||
25 | static PyObject* | |
26 | _pystatvfs_fromstructstatvfs(struct statvfs st) { | |
27 | @@ -9178,9 +9183,15 @@ | |
28 | PyStructSequence_SET_ITEM(v, 4, PyLong_FromLong((long) st.f_bavail)); | |
29 | PyStructSequence_SET_ITEM(v, 5, PyLong_FromLong((long) st.f_files)); | |
30 | PyStructSequence_SET_ITEM(v, 6, PyLong_FromLong((long) st.f_ffree)); | |
31 | +#ifdef __ANDROID__ | |
32 | + PyStructSequence_SET_ITEM(v, 7, PyLong_FromLong((long) st.f_bavail)); | |
33 | + PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) st.f_flags)); | |
34 | + PyStructSequence_SET_ITEM(v, 9, PyLong_FromLong((long) st.f_namelen)); | |
35 | +#else | |
36 | PyStructSequence_SET_ITEM(v, 7, PyLong_FromLong((long) st.f_favail)); | |
37 | PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) st.f_flag)); | |
38 | PyStructSequence_SET_ITEM(v, 9, PyLong_FromLong((long) st.f_namemax)); | |
39 | +#endif | |
40 | #else | |
41 | PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long) st.f_bsize)); | |
42 | PyStructSequence_SET_ITEM(v, 1, PyLong_FromLong((long) st.f_frsize)); | |
43 | @@ -9194,11 +9205,18 @@ | |
44 | PyLong_FromLongLong((PY_LONG_LONG) st.f_files)); | |
45 | PyStructSequence_SET_ITEM(v, 6, | |
46 | PyLong_FromLongLong((PY_LONG_LONG) st.f_ffree)); | |
47 | +#ifdef __ANDROID__ | |
48 | + PyStructSequence_SET_ITEM(v, 7, | |
49 | + PyLong_FromLongLong((PY_LONG_LONG) st.b_favail)); | |
50 | + PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) st.f_flags)); | |
51 | + PyStructSequence_SET_ITEM(v, 9, PyLong_FromLong((long) st.f_namelen)); | |
52 | +#else | |
53 | PyStructSequence_SET_ITEM(v, 7, | |
54 | PyLong_FromLongLong((PY_LONG_LONG) st.f_favail)); | |
55 | PyStructSequence_SET_ITEM(v, 8, PyLong_FromLong((long) st.f_flag)); | |
56 | PyStructSequence_SET_ITEM(v, 9, PyLong_FromLong((long) st.f_namemax)); | |
57 | #endif | |
58 | +#endif | |
59 | if (PyErr_Occurred()) { | |
60 | Py_DECREF(v); | |
61 | return NULL; | |
62 | @@ -9221,7 +9239,11 @@ | |
63 | if (!PyArg_ParseTuple(args, "i:fstatvfs", &fd)) | |
64 | return NULL; | |
65 | Py_BEGIN_ALLOW_THREADS | |
66 | +#ifdef __ANDROID__ | |
67 | + res = fstatfs(fd, &st); | |
68 | +#else | |
69 | res = fstatvfs(fd, &st); | |
70 | +#endif | |
71 | Py_END_ALLOW_THREADS | |
72 | if (res != 0) | |
73 | return posix_error(); | |
74 | @@ -9232,7 +9254,13 @@ | |
75 | ||
76 | ||
77 | #if defined(HAVE_STATVFS) && defined(HAVE_SYS_STATVFS_H) | |
78 | -#include <sys/statvfs.h> | |
79 | +#ifdef __ANDROID__ | |
80 | +# include <sys/vfs.h> | |
81 | +# define statvfs statfs | |
82 | +#else | |
83 | +# include <sys/statvfs.h> | |
84 | +#endif | |
85 | + | |
86 | ||
87 | PyDoc_STRVAR(posix_statvfs__doc__, | |
88 | "statvfs(path)\n\n\ | |
89 | @@ -9271,7 +9299,11 @@ | |
90 | goto exit; | |
91 | } | |
92 | #endif | |
93 | +#ifdef __ANDROID__ | |
94 | + result = fstatfs(path.fd, &st); | |
95 | +#else | |
96 | result = fstatvfs(path.fd, &st); | |
97 | +#endif | |
98 | } | |
99 | else | |
100 | #endif |