summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-09-02 13:46:43 (GMT)
committerGitHub <noreply@github.com>2023-09-02 13:46:43 (GMT)
commit1f3e797dc0451f48e649bcab2c9fd80224ffdac0 (patch)
treed168a07c4dc8eeed2861947c04042d33d52dd0e4 /Modules
parent5141b1ebe07ad54279e0770b4704eaf76f24951d (diff)
downloadcpython-1f3e797dc0451f48e649bcab2c9fd80224ffdac0.zip
cpython-1f3e797dc0451f48e649bcab2c9fd80224ffdac0.tar.gz
cpython-1f3e797dc0451f48e649bcab2c9fd80224ffdac0.tar.bz2
gh-108765: Remove old prototypes from pyport.h (#108782)
Move prototypes of gethostname(), _getpty() and struct termios from pyport.h to the C code using them: posixmodule.c, socketmodule.c and termios.c. Replace "#ifdef SOLARIS" with "#ifdef __sun".
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c7
-rw-r--r--Modules/socketmodule.c6
-rw-r--r--Modules/termios.c13
3 files changed, 22 insertions, 4 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 0436571..7615428 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -58,6 +58,13 @@
#include <stdio.h> // ctermid()
#include <stdlib.h> // system()
+// SGI apparently needs this forward declaration
+#ifdef HAVE__GETPTY
+# include <sys/types.h> // mode_t
+ extern char * _getpty(int *, int, mode_t, int);
+#endif
+
+
/*
* A number of APIs are available on macOS from a certain macOS version.
* To support building with a new SDK while deploying to older versions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index e368185..2f12c9c 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -111,9 +111,13 @@ Local naming conventions:
#include "pycore_fileutils.h" // _Py_set_inheritable()
#include "pycore_moduleobject.h" // _PyModule_GetState
+// gethostname() prototype missing from Solaris standard header files
+#ifdef __sun
+extern int gethostname(char *, int);
+#endif
#ifdef _Py_MEMORY_SANITIZER
-# include <sanitizer/msan_interface.h>
+# include <sanitizer/msan_interface.h>
#endif
/* Socket object documentation */
diff --git a/Modules/termios.c b/Modules/termios.c
index 21d3541..a061383 100644
--- a/Modules/termios.c
+++ b/Modules/termios.c
@@ -6,10 +6,17 @@
#include "Python.h"
-/* Apparently, on SGI, termios.h won't define CTRL if _XOPEN_SOURCE
- is defined, so we define it here. */
+// On QNX 6, struct termio must be declared by including sys/termio.h
+// if TCGETA, TCSETA, TCSETAW, or TCSETAF are used. sys/termio.h must
+// be included before termios.h or it will generate an error.
+#if defined(HAVE_SYS_TERMIO_H) && !defined(__hpux)
+# include <sys/termio.h>
+#endif
+
+// Apparently, on SGI, termios.h won't define CTRL if _XOPEN_SOURCE
+// is defined, so we define it here.
#if defined(__sgi)
-#define CTRL(c) ((c)&037)
+# define CTRL(c) ((c)&037)
#endif
#if defined(__sun)