syslog safe?
Is syslog() safe to call from real time userland code? (If not, what is the right way to do such output?)
Thanks,
-kb
Quoted 2 lines · Kent Borg
Is
syslog()safe to call from real time userland code? (If not, what is the right way to do such output?)
No problem using it, but it will trigger an automatic switch to secondary mode in order to issue the right Linux syscalls. The thread will switch back to primary automatically again as soon as a (usually blocking) Xenomai syscall is issued.
Signature · 1 line
Philippe.
Quoted 4 lines · Philippe Gerum
No problem using it, but it will trigger an automatic switch to secondary mode in order to issue the right Linux syscalls. The thread will switch back to primary automatically again as soon as a (usually blocking) Xenomai syscall is issued.
And, looking at strace output, it appears that is a syslog() is too low a priority to be logged it doesn't make a system call and so will not drop us out of realtime.
Thanks,
-kb
Quoted 10 lines · Kent Borg
Quoted 1 line · Philippe Gerum
No problem using it, but it will trigger an automatic switch to secondary mode in order to issue the right Linux syscalls. The thread will switch back to primary automatically again as soon as a (usually blocking) Xenomai syscall is issued.
And, looking at strace output, it appears that is a
syslog()is too low a priority to be logged it doesn't make a system call and so will not drop us out of realtime.
Do not trust strace there, it heavily relies on other glibc services, like buffered I/O, which might issue syscalls under various conditions. For instance, internal mutex locking might cause a syscall to deal with any contended request, or malloc called indirectly might ask for extending the caller's data segment, and so on. Additionally, some syslog flags, like LOG_CONS, do cause file I/O.
Signature · 1 line
Philippe.