STACK(9) BSD Kernel Developer's Manual STACK(9)NAME
STACK -- stack macros
SYNOPSIS
#include <sys/param.h>
type
STACK_ALLOC(sp, size);
type
STACK_MAX(sp, size);
type
STACK_ALIGN(sp, bytes);
type
STACK_GROW(sp, size);
type
STACK_SHRINK(sp, size);
DESCRIPTION
A stack is an area of memory with a fixed origin but with a variable size. A stack pointer points to the most recently referenced location
on the stack. Initially, when the stack has a size of zero, the stack pointer points to the origin of the stack. When data items are added
to the stack, the stack pointer moves away from the origin.
The STACK_ALLOC() macro returns a pointer to allocated stack space of some size. Given the returned pointer sp and size, STACK_MAX() returns
the maximum stack address of the allocated stack space. The STACK_ALIGN() macro can be used to align the stack pointer sp by the specified
amount of bytes.
Two basic operations are common to all stacks: a data item is added (``push'') to the location pointed by sp or a data item is removed
(``pop'') from the stack. The stack pointer must be subsequently adjusted by the size of the data item. The STACK_GROW() and STACK_SHRINK()
macros adjust the stack pointer sp by given size.
A stack may grow either up or down. The described macros take this into account by using the __MACHINE_STACK_GROWS_UP preprocessor define.
SEE ALSO param(3), queue(3)BSD April 8, 2011 BSD
Check Out this Related Man Page
STACK(9) BSD Kernel Developer's Manual STACK(9)NAME
STACK -- stack macros
SYNOPSIS
#include <sys/param.h>
type
STACK_ALLOC(sp, size);
type
STACK_MAX(sp, size);
type
STACK_ALIGN(sp, bytes);
type
STACK_GROW(sp, size);
type
STACK_SHRINK(sp, size);
DESCRIPTION
A stack is an area of memory with a fixed origin but with a variable size. A stack pointer points to the most recently referenced location
on the stack. Initially, when the stack has a size of zero, the stack pointer points to the origin of the stack. When data items are added
to the stack, the stack pointer moves away from the origin.
The STACK_ALLOC() macro returns a pointer to allocated stack space of some size. Given the returned pointer sp and size, STACK_MAX() returns
the maximum stack address of the allocated stack space. The STACK_ALIGN() macro can be used to align the stack pointer sp by the specified
amount of bytes.
Two basic operations are common to all stacks: a data item is added (``push'') to the location pointed by sp or a data item is removed
(``pop'') from the stack. The stack pointer must be subsequently adjusted by the size of the data item. The STACK_GROW() and STACK_SHRINK()
macros adjust the stack pointer sp by given size.
A stack may grow either up or down. The described macros take this into account by using the __MACHINE_STACK_GROWS_UP preprocessor define.
SEE ALSO param(3), queue(3)BSD April 8, 2011 BSD
Hi, I am writing a C program under SCO Unix. I have a memory stack problem but do not know how to go about fixing it. I have tried running INSURE but that does not detect any problems.
Essentially the problem is that the memory address shifts on return from a routine. I pass a pointer to... (3 Replies)
can anyone explain how the local variables are acessed from a stack frame of that particular function..since stacks can only push or pop values and stack pointer always points to top of the stack and the frame pointer always points to the end of the previous stack frame..how local variables are... (4 Replies)
Hi,
In Linux how to find out what will be the stack size allocated for a process?
Actually i have to fork n number of processess, and will call exec. I will be execing an executable which is already multithreaded and each thread size is defined. My doubt is how to know if the size of the... (2 Replies)
Hi,
Please see this:
When i make a declaration as:
char *i, j, *k;
and then do
sprintf( k, "print.sh %s", i );
the program works fine.
But when i change the declaration to:
char *i, *k;
and then do
sprintf( k, "print.sh %s", i );
I get a segmentation fault at the 'sprintf'... (16 Replies)
Hi,
I have a basic doubt here.
Consider the following code snippet:
main()
{
int *a;
.
.
}
Here the memory for a gets allocated in heap or stack. (5 Replies)
Hi all,
After being dumped in a Solaris sysadmin role, i have been trying to tidy the unpatched mess I have inherited. Part of this task is to update the current AMP stack.
The current stack is Webstack 1.5, which was current in 2009, and as far as I can see, no longer supported. Post the... (2 Replies)
I'm trying to create a simplified version of dc to learn from. The first thing I notice is that the main stack stores strings. How would I implement a string stack in C? How is something like this:
struct StringStack
{
const unsigned int pysicalSize; // physical size of the stack... (3 Replies)
Our stack used to be FreeBSD - Lighttpd - MySQL - Perl - Python - C++, which abbreviates to flimppc++ and pronounced as flimpsy.
Not great, but still better than our newer stack: Linux - Lighttpd - MariaDB - Perl - Python - C++, which abbreviates to llimppc++. The phonetic meaning behind that... (2 Replies)
Hi,
I am working in UEFI EDK2 Bios source. We created a platform related new package in the EDK2 source. I find a strange issue with the platform related code we added.
When I did source level debugging I noticed the
local variable in a C function is not getting created in stack when its... (6 Replies)
I am trying to illustrate the reverse order of parameters on the stack when passed to a function in C:
#include <stdio.h>
void p(int p1, int p2, double p3)
{
printf("params:\n"
"1) %p offset = %li\n"
"2) %p offset = %li\n"
... (5 Replies)