[Python-checkins] python/dist/src/Modules bz2module.c,1.18,1.19 fcntlmodule.c,2.38,2.39 fpectlmodule.c,2.18,2.19 grpmodule.c,2.20,2.21 mmapmodule.c,2.44,2.45 posixmodule.c,2.298,2.299 socketmodule.c,1.262,1.263 socketmodule.h,1.8,1.9

loewis@users.sourceforge.net loewis@users.sourceforge.net
Sat, 03 May 2003 02:14:56 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv20733/Modules

Modified Files:
	bz2module.c fcntlmodule.c fpectlmodule.c grpmodule.c 
	mmapmodule.c posixmodule.c socketmodule.c socketmodule.h 
Log Message:
Patch #708495: Port more stuff to OpenVMS.


Index: bz2module.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** bz2module.c	29 Apr 2003 14:53:06 -0000	1.18
--- bz2module.c	3 May 2003 09:14:53 -0000	1.19
***************
*** 1310,1314 ****
--- 1310,1316 ----
  
  			case 'U':
+ #ifdef WITH_UNIVERSAL_NEWLINES
  				self->f_univ_newline = 1;
+ #endif
  				break;
  

Index: fcntlmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/fcntlmodule.c,v
retrieving revision 2.38
retrieving revision 2.39
diff -C2 -d -r2.38 -r2.39
*** fcntlmodule.c	3 Mar 2003 12:29:42 -0000	2.38
--- fcntlmodule.c	3 May 2003 09:14:53 -0000	2.39
***************
*** 183,187 ****
--- 183,191 ----
  	}
  	Py_BEGIN_ALLOW_THREADS
+ #ifdef __VMS
+ 	ret = ioctl(fd, code, (void *)arg);
+ #else
  	ret = ioctl(fd, code, arg);
+ #endif
  	Py_END_ALLOW_THREADS
  	if (ret < 0) {

Index: fpectlmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/fpectlmodule.c,v
retrieving revision 2.18
retrieving revision 2.19
diff -C2 -d -r2.18 -r2.19
*** fpectlmodule.c	26 Sep 2002 16:52:02 -0000	2.18
--- fpectlmodule.c	3 May 2003 09:14:53 -0000	2.19
***************
*** 189,192 ****
--- 189,196 ----
      PyOS_setsig(SIGFPE, handler);
  
+ /*-- DEC ALPHA VMS --------------------------------------------------------*/
+ #elif defined(__ALPHA) && defined(__VMS)
+     PyOS_setsig(SIGFPE, handler);
+ 
  /*-- Cray Unicos ----------------------------------------------------------*/
  #elif defined(cray)

Index: grpmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/grpmodule.c,v
retrieving revision 2.20
retrieving revision 2.21
diff -C2 -d -r2.20 -r2.21
*** grpmodule.c	17 Sep 2002 07:05:25 -0000	2.20
--- grpmodule.c	3 May 2003 09:14:53 -0000	2.21
***************
*** 59,62 ****
--- 59,66 ----
  #define SET(i,val) PyStructSequence_SET_ITEM(v, i, val)
      SET(setIndex++, PyString_FromString(p->gr_name));
+ #ifdef __VMS
+     SET(setIndex++, Py_None);
+     Py_INCREF(Py_None);
+ #else
      if (p->gr_passwd)
  	    SET(setIndex++, PyString_FromString(p->gr_passwd));
***************
*** 65,68 ****
--- 69,73 ----
  	    Py_INCREF(Py_None);
      }
+ #endif
      SET(setIndex++, PyInt_FromLong((long) p->gr_gid));
      SET(setIndex++, w);

Index: mmapmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v
retrieving revision 2.44
retrieving revision 2.45
diff -C2 -d -r2.44 -r2.45
*** mmapmodule.c	9 Apr 2003 19:31:02 -0000	2.44
--- mmapmodule.c	3 May 2003 09:14:53 -0000	2.45
***************
*** 898,901 ****
--- 898,905 ----
  
  #ifdef HAVE_FSTAT
