summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2000-07-24 16:06:23 (GMT)
committerThomas Wouters <thomas@python.org>2000-07-24 16:06:23 (GMT)
commit1e0c2f4bee43728930bd5f4dc77283f09c4ba004 (patch)
tree230e982075e5b0804e08d8fd24e73373dfffeb8a /Include
parent332c59c4efafd7b1f841dd144fa3843c8476de6e (diff)
downloadcpython-1e0c2f4bee43728930bd5f4dc77283f09c4ba004.zip
cpython-1e0c2f4bee43728930bd5f4dc77283f09c4ba004.tar.gz
cpython-1e0c2f4bee43728930bd5f4dc77283f09c4ba004.tar.bz2
Create a new section of pyport.h to hold all external function declarations
for systems that are missing those declarations from system include files. Start by moving a pointy-haired ones from their previous locations to the new section. (The gethostname() one, for instance, breaks on several systems, because some define it as (char *, size_t) and some as (char *, int).) I purposely decided not to include the summary of used #defines like Tim did in the first section of pyport.h. In my opinion, the number of #defines likedly to be used by this section would make such an overview unwieldy. I would suggest documenting the non-obvious ones, though.
Diffstat (limited to 'Include')
-rw-r--r--Include/pyport.h62
1 files changed, 62 insertions, 0 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