summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Include/pyport.h62
-rw-r--r--Modules/posixmodule.c22
-rw-r--r--Modules/resource.c4
-rw-r--r--Modules/socketmodule.c13
-rw-r--r--Python/sysmodule.c1
5 files changed, 66 insertions, 36 deletions
diff --git a/Include/pyport.h b/Include/pyport.h
index 52807a9..f4daebc 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -74,6 +74,68 @@ extern "C" {
#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE)
#endif
+
+
+/**************************************************************************
+Prototypes that are missing from the standard include files on some systems
+(and possibly only some versions of such systems.)
+
+Please be conservative with adding new ones, document them and enclose them
+in platform-specific #ifdefs.
+**************************************************************************/
+
+#ifdef SOLARIS
+/* Unchecked */
+extern int gethostname(char *, int);
+#endif
+
+#ifdef __BEOS__
+/* Unchecked */
+/* It's in the libs, but not the headers... - [cjh] */
+int shutdown( int, int );
+#endif
+
+#ifdef HAVE__GETPTY
+/* Unchecked */
+extern char * _getpty(int *, int, mode_t, int);
+#endif
+
+#if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY)
+#if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H)
+/* BSDI does not supply a prototype for the 'openpty' and 'forkpty'
+ functions, even though they are included in libutil. */
+#include <termios.h>
+extern int openpty(int *, int *, char *, struct termios *, struct winsize *);
+extern int forkpty(int *, char *, struct termios *, struct winsize *);
+#endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */
+#endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */
+
+
+/* These are pulled from various places. It isn't obvious on what platforms
+ they are necessary, nor what the exact prototype should look like (which
+ is likely to vary between platforms!) If you find you need one of these
+ declarations, please move them to a platform-specific block and include
+ proper prototypes. */
+#if 0
+
+/* From Modules/resource.c */
+extern int getrusage();
+extern int getpagesize();
+
+/* From Python/sysmodule.c and Modules/posixmodule.c */
+extern int fclose(FILE *);
+
+/* From Modules/posixmodule.c */
+extern int fdatasync(int);
+/* XXX These are supposedly for SunOS4.1.3 but "shouldn't hurt elsewhere" */
+extern int rename(const char *, const char *);
+extern int pclose(FILE *);
+extern int lstat(const char *, struct stat *);
+extern int symlink(const char *, const char *);
+extern int fsync(int fd);
+
+#endif /* 0 */
+
#ifdef __cplusplus
}
#endif
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index c342dcf..5c94e29 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -128,14 +128,7 @@ corresponding Unix manual entries for more information on calls.";
#define UNION_WAIT /* This should really be checked for by autoconf */
#endif
-#ifdef HAVE_UNISTD_H
-/* XXX These are for SunOS4.1.3 but shouldn't hurt elsewhere */
-extern int rename(const char *, const char *);
-extern int pclose(FILE *);
-extern int lstat(const char *, struct stat *);
-extern int symlink(const char *, const char *);
-extern int fsync(int fd);
-#else /* !HAVE_UNISTD_H */
+#ifndef HAVE_UNISTD_H
#if defined(PYCC_VACPP)
extern int mkdir(char *);
#else
@@ -721,8 +714,6 @@ static char posix_fdatasync__doc__[] =
force write of file with filedescriptor to disk.\n\
does not force update of metadata.";
-extern int fdatasync(int); /* Prototype just in case */
-
static PyObject *
posix_fdatasync(PyObject *self, PyObject *args)
{
@@ -1680,12 +1671,6 @@ posix_fork(PyObject *self, PyObject *args)
#else
#ifdef HAVE_LIBUTIL_H
#include <libutil.h>
-#else
-/* BSDI does not supply a prototype for the 'openpty' and 'forkpty'
- functions, even though they are included in libutil. */
-#include <termios.h>
-extern int openpty(int *, int *, char *, struct termios *, struct winsize *);
-extern int forkpty(int *, char *, struct termios *, struct winsize *);
#endif /* HAVE_LIBUTIL_H */
#endif /* HAVE_PTY_H */
#endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */
@@ -1701,8 +1686,6 @@ posix_openpty(PyObject *self, PyObject *args)
int master_fd, slave_fd;
#ifndef HAVE_OPENPTY
char * slave_name;
- /* SGI apparently needs this forward declaration */
- extern char * _getpty(int *, int, mode_t, int);
#endif
if (!PyArg_ParseTuple(args, ":openpty"))
@@ -1719,7 +1702,7 @@ posix_openpty(PyObject *self, PyObject *args)
slave_fd = open(slave_name, O_RDWR);
if (slave_fd < 0)
return posix_error();
-#endif /* defined(HAVE_OPENPTY) */
+#endif /* HAVE_OPENPTY */
return Py_BuildValue("(ii)", master_fd, slave_fd);
@@ -3286,7 +3269,6 @@ Return an open file object connected to a file descriptor.";
static PyObject *
posix_fdopen(PyObject *self, PyObject *args)
{
- extern int fclose(FILE *);
int fd;
char *mode = "r";
int bufsize = -1;
diff --git a/Modules/resource.c b/Modules/resource.c
index 9da87af..76fd731 100644
--- a/Modules/resource.c
+++ b/Modules/resource.c
@@ -22,10 +22,6 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
but we can't declare the prototype, to avoid errors
when the header files declare it different.
Worse, on some Linuxes, getpagesize() returns a size_t... */
-#ifndef linux
-int getrusage();
-int getpagesize();
-#endif
#define doubletime(TV) ((double)(TV).tv_sec + (TV).tv_usec * 0.000001)
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 914931f..a9bfb26 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -110,10 +110,6 @@ Socket methods:
#include <unistd.h>
#endif
-#if !defined(MS_WINDOWS) && !defined(PYOS_OS2) && !defined(__BEOS__)
-extern int gethostname(char *, size_t); /* For Solaris, at least */
-#endif
-
#if defined(PYCC_VACPP)
#include <types.h>
#include <io.h>
@@ -129,11 +125,6 @@ extern int gethostname(char *, size_t); /* For Solaris, at least */
#include <os2.h>
#endif
-#if defined(__BEOS__)
-/* It's in the libs, but not the headers... - [cjh] */
-int shutdown( int, int );
-#endif
-
#include <sys/types.h>
#include "mytime.h"
@@ -2407,9 +2398,9 @@ shutdown() -- shut down traffic in one or both directions\n\
DL_EXPORT(void)
#if defined(MS_WINDOWS) || defined(PYOS_OS2) || defined(__BEOS__)
-init_socket()
+init_socket(void)
#else
-initsocket()
+initsocket(void)
#endif
{
PyObject *m, *d;
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 85118f8..8883ba1 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -385,7 +385,6 @@ settrace() -- set the global debug tracing function\n\
PyObject *
_PySys_Init(void)
{
- extern int fclose(FILE *);
PyObject *m, *v, *sysdict;
PyObject *sysin, *sysout, *syserr;
char *s;