+ #  ifdef __VMS
+ 	/* on OpenVMS we must ensure that all bytes are written to the file */
+ 	fsync(fd);
+ #  endif
  	if (fstat(fd, &st) == 0 && (size_t)map_size > st.st_size) {
  		PyErr_SetString(PyExc_ValueError, 

Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.298
retrieving revision 2.299
diff -C2 -d -r2.298 -r2.299
*** posixmodule.c	23 Apr 2003 02:39:17 -0000	2.298
--- posixmodule.c	3 May 2003 09:14:53 -0000	2.299
***************
*** 18,33 ****
  
  #if defined(__VMS)
- #    include <ctype.h>			/* tolower() */
- #    include <descrip.h>		/* string descriptors */
- #    include <dvidef.h>			/* DVI$_name */
- #    include <file.h>			/* -> O_RDWR */
- #    include <jpidef.h>			/* JPI$_name */
- #    include <lib$routines.h>		/* LIB$name */
- #    include <ots$routines.h>		/* OTS$name */
- #    include <ssdef.h>			/* SS$_name */
  #    include <unixio.h>
- #    include <unixlib.h>
- #    include <stat.h>
- #    include <wait.h>			/* define wait() */
  #endif /* defined(__VMS) */
  
--- 18,22 ----
***************
*** 326,386 ****
  #endif /* !_MSC_VER */
  
- #if defined(__VMS)
- /* add some values to provide a similar environment like POSIX */
- static
- void
- vms_add_posix_env(PyObject *d)
- {
- 	PyObject *o;
- 	char* str;
- 
- 	str = getenv("LINES");
- 	o = Py_BuildValue("s", str);
- 	if (o != NULL) {
- 		(void)PyDict_SetItemString(d, "LINES", o);
- 		Py_DECREF(o);
- 	}
- 
- 	str = getenv("COLUMNS");
- 	o = Py_BuildValue("s", str);
- 	if (o != NULL) {
- 		(void)PyDict_SetItemString(d, "COLUMNS", o);
- 		Py_DECREF(o);
- 	}
- 
- 	str = getenv("USER");
- 	o = Py_BuildValue("s", str);
- 	if (o != NULL) {
- 		(void)PyDict_SetItemString(d, "USERNAME", o);
- 		Py_DECREF(o);
- 	}
- 	o = Py_BuildValue("s", str);
- 	if (o != NULL) {
- 		(void)PyDict_SetItemString(d, "LOGNAME", o);
- 		Py_DECREF(o);
- 	}
- 
- 	str = getenv("HOME");
- 	o = Py_BuildValue("s", str);
- 	if (o != NULL) {
- 		(void)PyDict_SetItemString(d, "HOME", o);
- 		Py_DECREF(o);
- 	}
- 
- 	str = getenv("PATH");
- 	o = Py_BuildValue("s", str);
- 	if (o != NULL) {
- 		(void)PyDict_SetItemString(d, "PATH", o);
- 		Py_DECREF(o);
- 	}
- 	/* OS = "OpenVMS" */
- 	o = PyString_FromString ("OpenVMS");
- 	if (o != NULL) {
- 		(void)PyDict_SetItemString(d, "OS", o);
- 		Py_DECREF(o);
- 	}
- }
- #endif /* __VMS */
- 
  static PyObject *
  convertenviron(void)
--- 315,318 ----
***************
*** 422,428 ****
  		Py_DECREF(v);
  	}
! #if defined(__VMS)
!         vms_add_posix_env(d);
! #elif defined(PYOS_OS2)
      {
          APIRET rc;
--- 354,358 ----
  		Py_DECREF(v);
  	}
! #if defined(PYOS_OS2)
      {
          APIRET rc;
***************
*** 1134,1138 ****
  
  #if defined(__VMS)
! 	/* DECC V5.0 - only about FD= 0 @@ try getname()+$getdvi(dvi$_devnam) */
  	if (id == 0) {
  		ret = ttyname();
--- 1064,1068 ----
  
  #if defined(__VMS)
!         /* file descriptor 0 only, the default input device (stdin) */
  	if (id == 0) {
  		ret = ttyname();
***************
*** 1340,1346 ****
  #if defined(PYOS_OS2) && defined(PYCC_GCC)
  	res = _getcwd2(buf, sizeof buf);
- #elif defined(__VMS)
- 	/* 0 = force Unix-style path if in the VMS DCL environment! */
- 	res = getcwd(buf, sizeof buf, 0);
  #else
  	res = getcwd(buf, sizeof buf);
--- 1270,1273 ----
***************
*** 1379,1385 ****
  #if defined(PYOS_OS2) && defined(PYCC_GCC)
  	res = _getcwd2(buf, sizeof buf);
- #elif defined(__VMS)
- 	/* 0 = force Unix-style path if in the VMS DCL environment! */
- 	res = getcwd(buf, sizeof buf, 0);
  #else
  	res = getcwd(buf, sizeof buf);
--- 1306,1309 ----
***************
*** 5184,5192 ****
  	int res;
  	Py_BEGIN_ALLOW_THREADS
- #if defined(__VMS)
- 	res = pipe(fds,0,2100); /* bigger mailbox quota than 512 */
- #else
  	res = pipe(fds);
- #endif
  	Py_END_ALLOW_THREADS
  	if (res != 0)
--- 5108,5112 ----

Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.262
retrieving revision 1.263
diff -C2 -d -r1.262 -r1.263
*** socketmodule.c	2 May 2003 15:40:46 -0000	1.262
--- socketmodule.c	3 May 2003 09:14:53 -0000	1.263
***************
*** 2200,2204 ****
--- 2200,2208 ----
  {
  	char *name;
+ #ifdef ENABLE_IPV6
  	struct sockaddr_storage addrbuf;
+ #else
+         struct sockaddr_in addrbuf;
+ #endif
  
  	if (!PyArg_ParseTuple(args, "s:gethostbyname", &name))
***************
*** 2358,2362 ****
  	char *name;
  	struct hostent *h;
! 	struct sockaddr_storage addr;
  	struct sockaddr *sa;
  	PyObject *ret;
--- 2362,2370 ----
  	char *name;
  	struct hostent *h;
! #ifdef ENABLE_IPV6
!         struct sockaddr_storage addr;
! #else
!         struct sockaddr_in addr;
! #endif
  	struct sockaddr *sa;
  	PyObject *ret;

Index: socketmodule.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** socketmodule.h	13 Jun 2002 15:07:44 -0000	1.8
--- socketmodule.h	3 May 2003 09:14:53 -0000	1.9
***************
*** 3,7 ****
  /* Includes needed for the sockaddr_* symbols below */
  #ifndef MS_WINDOWS
! # include <sys/socket.h>
  # include <netinet/in.h>
  # if !(defined(__BEOS__) || defined(__CYGWIN__) || (defined(PYOS_OS2) && defined(PYCC_VACPP)))
--- 3,11 ----
  /* Includes needed for the sockaddr_* symbols below */
  #ifndef MS_WINDOWS
! #ifdef __VMS
! #   include <socket.h>
! # else
! #   include <sys/socket.h>
! # endif
  # include <netinet/in.h>
  # if !(defined(__BEOS__) || defined(__CYGWIN__) || (defined(PYOS_OS2) && defined(PYCC_VACPP)))