Skip to content

Commit 3b1580a

Browse files
authored
gh-78469: Declare missing sethostname for Solaris 10 (#109447)
Add OS version specific macro for Solaris: Py_SUNOS_VERSION.
1 parent 0050670 commit 3b1580a

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

Modules/socketmodule.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -5652,8 +5652,9 @@ socket_sethostname(PyObject *self, PyObject *args)
56525652
Py_buffer buf;
56535653
int res, flag = 0;
56545654

5655-
#ifdef _AIX
5656-
/* issue #18259, not declared in any useful header file */
5655+
#if defined(_AIX) || (defined(__sun) && defined(__SVR4) && Py_SUNOS_VERSION <= 510)
5656+
/* issue #18259, sethostname is not declared in any useful header file on AIX
5657+
* the same is true for Solaris 10 */
56575658
extern int sethostname(const char *, size_t);
56585659
#endif
56595660

configure

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

+8
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,14 @@ then
590590
darwin*) MACHDEP="darwin";;
591591
'') MACHDEP="unknown";;
592592
esac
593+
594+
if test "$ac_sys_system" = "SunOS"; then
595+
# For Solaris, there isn't an OS version specific macro defined
596+
# in most compilers, so we define one here.
597+
SUNOS_VERSION=`echo $ac_sys_release | sed -e 's!\.\([0-9]\)$!.0\1!g' | tr -d '.'`
598+
AC_DEFINE_UNQUOTED([Py_SUNOS_VERSION], [$SUNOS_VERSION],
599+
[The version of SunOS/Solaris as reported by `uname -r' without the dot.])
600+
fi
593601
fi
594602
AC_MSG_RESULT(["$MACHDEP"])
595603

pyconfig.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,9 @@
16211621
/* Define if you want to enable internal statistics gathering. */
16221622
#undef Py_STATS
16231623

1624+
/* The version of SunOS/Solaris as reported by `uname -r' without the dot. */
1625+
#undef Py_SUNOS_VERSION
1626+
16241627
/* Define if you want to enable tracing references for debugging purpose */
16251628
#undef Py_TRACE_REFS
16261629

0 commit comments

Comments
 (0)