Compatibility for POSIX

The POSIX Compatibility Kit is designed for current POSIX customers. The kit defines the basic POSIX pthread services, with some limitations, and utilizes THREADX® primitives underneath. The new POSIX compatibility layer should have very high performance, since the Compatibility Kit utilizes internal THREADX primitives and bypasses basic THREADX error checking. However, the application will achieve even greater performance and size benefits if a complete conversion to THREADX is performed.

Compatibility Kit Source

The Compatibility Kit source code is designed for economy of code. Each supported POSIX function is contained in its own file. Each file has a clear and descriptive name which allows for easy source navigation. Using separate files for each function will ensure that no dead code from unused functionality will be linked into the final application image. By including pthread.h, as the POSIX standard requires, the supported POSIX API function prototypes will be imported into the source file. The THREADX Compatibility Kit does not require any target-port-specific features, and will work with the vast collection of target microprocessors currently supported by THREADX.

Compatibility Kit Documentation

The Compatibility Kit User Guide provides an overview of the porting process, including various caveats and pitfalls to watch out for. In addition, each covered POSIX Subroutine is documented, including information about supported/unsupported options, limitations, deviations, and suggestions on how to workaround any limitations.

Compatibility Kit Services

The current release of the Compatibility Kit supports the following calls:

Pthread Related Subroutines:

sched_yield, pthread_create, pthread_detach, pthread_join, pthread_equal, pthread_exit, pthread_self, pthread_attr_destroy, pthread_attr_getdetachstatem, pthread_attr_setdetachstate, pthread_attr_getinheritsched, pthread_attr_setinheritsched, pthread_attr_getschedparam, pthread_attr_setschedparam, pthread_attr_getschedpolicy, pthread_attr_setschedpolicy, pthread_attr_init, pthread_attr_getstackaddr, pthread_attr_setstackaddr, pthread_attr_getstacksize, pthread_attr_setstacksize, pthread_attr_getstack, pthread_attr_setstack, pthread_setcancelstate, pthread_setcanceltype, pthread_cancel, pthread_yield, pthread_setschedparam, pthread_getschedparam, pthread_testcancel, pthread_once

Semaphore Related Subroutines:

sem_close, sem_getvalue, sem_open, sem_post, sem_trywait, sem_unlink, sem_wait, sem_init, sem_destroy

Conditional Variable Related Subroutines:

pthread_cond_destroy, pthread_cond_init, pthread_cond_broadcast, pthread_cond_signal, pthread_cond_timedwait, pthread_cond_wait

Message Queue Related Subroutines:

mq_send, mq_receive, mq_unlink, mq_close, mq_open

Mutex Related Subroutines:

pthread_mutexattr_gettype, pthread_mutexattr_settype, pthread_mutexattr_destroy, pthread_mutexattr_init, pthread_mutex_destroy, pthread_mutex_init, pthread_mutex_lock, pthread_mutex_unlock, pthread_mutex_trylock, pthread_mutexattr_getprotocol, pthread_mutexattr_setprotocol, pthread_mutexattr_getpshared, pthread_mutexattr_setpshared, pthread_mutex_timedlock

Compatibility Kit Error Handing

There are two “error handling” functions defined in tx_posix.c and used throughout the Compatibility Kit, as follows:

posix_internal_error, posix_error_handler

In general this routine is called when a basic usage error occurs. This may be used as a place to catch errors that are not detected if the application source is not checking the return status. The default processing for this routine is a simple spin loop.

Demonstration System

The file posix_demo.c contains a demonstration system that utilizes POSIX services. This demo application will demonstrate some of the basic OS objects of POSIX, such as pthreads, semaphores and message queues. This demo application should be used as an example of how to integrate the Compatibility Kit into your application.

Future Compatibility Kit Phases

Please get in touch with us for the next phases of this Compatibility Kit.


THREADX is a registered trademark of Express Logic. POSIX Compatibility Kit is a trademark of Express Logic.

Subscribe to our news