[Python-checkins] CVS: python/dist/src/Include pyport.h,2.5,2.6

Thomas Wouters python-dev@python.org
Mon, 24 Jul 2000 09:06:26 -0700


Update of /cvsroot/python/python/dist/src/Include
In directory slayer.i.sourceforge.net:/tmp/cvs-serv8962/Include

Modified Files:
	pyport.h 
Log Message:

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.



Index: pyport.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v
retrieving revision 2.5
retrieving revision 2.6
diff -C2 -r2.5 -r2.6
*** pyport.h	2000/07/23 21:18:08	2.5
--- pyport.h	2000/07/24 16:06:23	2.6
***************
*** 75,78 ****
--- 75,140 ----
  #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
  }