svn commit: r339924 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src modules/linuxkpi
Hans Petter Selasky
hselasky at FreeBSD.org
Tue Oct 30 16:42:58 UTC 2018
Author: hselasky
Date: Tue Oct 30 16:42:56 2018
New Revision: 339924
URL: https://svnweb.freebsd.org/changeset/base/339924
Log:
Implement the dump_stack() function in the LinuxKPI.
Submitted by: Johannes Lundberg <johalun0 at gmail.com>
MFC after: 3 days
Sponsored by: Mellanox Technologies
Modified:
head/sys/compat/linuxkpi/common/include/linux/kernel.h
head/sys/compat/linuxkpi/common/src/linux_compat.c
head/sys/modules/linuxkpi/Makefile
Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h Tue Oct 30 16:32:52 2018 (r339923)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Tue Oct 30 16:42:56 2018 (r339924)
@@ -138,6 +138,9 @@
#define printk(...) printf(__VA_ARGS__)
#define vprintk(f, a) vprintf(f, a)
+extern void linux_dump_stack(void);
+#define dump_stack() linux_dump_stack()
+
struct va_format {
const char *fmt;
va_list *va;
Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_compat.c Tue Oct 30 16:32:52 2018 (r339923)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c Tue Oct 30 16:42:56 2018 (r339924)
@@ -30,6 +30,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_stack.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
@@ -46,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include <sys/filio.h>
#include <sys/rwlock.h>
#include <sys/mman.h>
+#include <sys/stack.h>
#include <vm/vm.h>
#include <vm/pmap.h>
@@ -2205,6 +2208,18 @@ __unregister_chrdev(unsigned int major, unsigned int b
if (cdevp != NULL)
cdev_del(cdevp);
}
+}
+
+void
+linux_dump_stack(void)
+{
+#ifdef STACK
+ struct stack st;
+
+ stack_zero(&st);
+ stack_save(&st);
+ stack_print(&st);
+#endif
}
#if defined(__i386__) || defined(__amd64__)
Modified: head/sys/modules/linuxkpi/Makefile
==============================================================================
--- head/sys/modules/linuxkpi/Makefile Tue Oct 30 16:32:52 2018 (r339923)
+++ head/sys/modules/linuxkpi/Makefile Tue Oct 30 16:42:56 2018 (r339924)
@@ -24,7 +24,8 @@ SRCS+= bus_if.h \
pci_if.h \
vnode_if.h \
usb_if.h \
- opt_usb.h
+ opt_usb.h \
+ opt_stack.h
CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include
More information about the svn-src-all
mailing list