LD_PRELOAD checker for clock_gettime and consorts

Lange Norbert norbert.lange at andritz.com
Thu Jan 10 14:47:11 CET 2019


as you might know, I run into alot of troubles with realtime code calling clock_gettime.
This function is now a syscall on many architectures and depends on a linux kernel spinlock,
so a RT thread might deadlock itself when both trying to claim that lock and preventing the linux kernel to free it.

Usage is rather simple, the code compiles without any Cobalt/Xenomai headers.
RT-threads need to enable PTHREAD_WARNSW:
pthread_setmode_np(0, PTHREAD_WARNSW, NULL);

And the checker library needs to be preloaded:
LD_PRELOAD=libcobalt-gettime_checker.so ./yourapp -and -your -params.

Unlike the existing mode-checker, this does not need any changes to the binary,
and will also catch calls from all directly and indirectly loaded DSOs.

Other skins should be supported aswell, aslong as libcobalt is loaded (or more specific, the code looks for a symbol "cobalt_assert_nrt").

Kind regards,

This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.


Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation

Firmensitz/ Registered seat: Wien

Firmenbuchgericht/ Court of registry: Handelsgericht Wien

Firmenbuchnummer/ Company registration: FN 61833 g

DVR: 0605077

UID-Nr.: ATU14756806

Thank You
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libcobalt-gettime_checker.c
URL: <http://xenomai.org/pipermail/xenomai/attachments/20190110/bc2720f2/attachment.c>

More information about the Xenomai mailing list