Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

stack(3pub) [debian man page]

STACK(3pub)						       C Programmer's Manual						       STACK(3pub)

NAME
stack_create, stack_destroy, stack_pop, stack_is_empty, stack_copy, stack_push - manipulate stacks SYNOPSIS
#include <stack.h> Stack *stack_create(void); void stack_destroy(Stack *); void *stack_pop(Stack *); int stack_is_empty(Stack *); Stack *stack_copy(Stack *); int stack_push(Stack *, void *data, size_t bytes); DESCRIPTION
These functions operate on stacks. This manual page is shortish. SEE ALSO
publib(3) AUTHOR
Lars Wirzenius (lars.wirzenius@helsinki.fi) Publib C Programmer's Manual STACK(3pub)

Check Out this Related Man Page

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

NAME
stack -- kernel thread stack tracing routines SYNOPSIS
#include <sys/param.h> #include <sys/stack.h> In the kernel configuration file: options DDB options STACK struct stack * stack_create(void); void stack_destroy(struct stack *st); int stack_put(struct stack *st, vm_offset_t pc); void stack_copy(struct stack *src, struct stack dst); void stack_zero(struct stack *st); void stack_print(struct stack *st); void stack_print_ddb(struct stack *st); void stack_print_short(struct stack *st); void stack_print_short_ddb(struct stack *st); void stack_sbuf_print(struct sbuf sb*, struct stack *st); void stack_sbuf_print_ddb(struct sbuf sb*, struct stack *st); void stack_save(struct stack *st); DESCRIPTION
The stack KPI allows querying of kernel stack trace information and the automated generation of kernel stack trace strings for the purposes of debugging and tracing. To use the KPI, at least one of options DDB and options STACK must be compiled into the kernel. Each stack trace is described by a struct stack. Before a trace may be created or otherwise manipulated, storage for the trace must be allo- cated with stack_create(), which may sleep. Memory associated with a trace is freed by calling stack_destroy(). A trace of the current kernel thread's call stack may be captured using stack_save(). stack_print() and stack_print_short() may be used to print a stack trace using the kernel printf(9), and may sleep as a result of acquiring sx(9) locks in the kernel linker while looking up symbol names. In locking-sensitive environments, the unsynchronized stack_print_ddb() and stack_print_short_ddb() variants may be invoked. This function bypasses kernel linker locking, making it usable in ddb(4), but not in a live system where linker data structures may change. stack_sbuf_print() may be used to construct a human-readable string, including conversion (where possible) from a simple kernel instruction pointer to a named symbol and offset. The argument sb must be an initialized struct sbuf as described in sbuf(9). This function may sleep if an auto-extending struct sbuf is used, or due to kernel linker locking. In locking-sensitive environments, such as ddb(4), the unsynchro- nized stack_sbuf_print_ddb() variant may be invoked to avoid kernel linker locking; it should be used with a fixed-length sbuf. The utility functions stack_zero, stack_copy, and stack_put may be used to manipulate stack data structures directly. SEE ALSO
ddb(4), printf(9), sbuf(9), sx(9) AUTHORS
The stack(9) function suite was created by Antoine Brodin. stack(9) was extended by Robert Watson for general-purpose use outside of ddb(4). BSD
June 24, 2009 BSD
Man Page

14 More Discussions You Might Find Interesting

1. Programming

How to increase the size of the stack

Hi!!, could someone tell me how to increase the stack size in HP-UX? Thanx (7 Replies)
Discussion started by: jyotipg
7 Replies

2. UNIX for Advanced & Expert Users

help required - stack trace

Hi all, One of our programs written in Java, produced this logfile. This job runs 48 threads and only one thread failed with this error. The code is a blackbox(external product), so cant look at the source code. From what I can infer from the log, the job was trying to write the log messages into... (9 Replies)
Discussion started by: ranj@chn
9 Replies

3. Programming

finding stack location in C using program

