Skip to content

Commit 1942721

Browse files
[3.11] gh-78469: Declare missing sethostname for Solaris 10 (GH-109447) (#110581)
Add OS version specific macro for Solaris: Py_SUNOS_VERSION. (cherry picked from commit 3b1580a) Co-authored-by: Jakub Kulík <[email protected]>
1 parent 2b3a418 commit 1942721

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

Modules/socketmodule.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -5534,8 +5534,9 @@ socket_sethostname(PyObject *self, PyObject *args)
55345534
Py_buffer buf;
55355535
int res, flag = 0;
55365536

5537-
#ifdef _AIX
5538-
/* issue #18259, not declared in any useful header file */
5537+
#if defined(_AIX) || (defined(__sun) && defined(__SVR4) && Py_SUNOS_VERSION <= 510)
5538+
/* issue #18259, sethostname is not declared in any useful header file on AIX
5539+
* the same is true for Solaris 10 */
55395540
extern int sethostname(const char *, size_t);
55405541
#endif
55415542

configure

+11
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
@@ -582,6 +582,14 @@ then
582582
darwin*) MACHDEP="darwin";;
583583
'') MACHDEP="unknown";;
584584
esac
585+
586+
if test "$ac_sys_system" = "SunOS"; then
587+
# For Solaris, there isn't an OS version specific macro defined
588+
# in most compilers, so we define one here.
589+
SUNOS_VERSION=`echo $ac_sys_release | sed -e 's!\.\([0-9]\)$!.0\1!g' | tr -d '.'`
590+
AC_DEFINE_UNQUOTED([Py_SUNOS_VERSION], [$SUNOS_VERSION],
591+
[The version of SunOS/Solaris as reported by `uname -r' without the dot.])
592+
fi
585593
fi
586594
AC_MSG_RESULT("$MACHDEP")
587595

pyconfig.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,9 @@
15951595
/* Define if you want to enable internal statistics gathering. */
15961596
#undef Py_STATS
15971597

1598+
/* The version of SunOS/Solaris as reported by `uname -r' without the dot. */
1599+
#undef Py_SUNOS_VERSION
1600+
15981601
/* Define if you want to enable tracing references for debugging purpose */
15991602
#undef Py_TRACE_REFS
16001603

0 commit comments

Comments
 (0)