block_write_full_page(): report ENOSPC
[deliverable/linux.git] / arch / x86_64 / kernel / stacktrace.c
CommitLineData
21b32bbf
IM
1/*
2 * arch/x86_64/kernel/stacktrace.c
3 *
4 * Stack trace management functions
5 *
6 * Copyright (C) 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
7 */
8#include <linux/sched.h>
9#include <linux/stacktrace.h>
c0b766f1
AK
10#include <linux/module.h>
11#include <asm/stacktrace.h>
21b32bbf 12
c0b766f1 13static void save_stack_warning(void *data, char *msg)
21b32bbf 14{
21b32bbf
IM
15}
16
c0b766f1
AK
17static void
18save_stack_warning_symbol(void *data, char *msg, unsigned long symbol)
21b32bbf 19{
21b32bbf
IM
20}
21
c0b766f1 22static int save_stack_stack(void *data, char *name)
21b32bbf 23{
c0b766f1
AK
24 struct stack_trace *trace = (struct stack_trace *)data;
25 return trace->all_contexts ? 0 : -1;
26}
21b32bbf 27
c0b766f1
AK
28static void save_stack_address(void *data, unsigned long addr)
29{
30 struct stack_trace *trace = (struct stack_trace *)data;
31 if (trace->skip > 0) {
32 trace->skip--;
33 return;
21b32bbf 34 }
006e84ee 35 if (trace->nr_entries < trace->max_entries)
c0b766f1 36 trace->entries[trace->nr_entries++] = addr;
21b32bbf
IM
37}
38
c0b766f1
AK
39static struct stacktrace_ops save_stack_ops = {
40 .warning = save_stack_warning,
41 .warning_symbol = save_stack_warning_symbol,
42 .stack = save_stack_stack,
43 .address = save_stack_address,
44};
21b32bbf
IM
45
46/*
47 * Save stack-backtrace addresses into a stack_trace buffer.
21b32bbf 48 */
5a1b3999 49void save_stack_trace(struct stack_trace *trace, struct task_struct *task)
21b32bbf 50{
c0b766f1 51 dump_trace(task, NULL, NULL, &save_stack_ops, trace);
006e84ee
CM
52 if (trace->nr_entries < trace->max_entries)
53 trace->entries[trace->nr_entries++] = ULONG_MAX;
21b32bbf 54}
c0b766f1 55EXPORT_SYMBOL(save_stack_trace);
21b32bbf 56
This page took 0.089638 seconds and 5 git commands to generate.