diff options
author | fche <fche> | 2008-02-27 23:11:19 +0000 |
---|---|---|
committer | fche <fche> | 2008-02-27 23:11:19 +0000 |
commit | a20617af34e3dbeba682cfa6bf6366f3fc0f8e14 (patch) | |
tree | cd840323c6adb32af3f5fa8136a396a3a4f8562b /doc/tutorial/embedded-C.stp | |
parent | 9a5de18784b77de82e5121861fac892c2d4d2630 (diff) | |
download | systemtap-steved-a20617af34e3dbeba682cfa6bf6366f3fc0f8e14.tar.gz systemtap-steved-a20617af34e3dbeba682cfa6bf6366f3fc0f8e14.tar.xz systemtap-steved-a20617af34e3dbeba682cfa6bf6366f3fc0f8e14.zip |
PR5697: include tutorial & language reference guide
Diffstat (limited to 'doc/tutorial/embedded-C.stp')
-rw-r--r-- | doc/tutorial/embedded-C.stp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/tutorial/embedded-C.stp b/doc/tutorial/embedded-C.stp new file mode 100644 index 00000000..6834d728 --- /dev/null +++ b/doc/tutorial/embedded-C.stp @@ -0,0 +1,25 @@ +%{ +#include <linux/utsname.h> +%} + +function utsname:string (field:long) +%{ + if (down_read_trylock (& uts_sem)) + { + const char *f = + (THIS->field == 0 ? system_utsname.sysname : + THIS->field == 1 ? system_utsname.nodename : + THIS->field == 2 ? system_utsname.release : + THIS->field == 3 ? system_utsname.version : + THIS->field == 4 ? system_utsname.machine : + THIS->field == 5 ? system_utsname.domainname : ""); + strlcpy (THIS->__retvalue, f, MAXSTRINGLEN); + up_read (& uts_sem); + } +%} + +probe begin +{ + printf ("%s %s\n", utsname(0), utsname(2)) + exit () +} |