mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
frace docs an mmap minor improvements
This commit is contained in:
@@ -10,8 +10,6 @@ Trace a single function:
|
||||
# Clear previous trace.
|
||||
echo '' > trace
|
||||
|
||||
echo 1 > max_graph_depth
|
||||
|
||||
# List the available tracers, and pick one.
|
||||
cat available_tracers
|
||||
echo function > current_tracer
|
||||
@@ -29,7 +27,7 @@ Trace a single function:
|
||||
head trace
|
||||
|
||||
# Observe trace continously, and drain seen events out.
|
||||
cat trace_pipe
|
||||
cat trace_pipe &
|
||||
|
||||
Sample output:
|
||||
|
||||
@@ -60,6 +58,7 @@ Sample output:
|
||||
|
||||
Trace all possible functions, and draw a call graph:
|
||||
|
||||
echo 1 > max_graph_depth
|
||||
echo 1 > events/enable
|
||||
echo function_graph > current_tracer
|
||||
|
||||
|
||||
@@ -3,10 +3,18 @@ Remember: mmap, like most fops, does not work with debugfs as of 4.9! https://pa
|
||||
|
||||
Adapted from:
|
||||
https://coherentmusings.wordpress.com/2014/06/10/implementing-mmap-for-transferring-data-from-user-space-to-kernel-space/
|
||||
|
||||
Related:
|
||||
|
||||
- https://stackoverflow.com/questions/10760479/mmap-kernel-buffer-to-user-space/10770582#10770582
|
||||
- https://stackoverflow.com/questions/1623008/allocating-memory-for-user-space-from-kernel-thread
|
||||
- https://stackoverflow.com/questions/6967933/mmap-mapping-in-user-space-a-kernel-buffer-allocated-with-kmalloc
|
||||
- https://github.com/jeremytrimble/ezdma
|
||||
- https://github.com/simonjhall/dma
|
||||
- https://github.com/ikwzm/udmabuf
|
||||
*/
|
||||
|
||||
#include <asm/uaccess.h> /* copy_from_user */
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h> /* min */
|
||||
|
||||
Reference in New Issue
Block a user