LinuxQuestions.org
Help answer threads with 0 replies.
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

Reply
 
Search this Thread
Old 09-01-2009, 02:32 AM   #1
shiv.singh
LQ Newbie
 
Registered: May 2009
Posts: 16

Rep: Reputation: 0
Red face printf is giving strange behavior on MVL.


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 05:33 AM. Reason: more apropriate title
 
Old 09-01-2009, 04:59 AM   #2
shiv.singh
LQ Newbie
 
Registered: May 2009
Posts: 16

Original Poster
Rep: Reputation: 0
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.
 
Old 09-02-2009, 12:54 AM   #3
allanf
Member
 
Registered: Sep 2008
Location: MN
Distribution: Gentoo, Fedora, Suse, Slackware, Debian, CentOS
Posts: 97
Blog Entries: 1

Rep: Reputation: 19
When your daemon forks, does it follow the standard "Daemon writing rules" which closes the opened file descriptors?
 
  


Reply

Tags
broadcom, networking


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 04:13 PM
montavista 3.1 x86_pentium4 mvl-update-script?? lemay_jeff Linux - Newbie 0 07-06-2004 03:52 PM
More arguments in printf() AMMullan Programming 3 02-23-2004 02:29 PM
printf new_user10 Programming 3 09-09-2003 11:12 PM
How is 'man 3 printf' different from 'man printf' ?? purpleburple Linux - General 3 09-23-2002 12:29 AM


All times are GMT -5. The time now is 09:23 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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration