why must POSIX_Init() call exit() rather than use a "return" statement?

Morgan, Keith S morgank at lanl.gov
Mon May 6 22:07:43 UTC 2019

I have noticed that if I do not call exit() in the POSIX_Init() function, RTEMS executables will hang. Why must I call exit() to exit the POSIX_Init() function rather than conclude with a "return" statement?

Take for example, the psx_example3 example application in the examples-v2 repository. The POSIX_Init() function concludes with a call to exit().
See: examples-v2/posix_api/psx_example_3/test3.c
Cmd: sparc-rtems5-run -a -leon3 psx_example_3.exe

It is less obvious in other examples in the examples-v2 repository. Take for example the psx_barrier_report example. The POSIX_Init() function in rtems_config.c concludes with "return NULL", however, upon closer inspection, control is transferred to the main() function in barrier_attr_report.c which concludes with a call to exit() and so control is never returned to the POSIX_Init() function (and therefore the "return NULL" statement is never executed).
See: examples-v2/posix_api/psx_barrier_report/barrier_attr_report.c
See: examples-v2/posix_api/psx_barrier_report/rtems_config.c
Cmd: sparc-rtems5-run -a -leon3 psx_barrier_report.exe

I am using rtems5 and the leon3 bsp + simulator.


Keith Shearl Morgan
ISR-3, Space Data Systems
Los Alamos National Laboratory

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20190506/05fba388/attachment.html>

More information about the users mailing list