Commit eb33e5ae authored by Skip Montanaro's avatar Skip Montanaro

Remove support for BeOS

parent e9af284e
......@@ -7,7 +7,7 @@
This module provides access to the BSD *socket* interface. It is available on
all modern Unix systems, Windows, MacOS, BeOS, OS/2, and probably additional
all modern Unix systems, Windows, MacOS, OS/2, and probably additional
platforms.
.. note::
......
......@@ -500,12 +500,6 @@ in platform-specific #ifdefs.
extern int gethostname(char *, int);
#endif
#ifdef __BEOS__
/* Unchecked */
/* It's in the libs, but not the headers... - [cjh] */
int shutdown(int, int);
#endif
#ifdef HAVE__GETPTY
#include <sys/types.h> /* we need to import mode_t */
extern char * _getpty(int *, int, mode_t, int);
......@@ -577,10 +571,10 @@ extern double hypot(double, double);
/*
All windows ports, except cygwin, are handled in PC/pyconfig.h.
BeOS and cygwin are the only other autoconf platform requiring special
linkage handling and both of these use __declspec().
Cygwin is the only other autoconf platform requiring special
linkage handling and it uses __declspec().
*/
#if defined(__CYGWIN__) || defined(__BEOS__)
#if defined(__CYGWIN__)
# define HAVE_DECLSPEC_DLL
#endif
......@@ -591,7 +585,7 @@ extern double hypot(double, double);
# define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE
# define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE
/* module init functions inside the core need no external linkage */
/* except for Cygwin to handle embedding (FIXME: BeOS too?) */
/* except for Cygwin to handle embedding */
# if defined(__CYGWIN__)
# define PyMODINIT_FUNC __declspec(dllexport) void
# else /* __CYGWIN__ */
......
......@@ -394,24 +394,6 @@ def _init_posix():
g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp)
elif sys.platform == 'beos':
# Linker script is in the config directory. In the Makefile it is
# relative to the srcdir, which after installation no longer makes
# sense.
python_lib = get_python_lib(standard_lib=1)
linkerscript_path = g['LDSHARED'].split()[0]
linkerscript_name = os.path.basename(linkerscript_path)
linkerscript = os.path.join(python_lib, 'config',
linkerscript_name)
# XXX this isn't the right place to do this: adding the Python
# library to the link, if needed, should be in the "build_ext"
# command. (It's also needed for non-MS compilers on Windows, and
# it's taken care of for them by the 'build_ext.get_libraries()'
# method.)
g['LDSHARED'] = ("%s -L%s/lib -lpython%s" %
(linkerscript, PREFIX, get_python_version()))
global _config_vars
_config_vars = g
......
# Generated by h2py from /boot/develop/headers/be/net/netinet/in.h
# Included from socket.h
# Included from BeBuild.h
B_BEOS_VERSION_4 = 0x0400
B_BEOS_VERSION_4_5 = 0x0450
B_BEOS_VERSION_5 = 0x0500
B_BEOS_VERSION = B_BEOS_VERSION_5
B_BEOS_VERSION_MAUI = B_BEOS_VERSION_5
_PR2_COMPATIBLE_ = 1
_PR3_COMPATIBLE_ = 1
_R4_COMPATIBLE_ = 1
_R4_5_COMPATIBLE_ = 1
_PR2_COMPATIBLE_ = 0
_PR3_COMPATIBLE_ = 0
_R4_COMPATIBLE_ = 1
_R4_5_COMPATIBLE_ = 1
def _UNUSED(x): return x
# Included from sys/types.h
# Included from time.h
# Included from be_setup.h
def __std(ref): return ref
__be_os = 2
__dest_os = __be_os
__MSL__ = 0x4011
__GLIBC__ = -2
__GLIBC_MINOR__ = 1
# Included from null.h
NULL = (0)
NULL = 0
# Included from size_t.h
# Included from stddef.h
# Included from wchar_t.h
CLOCKS_PER_SEC = 1000
CLK_TCK = CLOCKS_PER_SEC
MAX_TIMESTR = 70
# Included from sys/time.h
# Included from ByteOrder.h
# Included from endian.h
__LITTLE_ENDIAN = 1234
LITTLE_ENDIAN = __LITTLE_ENDIAN
__BYTE_ORDER = __LITTLE_ENDIAN
BYTE_ORDER = __BYTE_ORDER
__BIG_ENDIAN = 0
BIG_ENDIAN = 0
__BIG_ENDIAN = 4321
BIG_ENDIAN = __BIG_ENDIAN
__BYTE_ORDER = __BIG_ENDIAN
BYTE_ORDER = __BYTE_ORDER
__LITTLE_ENDIAN = 0
LITTLE_ENDIAN = 0
__PDP_ENDIAN = 3412
PDP_ENDIAN = __PDP_ENDIAN
# Included from SupportDefs.h
# Included from Errors.h
# Included from limits.h
# Included from float.h
FLT_ROUNDS = 1
FLT_RADIX = 2
FLT_MANT_DIG = 24
FLT_DIG = 6
FLT_MIN_EXP = (-125)
FLT_MIN_10_EXP = (-37)
FLT_MAX_EXP = 128
FLT_MAX_10_EXP = 38
DBL_MANT_DIG = 53
DBL_DIG = 15
DBL_MIN_EXP = (-1021)
DBL_MIN_10_EXP = (-308)
DBL_MAX_EXP = 1024
DBL_MAX_10_EXP = 308
LDBL_MANT_DIG = DBL_MANT_DIG
LDBL_DIG = DBL_DIG
LDBL_MIN_EXP = DBL_MIN_EXP
LDBL_MIN_10_EXP = DBL_MIN_10_EXP
LDBL_MAX_EXP = DBL_MAX_EXP
LDBL_MAX_10_EXP = DBL_MAX_10_EXP
CHAR_BIT = (8)
SCHAR_MIN = (-127-1)
SCHAR_MAX = (127)
CHAR_MIN = SCHAR_MIN
CHAR_MAX = SCHAR_MAX
MB_LEN_MAX = (1)
SHRT_MIN = (-32767-1)
SHRT_MAX = (32767)
LONG_MIN = (-2147483647-1)
LONG_MAX = (2147483647)
INT_MIN = LONG_MIN
INT_MAX = LONG_MAX
ARG_MAX = (32768)
ATEXIT_MAX = (32)
CHILD_MAX = (1024)
IOV_MAX = (256)
FILESIZEBITS = (64)
LINK_MAX = (1)
LOGIN_NAME_MAX = (32)
MAX_CANON = (255)
MAX_INPUT = (255)
NAME_MAX = (256)
NGROUPS_MAX = (32)
OPEN_MAX = (128)
PATH_MAX = (1024)
PIPE_MAX = (512)
SSIZE_MAX = (2147483647)
TTY_NAME_MAX = (256)
TZNAME_MAX = (32)
SYMLINKS_MAX = (16)
_POSIX_ARG_MAX = (32768)
_POSIX_CHILD_MAX = (1024)
_POSIX_LINK_MAX = (1)
_POSIX_LOGIN_NAME_MAX = (9)
_POSIX_MAX_CANON = (255)
_POSIX_MAX_INPUT = (255)
_POSIX_NAME_MAX = (255)
_POSIX_NGROUPS_MAX = (0)
_POSIX_OPEN_MAX = (128)
_POSIX_PATH_MAX = (1024)
_POSIX_PIPE_BUF = (512)
_POSIX_SSIZE_MAX = (2147483647)
_POSIX_STREAM_MAX = (8)
_POSIX_TTY_NAME_MAX = (256)
_POSIX_TZNAME_MAX = (3)
B_GENERAL_ERROR_BASE = LONG_MIN
B_OS_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x1000
B_APP_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x2000
B_INTERFACE_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x3000
B_MEDIA_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x4000
B_TRANSLATION_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x4800
B_MIDI_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x5000
B_STORAGE_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x6000
B_POSIX_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x7000
B_MAIL_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x8000
B_PRINT_ERROR_BASE = B_GENERAL_ERROR_BASE + 0x9000
B_DEVICE_ERROR_BASE = B_GENERAL_ERROR_BASE + 0xa000
B_ERRORS_END = (B_GENERAL_ERROR_BASE + 0xffff)
E2BIG = (B_POSIX_ERROR_BASE + 1)
ECHILD = (B_POSIX_ERROR_BASE + 2)
EDEADLK = (B_POSIX_ERROR_BASE + 3)
EFBIG = (B_POSIX_ERROR_BASE + 4)
EMLINK = (B_POSIX_ERROR_BASE + 5)
ENFILE = (B_POSIX_ERROR_BASE + 6)
ENODEV = (B_POSIX_ERROR_BASE + 7)
ENOLCK = (B_POSIX_ERROR_BASE + 8)
ENOSYS = (B_POSIX_ERROR_BASE + 9)
ENOTTY = (B_POSIX_ERROR_BASE + 10)
ENXIO = (B_POSIX_ERROR_BASE + 11)
ESPIPE = (B_POSIX_ERROR_BASE + 12)
ESRCH = (B_POSIX_ERROR_BASE + 13)
EFPOS = (B_POSIX_ERROR_BASE + 14)
ESIGPARM = (B_POSIX_ERROR_BASE + 15)
EDOM = (B_POSIX_ERROR_BASE + 16)
ERANGE = (B_POSIX_ERROR_BASE + 17)
EPROTOTYPE = (B_POSIX_ERROR_BASE + 18)
EPROTONOSUPPORT = (B_POSIX_ERROR_BASE + 19)
EPFNOSUPPORT = (B_POSIX_ERROR_BASE + 20)
EAFNOSUPPORT = (B_POSIX_ERROR_BASE + 21)
EADDRINUSE = (B_POSIX_ERROR_BASE + 22)
EADDRNOTAVAIL = (B_POSIX_ERROR_BASE + 23)
ENETDOWN = (B_POSIX_ERROR_BASE + 24)
ENETUNREACH = (B_POSIX_ERROR_BASE + 25)
ENETRESET = (B_POSIX_ERROR_BASE + 26)
ECONNABORTED = (B_POSIX_ERROR_BASE + 27)
ECONNRESET = (B_POSIX_ERROR_BASE + 28)
EISCONN = (B_POSIX_ERROR_BASE + 29)
ENOTCONN = (B_POSIX_ERROR_BASE + 30)
ESHUTDOWN = (B_POSIX_ERROR_BASE + 31)
ECONNREFUSED = (B_POSIX_ERROR_BASE + 32)
EHOSTUNREACH = (B_POSIX_ERROR_BASE + 33)
ENOPROTOOPT = (B_POSIX_ERROR_BASE + 34)
ENOBUFS = (B_POSIX_ERROR_BASE + 35)
EINPROGRESS = (B_POSIX_ERROR_BASE + 36)
EALREADY = (B_POSIX_ERROR_BASE + 37)
EILSEQ = (B_POSIX_ERROR_BASE + 38)
ENOMSG = (B_POSIX_ERROR_BASE + 39)
ESTALE = (B_POSIX_ERROR_BASE + 40)
EOVERFLOW = (B_POSIX_ERROR_BASE + 41)
EMSGSIZE = (B_POSIX_ERROR_BASE + 42)
EOPNOTSUPP = (B_POSIX_ERROR_BASE + 43)
ENOTSOCK = (B_POSIX_ERROR_BASE + 44)
false = 0
true = 1
NULL = (0)
FALSE = 0
TRUE = 1
# Included from TypeConstants.h
B_HOST_IS_LENDIAN = 1
B_HOST_IS_BENDIAN = 0
def B_HOST_TO_LENDIAN_DOUBLE(arg): return (double)(arg)
def B_HOST_TO_LENDIAN_FLOAT(arg): return (float)(arg)
def B_HOST_TO_LENDIAN_INT64(arg): return (uint64)(arg)
def B_HOST_TO_LENDIAN_INT32(arg): return (uint32)(arg)
def B_HOST_TO_LENDIAN_INT16(arg): return (uint16)(arg)
def B_HOST_TO_BENDIAN_DOUBLE(arg): return __swap_double(arg)
def B_HOST_TO_BENDIAN_FLOAT(arg): return __swap_float(arg)
def B_HOST_TO_BENDIAN_INT64(arg): return __swap_int64(arg)
def B_HOST_TO_BENDIAN_INT32(arg): return __swap_int32(arg)
def B_HOST_TO_BENDIAN_INT16(arg): return __swap_int16(arg)
def B_LENDIAN_TO_HOST_DOUBLE(arg): return (double)(arg)
def B_LENDIAN_TO_HOST_FLOAT(arg): return (float)(arg)
def B_LENDIAN_TO_HOST_INT64(arg): return (uint64)(arg)
def B_LENDIAN_TO_HOST_INT32(arg): return (uint32)(arg)
def B_LENDIAN_TO_HOST_INT16(arg): return (uint16)(arg)
def B_BENDIAN_TO_HOST_DOUBLE(arg): return __swap_double(arg)
def B_BENDIAN_TO_HOST_FLOAT(arg): return __swap_float(arg)
def B_BENDIAN_TO_HOST_INT64(arg): return __swap_int64(arg)
def B_BENDIAN_TO_HOST_INT32(arg): return __swap_int32(arg)
def B_BENDIAN_TO_HOST_INT16(arg): return __swap_int16(arg)
B_HOST_IS_LENDIAN = 0
B_HOST_IS_BENDIAN = 1
def B_HOST_TO_LENDIAN_DOUBLE(arg): return __swap_double(arg)
def B_HOST_TO_LENDIAN_FLOAT(arg): return __swap_float(arg)
def B_HOST_TO_LENDIAN_INT64(arg): return __swap_int64(arg)
def B_HOST_TO_LENDIAN_INT32(arg): return __swap_int32(arg)
def B_HOST_TO_LENDIAN_INT16(arg): return __swap_int16(arg)
def B_HOST_TO_BENDIAN_DOUBLE(arg): return (double)(arg)
def B_HOST_TO_BENDIAN_FLOAT(arg): return (float)(arg)
def B_HOST_TO_BENDIAN_INT64(arg): return (uint64)(arg)
def B_HOST_TO_BENDIAN_INT32(arg): return (uint32)(arg)
def B_HOST_TO_BENDIAN_INT16(arg): return (uint16)(arg)
def B_LENDIAN_TO_HOST_DOUBLE(arg): return __swap_double(arg)
def B_LENDIAN_TO_HOST_FLOAT(arg): return __swap_float(arg)
def B_LENDIAN_TO_HOST_INT64(arg): return __swap_int64(arg)
def B_LENDIAN_TO_HOST_INT32(arg): return __swap_int32(arg)
def B_LENDIAN_TO_HOST_INT16(arg): return __swap_int16(arg)
def B_BENDIAN_TO_HOST_DOUBLE(arg): return (double)(arg)
def B_BENDIAN_TO_HOST_FLOAT(arg): return (float)(arg)
def B_BENDIAN_TO_HOST_INT64(arg): return (uint64)(arg)
def B_BENDIAN_TO_HOST_INT32(arg): return (uint32)(arg)
def B_BENDIAN_TO_HOST_INT16(arg): return (uint16)(arg)
def B_SWAP_DOUBLE(arg): return __swap_double(arg)
def B_SWAP_FLOAT(arg): return __swap_float(arg)
def B_SWAP_INT64(arg): return __swap_int64(arg)
def B_SWAP_INT32(arg): return __swap_int32(arg)
def B_SWAP_INT16(arg): return __swap_int16(arg)
def htonl(x): return B_HOST_TO_BENDIAN_INT32(x)
def ntohl(x): return B_BENDIAN_TO_HOST_INT32(x)
def htons(x): return B_HOST_TO_BENDIAN_INT16(x)
def ntohs(x): return B_BENDIAN_TO_HOST_INT16(x)
AF_INET = 1
INADDR_ANY = 0x00000000
INADDR_BROADCAST = 0xffffffff
INADDR_LOOPBACK = 0x7f000001
SOL_SOCKET = 1
SO_DEBUG = 1
SO_REUSEADDR = 2
SO_NONBLOCK = 3
SO_REUSEPORT = 4
MSG_OOB = 0x1
SOCK_DGRAM = 1
SOCK_STREAM = 2
IPPROTO_UDP = 1
IPPROTO_TCP = 2
IPPROTO_ICMP = 3
B_UDP_MAX_SIZE = (65536 - 1024)
FD_SETSIZE = 256
FDSETSIZE = FD_SETSIZE
NFDBITS = 32
def _FDMSKNO(fd): return ((fd) / NFDBITS)
def _FDBITNO(fd): return ((fd) % NFDBITS)
#! /bin/sh
H2PY=../../Tools/scripts/h2py.py
HEADERS=/boot/develop/headers
set -v
python $H2PY -i '(u_long)' $HEADERS/be/net/netinet/in.h
......@@ -7,9 +7,6 @@ child after a fork().
On some systems (e.g. Solaris without posix threads) we find that all
active threads survive in the child after a fork(); this is an error.
While BeOS doesn't officially support fork and native threading in
the same application, the present example should work just fine. DC
"""
import os, sys, time, thread, unittest
......
......@@ -875,17 +875,6 @@ libainstall: all
echo; echo "See Misc/AIX-NOTES for details."; \
else true; \
fi
@case "$(MACHDEP)" in beos*) \
echo; echo "Installing support files for building shared extension modules on BeOS:"; \
$(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \
echo; echo "$(LIBPL)/README"; \
$(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \
echo "$(LIBPL)/ar_beos"; \
$(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \
echo "$(LIBPL)/ld_so_beos"; \
echo; echo "See Misc/BeOS-NOTES for details."; \
;; \
esac
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
......
Python for BeOS R5
In Python-2.1, the standard version of the new setup.py program
will not build the full complement of modules on BeOS. Instead,
please replace it with the special BeOS version in Misc/BeOS-setup.py.
To build,
1) cp Misc/BeOS-setup.py setup.py
2) ./configure --prefix=/boot/home/config
3) make
The modules will all build, except termios which assumes some flags
we don't have. Put a libreadline.a in /boot/home/config/lib to get
a readline.so for your interactive editing convenience; NB, not
libreadline.so, you want to link a static readline library into the
dynamically loaded Python module.
Test:
make test
The BeOS is Not UNIX category:
- test_select crashed -- select.error : (-2147459072, 'Bad file descriptor')
- test_socket crashed -- exceptions.AttributeError : SOCK_RAW
- test_fcntl crashed -- exceptions.IOError: [Errno -2147483643] Invalid argument
This one is funny! BeOS does support large files, and that's why
we get this error: the file is too big for my filesystem!
- test_largefile crashed -- exceptions.IOError: [Errno -2147459065]
No space left on device
- test_pickle crashed. This is apparently a serious problem, "complex"
number objects reconstructed from a pickle don't compare equal to
their ancestors. But it happens on BeOS PPC only, not Intel.
Install:
make install
Maintainer: Mikael Jansson (mail at mikael.jansson.be)
This diff is collapsed.
......@@ -9,8 +9,6 @@ Files found here
ACKS Acknowledgements
AIX-NOTES Notes for building Python on AIX
BeOS-NOTES Notes for building on BeOS
BeOS-setup.py setup.py replacement for BeOS, see BeOS-NOTES
cheatsheet Quick summary of Python by Ken Manheimer
find_recursionlimit.py Script to find a value for sys.maxrecursionlimit
gdbinit Handy stuff to put in your .gdbinit file, if you use gdb
......
......@@ -11,7 +11,7 @@
co-exist. */
#include "pyexpatns.h"
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
#if defined(_MSC_EXTENSIONS) && !defined(__CYGWIN__)
#define XML_USE_MSC_EXTENSIONS 1
#endif
......
......@@ -2,8 +2,6 @@
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"
......@@ -49,9 +47,7 @@ extern void bzero(void *, int);
# include <winsock.h>
#else
# define SOCKET int
# ifdef __BEOS__
# include <net/socket.h>
# elif defined(__VMS)
# if defined(__VMS)
# include <socket.h>
# endif
#endif
......
......@@ -242,9 +242,7 @@ shutdown(how) -- shut down traffic in one or both directions\n\
# include <netdb.h>
/* Headers needed for inet_ntoa() and inet_addr() */
# ifdef __BEOS__
# include <net/netdb.h>
# elif defined(PYOS_OS2) && defined(PYCC_VACPP)
# if defined(PYOS_OS2) && defined(PYCC_VACPP)
# include <netdb.h>
typedef size_t socklen_t;
# else
......@@ -326,8 +324,7 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
#include "getnameinfo.c"
#endif
#if defined(MS_WINDOWS) || defined(__BEOS__)
/* BeOS suffers from the same socket dichotomy as Win32... - [cjh] */
#if defined(MS_WINDOWS)
/* seem to be a few differences in the API */
#define SOCKETCLOSE closesocket
#define NO_DUP /* Actually it exists on NT 3.5, but what the heck... */
......@@ -650,11 +647,6 @@ internal_setblocking(PySocketSockObject *s, int block)
#endif
Py_BEGIN_ALLOW_THREADS
#ifdef __BEOS__
block = !block;
setsockopt(s->sock_fd, SOL_SOCKET, SO_NONBLOCK,
(void *)(&block), sizeof(int));
#else
#ifndef MS_WINDOWS
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
block = !block;
......@@ -674,7 +666,6 @@ internal_setblocking(PySocketSockObject *s, int block)
block = !block;
ioctlsocket(s->sock_fd, FIONBIO, (u_long*)&block);
#endif /* MS_WINDOWS */
#endif /* __BEOS__ */
Py_END_ALLOW_THREADS
/* Since these don't return anything */
......@@ -992,11 +983,6 @@ makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto)
return Py_None;
}
#ifdef __BEOS__
/* XXX: BeOS version of accept() doesn't set family correctly */
addr->sa_family = AF_INET;
#endif
switch (addr->sa_family) {
case AF_INET:
......@@ -1715,12 +1701,6 @@ sock_getsockopt(PySocketSockObject *s, PyObject *args)
PyObject *buf;
socklen_t buflen = 0;
#ifdef __BEOS__
/* We have incomplete socket support. */
PyErr_SetString(socket_error, "getsockopt not supported");
return NULL;
#else
if (!PyArg_ParseTuple(args, "ii|i:getsockopt",
&level, &optname, &buflen))
return NULL;
......@@ -1759,7 +1739,6 @@ sock_getsockopt(PySocketSockObject *s, PyObject *args)
return NULL;
}
return buf;
#endif /* __BEOS__ */
}
PyDoc_STRVAR(getsockopt_doc,
......@@ -3248,11 +3227,6 @@ socket_getprotobyname(PyObject *self, PyObject *args)
{
char *name;
struct protoent *sp;
#ifdef __BEOS__
/* Not available in BeOS yet. - [cjh] */
PyErr_SetString(socket_error, "getprotobyname not supported");
return NULL;
#else
if (!PyArg_ParseTuple(args, "s:getprotobyname", &name))
return NULL;
Py_BEGIN_ALLOW_THREADS
......@@ -3263,7 +3237,6 @@ socket_getprotobyname(PyObject *self, PyObject *args)
return NULL;
}
return PyInt_FromLong((long) sp->p_proto);
#endif
}
PyDoc_STRVAR(getprotobyname_doc,
......@@ -4277,14 +4250,12 @@ init_socket(void)
/* Socket types */
PyModule_AddIntConstant(m, "SOCK_STREAM", SOCK_STREAM);
PyModule_AddIntConstant(m, "SOCK_DGRAM", SOCK_DGRAM);
#ifndef __BEOS__
/* We have incomplete socket support. */
PyModule_AddIntConstant(m, "SOCK_RAW", SOCK_RAW);
PyModule_AddIntConstant(m, "SOCK_SEQPACKET", SOCK_SEQPACKET);
#if defined(SOCK_RDM)
PyModule_AddIntConstant(m, "SOCK_RDM", SOCK_RDM);
#endif
#endif
#ifdef SO_DEBUG
PyModule_AddIntConstant(m, "SO_DEBUG", SO_DEBUG);
......
......@@ -8,7 +8,7 @@
# include <sys/socket.h>
# endif
# include <netinet/in.h>
# if !(defined(__BEOS__) || defined(__CYGWIN__) || (defined(PYOS_OS2) && defined(PYCC_VACPP)))
# if defined(__CYGWIN__) || (defined(PYOS_OS2) && defined(PYCC_VACPP))
# include <netinet/tcp.h>
# endif
......
......@@ -80,13 +80,6 @@ static long main_thread;
#include <sys/time.h>
#endif
#ifdef __BEOS__
#include <time.h>
/* For bigtime_t, snooze(). - [cjh] */
#include <support/SupportDefs.h>
#include <kernel/OS.h>
#endif
/* Forward declarations */
static int floatsleep(double);
static double floattime(void);
......@@ -894,7 +887,7 @@ static int
floatsleep(double secs)
{
/* XXX Should test for MS_WINDOWS first! */
#if defined(HAVE_SELECT) && !defined(__BEOS__) && !defined(__EMX__)
#if defined(HAVE_SELECT) && !defined(__EMX__)
struct timeval t;
double frac;
frac = fmod(secs, 1.0);
......@@ -963,22 +956,6 @@ floatsleep(double secs)
return -1;
}
Py_END_ALLOW_THREADS
#elif defined(__BEOS__)
/* This sleep *CAN BE* interrupted. */
{
if( secs <= 0.0 ) {
return;
}
Py_BEGIN_ALLOW_THREADS
/* BeOS snooze() is in microseconds... */
if( snooze( (bigtime_t)( secs * 1000.0 * 1000.0 ) ) == B_INTERRUPTED ) {
Py_BLOCK_THREADS
PyErr_SetFromErrno( PyExc_IOError );
return -1;
}
Py_END_ALLOW_THREADS
}
#elif defined(PLAN9)
{
double millisecs = secs * 1000.0;
......
/* Support for dynamic loading of extension modules */
#include <kernel/image.h>
#include <kernel/OS.h>
#include <stdlib.h>
#include "Python.h"
#include "importdl.h"
const struct filedescr _PyImport_DynLoadFiletab[] = {
{".so", "rb", C_EXTENSION},
{"module.so", "rb", C_EXTENSION},
{0, 0}
};
#if defined(MAXPATHLEN) && !defined(_SYS_PARAM_H)
#undef MAXPATHLEN
#endif
#ifdef WITH_THREAD
#include "pythread.h"
static PyThread_type_lock beos_dyn_lock;
#endif
static PyObject *beos_dyn_images = NULL;
/* ----------------------------------------------------------------------
* BeOS dynamic loading support
*
* This uses shared libraries, but BeOS has its own way of doing things
* (much easier than dlfnc.h, from the look of things). We'll use a
* Python Dictionary object to store the images_ids so we can be very
* nice and unload them when we exit.
*
* Note that this is thread-safe. Probably irrelevent, because of losing
* systems... Python probably disables threads while loading modules.
* Note the use of "probably"! Better to be safe than sorry. [chrish]
*
* As of 1.5.1 this should also work properly when you've configured
* Python without thread support; the 1.5 version required it, which wasn't
* very friendly. Note that I haven't tested it without threading... why
* would you want to avoid threads on BeOS? [chrish]
*
* As of 1.5.2, the PyImport_BeImageID() function has been removed; Donn
* tells me it's not necessary anymore because of PyCObject_Import().
* [chrish]
*/
/* Whack an item; the item is an image_id in disguise, so we'll call
* unload_add_on() for it.
*/
static void beos_nuke_dyn( PyObject *item )
{
status_t retval;
if( item ) {
image_id id = (image_id)PyInt_AsLong( item );
retval = unload_add_on( id );
}
}
/* atexit() handler that'll call unload_add_on() for every item in the
* dictionary.
*/
static void beos_cleanup_dyn( void )
{
if( beos_dyn_images ) {
int idx;
int list_size;
PyObject *id_list;
#ifdef WITH_THREAD
PyThread_acquire_lock( beos_dyn_lock, 1 );
#endif
id_list = PyDict_Values( beos_dyn_images );
list_size = PyList_Size( id_list );
for( idx = 0; idx < list_size; idx++ ) {
PyObject *the_item;
the_item = PyList_GetItem( id_list, idx );
beos_nuke_dyn( the_item );
}
PyDict_Clear( beos_dyn_images );
#ifdef WITH_THREAD
PyThread_free_lock( beos_dyn_lock );
#endif
}
}
/*
* Initialize our dictionary, and the dictionary mutex.
*/
static void beos_init_dyn( void )
{
/* We're protected from a race condition here by the atomic init_count
* variable.
*/
static int32 init_count = 0;
int32 val;
val = atomic_add( &init_count, 1 );
if( beos_dyn_images == NULL && val == 0 ) {
beos_dyn_images = PyDict_New();
#ifdef WITH_THREAD
beos_dyn_lock = PyThread_allocate_lock();
#endif
atexit( beos_cleanup_dyn );
}
}
/*
* Add an image_id to the dictionary; the module name of the loaded image
* is the key. Note that if the key is already in the dict, we unload
* that image; this should allow reload() to work on dynamically loaded
* modules (super-keen!).
*/
static void beos_add_dyn( char *name, image_id id )
{
int retval;
PyObject *py_id;
if( beos_dyn_images == NULL ) {
beos_init_dyn();
}
#ifdef WITH_THREAD
retval = PyThread_acquire_lock( beos_dyn_lock, 1 );
#endif
/* If there's already an object with this key in the dictionary,
* we're doing a reload(), so let's nuke it.
*/
py_id = PyDict_GetItemString( beos_dyn_images, name );
if( py_id ) {
beos_nuke_dyn( py_id );
retval = PyDict_DelItemString( beos_dyn_images, name );
}
py_id = PyInt_FromLong( (long)id );
if( py_id ) {
retval = PyDict_SetItemString( beos_dyn_images, name, py_id );
}
#ifdef WITH_THREAD
PyThread_release_lock( beos_dyn_lock );
#endif
}
dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
const char *pathname, FILE *fp)
{
dl_funcptr p;
image_id the_id;
status_t retval;
char fullpath[PATH_MAX];
char funcname[258];
if( Py_VerboseFlag ) {
printf( "load_add_on( %s )\n", pathname );
}
/* Hmm, this old bug appears to have regenerated itself; if the
* path isn't absolute, load_add_on() will fail. Reported to Be
* April 21, 1998.
*/
if( pathname[0] != '/' ) {
(void)getcwd( fullpath, PATH_MAX );
(void)strncat( fullpath, "/", PATH_MAX );
(void)strncat( fullpath, pathname, PATH_MAX );
if( Py_VerboseFlag ) {
printf( "load_add_on( %s )\n", fullpath );
}
} else {
(void)strcpy( fullpath, pathname );
}
the_id = load_add_on( fullpath );
if( the_id < B_NO_ERROR ) {
/* It's too bad load_add_on() doesn't set errno or something...
*/
char buff[256]; /* hate hard-coded string sizes... */
if( Py_VerboseFlag ) {
printf( "load_add_on( %s ) failed", fullpath );
}
if( the_id == B_ERROR )
PyOS_snprintf( buff, sizeof(buff),
"BeOS: Failed to load %.200s",
fullpath );
else
PyOS_snprintf( buff, sizeof(buff),
"Unknown error loading %.200s",
fullpath );
PyErr_SetString( PyExc_ImportError, buff );
return NULL;
}
PyOS_snprintf(funcname, sizeof(funcname), "init%.200s", shortname);
if( Py_VerboseFlag ) {
printf( "get_image_symbol( %s )\n", funcname );
}
retval = get_image_symbol( the_id, funcname, B_SYMBOL_TYPE_TEXT, &p );
if( retval != B_NO_ERROR || p == NULL ) {
/* That's bad, we can't find that symbol in the module...
*/
char buff[256]; /* hate hard-coded string sizes... */
if( Py_VerboseFlag ) {
printf( "get_image_symbol( %s ) failed", funcname );
}
switch( retval ) {
case B_BAD_IMAGE_ID:
PyOS_snprintf( buff, sizeof(buff),
"can't load init function for dynamic module: "
"Invalid image ID for %.180s", fullpath );
break;
case B_BAD_INDEX:
PyOS_snprintf( buff, sizeof(buff),
"can't load init function for dynamic module: "
"Bad index for %.180s", funcname );
break;
default:
PyOS_snprintf( buff, sizeof(buff),
"can't load init function for dynamic module: "
"Unknown error looking up %.180s", funcname );
break;
}
retval = unload_add_on( the_id );
PyErr_SetString( PyExc_ImportError, buff );
return NULL;
}
/* Save the module name and image ID for later so we can clean up
* gracefully.
*/
beos_add_dyn( fqname, the_id );
return p;
}
......@@ -133,10 +133,6 @@ static size_t _pythread_stacksize = 0;
#include "thread_os2.h"
#endif
#ifdef BEOS_THREADS
#include "thread_beos.h"
#endif
#ifdef WINCE_THREADS
#include "thread_wince.h"
#endif
......
#include <kernel/OS.h>
#include <support/SupportDefs.h>
#include <errno.h>
/* ----------------------------------------------------------------------
* Fast locking mechanism described by Benoit Schillings (benoit@be.com)
* in the Be Developer's Newsletter, Issue #26 (http://www.be.com/).
*/
typedef struct benaphore {
sem_id _sem;
int32 _atom;
} benaphore_t;
static status_t benaphore_create( const char *name, benaphore_t *ben );
static status_t benaphore_destroy( benaphore_t *ben );
static status_t benaphore_lock( benaphore_t *ben );
static status_t benaphore_timedlock( benaphore_t *ben, bigtime_t micros );
static status_t benaphore_unlock( benaphore_t *ben );
static status_t benaphore_create( const char *name, benaphore_t *ben )
{
if( ben != NULL ) {
ben->_atom = 0;
ben->_sem = create_sem( 0, name );
if( ben->_sem < B_NO_ERROR ) {
return B_BAD_SEM_ID;
}
} else {
return EFAULT;
}
return EOK;
}
static status_t benaphore_destroy( benaphore_t *ben )
{
if( ben->_sem >= B_NO_ERROR ) {
status_t retval = benaphore_timedlock( ben, 0 );
if( retval == EOK || retval == EWOULDBLOCK ) {
status_t del_retval = delete_sem( ben->_sem );
return del_retval;
}
}
return B_BAD_SEM_ID;
}
static status_t benaphore_lock( benaphore_t *ben )
{
int32 prev = atomic_add( &(ben->_atom), 1 );
if( prev > 0 ) {
return acquire_sem( ben->_sem );
}
return EOK;
}
static status_t benaphore_timedlock( benaphore_t *ben, bigtime_t micros )
{
int32 prev = atomic_add( &(ben->_atom), 1 );
if( prev > 0 ) {
status_t retval = acquire_sem_etc( ben->_sem, 1, B_TIMEOUT, micros );
switch( retval ) {
case B_WOULD_BLOCK: /* Fall through... */
case B_TIMED_OUT:
return EWOULDBLOCK;
break;
case B_OK:
return EOK;
break;
default:
return retval;
break;
}
}
return EOK;
}
static status_t benaphore_unlock( benaphore_t *ben )
{
int32 prev = atomic_add( &(ben->_atom), -1 );
if( prev > 1 ) {
return release_sem( ben->_sem );
}
return EOK;
}
/* ----------------------------------------------------------------------
* Initialization.
*/
static void PyThread__init_thread( void )
{
/* Do nothing. */
return;
}
/* ----------------------------------------------------------------------
* Thread support.
*
* Only ANSI C, renamed functions here; you can't use K&R on BeOS,
* and there's no legacy thread module to support.
*/
static int32 thread_count = 0;
long PyThread_start_new_thread( void (*func)(void *), void *arg )
{
status_t success = 0;
thread_id tid;
char name[B_OS_NAME_LENGTH];
int32 this_thread;
dprintf(("PyThread_start_new_thread called\n"));
/* We are so very thread-safe... */
this_thread = atomic_add( &thread_count, 1 );
PyOS_snprintf(name, sizeof(name),
"python thread (%d)", this_thread );
tid = spawn_thread( (thread_func)func, name,
B_NORMAL_PRIORITY, arg );
if( tid > B_NO_ERROR ) {
success = resume_thread( tid );
}
return ( success == B_NO_ERROR ? tid : -1 );
}
long PyThread_get_thread_ident( void )
{
/* Presumed to return the current thread's ID... */
thread_id tid;
tid = find_thread( NULL );
return ( tid != B_NAME_NOT_FOUND ? tid : -1 );
}
static void do_PyThread_exit_thread( int no_cleanup )
{
int32 threads;
dprintf(("PyThread_exit_thread called\n"));
/* Thread-safe way to read a variable without a mutex: */
threads = atomic_add( &thread_count, 0 );
if( threads == 0 ) {
/* No threads around, so exit main(). */
if( no_cleanup ) {
_exit(0);
} else {
exit(0);
}
} else {
/* Oh, we're a thread, let's try to exit gracefully... */
exit_thread( B_NO_ERROR );
}
}
void PyThread_exit_thread( void )
{
do_PyThread_exit_thread(0);
}
void PyThread__exit_thread( void )
{
do_PyThread_exit_thread(1);
}
#ifndef NO_EXIT_PROG
static void do_PyThread_exit_prog( int status, int no_cleanup )
{
dprintf(("PyThread_exit_prog(%d) called\n", status));
/* No need to do anything, the threads get torn down if main() exits. */
if (no_cleanup) {
_exit(status);
} else {
exit(status);
}
}
void PyThread_exit_prog( int status )
{
do_PyThread_exit_prog(status, 0);
}
void PyThread__exit_prog( int status )
{
do_PyThread_exit_prog(status, 1);
}
#endif /* NO_EXIT_PROG */
/* ----------------------------------------------------------------------
* Lock support.
*/
static int32 lock_count = 0;
PyThread_type_lock PyThread_allocate_lock( void )
{
benaphore_t *lock;
status_t retval;
char name[B_OS_NAME_LENGTH];
int32 this_lock;
dprintf(("PyThread_allocate_lock called\n"));
lock = (benaphore_t *)malloc( sizeof( benaphore_t ) );
if( lock == NULL ) {
/* TODO: that's bad, raise MemoryError */
return (PyThread_type_lock)NULL;
}
this_lock = atomic_add( &lock_count, 1 );
PyOS_snprintf(name, sizeof(name), "python lock (%d)", this_lock);
retval = benaphore_create( name, lock );
if( retval != EOK ) {
/* TODO: that's bad, raise an exception */
return (PyThread_type_lock)NULL;
}
dprintf(("PyThread_allocate_lock() -> %p\n", lock));
return (PyThread_type_lock) lock;
}
void PyThread_free_lock( PyThread_type_lock lock )
{
status_t retval;
dprintf(("PyThread_free_lock(%p) called\n", lock));
retval = benaphore_destroy( (benaphore_t *)lock );
if( retval != EOK ) {
/* TODO: that's bad, raise an exception */
return;
}
}
int PyThread_acquire_lock( PyThread_type_lock lock, int waitflag )
{
int success;
status_t retval;
dprintf(("PyThread_acquire_lock(%p, %d) called\n", lock, waitflag));
if( waitflag ) {
retval = benaphore_lock( (benaphore_t *)lock );
} else {
retval = benaphore_timedlock( (benaphore_t *)lock, 0 );
}
if( retval == EOK ) {
success = 1;
} else {
success = 0;
/* TODO: that's bad, raise an exception */
}
dprintf(("PyThread_acquire_lock(%p, %d) -> %d\n", lock, waitflag, success));
return success;
}
void PyThread_release_lock( PyThread_type_lock lock )
{
status_t retval;
dprintf(("PyThread_release_lock(%p) called\n", lock));
retval = benaphore_unlock( (benaphore_t *)lock );
if( retval != EOK ) {
/* TODO: that's bad, raise an exception */
return;
}
}
......@@ -487,11 +487,6 @@ QNX: Chris Herborth (chrish@qnx.com) writes:
little tight. To increase the stack size, edit the Makefile
to read: LDFLAGS = -N 48k
BeOS: See Misc/BeOS-NOTES for notes about compiling/installing
Python on BeOS R3 or later. Note that only the PowerPC
platform is supported for R3; both PowerPC and x86 are
supported for R4.
Cray T3E: Mark Hadfield (m.hadfield@niwa.co.nz) writes:
Python can be built satisfactorily on a Cray T3E but based on
my experience with the NIWA T3E (2002-05-22, version 2.2.1)
......
......@@ -50,9 +50,7 @@ except KeyError:
searchdirs=os.environ['INCLUDE'].split(';')
except KeyError:
try:
if sys.platform.find("beos") == 0:
searchdirs=os.environ['BEINCLUDES'].split(';')
elif sys.platform.startswith("atheos"):
if sys.platform.startswith("atheos"):
searchdirs=os.environ['C_INCLUDE_PATH'].split(':')
else:
raise KeyError
......
This diff is collapsed.
......@@ -357,27 +357,6 @@ AC_ARG_WITH(gcc,
case $ac_sys_system in
AIX*) CC=cc_r
without_gcc=;;
BeOS*)
case $BE_HOST_CPU in
ppc)
CC=mwcc
without_gcc=yes
BASECFLAGS="$BASECFLAGS -export pragma"
OPT="$OPT -O"
LDFLAGS="$LDFLAGS -nodup"
;;
x86)
CC=gcc
without_gcc=no
OPT="$OPT -O"
;;
*)
AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
;;
esac
AR="\$(srcdir)/Modules/ar_beos"
RANLIB=:
;;
Monterey*)
RANLIB=:
without_gcc=;;
......@@ -627,9 +606,6 @@ fi
if test $enable_shared = "yes"; then
AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
case $ac_sys_system in
BeOS*)
LDLIBRARY='libpython$(VERSION).so'
;;
CYGWIN*)
LDLIBRARY='libpython$(VERSION).dll.a'
DLLLIBRARY='libpython$(VERSION).dll'
......@@ -712,7 +688,6 @@ AC_PROG_INSTALL
AC_SUBST(LN)
if test -z "$LN" ; then
case $ac_sys_system in
BeOS*) LN="ln -s";;
CYGWIN*) LN="ln -s";;
atheos*) LN="ln -s";;
*) LN=ln;;
......@@ -1467,10 +1442,6 @@ then
BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
;;
BeOS*)
BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
;;
IRIX/5*) LDSHARED="ld -shared";;
IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
SunOS/5*)
......@@ -1720,16 +1691,9 @@ case "$ac_sys_system" in
esac
# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
# BeOS' sockets are stashed in libnet.
AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
case "$ac_sys_system" in
BeOS*)
AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
;;
esac
AC_MSG_CHECKING(for --with-libs)
AC_ARG_WITH(libs,
AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
......@@ -1913,10 +1877,6 @@ pthread_create (NULL, NULL, start_routine, NULL)], [
AC_DEFINE(ATHEOS_THREADS, 1,
[Define this if you have AtheOS threads.])
THREADOBJ="Python/thread.o"],[
AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
AC_DEFINE(BEOS_THREADS, 1,
[Define this if you have BeOS threads.])
THREADOBJ="Python/thread.o"],[
AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
posix_threads=yes
LIBS="$LIBS -lpthreads"
......@@ -1934,7 +1894,7 @@ pthread_create (NULL, NULL, start_routine, NULL)], [
LIBS="$LIBS -lcma"
THREADOBJ="Python/thread.o"],[
USE_THREAD_MODULE="#"])
])])])])])])])])])])
])])])])])])])])])
AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
LIBS="$LIBS -lmpc"
......@@ -2253,7 +2213,6 @@ then
else DYNLOADFILE="dynload_aix.o"
fi
;;
BeOS*) DYNLOADFILE="dynload_beos.o";;
hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
# Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
......@@ -2890,7 +2849,6 @@ fi],
AC_SUBST(LIBM)
case $ac_sys_system in
Darwin) ;;
BeOS) ;;
*) LIBM=-lm
esac
AC_MSG_CHECKING(for --with-libm=STRING)
......
......@@ -12,9 +12,6 @@
/* Define this if you have AtheOS threads. */
#undef ATHEOS_THREADS
/* Define this if you have BeOS threads. */
#undef BEOS_THREADS
/* Define if you have the Mach cthreads package */
#undef C_THREADS
......
......@@ -269,7 +269,7 @@ class PyBuildExt(build_ext):
def get_platform(self):
# Get value of sys.platform
for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']:
for platform in ['cygwin', 'darwin', 'atheos', 'osf1']:
if sys.platform.startswith(platform):
return platform
return sys.platform
......@@ -364,7 +364,7 @@ class PyBuildExt(build_ext):
# Check for MacOS X, which doesn't need libm.a at all
math_libs = ['m']
if platform in ['darwin', 'beos', 'mac']:
if platform in ['darwin', 'mac']:
math_libs = []
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
......
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