summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-05-03 09:14:54 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-05-03 09:14:54 (GMT)
commitc16f3bd8a391a68427a95e15a3c1894198ff0377 (patch)
tree113dca8c40c8a42cb665e6bcc4af44f9f68bd230 /Modules
parente59e2bab8fe0fc3d20e815ac0f9b83d361d0d715 (diff)
downloadcpython-c16f3bd8a391a68427a95e15a3c1894198ff0377.zip
cpython-c16f3bd8a391a68427a95e15a3c1894198ff0377.tar.gz
cpython-c16f3bd8a391a68427a95e15a3c1894198ff0377.tar.bz2
Patch #708495: Port more stuff to OpenVMS.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/bz2module.c2
-rw-r--r--Modules/fcntlmodule.c4
-rw-r--r--Modules/fpectlmodule.c4
-rw-r--r--Modules/grpmodule.c5
-rw-r--r--Modules/mmapmodule.c4
-rw-r--r--Modules/posixmodule.c84
-rw-r--r--Modules/socketmodule.c10
-rw-r--r--Modules/socketmodule.h6
8 files changed, 35 insertions, 84 deletions
diff --git a/Modules/bz2module.c b/Modules/bz2module.c
index 9289a02..83582bd 100644
--- a/Modules/bz2module.c
+++ b/Modules/bz2module.c
@@ -1309,7 +1309,9 @@ BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
break;
case 'U':
+#ifdef WITH_UNIVERSAL_NEWLINES
self->f_univ_newline = 1;
+#endif
break;
default:
diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c
index c495a77..9695057 100644
--- a/Modules/fcntlmodule.c
+++ b/Modules/fcntlmodule.c
@@ -182,7 +182,11 @@ fcntl_ioctl(PyObject *self, PyObject *args)
return NULL;
}
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) {
PyErr_SetFromErrno(PyExc_IOError);
diff --git a/Modules/fpectlmodule.c b/Modules/fpectlmodule.c
index 099cda0..241c1c2 100644
--- a/Modules/fpectlmodule.c
+++ b/Modules/fpectlmodule.c
@@ -188,6 +188,10 @@ static void fpe_reset(Sigfunc *handler)
ieee_set_fp_control(fp_control);
PyOS_setsig(SIGFPE, handler);
+/*-- DEC ALPHA VMS --------------------------------------------------------*/
+#elif defined(__ALPHA) && defined(__VMS)
+ PyOS_setsig(SIGFPE, handler);
+
/*-- Cray Unicos ----------------------------------------------------------*/
#elif defined(cray)
/* UNICOS delivers SIGFPE by default, but no matherr */
diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c
index 2882fab..ab9d3c5 100644
--- a/Modules/grpmodule.c
+++ b/Modules/grpmodule.c
@@ -58,12 +58,17 @@ mkgrent(struct group *p)
#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));
else {
SET(setIndex++, Py_None);
Py_INCREF(Py_None);
}
+#endif
SET(setIndex++, PyInt_FromLong((long) p->gr_gid));
SET(setIndex++, w);
#undef SET
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index c2c723c..56033e8 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -897,6 +897,10 @@ new_mmap_object(PyObject *self, PyObject *args, PyObject *kwdict)
}
#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,
"mmap length is greater than file size");
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 035bb36..ff81585 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -17,18 +17,7 @@
#include "structseq.h"
#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) */
PyDoc_STRVAR(posix__doc__,
@@ -325,63 +314,6 @@ static char **environ;
extern char **environ;
#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)
{
@@ -421,9 +353,7 @@ convertenviron(void)
Py_DECREF(k);
Py_DECREF(v);
}
-#if defined(__VMS)
- vms_add_posix_env(d);
-#elif defined(PYOS_OS2)
+#if defined(PYOS_OS2)
{
APIRET rc;
char buffer[1024]; /* OS/2 Provides a Documented Max of 1024 Chars */
@@ -1133,7 +1063,7 @@ posix_ttyname(PyObject *self, PyObject *args)
return NULL;
#if defined(__VMS)
- /* DECC V5.0 - only about FD= 0 @@ try getname()+$getdvi(dvi$_devnam) */
+ /* file descriptor 0 only, the default input device (stdin) */
if (id == 0) {
ret = ttyname();
}
@@ -1339,9 +1269,6 @@ posix_getcwd(PyObject *self, PyObject *noargs)
Py_BEGIN_ALLOW_THREADS
#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);
#endif
@@ -1378,9 +1305,6 @@ posix_getcwdu(PyObject *self, PyObject *noargs)
Py_BEGIN_ALLOW_THREADS
#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);
#endif
@@ -5183,11 +5107,7 @@ posix_pipe(PyObject *self, PyObject *noargs)
int fds[2];
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)
return posix_error();
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 843c5a9..f107e0b 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2199,7 +2199,11 @@ static PyObject *
socket_gethostbyname(PyObject *self, PyObject *args)
{
char *name;
+#ifdef ENABLE_IPV6
struct sockaddr_storage addrbuf;
+#else
+ struct sockaddr_in addrbuf;
+#endif
if (!PyArg_ParseTuple(args, "s:gethostbyname", &name))
return NULL;
@@ -2357,7 +2361,11 @@ socket_gethostbyname_ex(PyObject *self, PyObject *args)
{
char *name;
struct hostent *h;
- struct sockaddr_storage addr;
+#ifdef ENABLE_IPV6
+ struct sockaddr_storage addr;
+#else
+ struct sockaddr_in addr;
+#endif
struct sockaddr *sa;
PyObject *ret;
#ifdef HAVE_GETHOSTBYNAME_R
diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h
index 936acac..167d507 100644
--- a/Modules/socketmodule.h
+++ b/Modules/socketmodule.h
@@ -2,7 +2,11 @@
/* Includes needed for the sockaddr_* symbols below */
#ifndef MS_WINDOWS
-# include <sys/socket.h>
+#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)))
# include <netinet/tcp.h>