LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Tags used in this thread
Popular LQ Tags , ,

Reply
 
Thread Tools
Old 09-01-2009, 03:32 AM   #1
shiv.singh
LQ Newbie
 
Registered: May 2009
Posts: 13
Thanked: 0
Red face printf is giving strange behavior on MVL.


[Log in to get rid of this advertisement]
Hi All,
Here I encountered problem with printfs.

I am running number of processes using rc script on an embedded system ONT(Optical network terminal).

I have developed a packet sniffer application which captures RTP/RTCP packets on the network.

I am adding this process into rc script(onuInit) file for starting my application with other process while initing the board.

The problem comes now. I will not be able to see any printf traces which I supposed to print in packet-recorder application whenever I start capture, while other process are able to print the traces happily.

All the process are getting started as deamon(using fork) and my application too.


The strange thing here is I am able to see the printf traces in my application while init process completes, which is before a infinite while loop inside the message-handler thread which is reading the messages on queue, and once it reaches to the while loop it stops printind further traces. I am using msgrcv and checking for the number of bytes it read from the queue, if it is more than 0 then I process the message or else sleep for some time and try to read the queue again.

Now one more thing here if I kill my packet-recorder application and re-start it manually then I will be able to see my all printf traces

I have tried the following:
1) Bring–up the processes in different order.

2) Checked the stdin, stdout, stderr values (they all are fine and showing as 0, 1, 2).

3) ‘write’ is not working as it uses stdout.

4) File-writing fwrite and fprintf(both are working fine).

5) used _exit(0) instead exit(0).


Please can you suggest what can be the possible issues here.

I will be pleased to elaborate the issue if u find it non-understandable somewhere.

Thanks in advance.

Last edited by shiv.singh; 09-01-2009 at 06:33 AM.. Reason: more apropriate title
windows_xp_2003 shiv.singh is offline  
Tag This Post , ,
Reply With Quote
Old 09-01-2009, 05:59 AM   #2
shiv.singh
LQ Newbie
 
Registered: May 2009
Posts: 13
Thanked: 0

Original Poster
Hi,
I am not sure why this thread moved?
Please can you let me know so from next time I will take care of it.

Thanks.
windows_xp_2003 shiv.singh is offline     Reply With Quote
Old 09-02-2009, 01:54 AM   #3
allanf
Member
 
Registered: Sep 2008
Location: MN
Distribution: Gentoo, Fedora, Suse, SlackWare
Posts: 41
Blog Entries: 1
Thanked: 3
When your daemon forks, does it follow the standard "Daemon writing rules" which closes the opened file descriptors?
linux allanf is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How printf works dale_chip Programming 3 08-25-2007 05:13 PM
montavista 3.1 x86_pentium4 mvl-update-script?? lemay_jeff Linux - Newbie 0 07-06-2004 04:52 PM
More arguments in printf() AMMullan Programming 3 02-23-2004 03:29 PM
printf new_user10 Programming 3 09-10-2003 12:12 AM
How is 'man 3 printf' different from 'man printf' ?? purpleburple Linux - General 3 09-23-2002 01:29 AM


All times are GMT -5. The time now is 03:14 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration