|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /proc/21573/root/usr/share/systemtap/tapset/ |
Upload File : |
// logging tapset
// Copyright (C) 2005-2011 Red Hat Inc.
//
// This file is part of systemtap, and is free software. You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.
/**
* sfunction log - Send a line to the common trace buffer
*
* @msg: The formatted message string
*
* Description: This function logs data. log sends the
* message immediately to staprun and to the bulk transport
* (relayfs) if it is being used. If the last character given
* is not a newline, then one is added. This function is not
* as effecient as printf and should be used only for urgent
* messages.
*/
function log (msg:string) %{ /* unprivileged */
_stp_printf ("%s\n", STAP_ARG_msg);
%}
/**
* sfunction warn - Send a line to the warning stream
*
* @msg: The formatted message string
*
* Description: This function sends a warning message immediately to
* staprun. It is also sent over the bulk transport (relayfs) if it is
* being used. If the last characater is not a newline, the one is added.
*/
function warn (msg:string) %{ /* unprivileged */
_stp_warn ("%s", STAP_ARG_msg);
%}
/**
* sfunction exit - Start shutting down probing script.
*
* Description: This only enqueues a request to start
* shutting down the script. New probes will not fire
* (except "end" probes), but all currently
* running ones may complete their work.
*/
function exit () %{ /* unprivileged */
atomic_set (&session_state, STAP_SESSION_STOPPING);
_stp_exit ();
%}
/**
* sfunction error - Send an error message
*
* @msg: The formatted message string
*
* Description: An implicit end-of-line is added. staprun prepends
* the string "ERROR:". Sending an error message aborts the currently
* running probe. Depending on the MAXERRORS parameter, it may
* trigger an exit().
*/
function error (msg:string) %{ /* unprivileged */
/* This is an assignment of a local char[] to a global char*.
It would normally be just as unsafe as returning a pointer to
a local variable from a function. However, the translated
code ensures that upon an error (last_error != NULL), the
context stack is only ever unwound, and not reused, before
the probe-level stp-error call. */
CONTEXT->last_error = STAP_ARG_msg;
CONTEXT->last_stmt = NULL;
%}
function stp_print_binary(n:long, arg1:long, arg2:long, arg3:long, arg4:long) %{
_stp_print_binary (STAP_ARG_n, STAP_ARG_arg1, STAP_ARG_arg2, STAP_ARG_arg3, STAP_ARG_arg4);
%}
/**
* sfunction ftrace - Send a message to the ftrace ring-buffer
*
* @msg: The formatted message string
*
* Description: If the ftrace ring-buffer is configured & available,
* see /debugfs/tracing/trace for the message. Otherwise, the
* message may be quietly dropped. An implicit end-of-line is added.
*/
function ftrace (msg:string) %{
#ifdef STAPCONF_TRACE_PRINTK
static char *fmt = "%s\n";
trace_printk (fmt, STAP_ARG_msg);
/* The "fmt" is designed to be non __builtin_constant_p(), so as
to defeat trace_printk -> __trace_bprintk optimization. That's
because bprintk doesn't save the incoming strings, only their
addresses. */
#endif
%}
/**
* sfunction printk - Send a message to the kernel trace buffer
*
* @level: an integer for the severity level (0=KERN_EMERG ... 7=KERN_DEBUG)
* @msg: The formatted message string
*
* Description: Print a line of text to the kernel dmesg/console with the
* given severity. An implicit end-of-line is added. This function may
* not be safely called from all kernel probe contexts, so is restricted
* to guru mode only.
*/
function printk (level:long,msg:string) %{ /* guru */
printk (STAP_ARG_level == 0 ? KERN_EMERG "%s\n":
STAP_ARG_level == 1 ? KERN_ALERT "%s\n":
STAP_ARG_level == 2 ? KERN_CRIT "%s\n":
STAP_ARG_level == 3 ? KERN_ERR "%s\n":
STAP_ARG_level == 4 ? KERN_WARNING "%s\n":
STAP_ARG_level == 5 ? KERN_NOTICE "%s\n":
STAP_ARG_level == 6 ? KERN_INFO "%s\n":
STAP_ARG_level == 7 ? KERN_DEBUG "%s\n":
#ifdef KERN_DEFAULT
KERN_DEFAULT "%s\n"
#else
KERN_INFO "%s\n"
#endif
, STAP_ARG_msg);
%}