Unix/Linux Go Back    

NetBSD 6.1.5 - man page for stack_alloc (netbsd section 9)

Linux & Unix Commands - Search Man Pages
Man Page or Keyword Search:   man
Select Man Page Set:       apropos Keyword Search (sections above)

STACK(9)			  BSD Kernel Developer's Manual 			 STACK(9)

     STACK -- stack macros

     #include <sys/param.h>

     STACK_ALLOC(sp, size);

     STACK_MAX(sp, size);

     STACK_ALIGN(sp, bytes);

     STACK_GROW(sp, size);

     STACK_SHRINK(sp, size);

     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 spec-
     ified amount of bytes.

     Two basic operations are common to all stacks: a data item is added (``push'') to the loca-
     tion 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.

     param(3), queue(3)

BSD					  April 8, 2011 				      BSD
Unix & Linux Commands & Man Pages : ©2000 - 2018 Unix and Linux Forums

All times are GMT -4. The time now is 07:43 AM.