[Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.160,2.161 resource.c,2.15,2.16 socketmodule.c,1.120,1.121

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


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

Modified Files:
	posixmodule.c resource.c socketmodule.c 
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: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.160
retrieving revision 2.161
diff -C2 -r2.160 -r2.161
*** posixmodule.c	2000/07/23 19:47:12	2.160
--- posixmodule.c	2000/07/24 16:06:23	2.161
***************
*** 129,140 ****
  #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 */
  #if defined(PYCC_VACPP)
  extern int mkdir(char *);
--- 129,133 ----
  #endif
  
! #ifndef HAVE_UNISTD_H
  #if defined(PYCC_VACPP)
  extern int mkdir(char *);
***************
*** 722,727 ****
   does not force update of metadata.";
  
- extern int fdatasync(int); /* Prototype just in case */
- 
  static PyObject *
  posix_fdatasync(PyObject *self, PyObject *args)
--- 715,718 ----
***************
*** 1681,1690 ****
  #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 */
--- 1672,1675 ----
***************
*** 1702,1707 ****
  #ifndef HAVE_OPENPTY
  	char * slave_name;
- 	/* SGI apparently needs this forward declaration */
- 	extern char * _getpty(int *, int, mode_t, int);
  #endif
  
--- 1687,1690 ----
***************
*** 1720,1724 ****
  	if (slave_fd < 0)
  		return posix_error();
! #endif /* defined(HAVE_OPENPTY) */
  
  	return Py_BuildValue("(ii)", master_fd, slave_fd);
--- 1703,1707 ----
  	if (slave_fd < 0)
  		return posix_error();
! #endif /* HAVE_OPENPTY */
  
  	return Py_BuildValue("(ii)", master_fd, slave_fd);
***************
*** 3287,3291 ****
  posix_fdopen(PyObject *self, PyObject *args)
  {
- 	extern int fclose(FILE *);
  	int fd;
  	char *mode = "r";
--- 3270,3273 ----

Index: resource.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/resource.c,v
retrieving revision 2.15
retrieving revision 2.16
diff -C2 -r2.15 -r2.16
*** resource.c	2000/07/21 06:00:07	2.15
--- resource.c	2000/07/24 16:06:23	2.16
***************
*** 23,30 ****
     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)
--- 23,26 ----

Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.120
retrieving revision 1.121
diff -C2 -r1.120 -r1.121
*** socketmodule.c	2000/07/24 01:45:11	1.120
--- socketmodule.c	2000/07/24 16:06:23	1.121
***************
*** 111,118 ****
  #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>
--- 111,114 ----
***************
*** 130,138 ****
  #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"
--- 126,129 ----
***************
*** 2408,2414 ****
  DL_EXPORT(void)
  #if defined(MS_WINDOWS) || defined(PYOS_OS2) || defined(__BEOS__)
! init_socket()
  #else
! initsocket()
  #endif
  {
--- 2399,2405 ----
  DL_EXPORT(void)
  #if defined(MS_WINDOWS) || defined(PYOS_OS2) || defined(__BEOS__)
! init_socket(void)
  #else
! initsocket(void)
  #endif
  {