summaryrefslogtreecommitdiffstats
path: root/runtime/builtin_functions.h
blob: 505d073b7d5eaa47552051fae61a72b8f4e4c56d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef _BUILTIN_FUNCTIONS_
#define _BUILTIN_FUNCTIONS_

/* Builtin function definitions.
 * Copyright (C) 2005 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.
 */

/* 
 * This file contains definitions for "builtin functions" which are
 * registered in the systemtap translator, but given no definition.
 * The translator emits calls to builtins exactly the same way it
 * emits calls to functions written in the systemtap language; the
 * only difference is that this file (or a C tapset) must supply the
 * definition.
 *
 * Every builtin function "foo" called by a systemtap script is
 * translated to a C call to a C function named "function_foo". This
 * is the function you must provide in this file. In addition, the
 * translator emits a 
 * 
 *  #define _BUILTIN_FUNCTION_foo_ 
 *
 * symbol for each such function called, which you can use to elide
 * function definitions which are not used by a given systemtap
 * script.
 */

#ifdef _BUILTIN_FUNCTION_printk_
static void
function_printk (struct context *c)
{
  printk (KERN_INFO "%s\n", c->locals[c->nesting].function_printk.message);
}
#endif /* _BUILTIN_FUNCTION_printk_ */


#ifdef _BUILTIN_FUNCTION_log_
static void
function_log (struct context *c)
{
  _stp_log (c->locals[c->nesting].function_log.message);
}
#endif /* _BUILTIN_FUNCTION_log_ */


#ifdef _BUILTIN_FUNCTION_warn_
static void
function_warn (struct context *c)
{
  _stp_warn (c->locals[c->nesting].function_warn.message);
}
#endif /* _BUILTIN_FUNCTION_warn_ */


#endif /* _BUILTIN_FUNCTIONS_ */