Skip to content

bpo-31904: Add support for VxWorks RTOS #11951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a4885db
Use UTF-8 as the system encoding on VxWorks
hliu0 Nov 23, 2018
07f8be4
adapt posix module to vxWorks
wyxin1008 Nov 30, 2018
8e99c87
limited signal feilds in VxWorks
kuhlenough Sep 17, 2017
846db09
Support build python interpreter on VxWorks
jianxu3 Dec 4, 2018
c7a6d61
Support build python interpreter on VxWorks
jianxu3 Dec 4, 2018
46b2711
Use UTF-8 encoding and add return value for function
hliu0 Dec 4, 2018
95581c5
chmod the script configure to be executable
pxinwr Dec 10, 2018
e402833
Revert the changes for aclocal.m4 and configure.ac to adpat the new c…
jianxu3 Dec 11, 2018
42549fe
generate configure file using command autoconf
jianxu3 Dec 12, 2018
871eadb
add the support for spawnv() and spawnve() for vxworks (US120029)
yuesun1 Dec 11, 2018
cd02377
Add vxworks PLATFORM_TRIPLET and enable share library EXT_SUFFIX
LihuaZhao Dec 19, 2018
2c1394b
Add clang support for setup.py to get include and library path
LihuaZhao Dec 18, 2018
0ed5ced
add the posixmodule.c.h for spawnv() (US129972)
yuesun1 Dec 27, 2018
646cbaa
VxWorks uses semicolon as delim
hliu0 Dec 27, 2018
dcb4eda
add VxWorks Compatibility Wrapper
wyxin1008 Dec 27, 2018
317172c
fixed the select call is blocked by pipe
wyxin1008 Jan 14, 2019
dc83596
not build module grp and termios on VxWorks (US130019)
jianxu3 Jan 14, 2019
8fbdd91
module _crypt use api in libopenssl.so (US130019)
jianxu3 Jan 17, 2019
8579a4b
fixed test_time.py testcase fail problem (US130064)
jianxu3 Jan 17, 2019
176eb20
add preexec_fn support in subprocess for VxWorks
wyxin1008 Jan 25, 2019
a84a6bf
module _socket add dependence on libnet (US130019)
jianxu3 Jan 25, 2019
b28835a
add py_fds_to_keep and close_fds parameter suppport
wyxin1008 Jan 31, 2019
31512a4
add float point flag for spawn a new RTP
wyxin1008 Feb 14, 2019
75db11e
skip the ExecTests test cases in test_os.py
yuesun1 Feb 18, 2019
1e63c53
clinic update for posixmodule.c
pxinwr Feb 20, 2019
a0e7297
clinic update for _vxwapi.c
pxinwr Feb 20, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Include/osdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ extern "C" {
#define DELIM L';'
#endif

#ifdef __VXWORKS__
#define DELIM L';'
#endif

/* Filename separator */
#ifndef SEP
#define SEP L'/'
Expand Down
28 changes: 26 additions & 2 deletions Lib/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@
_mswindows = True
except ModuleNotFoundError:
_mswindows = False
import _posixsubprocess
_vxworks = (sys.platform == "vxworks")
if _vxworks:
import _vxwapi
else:
import _posixsubprocess
import select
import selectors
else:
Expand Down Expand Up @@ -733,6 +737,14 @@ def __init__(self, args, bufsize=-1, executable=None,
raise ValueError("preexec_fn is not supported on Windows "
"platforms")
else:
if _vxworks:
if shell:
raise ValueError("shell is not supported on VxWorks")
if preexec_fn is not None:
raise ValueError("Preexecution function is not supported"
"on VxWorks");
if start_new_session:
raise ValueError("VxWorks does not support sessions");
# POSIX
if pass_fds and not close_fds:
warnings.warn("pass_fds overriding close_fds.", RuntimeWarning)
Expand Down Expand Up @@ -1580,7 +1592,17 @@ def _execute_child(self, args, executable, preexec_fn, close_fds,
for dir in os.get_exec_path(env))
fds_to_keep = set(pass_fds)
fds_to_keep.add(errpipe_write)
self.pid = _posixsubprocess.fork_exec(
if _vxworks:
self.pid = _vxwapi.rtp_spawn(
args, executable_list,
close_fds, tuple(sorted(map(int, fds_to_keep))),
cwd, env_list,
p2cread, p2cwrite, c2pread, c2pwrite,
errread, errwrite,
errpipe_read, errpipe_write,
restore_signals, start_new_session, preexec_fn)
else:
self.pid = _posixsubprocess.fork_exec(
args, executable_list,
close_fds, tuple(sorted(map(int, fds_to_keep))),
cwd, env_list,
Expand All @@ -1589,6 +1611,8 @@ def _execute_child(self, args, executable, preexec_fn, close_fds,
errpipe_read, errpipe_write,
restore_signals, start_new_session, preexec_fn)
self._child_created = True
if _vxworks and self.pid == -1:
self._child_created = False
finally:
# be sure the FD is closed no matter what
os.close(errpipe_write)
Expand Down
3 changes: 2 additions & 1 deletion Lib/test/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,8 @@ def mock_execve(name, *args):
os.execve = orig_execve
os.defpath = orig_defpath


@unittest.skipUnless(hasattr(os, 'execv'),
"No os.execv or os.execve function to test.")
class ExecTests(unittest.TestCase):
@unittest.skipIf(USING_LINUXTHREADS,
"avoid triggering a linuxthreads bug: see issue #4970")
Expand Down
16 changes: 13 additions & 3 deletions Lib/test/test_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ def check_ns(sec, ns):
check_ns(time.clock_gettime(time.CLOCK_REALTIME),
time.clock_gettime_ns(time.CLOCK_REALTIME))

@unittest.skipUnless(hasattr(time, 'clock'),
'need time.clock()')
def test_clock(self):
with self.assertWarns(DeprecationWarning):
time.clock()
Expand Down Expand Up @@ -312,7 +314,13 @@ def test_ctime(self):
self.assertEqual(time.ctime(t), 'Sun Sep 16 01:03:52 1973')
t = time.mktime((2000, 1, 1, 0, 0, 0, 0, 0, -1))
self.assertEqual(time.ctime(t), 'Sat Jan 1 00:00:00 2000')
for year in [-100, 100, 1000, 2000, 2050, 10000]:
# the largest year on VxWorks is 2038
if 'vxworks' in sys.platform :
range = [-100, 100, 1000, 2000]
else:
range = [-100, 100, 1000, 2000, 2050, 10000]

for year in range:
try:
testval = time.mktime((year, 1, 10) + (0,)*6)
except (ValueError, OverflowError):
Expand Down Expand Up @@ -549,8 +557,10 @@ def test_localtime_failure(self):
self.assertRaises(ValueError, time.ctime, float("nan"))

def test_get_clock_info(self):
clocks = ['clock', 'monotonic', 'perf_counter', 'process_time', 'time']

if hasattr(time, 'clock'):
clocks = ['clock', 'monotonic', 'perf_counter', 'process_time', 'time']
else:
clocks = ['monotonic', 'perf_counter', 'process_time', 'time']
for name in clocks:
if name == 'clock':
with self.assertWarns(DeprecationWarning):
Expand Down
8 changes: 7 additions & 1 deletion Modules/_cryptmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#include "Python.h"

#include <sys/types.h>

#ifdef __VXWORKS__
#include <openssl/des.h>
#endif
/* Module crypt */

/*[clinic input]
Expand Down Expand Up @@ -39,8 +41,12 @@ crypt_crypt_impl(PyObject *module, const char *word, const char *salt)
struct crypt_data data;
memset(&data, 0, sizeof(data));
crypt_result = crypt_r(word, salt, &data);
#else
#ifdef __VXWORKS__
crypt_result = DES_crypt(word, salt);
#else
crypt_result = crypt(word, salt);
#endif
#endif
return Py_BuildValue("s", crypt_result);
}
Expand Down
Loading