Kaydet (Commit) 14c81aba authored tarafından Jesus Cea's avatar Jesus Cea

#16135: Removal of OS/2 support (Modules/*)

üst ab70e2ab
...@@ -14,11 +14,7 @@ ...@@ -14,11 +14,7 @@
*/ */
#if defined(HAVE_NDBM_H) #if defined(HAVE_NDBM_H)
#include <ndbm.h> #include <ndbm.h>
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
static char *which_dbm = "ndbm";
#else
static char *which_dbm = "GNU gdbm"; /* EMX port of GDBM */ static char *which_dbm = "GNU gdbm"; /* EMX port of GDBM */
#endif
#elif defined(HAVE_GDBM_NDBM_H) #elif defined(HAVE_GDBM_NDBM_H)
#include <gdbm/ndbm.h> #include <gdbm/ndbm.h>
static char *which_dbm = "GNU gdbm"; static char *which_dbm = "GNU gdbm";
......
...@@ -36,12 +36,8 @@ hpTimerUnit(void) ...@@ -36,12 +36,8 @@ hpTimerUnit(void)
#error "This module requires gettimeofday() on non-Windows platforms!" #error "This module requires gettimeofday() on non-Windows platforms!"
#endif #endif
#if (defined(PYOS_OS2) && defined(PYCC_GCC))
#include <sys/time.h>
#else
#include <sys/resource.h> #include <sys/resource.h>
#include <sys/times.h> #include <sys/times.h>
#endif
static PY_LONG_LONG static PY_LONG_LONG
hpTimer(void) hpTimer(void)
......
...@@ -79,9 +79,6 @@ typedef struct { ...@@ -79,9 +79,6 @@ typedef struct {
static user_signal_t *user_signals; static user_signal_t *user_signals;
/* the following macros come from Python: Modules/signalmodule.c */ /* the following macros come from Python: Modules/signalmodule.c */
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
#define NSIG 12
#endif
#ifndef NSIG #ifndef NSIG
# if defined(_NSIG) # if defined(_NSIG)
# define NSIG _NSIG /* For BSD/SysV */ # define NSIG _NSIG /* For BSD/SysV */
......
...@@ -325,11 +325,6 @@ fcntl_lockf(PyObject *self, PyObject *args) ...@@ -325,11 +325,6 @@ fcntl_lockf(PyObject *self, PyObject *args)
&lenobj, &startobj, &whence)) &lenobj, &startobj, &whence))
return NULL; return NULL;
#if defined(PYOS_OS2) && defined(PYCC_GCC)
PyErr_SetString(PyExc_NotImplementedError,
"lockf not supported on OS/2 (EMX)");
return NULL;
#else
#ifndef LOCK_SH #ifndef LOCK_SH
#define LOCK_SH 1 /* shared lock */ #define LOCK_SH 1 /* shared lock */
#define LOCK_EX 2 /* exclusive lock */ #define LOCK_EX 2 /* exclusive lock */
...@@ -383,7 +378,6 @@ fcntl_lockf(PyObject *self, PyObject *args) ...@@ -383,7 +378,6 @@ fcntl_lockf(PyObject *self, PyObject *args)
} }
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;
#endif /* defined(PYOS_OS2) && defined(PYCC_GCC) */
} }
PyDoc_STRVAR(lockf_doc, PyDoc_STRVAR(lockf_doc,
......
...@@ -160,12 +160,8 @@ pwd_getpwall(PyObject *self) ...@@ -160,12 +160,8 @@ pwd_getpwall(PyObject *self)
struct passwd *p; struct passwd *p;
if ((d = PyList_New(0)) == NULL) if ((d = PyList_New(0)) == NULL)
return NULL; return NULL;
#if defined(PYOS_OS2) && defined(PYCC_GCC)
if ((p = getpwuid(0)) != NULL) {
#else
setpwent(); setpwent();
while ((p = getpwent()) != NULL) { while ((p = getpwent()) != NULL) {
#endif
PyObject *v = mkpwent(p); PyObject *v = mkpwent(p);
if (v == NULL || PyList_Append(d, v) != 0) { if (v == NULL || PyList_Append(d, v) != 0) {
Py_XDECREF(v); Py_XDECREF(v);
......
...@@ -901,10 +901,6 @@ setup_readline(void) ...@@ -901,10 +901,6 @@ setup_readline(void)
using_history(); using_history();
rl_readline_name = "python"; rl_readline_name = "python";
#if defined(PYOS_OS2) && defined(PYCC_GCC)
/* Allow $if term= in .inputrc to work */
rl_terminal_name = getenv("TERM");
#endif
/* Force rebind of TAB to insert-tab */ /* Force rebind of TAB to insert-tab */
rl_bind_key('\t', rl_insert); rl_bind_key('\t', rl_insert);
/* Bind both ESC-TAB and ESC-ESC to the completion function */ /* Bind both ESC-TAB and ESC-ESC to the completion function */
......
...@@ -47,11 +47,6 @@ extern void bzero(void *, int); ...@@ -47,11 +47,6 @@ extern void bzero(void *, int);
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
#include <sys/time.h>
#include <utils.h>
#endif
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# include <winsock.h> # include <winsock.h>
......
...@@ -34,11 +34,6 @@ ...@@ -34,11 +34,6 @@
#define SIG_ERR ((PyOS_sighandler_t)(-1)) #define SIG_ERR ((PyOS_sighandler_t)(-1))
#endif #endif
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
#define NSIG 12
#include <process.h>
#endif
#ifndef NSIG #ifndef NSIG
# if defined(_NSIG) # if defined(_NSIG)
# define NSIG _NSIG /* For BSD/SysV */ # define NSIG _NSIG /* For BSD/SysV */
......
...@@ -223,13 +223,6 @@ if_indextoname(index) -- return the corresponding interface name\n\ ...@@ -223,13 +223,6 @@ if_indextoname(index) -- return the corresponding interface name\n\
#endif #endif
#if defined(PYOS_OS2)
# define INCL_DOS
# define INCL_DOSERRORS
# define INCL_NOPMAPI
# include <os2.h>
#endif
#if defined(__sgi) && _COMPILER_VERSION>700 && !_SGIAPI #if defined(__sgi) && _COMPILER_VERSION>700 && !_SGIAPI
/* make sure that the reentrant (gethostbyaddr_r etc) /* make sure that the reentrant (gethostbyaddr_r etc)
functions are declared correctly if compiling with functions are declared correctly if compiling with
...@@ -286,12 +279,7 @@ if_indextoname(index) -- return the corresponding interface name\n\ ...@@ -286,12 +279,7 @@ if_indextoname(index) -- return the corresponding interface name\n\
# include <unistd.h> # include <unistd.h>
/* Headers needed for inet_ntoa() and inet_addr() */ /* Headers needed for inet_ntoa() and inet_addr() */
# if defined(PYOS_OS2) && defined(PYCC_VACPP)
# include <netdb.h>
typedef size_t socklen_t;
# else
# include <arpa/inet.h> # include <arpa/inet.h>
# endif
# include <fcntl.h> # include <fcntl.h>
...@@ -395,11 +383,6 @@ dup_socket(SOCKET handle) ...@@ -395,11 +383,6 @@ dup_socket(SOCKET handle)
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
#define SOCKETCLOSE soclose
#define NO_DUP /* Sockets are Not Actual File Handles under OS/2 */
#endif
#ifndef SOCKETCLOSE #ifndef SOCKETCLOSE
#define SOCKETCLOSE close #define SOCKETCLOSE close
#endif #endif
...@@ -534,42 +517,6 @@ set_error(void) ...@@ -534,42 +517,6 @@ set_error(void)
return PyErr_SetExcFromWindowsErr(PyExc_OSError, err_no); return PyErr_SetExcFromWindowsErr(PyExc_OSError, err_no);
#endif #endif
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
if (sock_errno() != NO_ERROR) {
APIRET rc;
ULONG msglen;
char outbuf[100];
int myerrorcode = sock_errno();
/* Retrieve socket-related error message from MPTN.MSG file */
rc = DosGetMessage(NULL, 0, outbuf, sizeof(outbuf),
myerrorcode - SOCBASEERR + 26,
"mptn.msg",
&msglen);
if (rc == NO_ERROR) {
PyObject *v;
/* OS/2 doesn't guarantee a terminator */
outbuf[msglen] = '\0';
if (strlen(outbuf) > 0) {
/* If non-empty msg, trim CRLF */
char *lastc = &outbuf[ strlen(outbuf)-1 ];
while (lastc > outbuf &&
isspace(Py_CHARMASK(*lastc))) {
/* Trim trailing whitespace (CRLF) */
*lastc-- = '\0';
}
}
v = Py_BuildValue("(is)", myerrorcode, outbuf);
if (v != NULL) {
PyErr_SetObject(PyExc_OSError, v);
Py_DECREF(v);
}
return NULL;
}
}
#endif
return PyErr_SetFromErrno(PyExc_OSError); return PyErr_SetFromErrno(PyExc_OSError);
} }
...@@ -658,20 +605,17 @@ internal_setblocking(PySocketSockObject *s, int block) ...@@ -658,20 +605,17 @@ internal_setblocking(PySocketSockObject *s, int block)
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
#ifndef MS_WINDOWS #ifndef MS_WINDOWS
#if defined(PYOS_OS2) && !defined(PYCC_GCC) #if defined(__VMS)
block = !block;
ioctl(s->sock_fd, FIONBIO, (caddr_t)&block, sizeof(block));
#elif defined(__VMS)
block = !block; block = !block;
ioctl(s->sock_fd, FIONBIO, (unsigned int *)&block); ioctl(s->sock_fd, FIONBIO, (unsigned int *)&block);
#else /* !PYOS_OS2 && !__VMS */ #else /* !__VMS */
delay_flag = fcntl(s->sock_fd, F_GETFL, 0); delay_flag = fcntl(s->sock_fd, F_GETFL, 0);
if (block) if (block)
delay_flag &= (~O_NONBLOCK); delay_flag &= (~O_NONBLOCK);
else else
delay_flag |= O_NONBLOCK; delay_flag |= O_NONBLOCK;
fcntl(s->sock_fd, F_SETFL, delay_flag); fcntl(s->sock_fd, F_SETFL, delay_flag);
#endif /* !PYOS_OS2 */ #endif /* !__VMS */
#else /* MS_WINDOWS */ #else /* MS_WINDOWS */
block = !block; block = !block;
ioctlsocket(s->sock_fd, FIONBIO, (u_long*)&block); ioctlsocket(s->sock_fd, FIONBIO, (u_long*)&block);
...@@ -1329,11 +1273,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args, ...@@ -1329,11 +1273,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
} }
addr->sun_family = s->sock_family; addr->sun_family = s->sock_family;
memcpy(addr->sun_path, path, len); memcpy(addr->sun_path, path, len);
#if defined(PYOS_OS2)
*len_ret = sizeof(*addr);
#else
*len_ret = len + offsetof(struct sockaddr_un, sun_path); *len_ret = len + offsetof(struct sockaddr_un, sun_path);
#endif
retval = 1; retval = 1;
unix_out: unix_out:
Py_DECREF(args); Py_DECREF(args);
...@@ -2820,13 +2760,8 @@ sock_recvfrom_guts(PySocketSockObject *s, char* cbuf, Py_ssize_t len, int flags, ...@@ -2820,13 +2760,8 @@ sock_recvfrom_guts(PySocketSockObject *s, char* cbuf, Py_ssize_t len, int flags,
timeout = internal_select_ex(s, 0, interval); timeout = internal_select_ex(s, 0, interval);
if (!timeout) { if (!timeout) {
#ifndef MS_WINDOWS #ifndef MS_WINDOWS
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
n = recvfrom(s->sock_fd, cbuf, len, flags,
SAS2SA(&addrbuf), &addrlen);
#else
n = recvfrom(s->sock_fd, cbuf, len, flags, n = recvfrom(s->sock_fd, cbuf, len, flags,
(void *) &addrbuf, &addrlen); (void *) &addrbuf, &addrlen);
#endif
#else #else
n = recvfrom(s->sock_fd, cbuf, len, flags, n = recvfrom(s->sock_fd, cbuf, len, flags,
SAS2SA(&addrbuf), &addrlen); SAS2SA(&addrbuf), &addrlen);
...@@ -5509,32 +5444,6 @@ os_init(void) ...@@ -5509,32 +5444,6 @@ os_init(void)
#endif /* MS_WINDOWS */ #endif /* MS_WINDOWS */
#ifdef PYOS_OS2
#define OS_INIT_DEFINED
/* Additional initialization for OS/2 */
static int
os_init(void)
{
#ifndef PYCC_GCC
int rc = sock_init();
if (rc == 0) {
return 1; /* Success */
}
PyErr_Format(PyExc_ImportError, "OS/2 TCP/IP Error# %d", sock_errno());
return 0; /* Failure */
#else
/* No need to initialize sockets with GCC/EMX */
return 1; /* Success */
#endif
}
#endif /* PYOS_OS2 */
#ifndef OS_INIT_DEFINED #ifndef OS_INIT_DEFINED
static int static int
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# include <sys/socket.h> # include <sys/socket.h>
# endif # endif
# include <netinet/in.h> # include <netinet/in.h>
# if !(defined(__CYGWIN__) || (defined(PYOS_OS2) && defined(PYCC_VACPP))) # if !defined(__CYGWIN__)
# include <netinet/tcp.h> # include <netinet/tcp.h>
# endif # endif
......
...@@ -37,16 +37,6 @@ ...@@ -37,16 +37,6 @@
#endif /* MS_WINDOWS */ #endif /* MS_WINDOWS */
#endif /* !__WATCOMC__ || __QNX__ */ #endif /* !__WATCOMC__ || __QNX__ */
#if defined(PYOS_OS2)
#define INCL_DOS
#define INCL_ERRORS
#include <os2.h>
#endif
#if defined(PYCC_VACPP)
#include <sys/time.h>
#endif
#if defined(__APPLE__) #if defined(__APPLE__)
#include <mach/mach_time.h> #include <mach/mach_time.h>
#endif #endif
...@@ -1284,19 +1274,11 @@ PyInit_timezone(PyObject *m) { ...@@ -1284,19 +1274,11 @@ PyInit_timezone(PyObject *m) {
#if defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__) #if defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__)
PyObject *otz0, *otz1; PyObject *otz0, *otz1;
tzset(); tzset();
#ifdef PYOS_OS2
PyModule_AddIntConstant(m, "timezone", _timezone);
#else /* !PYOS_OS2 */
PyModule_AddIntConstant(m, "timezone", timezone); PyModule_AddIntConstant(m, "timezone", timezone);
#endif /* PYOS_OS2 */
#ifdef HAVE_ALTZONE #ifdef HAVE_ALTZONE
PyModule_AddIntConstant(m, "altzone", altzone); PyModule_AddIntConstant(m, "altzone", altzone);
#else #else
#ifdef PYOS_OS2
PyModule_AddIntConstant(m, "altzone", _timezone-3600);
#else /* !PYOS_OS2 */
PyModule_AddIntConstant(m, "altzone", timezone-3600); PyModule_AddIntConstant(m, "altzone", timezone-3600);
#endif /* PYOS_OS2 */
#endif #endif
PyModule_AddIntConstant(m, "daylight", daylight); PyModule_AddIntConstant(m, "daylight", daylight);
otz0 = PyUnicode_DecodeLocale(tzname[0], "surrogateescape"); otz0 = PyUnicode_DecodeLocale(tzname[0], "surrogateescape");
...@@ -1602,15 +1584,6 @@ floatsleep(double secs) ...@@ -1602,15 +1584,6 @@ floatsleep(double secs)
} }
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
} }
#elif defined(PYOS_OS2)
/* This Sleep *IS* Interruptable by Exceptions */
Py_BEGIN_ALLOW_THREADS
if (DosSleep(secs * 1000) != NO_ERROR) {
Py_BLOCK_THREADS
PyErr_SetFromErrno(PyExc_IOError);
return -1;
}
Py_END_ALLOW_THREADS
#else #else
/* XXX Can't interrupt this sleep */ /* XXX Can't interrupt this sleep */
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment