Consider this bad code, edited in Windows and run via CygWin after dos2unix so be
aware of any hidden "\r" charatcers...
Run under CygWin:-
On exitting the 10 stackit calls does the return stack remain __full__...
OR...
Does it get cleared completely by the exit 0 statement/command...
OR...
Is this skack only cleared on terminal closure...
OR...
Is it a memory leak...
OR finally...
I am missing something...
At this point I am assuming it is a memory leak...
I am not sure what you mean. Between subshell calls there is no regular "stack" like it is known from other programming languages (particularly FORTH and Assembler).
A subshell is basically opened by calling fork() and creating a new process environment, which inherits the environment from the calling process (with some rules applying, but that does not take anything away from the general principle). When the subshell is closed some values are passed back (return code, ...) but this is not like a "POP" operation because there was no stack to begin with - just nested subshell environments which in some (few, select) regards appear like a stack to the passing glance.
That code is a function that calls itself recursively 10 levels deep. The shell has to be prepared to process enough return staement to get back to the original caller. It is probably true that the shell is using the stack for this, but other implementations are possible. Whatever the shell is storing, it all goes away when the shell exits.
Hi All
Thought it would be kind of fun to implement a stack trace for a shell script that calls functions within a sub shell. This is for bash under Linux and probably not portable -
#! /bin/bash
error_exit()
{
echo "======================="
echo $1
echo... (4 Replies)
Hi,
I am new to the linux kernel development area. I want to know what is the difference between kernel mode stack and user mode stack? Does each process has a user mode stack and a kernel mode stack?? Or Each process has a user mode stack and there is only one kernel mode stack that is shared by... (4 Replies)
I would like to know how I could do the following :
void func(){
int a = 100; b=0;
int c = a/b;
}
void sig_handler (int sig,siginfo_t *info,void *context){
//signal handling function
//here I want to access the variables of func()
}
int main(){
struct sigaction *act =... (7 Replies)
Hello everbody:
when issuing the ulimit -a, on my tru64 machone, I get the following:
root@billing4# ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) 10485760
stack(kbytes) 32768
memory(kbytes) 10190528
coredump(blocks) 0... (1 Reply)
I try to solve the problem https://www.unix.com/showthread.php?p=86595 use stack hack method, I am puzzled the stack layout.
under vc6.0, the following code work(in release mode).
#include <stdio.h>
void change()
{
int x;
int j;
(&x) = 5; // if in debug mode, change to (&x) = 5;... (1 Reply)