Mercurial > hg
comparison mercurial/osutil.c @ 27970:3d23700cf4a9 stable
osutil: disable compilation of recvfds() on unsupported platforms
It appears that Solaris doesn't provide CMSG_LEN(), msg_control, etc. As
recvfds() is only necessary for chg, this patch just drops it if CMSG_LEN
isn't defined, which is the same workaround as Python 3.x.
https://hg.python.org/cpython/rev/c64216addd7f#l7.33
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 02 Feb 2016 20:56:48 +0900 |
parents | f6d1e92fdf8c |
children | e60c492a0d9b |
comparison
equal
deleted
inserted
replaced
27969:5907ed2b56fb | 27970:3d23700cf4a9 |
---|---|
651 } | 651 } |
652 | 652 |
653 /* | 653 /* |
654 * recvfds() simply does not release GIL during blocking io operation because | 654 * recvfds() simply does not release GIL during blocking io operation because |
655 * command server is known to be single-threaded. | 655 * command server is known to be single-threaded. |
656 * | |
657 * Old systems such as Solaris don't provide CMSG_LEN, msg_control, etc. | |
658 * Currently, recvfds() is not supported on these platforms. | |
656 */ | 659 */ |
660 #ifdef CMSG_LEN | |
657 | 661 |
658 static ssize_t recvfdstobuf(int sockfd, int **rfds, void *cbuf, size_t cbufsize) | 662 static ssize_t recvfdstobuf(int sockfd, int **rfds, void *cbuf, size_t cbufsize) |
659 { | 663 { |
660 char dummy[1]; | 664 char dummy[1]; |
661 struct iovec iov = {dummy, sizeof(dummy)}; | 665 struct iovec iov = {dummy, sizeof(dummy)}; |
711 bail: | 715 bail: |
712 Py_XDECREF(rfdslist); | 716 Py_XDECREF(rfdslist); |
713 return NULL; | 717 return NULL; |
714 } | 718 } |
715 | 719 |
720 #endif /* CMSG_LEN */ | |
716 #endif /* ndef _WIN32 */ | 721 #endif /* ndef _WIN32 */ |
717 | 722 |
718 static PyObject *listdir(PyObject *self, PyObject *args, PyObject *kwargs) | 723 static PyObject *listdir(PyObject *self, PyObject *args, PyObject *kwargs) |
719 { | 724 { |
720 PyObject *statobj = NULL; /* initialize - optional arg */ | 725 PyObject *statobj = NULL; /* initialize - optional arg */ |
879 "On error, this function may raise either a WindowsError or an IOError."}, | 884 "On error, this function may raise either a WindowsError or an IOError."}, |
880 #else | 885 #else |
881 {"statfiles", (PyCFunction)statfiles, METH_VARARGS | METH_KEYWORDS, | 886 {"statfiles", (PyCFunction)statfiles, METH_VARARGS | METH_KEYWORDS, |
882 "stat a series of files or symlinks\n" | 887 "stat a series of files or symlinks\n" |
883 "Returns None for non-existent entries and entries of other types.\n"}, | 888 "Returns None for non-existent entries and entries of other types.\n"}, |
889 #ifdef CMSG_LEN | |
884 {"recvfds", (PyCFunction)recvfds, METH_VARARGS, | 890 {"recvfds", (PyCFunction)recvfds, METH_VARARGS, |
885 "receive list of file descriptors via socket\n"}, | 891 "receive list of file descriptors via socket\n"}, |
892 #endif | |
886 #endif | 893 #endif |
887 #ifdef __APPLE__ | 894 #ifdef __APPLE__ |
888 { | 895 { |
889 "isgui", (PyCFunction)isgui, METH_NOARGS, | 896 "isgui", (PyCFunction)isgui, METH_NOARGS, |
890 "Is a CoreGraphics session available?" | 897 "Is a CoreGraphics session available?" |