×

Loading...

Topic

This topic has been archived. It cannot be replied.
  • 工作学习 / IT技术讨论 / Wish experts answer my questions in c programming under Unix in a real time system: Thanks! 1. how to enlarge the stack size in a c program? 2. should main() be the driver function in in a c program?
    • explain your questions in more detail. Your questions are too generic to be understood.
      • the stack is assigned during a *.c file compiled and loading into system. a executable file contains: symbol table,global variables, program code. so how a programmer enlarge the stack used by the *.c application?
        • you mean that *.c program running separately as a standalone process and your own application needs to enlarge the stack it uses. I guess you don't have the source code for the *.c program, right?
          • What you describ is correct. As for the code, I read it. A big array is used as a stack and the stack pointer moved to the bottom of such array at the very beginning of the .c program.
        • oh, I see , you are talking about Unix , not RTOS
          If you want to change user process stack size, use ulimit shell command to modify it(ulimi -s). As for kernel, there is no easy way to change it... emmm... maybe you can try to modify /etc/system, which is a file that configures kernel parameter upon boot, but be careful, you might make your unix box unbootable.
    • the space of stack is decided by linker
      check ur link program's man page to see the option
      • so the stack can not be enlarged in the program?
        • some trick can do so, but not recomanded