Skip to contentSkip to conversation

syslog safe?

Xenomai-help Kent Borg 2 participants 4 messages Apr 25, 2006

lore
Share & tools
lore

Kent Borg

author
#0 lore raw

Is syslog() safe to call from real time userland code? (If not, what is the right way to do such output?)

Thanks,

-kb

#1 lore raw
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.
author
#2 lore raw
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

#3 lore raw
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.