OS/2¶
libos/os2 implements picolibc's system calls on the OS/2 Dos API, for
16-bit OS/2 1.x (i8086-pc-os2, NE programs) and 32-bit OS/2 2.0 and
later (i386-pc-os2, LX programs and DLLs). Build it with
-Dos-os2=true.
- A file descriptor is the OS/2 file handle. Files are binary, and
\nis written as\r\nto the console and other devices. crt0sets up the NE or LX entry: OS/2 passes the environment and the command line, which becomeenvironandargv.dllcrt0starts a 32-bit DLL, which is initialized for each process that loads it.sbrkgrows DGROUP withDosReallocSegin the 16-bit models with near data, uses one far segment fromDosAllocSegin those with far data, and commits aDosAllocMemreservation in 32-bit programs.- Threads (32-bit, with
-Dsingle-thread=false -Dthread-local-storage=true -Dthread-local-storage-api=false):<threads.h>is C11 threads onDosCreateThreadand the mutex and event semaphores, and the C library's own locks are mutex semaphores. clang keeps__threadvariables,errnoamong them, in emulated TLS:__emutls_get_addressfinds each thread's copies through a word ofDosAllocThreadLocalMemory.__cxa_thread_atexit_implruns the destructors of C++thread_localobjects when a thread ends. A zeroedmtx_torcnd_tworks, as libc++ needs. clock_gettimehasCLOCK_REALTIME, and on 32-bit OS/2CLOCK_MONOTONIC(milliseconds since the system started).
The cross files are scripts/cross-clang-i8086-os2-<model>.txt (small,
medium, compact and large) and scripts/cross-clang-i386-os2.txt. The
OS/2 SDK builds the sysroots
and has the headers and examples.