LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 06-28-2005, 12:06 PM   #1
prital
LQ Newbie
 
Registered: Dec 2004
Posts: 24

Rep: Reputation: 15
kernel stack overflow


Hello,
I run the following user application 'test' :
void main()
{
int n=0;
FILE * fp = fopen ("/log_file" , "w");

while(1)
{
fprintf(fp,"\nStart loop %d", n++);
fflush(fp);
sleep(60);
}
fclose(fp);
}

AFter some hours, I get the following message:

Kernel stack overflow in process c785c000, r1=c785c4c0
NIP: C000FDCC XER: 20000000 LR: C000F404 SP: C785C4C0 REGS: c785c410 TRAP: 0800
Not tainted
MSR: 00009030 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11
DEAR: 206661A7, ESR: 00000000
TASK = c785c000[129] 'test' Last syscall: 54

How can I solve this problem?
Thank you very much.
 
Old 06-29-2005, 05:06 AM   #2
freegianghu
Member
 
Registered: Oct 2004
Location: somewhere in the street
Distribution: Window$
Posts: 192

Rep: Reputation: 30
Re: kernel stack overflow

Quote:
Originally posted by prital
Hello,
I run the following user application 'test' :
void main()
{
int n=0;
FILE * fp = fopen ("/log_file" , "w");

while(1)
{
fprintf(fp,"\nStart loop %d", n++);
fflush(fp);
sleep(60);
}
fclose(fp);
}

AFter some hours, I get the following message:

Kernel stack overflow in process c785c000, r1=c785c4c0
NIP: C000FDCC XER: 20000000 LR: C000F404 SP: C785C4C0 REGS: c785c410 TRAP: 0800
Not tainted
MSR: 00009030 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11
DEAR: 206661A7, ESR: 00000000
TASK = c785c000[129] 'test' Last syscall: 54

How can I solve this problem?
Thank you very much.
Do you think something going wrong with your hardware? (comment out sleep(60); to running test again)

GH
 
Old 06-29-2005, 09:12 AM   #3
lordofring
Member
 
Registered: Feb 2005
Posts: 91

Rep: Reputation: 15
#include <stdio.h>

int main()
{
int i = 0 ;
FILE * fd = fopen("./log", "w") ;

while(1)
{
fprintf(fd, "n is %d\t", i++) ;
fflush(fd) ;
sleep(1) ;
}
fclose(fd) ;

return 0 ;
}


I run the program from yesterday afternoon. I stopped it on the morning. The last number in my log file is 62581. It runs fine in 17 hours. So your code should be fine.
 
  


Reply



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
Difference b/t Kernel stack and User stack hazzyb Linux - Software 2 09-29-2008 07:40 PM
"Stack Overflow" in Cedega kornerr Linux - General 5 09-09-2005 09:35 PM
Where to find a Kernel/Kernel Patch with support for stack sizes >8K Valhalla Linux - Software 2 05-24-2005 05:39 PM
Power PC 405 kernel stack overflow jeff_fellin Linux - General 0 01-04-2005 01:39 PM
stack overflow in linux kernel module appas Programming 2 09-20-2004 05:12 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:57 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration