@@ -223,13 +223,6 @@ if_indextoname(index) -- return the corresponding interface name\n\
223223#endif
224224
225225
226- #if defined(PYOS_OS2 )
227- # define INCL_DOS
228- # define INCL_DOSERRORS
229- # define INCL_NOPMAPI
230- # include <os2.h>
231- #endif
232-
233226#if defined(__sgi ) && _COMPILER_VERSION > 700 && !_SGIAPI
234227/* make sure that the reentrant (gethostbyaddr_r etc)
235228 functions are declared correctly if compiling with
@@ -286,12 +279,7 @@ if_indextoname(index) -- return the corresponding interface name\n\
286279# include <unistd.h>
287280
288281/* Headers needed for inet_ntoa() and inet_addr() */
289- # if defined(PYOS_OS2 ) && defined(PYCC_VACPP )
290- # include <netdb.h>
291- typedef size_t socklen_t ;
292- # else
293282# include <arpa/inet.h>
294- # endif
295283
296284# include <fcntl.h>
297285
@@ -395,11 +383,6 @@ dup_socket(SOCKET handle)
395383#define snprintf _snprintf
396384#endif
397385
398- #if defined(PYOS_OS2 ) && !defined(PYCC_GCC )
399- #define SOCKETCLOSE soclose
400- #define NO_DUP /* Sockets are Not Actual File Handles under OS/2 */
401- #endif
402-
403386#ifndef SOCKETCLOSE
404387#define SOCKETCLOSE close
405388#endif
@@ -534,42 +517,6 @@ set_error(void)
534517 return PyErr_SetExcFromWindowsErr (PyExc_OSError , err_no );
535518#endif
536519
537- #if defined(PYOS_OS2 ) && !defined(PYCC_GCC )
538- if (sock_errno () != NO_ERROR ) {
539- APIRET rc ;
540- ULONG msglen ;
541- char outbuf [100 ];
542- int myerrorcode = sock_errno ();
543-
544- /* Retrieve socket-related error message from MPTN.MSG file */
545- rc = DosGetMessage (NULL , 0 , outbuf , sizeof (outbuf ),
546- myerrorcode - SOCBASEERR + 26 ,
547- "mptn.msg" ,
548- & msglen );
549- if (rc == NO_ERROR ) {
550- PyObject * v ;
551-
552- /* OS/2 doesn't guarantee a terminator */
553- outbuf [msglen ] = '\0' ;
554- if (strlen (outbuf ) > 0 ) {
555- /* If non-empty msg, trim CRLF */
556- char * lastc = & outbuf [ strlen (outbuf )- 1 ];
557- while (lastc > outbuf &&
558- isspace (Py_CHARMASK (* lastc ))) {
559- /* Trim trailing whitespace (CRLF) */
560- * lastc -- = '\0' ;
561- }
562- }
563- v = Py_BuildValue ("(is)" , myerrorcode , outbuf );
564- if (v != NULL ) {
565- PyErr_SetObject (PyExc_OSError , v );
566- Py_DECREF (v );
567- }
568- return NULL ;
569- }
570- }
571- #endif
572-
573520 return PyErr_SetFromErrno (PyExc_OSError );
574521}
575522
@@ -658,20 +605,17 @@ internal_setblocking(PySocketSockObject *s, int block)
658605
659606 Py_BEGIN_ALLOW_THREADS
660607#ifndef MS_WINDOWS
661- #if defined(PYOS_OS2 ) && !defined(PYCC_GCC )
662- block = !block ;
663- ioctl (s -> sock_fd , FIONBIO , (caddr_t )& block , sizeof (block ));
664- #elif defined(__VMS )
608+ #if defined(__VMS )
665609 block = !block ;
666610 ioctl (s -> sock_fd , FIONBIO , (unsigned int * )& block );
667- #else /* !PYOS_OS2 && ! __VMS */
611+ #else /* !__VMS */
668612 delay_flag = fcntl (s -> sock_fd , F_GETFL , 0 );
669613 if (block )
670614 delay_flag &= (~O_NONBLOCK );
671615 else
672616 delay_flag |= O_NONBLOCK ;
673617 fcntl (s -> sock_fd , F_SETFL , delay_flag );
674- #endif /* !PYOS_OS2 */
618+ #endif /* !__VMS */
675619#else /* MS_WINDOWS */
676620 block = !block ;
677621 ioctlsocket (s -> sock_fd , FIONBIO , (u_long * )& block );
@@ -1329,11 +1273,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
13291273 }
13301274 addr -> sun_family = s -> sock_family ;
13311275 memcpy (addr -> sun_path , path , len );
1332- #if defined(PYOS_OS2 )
1333- * len_ret = sizeof (* addr );
1334- #else
13351276 * len_ret = len + offsetof(struct sockaddr_un , sun_path );
1336- #endif
13371277 retval = 1 ;
13381278 unix_out :
13391279 Py_DECREF (args );
@@ -2820,13 +2760,8 @@ sock_recvfrom_guts(PySocketSockObject *s, char* cbuf, Py_ssize_t len, int flags,
28202760 timeout = internal_select_ex (s , 0 , interval );
28212761 if (!timeout ) {
28222762#ifndef MS_WINDOWS
2823- #if defined(PYOS_OS2 ) && !defined(PYCC_GCC )
2824- n = recvfrom (s -> sock_fd , cbuf , len , flags ,
2825- SAS2SA (& addrbuf ), & addrlen );
2826- #else
28272763 n = recvfrom (s -> sock_fd , cbuf , len , flags ,
28282764 (void * ) & addrbuf , & addrlen );
2829- #endif
28302765#else
28312766 n = recvfrom (s -> sock_fd , cbuf , len , flags ,
28322767 SAS2SA (& addrbuf ), & addrlen );
@@ -5509,32 +5444,6 @@ os_init(void)
55095444#endif /* MS_WINDOWS */
55105445
55115446
5512- #ifdef PYOS_OS2
5513- #define OS_INIT_DEFINED
5514-
5515- /* Additional initialization for OS/2 */
5516-
5517- static int
5518- os_init (void )
5519- {
5520- #ifndef PYCC_GCC
5521- int rc = sock_init ();
5522-
5523- if (rc == 0 ) {
5524- return 1 ; /* Success */
5525- }
5526-
5527- PyErr_Format (PyExc_ImportError , "OS/2 TCP/IP Error# %d" , sock_errno ());
5528-
5529- return 0 ; /* Failure */
5530- #else
5531- /* No need to initialize sockets with GCC/EMX */
5532- return 1 ; /* Success */
5533- #endif
5534- }
5535-
5536- #endif /* PYOS_OS2 */
5537-
55385447
55395448#ifndef OS_INIT_DEFINED
55405449static int
0 commit comments