OS/2 is a proprietary operating system which supports x86 hardware architecture. Despite being quite old it is still in use and there are some (compatible) reincarnations (eComStation, Blue Lion) with ongoing support and new features. So, overall, the system is alive and it would be nice to support it.
The amount of work depends on the way we choose:
- EMX environment with old GCC 2.x.
- kLIBC C runtime library with GCC (including the latest 6.x versions) based on it.
- Use native system calls whenever is possible.
First way is definitely not a deal. Second one lets work to be done quickly using emulated POSIX environment, but some of the required parts are still not available (pthreads, mmap). The last one should be the most tricky and requires more efforts, but is gives full control over the situation and shouldn't impact on overall performance.
As we should avoid additional external dependencies like kLIBC, it will be better to start with a native way and go with IBM's Developer Toolkit 4.5.x (provides headers and import libraries).
Anyway, we need development environment with bash, make and CMake, which are freely available. There are several compilers for OS/2 (GCC, Watcom, VisualAge), but we should start with GCC as one of the most popular.
To port the library we need to implement the following models:
- Threads (we should use
_beginthread()
and friends from C runtime library) and synchronisation primitives.
- Diretory iterating.
- Shared library loading.
- Replace
mmap()
with something like DosAllocMem()
.
- IPC still need more checks on its possibility, but it seems that OS/2 doesn't have system semaphore primitive. For shared memory we can use
DosAllocSharedMem()
along with a process-wide mutex.
- Time profiler (need to look at
DosTmrQueryTime ()
or DosGetDateTime()
more closely).
So, on the first impression, it is possible to make a native port to OS/2, maybe not feature-complete, but with most of them.