New answers tagged

5

The required stack argument goes hand-in-hand with the fn argument. The raw kernel syscall doesn’t always need a stack because it behaves like fork: execution in the child starts at the return of the system call. The libc wrapper then needs to set things up to call fn, and to do so, it needs the stack (and has always done so). As a result, a stack is always ...


2

I believe I've found the answer on my own. Looking at the x86-64 source file for the clone wrapper (clone.s) I found this interesting piece of code: movq %rdi,0(%rsi) This places the function pointer into the child process stack. This happen right before the syscall for clone. If my understanding is correct, then this causes the child process to ...


0

In Bash, there's the DIRSTACK array variable: DIRSTACK An array variable containing the current contents of the directory stack. Directories appear in the stack in the order they are displayed by the dirs builtin. The last one pushed is "${DIRSTACK[0]}", the second at index [1], etc. me@hostname /tmp$ pushd a /tmp/a /tmp me@hostname /tmp/a$ pushd ...


0

If you want to know just the name of the previous directory you can issue % echo $OLDPWD If you want to go to that directory, you can simply do % cd - which will automatically changedir to $OLDPWD If you want to the full directory stack that you have created using pushd-popd % dirs -v this will print the directory index alongside the directory name You ...


Top 50 recent answers are included