aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/kernel.h41
1 files changed, 40 insertions, 1 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index bc5392a326ab..a3a5574a61fc 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -514,7 +514,8 @@ do { \
514 * 514 *
515 * This is intended as a debugging tool for the developer only. 515 * This is intended as a debugging tool for the developer only.
516 * Please refrain from leaving trace_printks scattered around in 516 * Please refrain from leaving trace_printks scattered around in
517 * your code. 517 * your code. (Extra memory is used for special buffers that are
518 * allocated when trace_printk() is used)
518 */ 519 */
519 520
520#define trace_printk(fmt, args...) \ 521#define trace_printk(fmt, args...) \
@@ -537,6 +538,44 @@ int __trace_bprintk(unsigned long ip, const char *fmt, ...);
537extern __printf(2, 3) 538extern __printf(2, 3)
538int __trace_printk(unsigned long ip, const char *fmt, ...); 539int __trace_printk(unsigned long ip, const char *fmt, ...);
539 540
541/**
542 * trace_puts - write a string into the ftrace buffer
543 * @str: the string to record
544 *
545 * Note: __trace_bputs is an internal function for trace_puts and
546 * the @ip is passed in via the trace_puts macro.
547 *
548 * This is similar to trace_printk() but is made for those really fast
549 * paths that a developer wants the least amount of "Heisenbug" affects,
550 * where the processing of the print format is still too much.
551 *
552 * This function allows a kernel developer to debug fast path sections
553 * that printk is not appropriate for. By scattering in various
554 * printk like tracing in the code, a developer can quickly see
555 * where problems are occurring.
556 *
557 * This is intended as a debugging tool for the developer only.
558 * Please refrain from leaving trace_puts scattered around in
559 * your code. (Extra memory is used for special buffers that are
560 * allocated when trace_puts() is used)
561 *
562 * Returns: 0 if nothing was written, positive # if string was.
563 * (1 when __trace_bputs is used, strlen(str) when __trace_puts is used)
564 */
565
566extern int __trace_bputs(unsigned long ip, const char *str);
567extern int __trace_puts(unsigned long ip, const char *str, int size);
568#define trace_puts(str) ({ \
569 static const char *trace_printk_fmt \
570 __attribute__((section("__trace_printk_fmt"))) = \
571 __builtin_constant_p(str) ? str : NULL; \
572 \
573 if (__builtin_constant_p(str)) \
574 __trace_bputs(_THIS_IP_, trace_printk_fmt); \
575 else \
576 __trace_puts(_THIS_IP_, str, strlen(str)); \
577})
578
540extern void trace_dump_stack(void); 579extern void trace_dump_stack(void);
541 580
542/* 581/*