Skip to contentSkip to conversation

rt_printf with daemonized task

Xenomai-help [email protected] 2 participants 2 messages Oct 6, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

we are using a xenomai system with kernel 2.6.22 and xenomai 2.4.7.

There is some strange behaviour when using rt_printf in one of our
application. The application is setup as a server process, which itself
is setting up several xenomai tasks.
All rt_printf outputs are displayed correctly as long as the server process is not daemonized.

If the server process is daemonized with code like

if( (pid=fork()) < 0 )

{
        return(-1);
}else
{
        if( pid != 0 )
        {
            exit(0);
        }
}

all rt_printf-output is printed only when the server process exits and not during the time the server process is running.

Any idea ?

Thanks,

Oliver

#1 lore raw
Quoted 14 lines · [email protected] wrote:

Hi,

we are using a xenomai system with kernel 2.6.22 and xenomai 2.4.7.

There is some strange behaviour when using rt_printf in one of our
application. The application is setup as a server process, which itself
is setting up several xenomai tasks.
All rt_printf outputs are displayed correctly as long as the server process is not daemonized.

If the server process is daemonized with code like

if( (pid=fork()) < 0 )

Quoted 9 lines
{
        return(-1);
}else
{
        if( pid != 0 )
        {
            exit(0);
        }
}

This is over-simplified. You process is not really daemonized. You should really call the glibc daemon() function.

Quoted 6 lines

all rt_printf-output is printed only when the server process exits and not during the time the server process is running.

Any idea ?

I guess you do not need rt_printf output in the parent. So, you should try and initialize the rt_printf library only in the child.

Signature · 1 line
                                          Gilles