Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Port OS9 code to Linux

73 views
Skip to first unread message

Seth

unread,
Apr 25, 2011, 3:02:29 PM4/25/11
to
My company has an huge OS9 code base(all C) and I am trying to do a
small excersize by porting one of the projects. We have used a lot of
shared memory and use _os_link and _os_datmod extensively.

I was wondering if anyone has experiencing port OS9 code to linux and
how they dealt with these functions.

Thanks

Martin Gregorie

unread,
Apr 25, 2011, 4:16:30 PM4/25/11
to

I've written a few programs that are portable between OS/9 v2.4 and Linux
and ported rather more from OS9 to Linux. There were no particular
problems. I did the following:

- Wrote a compatibility header that explicitly defines values that are
specific to each operating system. There is a version of it for each
OS. I found the compilers' built-in defines that identify the OS to
be somewhat non-intuitive, so put my own defines (LINUX, OSK) in the
relevant copy of the header to steer #ifdef preprocessor statements
round OS-specific code.

- there are a few library functions that OSK uses and Linux doesn't.
I built a small compatibility library for Linux that implemented missing
OS/9 library functions where there was no obvious work-round or it was
a frequently used function.

- Linux doesn't use termcap - instead it uses terminfo and ncurses.
Thats generally not too hard a gap to bridge.

- the UNIX Inter-Process Communication (IPC) library functions map fairly
well onto OSK shared memory, semaphores, etc. Both OSes have named
pipes, though I must admit I find its easier to use a socket in Linux
where I'd use a named pipe and a semaphore in OSK.

At most you may want to write wrappers for the IPC functions
that have the same names and parameters as the os_* functions.
Whether this is worth doing will depend on the way your code is
organised.

At a guess the thing that may trip you is process scheduling: the OS/9
scheduler is much more flexible and configurable than the Linux
equivalent, which is pure priority-preemptive. In particular, if you're
using the OS/9 ability to support:
- round-robin switching within a priority
- aging to guarantee low priority processes some mill time
- manual activation of low priority processes below the round-robin
threshhold

you may need to rethink your process priorities and control switching
strategy.

If you're using the EFFO shell or one of the advanced OS9 shells bash
will hold few surprises for you, though if you use the original OS9 shell
you will have a small learning curve.

Apart from that, the water is fine: jump in. The GNU compilation and make
system are IMO superior to OS9 and there are several good source
management systems: I stick with cvs because I know it and because its
fixable/hackable with the standard command line tools for manipulating
the filing system.

--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |

0 new messages