Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-40280: Add configure check for socket shutdown (GH-29795) #29795

Merged
merged 1 commit into from
Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
``configure`` now checks for socket ``shutdown`` function. The check makes
it possible to disable ``SYS_shutdown`` with ``ac_cv_func_shutdown=no`` in
CONFIG_SITE.
4 changes: 4 additions & 0 deletions Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -4788,6 +4788,7 @@ Set operation mode, IV and length of associated data for an AF_ALG\n\
operation socket.");
#endif

#ifdef HAVE_SHUTDOWN
/* s.shutdown(how) method */

static PyObject *
Expand All @@ -4812,6 +4813,7 @@ PyDoc_STRVAR(shutdown_doc,
\n\
Shut down the reading side of the socket (flag == SHUT_RD), the writing side\n\
of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR).");
#endif

#if defined(MS_WINDOWS) && defined(SIO_RCVALL)
static PyObject*
Expand Down Expand Up @@ -4957,8 +4959,10 @@ static PyMethodDef sock_methods[] = {
gettimeout_doc},
{"setsockopt", (PyCFunction)sock_setsockopt, METH_VARARGS,
setsockopt_doc},
#ifdef HAVE_SHUTDOWN
{"shutdown", (PyCFunction)sock_shutdown, METH_O,
shutdown_doc},
#endif
#ifdef CMSG_LEN
{"recvmsg", (PyCFunction)sock_recvmsg, METH_VARARGS,
recvmsg_doc},
Expand Down
3 changes: 3 additions & 0 deletions PC/pyconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,9 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
/* Define if you have siginterrupt. */
/* #undef HAVE_SIGINTERRUPT */

/* Define to 1 if you have the `shutdown' function. */
#define HAVE_SHUTDOWN 1

/* Define if you have symlink. */
/* #undef HAVE_SYMLINK */

Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -13395,7 +13395,7 @@ for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
setgid sethostname \
setlocale setregid setreuid setresuid setresgid setsid setpgid setpgrp setpriority setuid setvbuf \
sched_get_priority_max sched_setaffinity sched_setscheduler sched_setparam \
sched_rr_get_interval \
sched_rr_get_interval shutdown \
sigaction sigaltstack sigfillset siginterrupt sigpending sigrelse \
sigtimedwait sigwait sigwaitinfo snprintf splice strftime strlcpy strsignal symlinkat sync \
sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3956,7 +3956,7 @@ AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
setgid sethostname \
setlocale setregid setreuid setresuid setresgid setsid setpgid setpgrp setpriority setuid setvbuf \
sched_get_priority_max sched_setaffinity sched_setscheduler sched_setparam \
sched_rr_get_interval \
sched_rr_get_interval shutdown \
sigaction sigaltstack sigfillset siginterrupt sigpending sigrelse \
sigtimedwait sigwait sigwaitinfo snprintf splice strftime strlcpy strsignal symlinkat sync \
sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Expand Down
3 changes: 3 additions & 0 deletions pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,9 @@
/* Define to 1 if you have the `shm_unlink' function. */
#undef HAVE_SHM_UNLINK

/* Define to 1 if you have the `shutdown' function. */
#undef HAVE_SHUTDOWN

/* Define to 1 if you have the `sigaction' function. */
#undef HAVE_SIGACTION

Expand Down