I have a question about the stack size of a process on Linux. Is this stack size determined at linkage time and is coded in the ELF file?
I wrote a program which prints its stack size by
pthread_attr_getstacksize(&attr, &stacksize);
And if I run this program directly from a shell, it gives a value of about 10MB. But when I exec
it from a thread which belongs to a multi-thread program, it gives a value of about 2MB.
So I want to know what factors affect the stack size of a process which is fork and exec
-ed from some parent process. And is it possible to set the stack size of a process in its parent at run time before fork and exec
the child?