Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
8e9ebfd3
Kaydet (Commit)
8e9ebfd3
authored
Kas 22, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
os2 patch by Jeff Rush
üst
c0b93191
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
207 additions
and
23 deletions
+207
-23
osdefs.h
Include/osdefs.h
+1
-1
os.py
Lib/os.py
+12
-0
test_select.py
Lib/test/test_select.py
+1
-1
test_signal.py
Lib/test/test_signal.py
+2
-3
posixmodule.c
Modules/posixmodule.c
+0
-0
selectmodule.c
Modules/selectmodule.c
+5
-0
signalmodule.c
Modules/signalmodule.c
+5
-0
socketmodule.c
Modules/socketmodule.c
+116
-15
timemodule.c
Modules/timemodule.c
+21
-1
importdl.c
Python/importdl.c
+38
-0
thread.c
Python/thread.c
+4
-0
thread_os2.h
Python/thread_os2.h
+2
-2
No files found.
Include/osdefs.h
Dosyayı görüntüle @
8e9ebfd3
...
...
@@ -44,7 +44,7 @@ PERFORMANCE OF THIS SOFTWARE.
#define DELIM '\n'
#endif
#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) ||
defined(__DJGPP
__)
#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) ||
defined(__DJGPP__) || defined(__TOS_OS2
__)
#define SEP '\\'
#define ALTSEP '/'
#define MAXPATHLEN 256
...
...
Lib/os.py
Dosyayı görüntüle @
8e9ebfd3
...
...
@@ -59,6 +59,18 @@ elif 'dos' in _names:
import
dospath
path
=
dospath
del
dospath
elif
'os2'
in
_names
:
name
=
'os2'
curdir
=
'.'
;
pardir
=
'..'
;
sep
=
'
\\
'
;
pathsep
=
';'
defpath
=
'.;C:
\\
bin'
from
os2
import
*
try
:
from
os2
import
_exit
except
ImportError
:
pass
import
ntpath
path
=
ntpath
del
ntpath
elif
'mac'
in
_names
:
name
=
'mac'
curdir
=
':'
;
pardir
=
'::'
;
sep
=
':'
;
pathsep
=
'
\n
'
...
...
Lib/test/test_select.py
Dosyayı görüntüle @
8e9ebfd3
...
...
@@ -35,7 +35,7 @@ else:
def
test
():
import
sys
if
sys
.
platform
[:
3
]
in
(
'win'
,
'mac'
):
if
sys
.
platform
[:
3
]
in
(
'win'
,
'mac'
,
'os2'
):
if
verbose
:
print
"Can't test select easily on"
,
sys
.
platform
return
...
...
Lib/test/test_signal.py
Dosyayı görüntüle @
8e9ebfd3
...
...
@@ -4,9 +4,8 @@ import signal
import
os
import
sys
if
sys
.
platform
[:
3
]
==
'win'
:
raise
ImportError
,
"Can't test signal on Windows"
if
sys
.
platform
[:
3
]
in
(
'win'
,
'os2'
):
raise
ImportError
,
"Can't test signal on
%
s"
%
sys
.
platform
[:
3
]
if
verbose
:
x
=
'-x'
...
...
Modules/posixmodule.c
Dosyayı görüntüle @
8e9ebfd3
This diff is collapsed.
Click to expand it.
Modules/selectmodule.c
Dosyayı görüntüle @
8e9ebfd3
...
...
@@ -48,6 +48,11 @@ extern void bzero();
#include <sys/types.h>
#if defined(PYOS_OS2)
#include <sys/time.h>
#include <utils.h>
#endif
#ifdef MS_WINDOWS
#include <winsock.h>
#else
...
...
Modules/signalmodule.c
Dosyayı görüntüle @
8e9ebfd3
...
...
@@ -50,6 +50,11 @@ PERFORMANCE OF THIS SOFTWARE.
#define SIG_ERR ((RETSIGTYPE (*)())-1)
#endif
#if defined(PYOS_OS2)
#define NSIG 12
#include <process.h>
#endif
#ifndef NSIG
#ifdef _SIGMAX
#define NSIG (_SIGMAX + 1)
/* For QNX */
...
...
Modules/socketmodule.c
Dosyayı görüntüle @
8e9ebfd3
...
...
@@ -91,10 +91,25 @@ Socket methods:
#include <unistd.h>
#endif
#if
ndef MS_WINDOWS
#if
!defined(MS_WINDOWS) && !defined(PYOS_OS2)
extern
int
gethostname
();
/* For Solaris, at least */
#endif
#if defined(PYCC_VACPP)
#include <types.h>
#include <io.h>
#include <sys/ioctl.h>
#include <utils.h>
#include <ctype.h>
#endif
#if defined(PYOS_OS2)
#define INCL_DOS
#define INCL_DOSERRORS
#define INCL_NOPMAPI
#include <os2.h>
#endif
#include <sys/types.h>
#include "mytime.h"
...
...
@@ -136,6 +151,12 @@ extern int gethostname(); /* For Solaris, at least */
#define FORCE_ANSI_FUNC_DEFS
#endif
#if defined(PYOS_OS2)
#define close soclose
#define NO_DUP
/* Sockets are Not Actual File Handles under OS/2 */
#define FORCE_ANSI_FUNC_DEFS
#endif
#ifdef FORCE_ANSI_FUNC_DEFS
#define BUILD_FUNC_DEF_1( fnname, arg1type, arg1name ) \
fnname( arg1type arg1name )
...
...
@@ -198,6 +219,36 @@ PySocket_Err()
}
else
#endif
#if defined(PYOS_OS2)
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
;
outbuf
[
msglen
]
=
'\0'
;
/* OS/2 Doesn't Guarantee a Terminator */
if
(
strlen
(
outbuf
)
>
0
)
{
/* If Non-Empty Msg, Trim CRLF */
char
*
lastc
=
&
outbuf
[
strlen
(
outbuf
)
-
1
];
while
(
lastc
>
outbuf
&&
isspace
(
*
lastc
))
*
lastc
--
=
'\0'
;
/* Trim Trailing Whitespace (CRLF) */
}
v
=
Py_BuildValue
(
"(is)"
,
myerrorcode
,
outbuf
);
if
(
v
!=
NULL
)
{
PyErr_SetObject
(
PySocket_Error
,
v
);
Py_DECREF
(
v
);
}
return
NULL
;
}
}
#endif
return
PyErr_SetFromErrno
(
PySocket_Error
);
}
...
...
@@ -527,16 +578,21 @@ BUILD_FUNC_DEF_2(PySocketSock_setblocking,PySocketSockObject*,s,PyObject*,args)
return
NULL
;
Py_BEGIN_ALLOW_THREADS
#ifndef MS_WINDOWS
#ifdef PYOS_OS2
block
=
!
block
;
ioctl
(
s
->
sock_fd
,
FIONBIO
,
(
caddr_t
)
&
block
,
sizeof
(
block
));
#else
/* !PYOS_OS2 */
delay_flag
=
fcntl
(
s
->
sock_fd
,
F_GETFL
,
0
);
if
(
block
)
delay_flag
&=
(
~
O_NDELAY
);
else
delay_flag
|=
O_NDELAY
;
fcntl
(
s
->
sock_fd
,
F_SETFL
,
delay_flag
);
#else
#endif
/* !PYOS_OS2 */
#else
/* MS_WINDOWS */
block
=
!
block
;
ioctlsocket
(
s
->
sock_fd
,
FIONBIO
,
(
u_long
*
)
&
block
);
#endif
#endif
/* MS_WINDOWS */
Py_END_ALLOW_THREADS
Py_INCREF
(
Py_None
);
...
...
@@ -883,7 +939,11 @@ BUILD_FUNC_DEF_2(PySocketSock_recvfrom,PySocketSockObject *,s, PyObject *,args)
Py_BEGIN_ALLOW_THREADS
n
=
recvfrom
(
s
->
sock_fd
,
PyString_AsString
(
buf
),
len
,
flags
,
#ifndef MS_WINDOWS
#if defined(PYOS_OS2)
(
struct
sockaddr
*
)
addrbuf
,
&
addrlen
#else
(
ANY
*
)
addrbuf
,
&
addrlen
#endif
#else
(
struct
sockaddr
*
)
addrbuf
,
&
addrlen
#endif
...
...
@@ -1388,22 +1448,57 @@ NTinit()
#endif
/* MS_WINDOWS */
#if defined(PYOS_OS2)
/* Additional initialization and cleanup for OS/2 */
static
void
OS2cleanup
()
{
/* No cleanup is necessary for OS/2 Sockets */
}
static
int
OS2init
()
{
char
reason
[
64
];
int
rc
=
sock_init
();
if
(
rc
==
0
)
{
atexit
(
OS2cleanup
);
return
1
;
// Indicate Success
}
sprintf
(
reason
,
"OS/2 TCP/IP Error# %d"
,
sock_errno
());
PyErr_SetString
(
PyExc_ImportError
,
reason
);
return
0
;
// Indicate Failure
}
#endif
/* PYOS_OS2 */
/* Initialize this module.
This is called when the first 'import socket' is done,
via a table in config.c, if config.c is compiled with USE_SOCKET
defined.
For MS_WINDOWS (which means any Windows variant), this module
is actually called "_socket", and there's a wrapper "socket.py"
which implements some missing functionality (such as makefile(),
dup() and fromfd()). The import of "_socket" may fail with an
ImportError exception if initialization of WINSOCK fails. When
WINSOCK is initialized succesfully, a call to WSACleanup() is
scheduled to be made at exit time. */
* This is called when the first 'import socket' is done,
* via a table in config.c, if config.c is compiled with USE_SOCKET
* defined.
*
* For MS_WINDOWS (which means any Windows variant), this module
* is actually called "_socket", and there's a wrapper "socket.py"
* which implements some missing functionality (such as makefile(),
* dup() and fromfd()). The import of "_socket" may fail with an
* ImportError exception if initialization of WINSOCK fails. When
* WINSOCK is initialized succesfully, a call to WSACleanup() is
* scheduled to be made at exit time.
*
* For OS/2, this module is also called "_socket" and uses a wrapper
* "socket.py" which implements that functionality that is missing
* when PC operating systems don't put socket descriptors in the
* operating system's filesystem layer.
*/
void
#if
def MS_WINDOWS
#if
defined(MS_WINDOWS) || defined(PYOS_OS2)
init_socket
()
#else
initsocket
()
...
...
@@ -1415,7 +1510,13 @@ initsocket()
return
;
m
=
Py_InitModule
(
"_socket"
,
PySocket_methods
);
#else
#if defined(__TOS_OS2__)
if
(
!
OS2init
())
return
;
m
=
Py_InitModule
(
"_socket"
,
PySocket_methods
);
#else
m
=
Py_InitModule
(
"socket"
,
PySocket_methods
);
#endif
#endif
d
=
PyModule_GetDict
(
m
);
PySocket_Error
=
PyErr_NewException
(
"socket.error"
,
NULL
,
NULL
);
...
...
Modules/timemodule.c
Dosyayı görüntüle @
8e9ebfd3
...
...
@@ -59,7 +59,7 @@ PERFORMANCE OF THIS SOFTWARE.
#ifdef HAVE_FTIME
#include <sys/timeb.h>
#if
ndef MS_WINDOWS
#if
!defined(MS_WINDOWS) && !defined(PYOS_OS2)
extern
int
ftime
();
#endif
/* MS_WINDOWS */
#endif
/* HAVE_FTIME */
...
...
@@ -85,6 +85,18 @@ extern int ftime();
#undef HAVE_CLOCK
/* We have our own version down below */
#endif
/* MS_WIN32 */
#if defined(PYOS_OS2)
#define INCL_DOS
#define INCL_DOSERRORS
#define INCL_NOPMAPI
#include <os2.h>
#endif
#if defined(PYCC_VACPP)
#include <time.h>
#define timezone _timezone
#endif
/* Forward declarations */
static
int
floatsleep
Py_PROTO
((
double
));
static
double
floattime
Py_PROTO
(());
...
...
@@ -588,10 +600,18 @@ floatsleep(double secs)
Sleep
((
int
)(
secs
*
1000
));
Py_END_ALLOW_THREADS
#else
/* !MS_WIN32 */
#ifdef PYOS_OS2
/* This Sleep *IS* Interruptable by Exceptions */
if
(
DosSleep
(
secs
*
1000
)
!=
NO_ERROR
)
{
PyErr_SetFromErrno
(
PyExc_IOError
);
return
-
1
;
}
#else
/* !PYOS_OS2 */
/* XXX Can't interrupt this sleep */
Py_BEGIN_ALLOW_THREADS
sleep
((
int
)
secs
);
Py_END_ALLOW_THREADS
#endif
/* !PYOS_OS2 */
#endif
/* !MS_WIN32 */
#endif
/* !MSDOS */
#endif
/* !__WATCOMC__ */
...
...
Python/importdl.c
Dosyayı görüntüle @
8e9ebfd3
...
...
@@ -47,6 +47,7 @@ PERFORMANCE OF THIS SOFTWARE.
_AIX -- AIX style dynamic linking
MS_WIN32 -- Windows NT style dynamic linking (using DLLs)
MS_WIN16 -- Windows 16-bit dynamic linking (using DLLs)
PYOS_OS2 -- IBM OS/2 dynamic linking (using DLLs)
_DL_FUNCPTR_DEFINED -- if the typedef dl_funcptr has been defined
USE_MAC_DYNAMIC_LOADING -- Mac CFM shared libraries
SHORT_EXT -- short extension for dynamic module, e.g. ".so"
...
...
@@ -76,6 +77,17 @@ typedef void (*dl_funcptr)();
#define LONG_EXT "module.sl"
#endif
#if defined(PYOS_OS2)
#define DYNAMIC_LINK
#define INCL_DOSERRORS
#define INCL_DOSMODULEMGR
#include <os2.h>
typedef
int
(
*
APIENTRY
dl_funcptr
)();
#define _DL_FUNCPTR_DEFINED 1
#define SHORT_EXT ".pyd"
#define LONG_EXT ".dll"
#endif
#if defined(__NetBSD__)
#define DYNAMIC_LINK
#define USE_SHLIB
...
...
@@ -458,6 +470,32 @@ _PyImport_LoadDynamicModule(name, pathname, fp)
p
=
GetProcAddress
(
hDLL
,
funcname
);
}
#endif
/* MS_WIN16 */
#if defined(PYOS_OS2)
{
APIRET
rc
;
HMODULE
hDLL
;
char
failreason
[
256
];
rc
=
DosLoadModule
(
failreason
,
sizeof
(
failreason
),
pathname
,
&
hDLL
);
if
(
rc
!=
NO_ERROR
)
{
char
errBuf
[
256
];
sprintf
(
errBuf
,
"DLL load failed, rc = %d, problem '%s': %s"
,
rc
,
failreason
);
PyErr_SetString
(
PyExc_ImportError
,
errBuf
);
return
NULL
;
}
rc
=
DosQueryProcAddr
(
hDLL
,
0L
,
funcname
,
&
p
);
if
(
rc
!=
NO_ERROR
)
p
=
NULL
;
/* Signify Failure to Acquire Entrypoint */
}
#endif
/* PYOS_OS2 */
#ifdef USE_DL
p
=
dl_loadmod
(
Py_GetProgramName
(),
pathname
,
funcname
);
#endif
/* USE_DL */
...
...
Python/thread.c
Dosyayı görüntüle @
8e9ebfd3
...
...
@@ -149,6 +149,10 @@ void init_thread _P0()
#include "thread_nt.h"
#endif
#ifdef OS2_THREADS
#include "thread_os2.h"
#endif
/*
#ifdef FOOBAR_THREADS
#include "thread_foobar.h"
...
...
Python/thread_os2.h
Dosyayı görüntüle @
8e9ebfd3
...
...
@@ -56,7 +56,7 @@ int start_new_thread(void (*func)(void *), void *arg)
int
aThread
;
int
success
=
1
;
aThread
=
_beginthread
(
func
,
409
6
,
arg
);
aThread
=
_beginthread
(
func
,
NULL
,
6553
6
,
arg
);
if
(
aThread
==
-
1
)
{
success
=
0
;
...
...
@@ -210,7 +210,7 @@ void free_sema(type_sema aSemaphore)
}
void
down_sema
(
type_sema
aSemaphore
,
int
waitflag
)
int
down_sema
(
type_sema
aSemaphore
,
int
waitflag
)
{
return
-
1
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment