Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
bcc20748
Commit
bcc20748
authored
Aug 04, 1998
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes for BeOS, QNX and long long, by Chris Herborth.
parent
1a8791e0
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
132 additions
and
14 deletions
+132
-14
Modules/Makefile.pre.in
Modules/Makefile.pre.in
+2
-2
Modules/Setup.in
Modules/Setup.in
+1
-0
Modules/_localemodule.c
Modules/_localemodule.c
+3
-3
Modules/posixmodule.c
Modules/posixmodule.c
+5
-0
Modules/pwdmodule.c
Modules/pwdmodule.c
+12
-0
Modules/readline.c
Modules/readline.c
+9
-0
Modules/selectmodule.c
Modules/selectmodule.c
+8
-1
Modules/socketmodule.c
Modules/socketmodule.c
+40
-3
Modules/syslogmodule.c
Modules/syslogmodule.c
+2
-0
Modules/termios.c
Modules/termios.c
+4
-0
Modules/threadmodule.c
Modules/threadmodule.c
+8
-1
Modules/timemodule.c
Modules/timemodule.c
+38
-4
No files found.
Modules/Makefile.pre.in
View file @
bcc20748
...
...
@@ -82,7 +82,7 @@ SHELL= /bin/sh
MAKESETUP
=
$(srcdir)
/makesetup
# (The makesetup script inserts all variable definitions
found
# (The makesetup script inserts all variable definitions
# found in the Setup file just below the following line.
# This means that the Setup file can override any of the definitions
# given before this point, but not any given below.
...
...
@@ -112,7 +112,7 @@ all: $(OBJS)
add2lib
:
$(OBJS)
-
for
i
in
$(OBJS)
;
do
\
if
test
"
$$
i"
=
"signalmodule.o"
;
then
\
ar
d
$(LIBRARY)
sigcheck.o intrcheck.o 2>/dev/null
;
\
$(AR)
d
$(LIBRARY)
sigcheck.o intrcheck.o 2>/dev/null
;
\
break
;
\
fi
;
\
done
...
...
Modules/Setup.in
View file @
bcc20748
...
...
@@ -142,6 +142,7 @@ pwd pwdmodule.c # pwd(3)
grp
grpmodule.c
# grp(3)
select
selectmodule.c
# select(2); not on ancient System V
socket
socketmodule.c
# socket(2); not on ancient System V
#_socket socketmodule.c # socket(2); use this one for BeOS sockets
errno
errnomodule.c
# posix (UNIX) errno values
# The crypt module is now disabled by default because it breaks builds
...
...
Modules/_localemodule.c
View file @
bcc20748
...
...
@@ -92,7 +92,7 @@ fixup_ulcase()
if
(
isupper
(
c
))
ul
[
n
++
]
=
c
;
}
ulo
=
PyString_FromStringAndSize
((
char
*
)
ul
,
n
);
ulo
=
PyString_FromStringAndSize
((
c
onst
c
har
*
)
ul
,
n
);
if
(
!
ulo
)
return
;
if
(
string
)
PyDict_SetItemString
(
string
,
"uppercase"
,
ulo
);
...
...
@@ -105,7 +105,7 @@ fixup_ulcase()
if
(
islower
(
c
))
ul
[
n
++
]
=
c
;
}
ulo
=
PyString_FromStringAndSize
((
char
*
)
ul
,
n
);
ulo
=
PyString_FromStringAndSize
((
c
onst
c
har
*
)
ul
,
n
);
if
(
!
ulo
)
return
;
if
(
string
)
PyDict_SetItemString
(
string
,
"lowercase"
,
ulo
);
...
...
@@ -118,7 +118,7 @@ fixup_ulcase()
if
(
isalpha
(
c
))
ul
[
n
++
]
=
c
;
}
ulo
=
PyString_FromStringAndSize
((
char
*
)
ul
,
n
);
ulo
=
PyString_FromStringAndSize
((
c
onst
c
har
*
)
ul
,
n
);
if
(
!
ulo
)
return
;
if
(
string
)
PyDict_SetItemString
(
string
,
"letters"
,
ulo
);
...
...
Modules/posixmodule.c
View file @
bcc20748
...
...
@@ -2403,6 +2403,11 @@ static char posix_putenv__doc__[] =
"putenv(key, value) -> None
\n
\
Change or add an environment variable."
;
#ifdef __BEOS__
/* We have putenv(), but not in the headers (as of PR2). - [cjh] */
int
putenv
(
const
char
*
str
);
#endif
static
PyObject
*
posix_putenv
(
self
,
args
)
PyObject
*
self
;
...
...
Modules/pwdmodule.c
View file @
bcc20748
...
...
@@ -51,6 +51,13 @@ static PyObject *
mkpwent
(
p
)
struct
passwd
*
p
;
{
#ifdef __BEOS__
/* For faking the GECOS field. - [cjh] */
char
*
be_user
=
NULL
;
be_user
=
getenv
(
"USER"
);
#endif
return
Py_BuildValue
(
"(ssllsss)"
,
p
->
pw_name
,
...
...
@@ -64,7 +71,12 @@ mkpwent(p)
(
long
)
p
->
pw_uid
,
(
long
)
p
->
pw_gid
,
#endif
#ifdef __BEOS__
/* BeOS doesn't have a GECOS field, oddly enough. - [cjh] */
be_user
?
be_user
:
"baron"
,
#else
p
->
pw_gecos
,
#endif
p
->
pw_dir
,
p
->
pw_shell
);
}
...
...
Modules/readline.c
View file @
bcc20748
...
...
@@ -17,6 +17,14 @@
#endif
/* GNU readline definitions */
/* If you have string.h, you might need to add yourself to this #if... [cjh] */
#if defined(__BEOS__)
#undef HAVE_CONFIG_H
/* At max warnings, we need protos for everything. [cjh] */
#include <readline/readline.h>
#include <readline/history.h>
#include <unistd.h>
#else
#include <readline/readline.h>
/* You may need to add an -I option to Setup */
extern
int
rl_parse_and_bind
();
...
...
@@ -26,6 +34,7 @@ extern int rl_bind_key();
extern
int
rl_bind_key_in_map
();
extern
int
rl_initialize
();
extern
int
add_history
();
#endif
/* Pointers needed from outside (but not declared in a header file). */
extern
int
(
*
PyOS_InputHook
)();
...
...
Modules/selectmodule.c
View file @
bcc20748
...
...
@@ -33,6 +33,8 @@ PERFORMANCE OF THIS SOFTWARE.
Under Unix, the file descriptors are small integers.
Under Win32, select only exists for sockets, and sockets may
have any value except INVALID_SOCKET.
Under BeOS, we suffer the same dichotomy as Win32; sockets can be anything
>= 0.
*/
#include "Python.h"
...
...
@@ -56,9 +58,14 @@ extern void bzero();
#ifdef MS_WINDOWS
#include <winsock.h>
#else
#ifdef __BEOS__
#include <net/socket.h>
#define SOCKET int
#else
#include "myselect.h"
/* Also includes mytime.h */
#define SOCKET int
#endif
#endif
static
PyObject
*
SelectError
;
...
...
@@ -134,7 +141,7 @@ list2set(list, set, fd2obj)
"argument must be an int, or have a fileno() method."
);
goto
finally
;
}
#if
def _MSC_VER
#if
defined(_MSC_VER) || defined(__BEOS__)
max
=
0
;
/* not used for Win32 */
#else
/* !_MSC_VER */
if
(
v
<
0
||
v
>=
FD_SETSIZE
)
{
...
...
Modules/socketmodule.c
View file @
bcc20748
...
...
@@ -94,7 +94,7 @@ Socket methods:
#include <unistd.h>
#endif
#if !defined(MS_WINDOWS) && !defined(PYOS_OS2)
#if !defined(MS_WINDOWS) && !defined(PYOS_OS2)
&& !defined(__BEOS__)
extern
int
gethostname
();
/* For Solaris, at least */
#endif
...
...
@@ -113,6 +113,11 @@ extern int gethostname(); /* For Solaris, at least */
#include <os2.h>
#endif
#if defined(__BEOS__)
/* It's in the libs, but not the headers... - [cjh] */
int
shutdown
(
int
,
int
);
#endif
#include <sys/types.h>
#include "mytime.h"
...
...
@@ -147,7 +152,8 @@ extern int gethostname(); /* For Solaris, at least */
it must be compiled by the C++ compiler, as it takes the address of
a static data item exported from the main Python DLL.
*/
#ifdef MS_WINDOWS
#if defined(MS_WINDOWS) || defined(__BEOS__)
/* BeOS suffers from the same socket dichotomy as Win32... - [cjh] */
/* seem to be a few differences in the API */
#define close closesocket
#define NO_DUP
/* Actually it exists on NT 3.5, but what the heck... */
...
...
@@ -407,6 +413,11 @@ BUILD_FUNC_DEF_2(makesockaddr,struct sockaddr *,addr, int,addrlen)
return
Py_None
;
}
#ifdef __BEOS__
/* XXX: BeOS version of accept() doesn't set family coreectly */
addr
->
sa_family
=
AF_INET
;
#endif
switch
(
addr
->
sa_family
)
{
case
AF_INET
:
...
...
@@ -600,6 +611,11 @@ BUILD_FUNC_DEF_2(PySocketSock_setblocking,PySocketSockObject*,s,PyObject*,args)
if
(
!
PyArg_Parse
(
args
,
"i"
,
&
block
))
return
NULL
;
Py_BEGIN_ALLOW_THREADS
#ifdef __BEOS__
block
=
!
block
;
setsockopt
(
s
->
sock_fd
,
SOL_SOCKET
,
SO_NONBLOCK
,
(
void
*
)(
&
block
),
sizeof
(
int
)
);
#else
#ifndef MS_WINDOWS
#ifdef PYOS_OS2
block
=
!
block
;
...
...
@@ -616,6 +632,7 @@ BUILD_FUNC_DEF_2(PySocketSock_setblocking,PySocketSockObject*,s,PyObject*,args)
block
=
!
block
;
ioctlsocket
(
s
->
sock_fd
,
FIONBIO
,
(
u_long
*
)
&
block
);
#endif
/* MS_WINDOWS */
#endif
/* __BEOS__ */
Py_END_ALLOW_THREADS
Py_INCREF
(
Py_None
);
...
...
@@ -682,6 +699,12 @@ BUILD_FUNC_DEF_2(PySocketSock_getsockopt,PySocketSockObject *,s, PyObject *,args
PyObject
*
buf
;
int
buflen
=
0
;
#ifdef __BEOS__
/* We have incomplete socket support. */
PyErr_SetString
(
PySocket_Error
,
"getsockopt not supported"
);
return
NULL
;
#else
if
(
!
PyArg_ParseTuple
(
args
,
"ii|i"
,
&
level
,
&
optname
,
&
buflen
))
return
NULL
;
...
...
@@ -710,6 +733,7 @@ BUILD_FUNC_DEF_2(PySocketSock_getsockopt,PySocketSockObject *,s, PyObject *,args
}
_PyString_Resize
(
&
buf
,
buflen
);
return
buf
;
#endif
/* __BEOS__ */
}
static
char
getsockopt_doc
[]
=
...
...
@@ -1506,6 +1530,11 @@ BUILD_FUNC_DEF_2(PySocket_getprotobyname,PyObject *,self, PyObject *,args)
{
char
*
name
;
struct
protoent
*
sp
;
#ifdef __BEOS__
/* Not available in BeOS yet. - [cjh] */
PyErr_SetString
(
PySocket_Error
,
"getprotobyname not supported"
);
return
NULL
;
#else
if
(
!
PyArg_Parse
(
args
,
"s"
,
&
name
))
return
NULL
;
Py_BEGIN_ALLOW_THREADS
...
...
@@ -1516,6 +1545,7 @@ BUILD_FUNC_DEF_2(PySocket_getprotobyname,PyObject *,self, PyObject *,args)
return
NULL
;
}
return
PyInt_FromLong
((
long
)
sp
->
p_proto
);
#endif
}
static
char
getprotobyname_doc
[]
=
...
...
@@ -1866,7 +1896,7 @@ shutdown() -- shut down traffic in one or both directions\n\
(*) not available on all platforms!)"
;
void
#if defined(MS_WINDOWS) || defined(PYOS_OS2)
#if defined(MS_WINDOWS) || defined(PYOS_OS2)
|| defined(__BEOS__)
init_socket
()
#else
initsocket
()
...
...
@@ -1882,8 +1912,12 @@ initsocket()
if
(
!
OS2init
())
return
;
m
=
Py_InitModule3
(
"_socket"
,
PySocket_methods
,
module_doc
);
#else
#if defined(__BEOS__)
m
=
Py_InitModule3
(
"_socket"
,
PySocket_methods
,
module_doc
);
#else
m
=
Py_InitModule3
(
"socket"
,
PySocket_methods
,
module_doc
);
#endif
/* __BEOS__ */
#endif
#endif
d
=
PyModule_GetDict
(
m
);
...
...
@@ -1903,9 +1937,12 @@ initsocket()
#endif
/* AF_UNIX */
insint
(
d
,
"SOCK_STREAM"
,
SOCK_STREAM
);
insint
(
d
,
"SOCK_DGRAM"
,
SOCK_DGRAM
);
#ifndef __BEOS__
/* We have incomplete socket support. */
insint
(
d
,
"SOCK_RAW"
,
SOCK_RAW
);
insint
(
d
,
"SOCK_SEQPACKET"
,
SOCK_SEQPACKET
);
insint
(
d
,
"SOCK_RDM"
,
SOCK_RDM
);
#endif
#ifdef SO_DEBUG
insint
(
d
,
"SO_DEBUG"
,
SO_DEBUG
);
...
...
Modules/syslogmodule.c
View file @
bcc20748
...
...
@@ -207,7 +207,9 @@ initsyslog()
ins
(
d
,
"LOG_PID"
,
LOG_PID
);
ins
(
d
,
"LOG_CONS"
,
LOG_CONS
);
ins
(
d
,
"LOG_NDELAY"
,
LOG_NDELAY
);
#ifdef LOG_NOWAIT
ins
(
d
,
"LOG_NOWAIT"
,
LOG_NOWAIT
);
#endif
#ifdef LOG_PERROR
ins
(
d
,
"LOG_PERROR"
,
LOG_PERROR
);
#endif
...
...
Modules/termios.c
View file @
bcc20748
...
...
@@ -21,6 +21,10 @@ This module should be used in conjunction with the TERMIOS module,\n\
which defines the relevant symbolic constants."
;
#ifdef __BEOS__
#include <unistd.h>
#endif
#define BAD "bad termios argument"
static
PyObject
*
TermiosError
;
...
...
Modules/threadmodule.c
View file @
bcc20748
...
...
@@ -56,7 +56,7 @@ staticforward PyTypeObject Locktype;
#define is_lockobject(v) ((v)->ob_type == &Locktype)
type_lock
static
type_lock
getlocklock
(
lock
)
PyObject
*
lock
;
{
...
...
@@ -252,7 +252,14 @@ t_bootstrap(boot_raw)
PyThreadState_Clear
(
tstate
);
PyEval_ReleaseThread
(
tstate
);
PyThreadState_Delete
(
tstate
);
#ifdef __BEOS__
/* Dunno if this will cause problems with other ports; the BeOS thread
* support features only 100% renamed functions. [cjh]
*/
PyThread_exit_thread
();
#else
exit_thread
();
#endif
}
static
PyObject
*
...
...
Modules/timemodule.c
View file @
bcc20748
...
...
@@ -53,14 +53,17 @@ PERFORMANCE OF THIS SOFTWARE.
#include <unistd.h>
#endif
#if
def HAVE_SELECT
#if
defined(HAVE_SELECT) && !defined(__BEOS__)
#include "myselect.h"
#else
#include "mytime.h"
#endif
#ifdef HAVE_FTIME
#ifndef __BEOS__
/* We have ftime(), but not in the headers (PR2). - [cjh] */
#include <sys/timeb.h>
#endif
#if !defined(MS_WINDOWS) && !defined(PYOS_OS2)
extern
int
ftime
();
#endif
/* MS_WINDOWS */
...
...
@@ -99,6 +102,12 @@ extern int ftime();
#define timezone _timezone
#endif
#ifdef __BEOS__
/* For bigtime_t, snooze(). - [cjh] */
#include <support/SupportDefs.h>
#include <kernel/OS.h>
#endif
/* Forward declarations */
static
int
floatsleep
Py_PROTO
((
double
));
static
double
floattime
Py_PROTO
(());
...
...
@@ -670,7 +679,7 @@ floattime()
}
#endif
/* !HAVE_GETTIMEOFDAY */
{
#if
def HAVE_FTIME
#if
defined(HAVE_FTIME) && !defined(__BEOS__)
struct
timeb
t
;
ftime
(
&
t
);
return
(
double
)
t
.
time
+
(
double
)
t
.
millitm
*
(
double
)
0
.
001
;
...
...
@@ -696,7 +705,7 @@ floatsleep(double secs)
#endif
/* MPW */
{
/* XXX Should test for MS_WIN32 first! */
#if
def HAVE_SELECT
#if
defined(HAVE_SELECT) && !defined(__BEOS__)
struct
timeval
t
;
double
frac
;
frac
=
fmod
(
secs
,
1
.
0
);
...
...
@@ -710,7 +719,7 @@ floatsleep(double secs)
return
-
1
;
}
Py_END_ALLOW_THREADS
#else
/* !HAVE_SELECT */
#else
/* !HAVE_SELECT
|| __BEOS__
*/
#ifdef macintosh
#define MacTicks (* (long *)0x16A)
long
deadline
;
...
...
@@ -773,10 +782,35 @@ floatsleep(double secs)
}
Py_END_ALLOW_THREADS
#else
/* !PYOS_OS2 */
#ifdef __BEOS__
/* This sleep *CAN BE* interrupted. */
{
bigtime_t
frac
,
seconds
;
extern
double
fmod
Py_PROTO
((
double
,
double
));
extern
double
floor
Py_PROTO
((
double
));
if
(
secs
<=
0
.
0
)
{
return
;
}
frac
=
(
bigtime_t
)
fmod
(
secs
,
1
.
0
);
seconds
=
(
bigtime_t
)
floor
(
secs
);
Py_BEGIN_ALLOW_THREADS
if
(
snooze
(
seconds
*
(
bigtime_t
)
1000
+
frac
)
==
B_INTERRUPTED
)
{
Py_BLOCK_THREADS
PyErr_SetFromErrno
(
PyExc_IOError
);
return
-
1
;
}
Py_END_ALLOW_THREADS
}
#else
/* !__BEOS__ */
/* XXX Can't interrupt this sleep */
Py_BEGIN_ALLOW_THREADS
sleep
((
int
)
secs
);
Py_END_ALLOW_THREADS
#endif
/* !__BEOS__ */
#endif
/* !PYOS_OS2 */
#endif
/* !MS_WIN32 */
#endif
/* !MSDOS */
...
...
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