Is there a way to find the address of stack memory writing a program? Please guide me (12 Replies)
Discussion started by: jacques83
12 Replies

4. UNIX for Advanced & Expert Users

User defined stacks for threads using glibc-2.3.5

Hi, I am currently working with threads using linux 2.6.11 and glibc 2.3.5 on x86. When i am trying to create thread with user defined stacks glibc gives segmentation fault. I have written a wrapper to pthread_create () and generated shared object for the same. When i am trying to create any... (6 Replies)
Discussion started by: mysterious
6 Replies

5. Programming

Regarding stack analysis

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)
Discussion started by: vpraveen84
7 Replies

6. Programming

Threads and stack size

Can someone explain me, why when I create new threads with stack bigger than default (using pthread_attr_setstacksize()) i can create more? Each thread has it's own stack, so how bigger stack can cause possibility to create more threads? (7 Replies)
Discussion started by: dawwin
7 Replies

7. Ubuntu

pstack missing from Ubuntu 10.10

Hi All I would like to use the tool "pstack" to get a sample of the stack trace for a process. As far as I understood It seems widely available in all Linux systems, but it is not in Ubuntu 10.10. I tried using apt-get as per some posts in few forum, but it cannot be found in the APT... (9 Replies)
Discussion started by: manustone
9 Replies

8. UNIX for Dummies Questions & Answers

Stack Memory

I have a java process that piles up the stack memory. ulimit -a core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 10 stack size ... (9 Replies)
Discussion started by: mohtashims
9 Replies

9. UNIX for Advanced & Expert Users

How to identify maximum stack size?

Hi All, I have set max stack size as 4KB for my thread, but it always using very less. So I like to know what is the maximum stack size is used by my thread. I tried with gcc -fstack-usage command line option, but its not supported by mips. Kindly suggest me the way to find the max stack... (6 Replies)
Discussion started by: rajamohan
6 Replies

10. Shell Programming and Scripting

Stacking Columns

How do I stack several columns of data into their own rows? In: A,B,C,d,e,f,g,H,I 1,2,3,4,5,6,7,8,9 Out: A,B,C,X,Y,H,I 1,2,3,d,4,8,9 1,2,3,e,5,8,9 1,2,3,f,6,8,9 1,2,3,g,7,8,9 Mike (10 Replies)
Discussion started by: Michael Stora
10 Replies

11. Linux

Server hung, is this a stack trace?

Hi everyone, Our Red Hat server hung yesterday, and I managed to log into the console and see the following message: RIP: 0010: mwait_idle_with_hints+0x66/ 0x67 RSP: 0018:ffffffff80457f40 EFLAGS: 00000046 RAX: 0000000000000010 RBX: ffff810c20075910 RCX: 0000000000000001 RDX:... (6 Replies)
Discussion started by: badoshi
6 Replies

12. Solaris

Configure dual stack on existing Solaris 10

I have a Solaris 10 server with the following interfaces: ifconfig -a lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 e1000g0: flags=209040843<UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER,CoS> mtu 1500 index... (8 Replies)
Discussion started by: e_mikey_2000
8 Replies

13. What is on Your Mind?

Your Favorite Tech Support Web Sites and Why?

Where do you go to participate in technical discussions besides UNIX.COM and why? Personally, I do not really participate in other forums and discussion boards, but I do ask questions from time to time on Stack sites. The problem I have with Stack is that my questions are never answered on any... (30 Replies)
Discussion started by: Neo
30 Replies

14. UNIX for Beginners Questions & Answers

Saltstack commands inside bash scripts donā€™t work

In a Redhat Linux environment, I could run salt commands on the $ prompt but not inside my bash scripts. It will say command not found and the $PATH variable is exactly the same outside and inside the script. !#/usr/bin/bash echo “running”¯ salt "*" cmd.run ‘ls' exit Output:-... (8 Replies)
Discussion started by: gurudewa
8 Replies