I know the definition of setjmp and longjmp. setjmp stores the environment in stack context and the other one restores.
But i think there is somewhere some lack of understanding in my part. Can someone explain me, with the help of good examples as how can i assure, and how it will be saved and how it will be restored?
I saw the there are a lot of CPU registers pointed in jmp_buf. But how do i assure that it is restored?
Kindly help me to explain with neat examples. I googled and referred to other questions with stack overflow, but none give clear examples.
Huge huge thanks in advance.
P.S: It should be from Linux/ Unix context only.