Show More
@@ -20,6 +20,7 b'' | |||||
20 | #include <windows.h> |
|
20 | #include <windows.h> | |
21 | #else |
|
21 | #else | |
22 | #include <dirent.h> |
|
22 | #include <dirent.h> | |
|
23 | #include <signal.h> | |||
23 | #include <sys/socket.h> |
|
24 | #include <sys/socket.h> | |
24 | #include <sys/stat.h> |
|
25 | #include <sys/stat.h> | |
25 | #include <sys/types.h> |
|
26 | #include <sys/types.h> | |
@@ -1111,6 +1112,25 b' static PyObject *getfstype(PyObject *sel' | |||||
1111 | } |
|
1112 | } | |
1112 | #endif /* defined(HAVE_LINUX_STATFS) || defined(HAVE_BSD_STATFS) */ |
|
1113 | #endif /* defined(HAVE_LINUX_STATFS) || defined(HAVE_BSD_STATFS) */ | |
1113 |
|
1114 | |||
|
1115 | static PyObject *unblocksignal(PyObject *self, PyObject *args) | |||
|
1116 | { | |||
|
1117 | int sig = 0; | |||
|
1118 | int r; | |||
|
1119 | if (!PyArg_ParseTuple(args, "i", &sig)) | |||
|
1120 | return NULL; | |||
|
1121 | sigset_t set; | |||
|
1122 | r = sigemptyset(&set); | |||
|
1123 | if (r != 0) | |||
|
1124 | return PyErr_SetFromErrno(PyExc_OSError); | |||
|
1125 | r = sigaddset(&set, sig); | |||
|
1126 | if (r != 0) | |||
|
1127 | return PyErr_SetFromErrno(PyExc_OSError); | |||
|
1128 | r = sigprocmask(SIG_UNBLOCK, &set, NULL); | |||
|
1129 | if (r != 0) | |||
|
1130 | return PyErr_SetFromErrno(PyExc_OSError); | |||
|
1131 | Py_RETURN_NONE; | |||
|
1132 | } | |||
|
1133 | ||||
1114 | #endif /* ndef _WIN32 */ |
|
1134 | #endif /* ndef _WIN32 */ | |
1115 |
|
1135 | |||
1116 | static PyObject *listdir(PyObject *self, PyObject *args, PyObject *kwargs) |
|
1136 | static PyObject *listdir(PyObject *self, PyObject *args, PyObject *kwargs) | |
@@ -1291,6 +1311,8 b' static PyMethodDef methods[] = {' | |||||
1291 | {"getfstype", (PyCFunction)getfstype, METH_VARARGS, |
|
1311 | {"getfstype", (PyCFunction)getfstype, METH_VARARGS, | |
1292 | "get filesystem type (best-effort)\n"}, |
|
1312 | "get filesystem type (best-effort)\n"}, | |
1293 | #endif |
|
1313 | #endif | |
|
1314 | {"unblocksignal", (PyCFunction)unblocksignal, METH_VARARGS, | |||
|
1315 | "change signal mask to unblock a given signal\n"}, | |||
1294 | #endif /* ndef _WIN32 */ |
|
1316 | #endif /* ndef _WIN32 */ | |
1295 | #ifdef __APPLE__ |
|
1317 | #ifdef __APPLE__ | |
1296 | { |
|
1318 | { | |
@@ -1301,7 +1323,7 b' static PyMethodDef methods[] = {' | |||||
1301 | {NULL, NULL} |
|
1323 | {NULL, NULL} | |
1302 | }; |
|
1324 | }; | |
1303 |
|
1325 | |||
1304 |
static const int version = |
|
1326 | static const int version = 2; | |
1305 |
|
1327 | |||
1306 | #ifdef IS_PY3K |
|
1328 | #ifdef IS_PY3K | |
1307 | static struct PyModuleDef osutil_module = { |
|
1329 | static struct PyModuleDef osutil_module = { |
@@ -74,7 +74,7 b' def _importfrom(pkgname, modname):' | |||||
74 | (r'cext', r'bdiff'): 1, |
|
74 | (r'cext', r'bdiff'): 1, | |
75 | (r'cext', r'diffhelpers'): 1, |
|
75 | (r'cext', r'diffhelpers'): 1, | |
76 | (r'cext', r'mpatch'): 1, |
|
76 | (r'cext', r'mpatch'): 1, | |
77 |
(r'cext', r'osutil'): |
|
77 | (r'cext', r'osutil'): 2, | |
78 | (r'cext', r'parsers'): 4, |
|
78 | (r'cext', r'parsers'): 4, | |
79 | } |
|
79 | } | |
80 |
|
80 |
@@ -163,6 +163,10 b' try:' | |||||
163 | setprocname = osutil.setprocname |
|
163 | setprocname = osutil.setprocname | |
164 | except AttributeError: |
|
164 | except AttributeError: | |
165 | pass |
|
165 | pass | |
|
166 | try: | |||
|
167 | unblocksignal = osutil.unblocksignal | |||
|
168 | except AttributeError: | |||
|
169 | pass | |||
166 |
|
170 | |||
167 | # Python compatibility |
|
171 | # Python compatibility | |
168 |
|
172 |
General Comments 0
You need to be logged in to leave comments.
Login now