Re: [Haifux] stack size

2003-06-19 Thread Nadav Har'El
On Thu, Jun 19, 2003, Orna Agmon wrote about "Re: [Haifux] stack size": > > static inline unsigned long getstack(void) > > { > > unsigned long stackaddr; > > > > /* I think the constraints are correct, but won't bet on it */ > >

Re: [Haifux] stack size

2003-06-19 Thread Orna Agmon
On Thu, 19 Jun 2003, Muli Ben-Yehuda wrote: > On Thu, Jun 19, 2003 at 02:54:53PM +0200, Eli Billauer wrote: > > Hello Orna. > > > > What I would do, is to write a small function which returns the value of > > the stack pointer, when it was called. It's not very accurate, but it > > can give a g

Re: [Haifux] stack size

2003-06-19 Thread Shachar Shemesh
Orna Agmon wrote: I found some info on preventing attacks on the stack, so it seems to me that it should be possible to do this in a non- hostile manner. The stack overrun protection, besides not being particularily effective, will be useless for what you are trying to do. Very roughly, it plac

Re: [Haifux] stack size

2003-06-19 Thread Muli Ben-Yehuda
On Thu, Jun 19, 2003 at 02:54:53PM +0200, Eli Billauer wrote: > Hello Orna. > > What I would do, is to write a small function which returns the value of > the stack pointer, when it was called. It's not very accurate, but it > can give a good indication of how heavily the stack is consumed. The

Re: [Haifux] stack size

2003-06-19 Thread Muli Ben-Yehuda
On Thu, Jun 19, 2003 at 03:23:51PM +0300, Kohn Emil Dan wrote: > In linux, the kernel stack size is 8K minus the size of the task_struct > struct. There's also on going work to make the stack 4k, and have seperate stacks for interrupt handlers. This is because for a large number of threads, havin

Re: [Haifux] stack size

2003-06-19 Thread Muli Ben-Yehuda
On Thu, Jun 19, 2003 at 04:49:38PM +0300, Nadav Har'El wrote: > On Thu, Jun 19, 2003, Orna Agmon wrote about "Re: [Haifux] stack size": > > Eli, I am not trying to prove a point, but find something automatic that > > will tell me when the struct is too large, and I s

Re: [Haifux] stack size

2003-06-19 Thread Nadav Har'El
On Thu, Jun 19, 2003, Orna Agmon wrote about "Re: [Haifux] stack size": > Eli, I am not trying to prove a point, but find something automatic that > will tell me when the struct is too large, and I should use the heap. I Ok, here's an automatic algorithm for you: for ea

Re: [Haifux] stack size

2003-06-19 Thread Orna Agmon
On Thu, 19 Jun 2003, Eli Billauer wrote: > What I would do, is to write a small function which returns the value of > the stack pointer, when it was called. It's not very accurate, but it > can give a good indication of how heavily the stack is consumed. > > I process is more or less: Write a d

Re: [Haifux] stack size

2003-06-19 Thread guy keren
On Thu, 19 Jun 2003, Orna Agmon wrote: > Hello eveyone, > > I was wondering if there was anything that detected C stack overflow in a > nice way (i.e., not by having to cut down my program until I stop getting > a segmentation fault on the first line of main). if this is linux on IA32, kernel 2.

Re: [Haifux] stack size

2003-06-19 Thread Nadav Har'El
On Thu, Jun 19, 2003, Kohn Emil Dan wrote about "Re: [Haifux] stack size": > In linux, the kernel stack size is 8K minus the size of the task_struct > struct. Right, but as I said this 8k limit is for the Linux *kernel*, not for user-space programming. User space has a much larger

Re: [Haifux] stack size

2003-06-19 Thread Kohn Emil Dan
On Thu, 19 Jun 2003, Nadav Har'El wrote: > On Thu, Jun 19, 2003, Nadav Har'El wrote about "Re: [Haifux] stack size": > > You're doing something wrong. Huge data structures do not belong on the > > stack, which is by definition a small area used for

Re: [Haifux] stack size

2003-06-19 Thread Eli Billauer
Hello Orna. What I would do, is to write a small function which returns the value of the stack pointer, when it was called. It's not very accurate, but it can give a good indication of how heavily the stack is consumed. I process is more or less: Write a dummy function, which does nothing inte

Re: [Haifux] stack size

2003-06-19 Thread Nadav Har'El
On Thu, Jun 19, 2003, Nadav Har'El wrote about "Re: [Haifux] stack size": > You're doing something wrong. Huge data structures do not belong on the > stack, which is by definition a small area used for temporary allocation > of small things during function calls (au

Re: [Haifux] stack size

2003-06-19 Thread Nadav Har'El
On Thu, Jun 19, 2003, Orna Agmon wrote about "[Haifux] stack size": > Hello eveyone, > > I was wondering if there was anything that detected C stack overflow in a > nice way (i.e., not by having to cut down my program until I stop getting > a segmentation fault

RE: [Haifux] stack size

2003-06-19 Thread Haim Cohen
2003 12:51 > To: Haifa Linux club > Subject: [Haifux] stack size > > > Hello eveyone, > > I was wondering if there was anything that detected C stack > overflow in a > nice way (i.e., not by having to cut down my program until I > stop getting > a segmentation

[Haifux] stack size

2003-06-19 Thread Orna Agmon
Hello eveyone, I was wondering if there was anything that detected C stack overflow in a nice way (i.e., not by having to cut down my program until I stop getting a segmentation fault on the first line of main). In details: I have a program that looks somewhat like that: typedef struct{ /*a