From 3af510b4d1db129b9bf93305a338e0c2c1e2da19 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Tue, 1 Apr 2008 22:11:31 -0400 Subject: removing abandoned experiment: safety/* disassembly/symbol checks --- ChangeLog | 4 + safety/README | 10 -- safety/data/opcodes-i686 | 107 -------------------- safety/data/opcodes-ia64 | 89 ---------------- safety/data/opcodes-x86_64 | 104 ------------------- safety/data/references | 94 ----------------- safety/safety.py | 245 --------------------------------------------- 7 files changed, 4 insertions(+), 649 deletions(-) delete mode 100644 safety/README delete mode 100644 safety/data/opcodes-i686 delete mode 100644 safety/data/opcodes-ia64 delete mode 100644 safety/data/opcodes-x86_64 delete mode 100644 safety/data/references delete mode 100755 safety/safety.py diff --git a/ChangeLog b/ChangeLog index 8eb41250..ad961375 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-04-01 Frank Ch. Eigler + + * safety/*: Removed subdirectory containing abandoned experiment. + 2008-03-31 Frank Ch. Eigler * configure.ac: Bump version to 0.7. diff --git a/safety/README b/safety/README deleted file mode 100644 index 61eda4a2..00000000 --- a/safety/README +++ /dev/null @@ -1,10 +0,0 @@ -This is a static safety-checker for SystemTap modules. It attempts to -validate modules by checking the opcodes used and the external references -against a whitelist. - -The script relies on external data files to provide the whitelists, which by -default are in the /data directory. The 'references' file -provides a plain list of allowed references. The 'opcodes' file provides a -list of regular expressions that match allowed opcodes. Either data file may -have an optional kernel and/or architecture suffix, as in 'opcodes-i686' or -'references-2.6.9-32.ELsmp-x86_64'. diff --git a/safety/data/opcodes-i686 b/safety/data/opcodes-i686 deleted file mode 100644 index 123fa2b0..00000000 --- a/safety/data/opcodes-i686 +++ /dev/null @@ -1,107 +0,0 @@ -aaa -aad -aam -aas -adc[bwl]? -add[bwl]? -and[bwl]? -bound[wl]? -bsf[wl]? -bsr[wl]? -bswapl? -btc[wl]? -btr[wl]? -bts[wl]? -bt[wl]? -call -cbtw -cbw -cdq -clc -cld -cli -cltd -cmc -cmovn?(?:a|ae|b|be|c|e|g|ge|l|le|o|p|pe|po|s|z)[wl]? -cmp[bwl]? -cmps[bwl]? -cmpxchg8b -cmpxchg[bwl]? -cpuid -cwd -cwde -cwtd -cwtl -daa -das -dec[bwl]? -div[bwl]? -enter -idiv[bwl]? -imul[bwl]? -inc[bwl]? -je?cxz -jmp -jn?(?:a|ae|b|be|c|e|g|ge|l|le|o|p|pe|po|s|z) -lcall -lds[wl]? -leave -lea[wl]? -les[wl]? -lfence -lfs[wl]? -lgs[wl]? -lods[bwl]? -loopn?[ze]? -lret -lss[wl]? -mfence -movaps -mov[bwl]? -movs[bwl]? -movsb[wl]? -movswl? -movzb[wl]? -movzwl? -mul[bwl]? -neg[bwl]? -nop -not[bwl]? -or[bwl]? -pause -popa[wl]? -popf[wl]? -pop[wl]? -prefetch(?:t[012]|nta) -pusha[wl]? -pushf[wl]? -push[wl]? -rcl[bwl]? -rcr[bwl]? -rdmsr -rdtsc -ret -rol[bwl]? -ror[bwl]? -sahf -sal[bwl]? -sar[bwl]? -sbb[bwl]? -scas[bwl]? -setn?(?:a|ae|b|be|c|e|g|ge|l|le|o|p|pe|po|s|z) -shl[bwl]? -shld[bwl]? -shr[bwl]? -shrd[bwl]? -smov[lw]? -stc -std -sti -stos[bwl]? -sub[bwl]? -test[bwl]? -xadd[bwl]? -xchg[bwl]? -xlat -xlatb -xor[bwl]? diff --git a/safety/data/opcodes-ia64 b/safety/data/opcodes-ia64 deleted file mode 100644 index edb1792e..00000000 --- a/safety/data/opcodes-ia64 +++ /dev/null @@ -1,89 +0,0 @@ -add[sl]? -addp4 -alloc -and -andcm -br(?:\.cond)?(?:\.(?:spnt|sptk|dpnt|dptk))?(?:\.(?:few|many))?(?:\.clr)? -br\.cond(?:\.(?:spnt|sptk|dpnt|dptk))?(?:\.(?:few|many))?(?:\.clr)? -br\.call(?:\.(?:spnt|sptk|dpnt|dptk))?(?:\.(?:few|many))?(?:\.clr)? -br\.ret(?:\.(?:spnt|sptk|dpnt|dptk))?(?:\.(?:few|many))?(?:\.clr)? -br\.cloop(?:\.(?:spnt|sptk|dpnt|dptk))?(?:\.(?:few|many))?(?:\.clr)? -br\.ctop(?:\.(?:spnt|sptk|dpnt|dptk))?(?:\.(?:few|many))?(?:\.clr)? -br\.cexit(?:\.(?:spnt|sptk|dpnt|dptk))?(?:\.(?:few|many))?(?:\.clr)? -br\.wtop(?:\.(?:spnt|sptk|dpnt|dptk))?(?:\.(?:few|many))?(?:\.clr)? -br\.wexit(?:\.(?:spnt|sptk|dpnt|dptk))?(?:\.(?:few|many))?(?:\.clr)? -brl(?:\.cond)?(?:\.(?:spnt|sptk|dpnt|dptk))?(?:\.(?:few|many))?(?:\.clr)? -brl\.call(?:\.(?:spnt|sptk|dpnt|dptk))?(?:\.(?:few|many))?(?:\.clr)? -brp(?:\.(?:sptk|loop|exit|dptk))(?:\.imp)? -brp\.ret(?:\.(?:sptk|loop|exit|dptk))(?:\.imp)? -chk\.s(?:\.[im])? -chk\.a\.(?:clr|nc) -clrrrb -cmp\.(?:eq|ne|l[te]u?|g[te]u?)(?:\.(?:unc|or|and|or.andcm|orcm|andcm|and.orcm))? -cmp4\.(?:eq|ne|l[te]u?|g[te]u?)(?:\.(?:unc|or|and|or.andcm|orcm|andcm|and.orcm))? -cmpxchg[1248]\.(?:acq|rel)(?:\.nt[1a])? -cmp8xchg16\.(?:acq|rel)(?:\.nt[1a])? -cover -czx[12]\.[lr] -dep(?:\.z)? -extr(?:\.u)? -fetchadd[48]\.(?:acq|rel)(?:\.nt[1a])? -getf\.(?:s|d|exp|sig) -hint(?:\.[ibmfx])? -ld[1248](?:\.(?:s|a|sa|c\.nc|c\.clr|c\.clr\.acq|acq|bias))?(?:\.nt[1a])? -ld8\.fill(?:\.nt[1a])? -ld16(?:\.acq)?(?:\.nt[1a])? -ldf8(?:\.(?:s|a|sa|c\.nc|c\.clr))?(?:\.nt[1a])? -lfetch(?:.fault)?(?:\.excl)?(?:\.nt[12a])? -mf -mix[124]\.[lr] -mov(?:\.[im])? -mov(?:\.ret)?(?:\.sptk|\.dptk)?(?:\.imp)? -movl -mux[12] -nop(?:\.[ibmfx])? -or -pack2\.[us]ss -pack4.sss -padd[124] -padd[12]\.(?:sss|uus|uuu) -pavg[12](?:\.raz) -pavgsub[12] -pcmp[124]\.(?:eq|gt) -pmax1\.u -pmax2 -pmin1\.u -pmin2 -pmpy2\.[rl] -pmpyshr2(?:\.u)? -popcnt -psad1 -pshl[24] -pshladd2 -pshr[24](?:\.u)? -pshradd2 -psub[124] -psub[12]\.(?:sss|uus|uuu) -rsm -setf\.(?:s|d|exp|sig) -shl -shladd -shladdp4 -shr(?:\.u)? -shrp -srlz\.[id] -ssm -st[1248](?:\.rel)?(?:\.nta)? -st16(?:\.rel)?(?:\.nta)? -st8\.spill(?:\.nta)? -stf8(?:\.nta)? -sub -sxt[124] -tbit\.n?z(?:\.(?:unc|or|and|or.andcm|orcm|andcm|and.orcm))? -tnat\.n?z(?:\.(?:unc|or|and|or.andcm|orcm|andcm|and.orcm))? -unpack[124]\.[hl] -xchg[1248](?:\.nt[1a])? -xma\.[lh]u? -xmpy\.[lh]u? -xor -zxt[124] diff --git a/safety/data/opcodes-x86_64 b/safety/data/opcodes-x86_64 deleted file mode 100644 index b89df879..00000000 --- a/safety/data/opcodes-x86_64 +++ /dev/null @@ -1,104 +0,0 @@ -adc[bwlq]? -add[bwlq]? -and[bwlq]? -boundl? -bsf[wlq]? -bsr[wlq]? -bswap[lq]? -btc[wlq]? -btr[wlq]? -bts[wlq]? -bt[wlq]? -callq? -cbtw -cbw -cdq -cdqe -clc -cld -cli -cltd -cltq -cmc -cmovn?(?:a|ae|b|be|c|e|g|ge|l|le|o|p|pe|po|s|z)[wlq]? -cmp[bwlq]? -cmps[bwlq]? -cmpxchg16b -cmpxchg8b -cmpxchg[bwlq]? -cpuid -cqo -cqtd -cqto -cwd -cwde -cwtd -cwtl -dec[bwlq]? -div[bwlq]? -enterq? -idiv[bwlq]? -imul[bwlq]? -inc[bwlq]? -jcxz -jmpq? -jn?(?:a|ae|b|be|c|e|g|ge|l|le|o|p|pe|po|s|z) -lcallq? -leaveq? -lea[wlq]? -lfence -lfs[wl]? -lgs[wl]? -lods[bwlq]? -loopn?[ze]? -lretq? -lss[wl]? -mfence -movaps -mov[bwlq]? -movs[bwlq]? -movsb[wlq]? -movslq? -movsw[lq]? -movzb[wlq]? -movzw[lq]? -mul[bwlq]? -neg[bwlq]? -nop -not[bwlq]? -or[bwlq]? -pause -popf[wlq]? -pop[wlq]? -prefetch(?:t[012]|nta) -pushf[wlq]? -push[wlq]? -rcl[bwlq]? -rcr[bwlq]? -rdmsr -rdtsc -retq? -rol[bwlq]? -ror[bwlq]? -sahf -sal[bwlq]? -sar[bwlq]? -sbb[bwlq]? -scas[bwlq]? -setn?(?:a|ae|b|be|c|e|g|ge|l|le|o|p|pe|po|s|z) -shl[bwlq]? -shld[bwlq]? -shr[bwlq]? -shrd[bwlq]? -smov[lw]? -stc -std -sti -stos[bwlq]? -sub[bwlq]? -test[bwlq]? -xadd[bwlq]? -xchg[bwlq]? -xlat -xlatb -xor[bwlq]? diff --git a/safety/data/references b/safety/data/references deleted file mode 100644 index bfea8e86..00000000 --- a/safety/data/references +++ /dev/null @@ -1,94 +0,0 @@ -__alloc_percpu -autoremove_wake_function -__bitmap_weight -cond_resched -__const_udelay -copy_from_user -__copy_from_user_ll -copy_to_user -__copy_user -copy_user_generic -cpu_callout_map -cpu_online_map -cpu_possible_map -cpu_to_node -create_proc_entry -del_timer_sync -__divdi3 -do_gettimeofday -__down_failed -__find_next_bit -find_next_bit -finish_wait -free_percpu -__get_user_4 -init_timer -__init_timer_base -jiffies -kallsyms_lookup_name -kfree -__kmalloc -kmalloc_node -kmem_cache_alloc -malloc_sizes -memcmp -memcpy -memset -__might_sleep -__moddi3 -__mod_timer -mod_timer -msleep -node_online_map -param_get_int -param_get_long -param_get_string -param_set_copystring -param_set_int -param_set_long -per_cpu__cpu_info -prepare_to_wait -printk -proc_mkdir -proc_root -_read_lock -_read_trylock -_read_unlock -register_kprobe -register_kretprobe -register_profile_notifier -register_timer_hook -remove_proc_entry -schedule -schedule_delayed_work -scnprintf -simple_strtol -snprintf -_spin_lock -_spin_lock_irqsave -_spin_trylock -_spin_unlock -_spin_unlock_irqrestore -sprintf -strcmp -strlcat -strlcpy -strlen -strncmp -strncpy -__strncpy_from_user -strsep -__udivdi3 -__umoddi3 -unregister_kprobe -unregister_kretprobe -unregister_profile_notifier -unregister_timer_hook -unw_init_running -unw_unwind -__up_wakeup -vscnprintf -vsnprintf -__wake_up -_write_trylock -_write_unlock diff --git a/safety/safety.py b/safety/safety.py deleted file mode 100755 index 8607ce75..00000000 --- a/safety/safety.py +++ /dev/null @@ -1,245 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# vim: noet sw=4 ts=4 enc=utf-8 -"A static safety-checker for SystemTap modules." - -# Copyright (C) 2006 Intel Corporation. -# -# 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. - - -# in python 2.4, set & frozenset are builtins -# in python 2.3, the equivalents live in the 'sets' module -from sys import hexversion as __hexversion -if __hexversion < 0x020400f0: - from sets import Set as set, ImmutableSet as frozenset - - -def main(argv): - """ - CLI to the SystemTap static safety-checker. - - Provides a command-line interface for running the SystemTap module - safety checker. Use '-h' or '--help' for a description of the - command-line options. - - Returns the number of modules that failed the check. - """ - bad = 0 - (options, args) = __parse_args(argv[1:]) - safe = StaticSafety(options.arch, options.release, options.datapath) - for m in args: - if not safe.check_module(m): - bad += 1 - return bad - - -def __parse_args(argv): - from optparse import OptionParser - parser = OptionParser(usage="usage: %prog [options] [module]...", - description=__doc__) - parser.add_option('--data-path', dest='datapath', metavar='PATH', - help='specify the whitelist data files [default: /data]') - parser.add_option('-m', '--machine', '--architecture', dest='arch', - help='specify the machine architecture of the target') - parser.add_option('-r', '--kernel-release', dest='release', - help='specify the kernel release running on the target') - return parser.parse_args(argv) - - -class StaticSafety: - "Manage a safety-checking session." - - def __init__(self, arch=None, release=None, datapath=None): - from os import uname - self.__arch = arch or uname()[4] - self.__release = release or uname()[2] - self.__build_data_path(datapath) - self.__build_search_suffixes() - self.__load_allowed_references() - self.__load_allowed_opcodes() - - def __build_data_path(self, datapath): - "Determine where the data directory resides." - from sys import argv - from os.path import dirname, isdir, realpath - if datapath is None: - local = dirname(realpath(argv[0])) - self.__data_path = local + '/data' - else: - self.__data_path = datapath - - if not isdir(self.__data_path): - raise StandardError( - "Can't find the data directory! (looking in %s)" - % self.__data_path) - - def __build_search_suffixes(self): - "Construct arch & kernel-versioning search suffixes." - ss = set() - - # add empty string - ss.add('') - - # add architecture search path - archsfx = '-%s' % self.__arch - ss.add(archsfx) - - # add full kernel-version-release (2.6.NN-FOOBAR) + arch - relsfx = '-%s' % self.__release - ss.add(relsfx) - ss.add(relsfx + archsfx) - - # add kernel version (2.6.NN) + arch - dash_i = relsfx.find('-') - if dash_i > 0: - ss.add(relsfx[:dash_i]) - ss.add(relsfx[:dash_i] + archsfx) - - # start dropping decimals - dot_i = relsfx.rfind('.', 0, dash_i) - while dot_i > 0: - ss.add(relsfx[:dot_i]) - ss.add(relsfx[:dot_i] + archsfx) - dot_i = relsfx.rfind('.', 0, dot_i) - - self.__search_suffixes = frozenset(ss) - - def __load_allowed_references(self): - "Build the list of allowed external references from the data files." - wr = set() - for sfx in self.__search_suffixes: - try: - refs = open(self.__data_path + '/references' + sfx) - for line in refs: - wr.add(line.rstrip()) - refs.close() - except IOError: - pass - if not len(wr): - raise StandardError("No whitelisted references found!") - self.__white_references = frozenset(wr) - - def __load_allowed_opcodes(self): - "Build the regular expression matcher for allowed opcodes from the data files." - from re import compile - wo = [] - for sfx in self.__search_suffixes: - try: - opcs = open(self.__data_path + '/opcodes' + sfx) - for line in opcs: - wo.append(line.rstrip()) - opcs.close() - except IOError: - pass - if not len(wo): - raise StandardError("No whitelisted opcodes found!") - self.__white_opcodes_re = compile(r'^(?:' + r'|'.join(wo) + r')$') - - def __check_references(self, module): - "Check that all unresolved references in the module are allowed." - from os import popen - from re import compile - - sym_re = compile(r'^([\w@.]+) [Uw]\s+$') - def check(line): - m = sym_re.match(line) - if m: - ref = m.group(1) - if ref not in self.__white_references: - print 'ERROR: Invalid reference to %s' % ref - return False - return True - print 'WARNING: Unmatched line:\n %s' % `line` - return True - - command = 'nm --format=posix --no-sort --undefined-only ' + `module` - ok = True - nm = popen(command) - for line in nm: - ok &= check(line) - if nm.close(): - ok = False - return ok - - def __check_opcodes(self, module): - "Check that all disassembled opcodes in the module are allowed." - from os import popen - from re import compile - - skip_ud2a = [0] - - ignore_re = compile(r'^$|^\s+\.{3}$|^.*Disassembly of section|^.*file format') - if self.__arch == 'ia64': - opc = r'(?:\[[IBFLMX]{3}\]\s+)?(?:\(p\d\d\)\s+)?([\w.]+)\b' - elif self.__arch == 'x86_64' or self.__arch == 'i686': - opc = r'(?:lock\s+)?|(?:repn?[ze]?\s+)?|(?:rex\w+\s+)?(\w+)\b' - else: - opc = r'(\w+)\b' - opc_re = compile(r'^[A-Fa-f\d]+\s+<([^>]+)>\s+%s' % opc) - def check(line): - m = ignore_re.match(line) - if m: - return True - m = opc_re.match(line) - if m: - loc, opc = m.groups() - if opc == 'ud2a': - # The kernel abuses ud2a for BUG checks by following it - # directly with __LINE__ and __FILE__. Objdump doesn't - # know this though, so it tries to interpret the data as - # real instructions. Because x86(-64) instructions are - # variable-length, it's hard to tell when objdump is synced - # up again. We'll fast-forward to the next function - # boundary and hope things are better there. - for skip in objdump: - mskip = opc_re.match(skip) - if mskip: - locskip = mskip.group(1) - # a loc without an offset marks a new function - if '+' not in locskip: - return check(skip) - skip_ud2a[0] += 1 - return True - elif not self.__white_opcodes_re.match(opc): - print "ERROR: Invalid opcode '%s' at <%s>" % (opc, loc) - return False - return True - print 'WARNING: Unmatched line:\n %s' % `line` - return True - - command = 'objdump --disassemble --prefix-addresses ' + `module` - ok = True - objdump = popen(command) - for line in objdump: - ok &= check(line) - if objdump.close(): - ok = False - - if skip_ud2a[0]: - #print 'WARNING: Skipped %d lines due to ud2a corruption' % skip_ud2a[0] - pass - - return ok - - def check_module(self, module): - "Check a module for exclusively safe opcodes and external references." - from os.path import isfile - if not isfile(module): - print 'ERROR: %s is not a file!' % `module` - return False - res = self.__check_references(module) and self.__check_opcodes(module) - if res: - print 'PASS: %s' % module - else: - print 'FAIL: %s' % module - return res - - -if __name__ == '__main__': - from sys import exit, argv - exit(main(argv)) - -- cgit From eace89a86a89977dccb4e943192becc5be47cef1 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Tue, 1 Apr 2008 22:32:28 -0400 Subject: removing another part of retired LKET --- runtime/ChangeLog | 4 + runtime/lket/b2a/.cvsignore | 1 - runtime/lket/b2a/Makefile.am | 18 - runtime/lket/b2a/Makefile.in | 449 ------------------ runtime/lket/b2a/lket_b2a.c | 1030 ------------------------------------------ runtime/lket/b2a/lket_b2a.h | 101 ----- 6 files changed, 4 insertions(+), 1599 deletions(-) delete mode 100644 runtime/lket/b2a/.cvsignore delete mode 100644 runtime/lket/b2a/Makefile.am delete mode 100644 runtime/lket/b2a/Makefile.in delete mode 100644 runtime/lket/b2a/lket_b2a.c delete mode 100644 runtime/lket/b2a/lket_b2a.h diff --git a/runtime/ChangeLog b/runtime/ChangeLog index b52ddf7b..e66a048e 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,7 @@ +2008-04-01 Frank Ch. Eigler + + * lket/*: Belatedly remove retired LKET code. + 2008-03-17 Eugene Teo PR 5947 diff --git a/runtime/lket/b2a/.cvsignore b/runtime/lket/b2a/.cvsignore deleted file mode 100644 index e289e6f1..00000000 --- a/runtime/lket/b2a/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -Makefile lket-b2a .deps diff --git a/runtime/lket/b2a/Makefile.am b/runtime/lket/b2a/Makefile.am deleted file mode 100644 index 01472f6a..00000000 --- a/runtime/lket/b2a/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -bin_PROGRAMS = lket-b2a -lket_b2a_SOURCES = lket_b2a.c -lket_b2a_DEPENDENCIES = lket_b2a.h -lket_b2a_LDFLAGS = `pkg-config --libs glib-2.0` -lket_b2a_CFLAGS = -O2 -D_GNU_SOURCE -Wall `pkg-config --cflags glib-2.0` - -if HAS_MYSQL -lket_b2a_CFLAGS += -DHAS_MYSQL -if HAS_MYSQL_CONFIG -lket_b2a_LDFLAGS += `mysql_config --libs` -lket_b2a_CFLAGS += `mysql_config --cflags` -else -lket_b2a_CFLAGS += -I/usr/include/mysql -g -pipe -fsigned-char -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -lket_b2a_LDFLAGS += -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib -lssl -lcrypto -endif -endif - - diff --git a/runtime/lket/b2a/Makefile.in b/runtime/lket/b2a/Makefile.in deleted file mode 100644 index e262682a..00000000 --- a/runtime/lket/b2a/Makefile.in +++ /dev/null @@ -1,449 +0,0 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -bin_PROGRAMS = lket-b2a$(EXEEXT) -@HAS_MYSQL_TRUE@am__append_1 = -DHAS_MYSQL -@HAS_MYSQL_CONFIG_TRUE@@HAS_MYSQL_TRUE@am__append_2 = `mysql_config --libs` -@HAS_MYSQL_CONFIG_TRUE@@HAS_MYSQL_TRUE@am__append_3 = `mysql_config --cflags` -@HAS_MYSQL_CONFIG_FALSE@@HAS_MYSQL_TRUE@am__append_4 = -I/usr/include/mysql -g -pipe -fsigned-char -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -@HAS_MYSQL_CONFIG_FALSE@@HAS_MYSQL_TRUE@am__append_5 = -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib -lssl -lcrypto -subdir = runtime/lket/b2a -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) -am_lket_b2a_OBJECTS = lket_b2a-lket_b2a.$(OBJEXT) -lket_b2a_OBJECTS = $(am_lket_b2a_OBJECTS) -lket_b2a_LDADD = $(LDADD) -lket_b2a_LINK = $(CCLD) $(lket_b2a_CFLAGS) $(CFLAGS) \ - $(lket_b2a_LDFLAGS) $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(lket_b2a_SOURCES) -DIST_SOURCES = $(lket_b2a_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATE = @DATE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -MYSQL_CONFIG = @MYSQL_CONFIG@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PROCFLAGS = @PROCFLAGS@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -U = @U@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -builddir = @builddir@ -cap_LIBS = @cap_LIBS@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -elfutils_abs_srcdir = @elfutils_abs_srcdir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sqlite3_LIBS = @sqlite3_LIBS@ -srcdir = @srcdir@ -stap_LIBS = @stap_LIBS@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -lket_b2a_SOURCES = lket_b2a.c -lket_b2a_DEPENDENCIES = lket_b2a.h -lket_b2a_LDFLAGS = `pkg-config --libs glib-2.0` $(am__append_2) \ - $(am__append_5) -lket_b2a_CFLAGS = -O2 -D_GNU_SOURCE -Wall `pkg-config --cflags \ - glib-2.0` $(am__append_1) $(am__append_3) $(am__append_4) -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu runtime/lket/b2a/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu runtime/lket/b2a/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -lket-b2a$(EXEEXT): $(lket_b2a_OBJECTS) $(lket_b2a_DEPENDENCIES) - @rm -f lket-b2a$(EXEEXT) - $(lket_b2a_LINK) $(lket_b2a_OBJECTS) $(lket_b2a_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lket_b2a-lket_b2a.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -lket_b2a-lket_b2a.o: lket_b2a.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lket_b2a_CFLAGS) $(CFLAGS) -MT lket_b2a-lket_b2a.o -MD -MP -MF $(DEPDIR)/lket_b2a-lket_b2a.Tpo -c -o lket_b2a-lket_b2a.o `test -f 'lket_b2a.c' || echo '$(srcdir)/'`lket_b2a.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/lket_b2a-lket_b2a.Tpo $(DEPDIR)/lket_b2a-lket_b2a.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lket_b2a.c' object='lket_b2a-lket_b2a.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lket_b2a_CFLAGS) $(CFLAGS) -c -o lket_b2a-lket_b2a.o `test -f 'lket_b2a.c' || echo '$(srcdir)/'`lket_b2a.c - -lket_b2a-lket_b2a.obj: lket_b2a.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lket_b2a_CFLAGS) $(CFLAGS) -MT lket_b2a-lket_b2a.obj -MD -MP -MF $(DEPDIR)/lket_b2a-lket_b2a.Tpo -c -o lket_b2a-lket_b2a.obj `if test -f 'lket_b2a.c'; then $(CYGPATH_W) 'lket_b2a.c'; else $(CYGPATH_W) '$(srcdir)/lket_b2a.c'; fi` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/lket_b2a-lket_b2a.Tpo $(DEPDIR)/lket_b2a-lket_b2a.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lket_b2a.c' object='lket_b2a-lket_b2a.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lket_b2a_CFLAGS) $(CFLAGS) -c -o lket_b2a-lket_b2a.obj `if test -f 'lket_b2a.c'; then $(CYGPATH_W) 'lket_b2a.c'; else $(CYGPATH_W) '$(srcdir)/lket_b2a.c'; fi` - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-exec-am: install-binPROGRAMS - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/runtime/lket/b2a/lket_b2a.c b/runtime/lket/b2a/lket_b2a.c deleted file mode 100644 index ab1bb299..00000000 --- a/runtime/lket/b2a/lket_b2a.c +++ /dev/null @@ -1,1030 +0,0 @@ -// Copyright (C) 2005, 2006 IBM Corp. -// Copyright (C) 2006 Red Hat Inc. -// Copyright (C) 2007 Bull S.A.S -// -// 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. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "lket_b2a.h" - -/* A flag indicate whether to store the trace - data into local file/MySQL database */ -int into_file, into_db; -int name_flag=1, id_flag=0, appname_flag=1; -#ifdef HAS_MYSQL - -#define SQLSIZE 1024*1024 -int sql_count; -#define INSERT_THRESHOLD 100 -char sql[4096]; -char sqlStatement[SQLSIZE]; -char sql_col[1024]; -char sql_val[2048]; - -MYSQL mysql; -#endif - -/* A FILE handle points to a local file used to - store the trace data */ -FILE *outfp; - -#define TIMING_GETCYCLES 0x01 -#define TIMING_GETTIMEOFDAY 0x02 -#define TIMING_SCHEDCLOCK 0x03 - -typedef struct _cpufreq_info { - long timebase; - long long last_cycles; - long long last_time; -} cpufreq_info; - -#define MAX_CPUS 256 -cpufreq_info cpufreq[MAX_CPUS]; - -static long timing_method = TIMING_GETTIMEOFDAY; - -static long long start_timestamp; - -GTree *appNameTree; - -/* event table */ -event_desc *events_des[MAX_EVT_TYPES][MAX_GRPID][MAX_HOOKID]; - -#define b2a_error(fmt, args...) do { fprintf(stderr, "Error %d@%s: "fmt, __LINE__, __func__, ## args);\ - exit(-1); } while(0) - -void usage() -{ -printf("Usage:\n\ - lket-b2a Options INFILE1 [INFILE2...]\n\ - Options:\n\ - -f dump the trace data into a local file named \"lket.out\"\n\ - -n name_flag. name_flag set to 0 means not printing the event\n\ - description string and 1 means printing. Only valid with -f\n\ - option. name_flag is set to 1 by default.\n\ - -i id_flag. id_flag set to 0 means not printing event groupid and\n\ - hookid and 1 means printing. Only valid with -f option. id_flag\n\ - is set to 0 by default.\n\ - -a appname_flag. appname_flag set to 0 means not printing process\n\ - name and 1 means printing. Only valid with -f option. appname_flag\n\ - is set to 1 by default.\n\ - -m dump the trace data into MySQL\n\ - Example:\n\ - lket-b2a -f -a 1 -i 1 -n 0 stpd_cpu*\n\ - lket-b2a -m stpd_cpu*\n"); -} - -int main(int argc, char *argv[]) -{ - lket_pkt_header *hdrs = NULL; - FILE **infps = NULL; - char outfilename[MAX_STRINGLEN]={0}; - int i, j, total_infiles = 0; - long long min; - int retvalue = 0; - - char database[18]; - time_t timer; - struct tm *tm; - - time(&timer); - tm = localtime(&timer); - strftime(database, 18, "DB%Y%m%d%H%M%S", tm); - - while (1) { - int c = getopt(argc, argv, "mfi:n:a:"); - if (c < 0) // no more options - break; - switch (c) { - case 'm': - into_db = 1; - break; - case 'f': - into_file = 1; - break; - case 'n': - name_flag = atoi(optarg); - if(name_flag!=0 && name_flag!=1) { - fprintf(stderr, "you must specify 0 or 1 for -n option\n"); - usage(); - exit(-1); - } - break; - case 'i': - id_flag = atoi(optarg); - if(id_flag!=0 && id_flag!=1) { - fprintf(stderr, "you must specify 0 or 1 for -i option\n"); - usage(); - exit(-1); - } - break; - case 'a': - appname_flag = atoi(optarg); - if(appname_flag!=0 && appname_flag!=1) { - fprintf(stderr, "you must specify 0 or 1 for -a option\n"); - usage(); - exit(-1); - } - break; - - default: - printf("Error in options\n"); - usage(); - exit(-1); - break; - } - } - -#ifndef HAS_MYSQL - if(into_db) { - b2a_error("-m option is not supported since lket-b2a is not compiled with mysql support\n"); - } -#endif - if(into_file==0 && into_db==0) { -#ifdef HAS_MYSQL - fprintf(stderr, "At least one of -m/-f option should be specified\n"); -#else - fprintf(stderr, "-f option must be specified\n"); -#endif - usage(); - exit(-1); - } - - total_infiles = argc - optind; - - // open the input files and the output file - infps = (FILE **)malloc(total_infiles * sizeof(FILE *)); - if(!infps) { - b2a_error("Unable to malloc infps\n"); - } - - memset(infps, 0, total_infiles * sizeof(FILE *)); - for(i=0; i < total_infiles; i++) { - infps[i] = fopen(argv[optind++], "r"); - if(infps[i] == NULL) { - printf("Unable to open %s\n", argv[optind-1]); - retvalue = -1; - goto failed; - } - } - - if(into_file) { - if(strnlen(outfilename, MAX_STRINGLEN) == 0) - strncpy(outfilename, DEFAULT_OUTFILE_NAME, MAX_STRINGLEN); - - outfp = fopen(outfilename, "w"); - if(outfp == NULL) { - fprintf(stderr,"Unable to create %s\n", outfilename); - retvalue = -1; - goto failed; - } - } - /* create the search tree */ - appNameTree = g_tree_new_full(compareFunc, NULL, NULL, destroyTreeData); - -#ifdef HAS_MYSQL - if(into_db) { - if(!mysql_init(&mysql)) { - b2a_error("Failed to Init MySQL: Error: %s\n", - mysql_error(&mysql)); - } - - if(!mysql_real_connect(&mysql, NULL, NULL, NULL, NULL, 0, NULL, - CLIENT_MULTI_STATEMENTS)) { - b2a_error("Failed to connect to database: Error: %s\n", - mysql_error(&mysql)); - } - - snprintf(sql, 64,"create database %s", database); - - if(mysql_query(&mysql, sql)) { - b2a_error("Failed create database %s, Error: %s\n", - database, mysql_error(&mysql)); - } - - if(!mysql_real_connect(&mysql, NULL, NULL, NULL, database, 0, NULL, - CLIENT_MULTI_STATEMENTS)) { - b2a_error("Failed to connect to database %s: Error: %s\n", - database, mysql_error(&mysql)); - } - } -#endif - - // find the lket header - find_init_header(infps, total_infiles); - - // allocate packet headers array - hdrs = malloc(total_infiles * sizeof(lket_pkt_header)); - if(!hdrs) { - printf("Unable to malloc hdrs \n"); - retvalue = -1; - goto failed; - } - memset(hdrs, 0, total_infiles * sizeof(lket_pkt_header)); - - // initialize packet headers array - start_timestamp = 0; - j = 0; - for(i=0; i < total_infiles; i++) { - get_pkt_header(infps[i], &hdrs[i]); - if( (hdrs[i].microsecond < start_timestamp && hdrs[i].microsecond >0) - || (start_timestamp == 0)) { - start_timestamp = hdrs[i].microsecond; - j = i; - } - } - - // initialize the start cycles - if(timing_method == TIMING_GETCYCLES) { - for(i=0; i 0)) { - min = hdrs[i].microsecond; - j = i; - } - } - } while(min != 0); - -failed: - // close all opened files - for(i=0; i < total_infiles; i++) - if(infps[i]) - fclose(infps[i]); - if(outfp) - fclose(outfp); - - // free all allocated memory space - if(infps) - free(infps); - if(hdrs) - free(hdrs); - - for(i=1; iflag == 0 && into_db) { - snprintf(sql, 256, "drop table %d_%d",i,j); - if(mysql_query(&mysql,sql)) { - b2a_error("Failed to exec sql: %s, Error: %s\n", - sql, mysql_error(&mysql)); - } - snprintf(sql, 256, "delete from table_desc where table_name='%d_%d'",i,j); - if(mysql_query(&mysql,sql)) { - b2a_error("Failed to exec sql: %s, Error: %s\n", - sql, mysql_error(&mysql)); - } - } - /* destroy entrytime tree */ - if(events_des[_HOOKID_REGSYSEVT][i][j]->entrytime) - g_tree_destroy(events_des[_HOOKID_REGSYSEVT][i][j]->entrytime); -#endif - } - } - -#ifdef HAS_MYSQL - if(into_db) { - mysql_close(&mysql); - } -#endif - if (appNameTree) - g_tree_destroy(appNameTree); - - return retvalue; -} - -/* register newly found process name for addevent.process.snapshot - and addevent.process.execve */ -void register_appname(int i, FILE *fp, lket_pkt_header *phdr) -{ - int pid, tid, ppid; - char *appname=NULL; - int count; - int len; - int c; - int location; - len=0; - count=0; - -#ifdef HAS_MYSQL - static int flag = 0; - - if(into_db) { - if(flag==0) { - if(mysql_query(&mysql, "create table appNameMap ( pid INT, pname varchar(20))")) { - b2a_error("Failed to create appNameMap table, Error: %s\n", - mysql_error(&mysql)); - } - } - flag=1; - } -#endif - appname = (char *)malloc(512); - location = ftell(fp); - - if(HDR_HookID(phdr) == _HOOKID_PROCESS_SNAPSHOT ) { /* process_snapshot */ - fread(&tid, 1, 4, fp); /* read tid */ - fread(&pid, 1, 4, fp); /* read pid */ - fread(&ppid, 1, 4, fp); /* read ppid */ - c = fgetc_unlocked(fp); - len+=13; - while (c && len < 1024) { - appname[count++] = (char)c; - c = fgetc_unlocked(fp); - ++len; - } - appname[count]='\0'; - } else if (HDR_HookID(phdr) == _HOOKID_PROCESS_EXECVE) { /* process.execve */ - fread(&tid, 1, 4, fp); /* read tid */ - fread(&pid, 1, 4, fp); /* read pid */ - fread(&ppid, 1, 4, fp); /* read ppid */ - c = fgetc_unlocked(fp); - len+=5; - while (c && len < 1024) { - appname[count++] = (char)c; - c = fgetc_unlocked(fp); - ++len; - } - appname[count]='\0'; - } else if (HDR_HookID(phdr) == _HOOKID_PROCESS_FORK) { - fread(&tid, 1, 4, fp); /* read tid */ - fread(&pid, 1, 4, fp); /* read pid */ - fread(&ppid, 1, 4, fp); /* read ppid */ - - char *appname_ptr; - appname_ptr = (char *)(g_tree_lookup(appNameTree,(gconstpointer)((long)ppid))); - if(appname_ptr == NULL) - strncpy(appname, "N/A", 4); - else - strncpy(appname, appname_ptr, 256); - - } else { - free(appname); - return; - } - fseek(fp, location, SEEK_SET); -#ifdef HAS_MYSQL - if(into_db) { - snprintf(sql, 256,"insert into appNameMap values ( %d, \"%s\")", pid, appname); - if(mysql_query(&mysql,sql)) { - b2a_error("Failed to exec SQL: %s, Error: %s\n", - sql, mysql_error(&mysql)); - } - } -#endif - g_tree_insert(appNameTree, (gpointer)((long)pid), (gpointer)appname); -} - - -gint compareFunc(gconstpointer a, gconstpointer b, gpointer user_data) -{ - if((long)(a) > (long)(b)) return 1; - else if ((long)(a) < (long)(b)) return -1; - else return 0; -} - -void destroyTreeData(gpointer data) -{ - free(data); -} - -/* - * search the LKET init header in a set of input files, - * and the header structure is defined in tapsets/lket_trace.stp - */ -void find_init_header(FILE **infps, const int total_infiles) -{ - int i, j, k; - int32_t magic; - percpu_header pcpu; - - /* information from lket_init_header */ - int16_t inithdr_len; - int8_t ver_major; - int8_t ver_minor; - int8_t big_endian; - int8_t timing_field; - int8_t bits_width; - int32_t init_timebase; - char timing_methods_str[128]; - - if(total_infiles <= 0 ) - b2a_error("total_infiles <= 0\n"); - j = total_infiles; - for(i=0; isys_size -= sizeof(lket_pkt_header)-sizeof(phdr->total_size)-sizeof(phdr->sys_size); - phdr->total_size -= sizeof(lket_pkt_header)-sizeof(phdr->total_size)-sizeof(phdr->sys_size); - return 0; -} - -void print_pkt_header(lket_pkt_header *phdr) -{ - long long usecs; - int sec, usec; - int grpid, hookid, pid, tid, ppid; - - if(!phdr) - b2a_error("phdr is NULL\n"); - - if(timing_method == TIMING_GETCYCLES) - usecs = (phdr->microsecond - cpufreq[HDR_CpuID(phdr)].last_cycles) - / cpufreq[HDR_CpuID(phdr)].timebase + cpufreq[HDR_CpuID(phdr)].last_time; - else if(timing_method == TIMING_SCHEDCLOCK) - usecs = (phdr->microsecond - start_timestamp) / 1000; - else - usecs = phdr->microsecond - start_timestamp; - - sec = usecs/1000000; - usec = usecs%1000000; - - grpid = HDR_GroupID(phdr); - hookid = HDR_HookID(phdr); - pid = HDR_PID(phdr); - tid = HDR_TID(phdr); - ppid = HDR_PPID(phdr); - - if(into_file) { - fprintf(outfp, "\n%d.%d CPU:%d TID:%d, PID:%d, PPID:%d, ", sec, usec, - HDR_CpuID(phdr), tid, pid, ppid); - if(appname_flag==1) { - char *appname_ptr; - appname_ptr = (char *)(g_tree_lookup(appNameTree,(gconstpointer)((long)pid))); - if(appname_ptr == NULL) - fprintf(outfp, "APPNAME:N/A "); - else - fprintf(outfp, "APPNAME:%s ", appname_ptr); - } - if(name_flag==1) - fprintf(outfp, "EVT_NAME:%s ", events_des[_HOOKID_REGSYSEVT][grpid][hookid]->description); - if(id_flag==1) - fprintf(outfp, "HOOKGRP:%d HOOKID:%d ", grpid, hookid); - } - -#ifdef HAS_MYSQL - if(into_db) { - if(!(hookid%2)) { // return type event - long long *entrytime; - long long entryusecs; - entrytime = g_tree_lookup(events_des[_HOOKID_REGSYSEVT][grpid][hookid-1]->entrytime, - (gconstpointer)((long)tid)); - if(entrytime==NULL) // key not found - entryusecs = 0; - else - entryusecs = *entrytime; - snprintf(sql_col, 128, "groupid, hookid, usec, thread_id, process_id, parentprocess_id, \ - cpu_id, entry_usec,"); - snprintf(sql_val, 256, "%d, %d, %lld, %d, %d, %d, %d, %lld,", grpid, - hookid, usecs, tid, pid, ppid, HDR_CpuID(phdr), - entryusecs); - } else { - snprintf(sql_col, 128, "groupid, hookid, usec, thread_id, process_id, parentprocess_id, cpu_id,"); - snprintf(sql_val, 256, "%d, %d, %lld, %d, %d, %d, %d, ", grpid, - hookid, usecs, tid, pid, ppid, HDR_CpuID(phdr)); - } - if(hookid%2) { - char *entrytime = malloc(sizeof(long long)); - *((long long *)entrytime) = usecs; - g_tree_insert(events_des[_HOOKID_REGSYSEVT][grpid][hookid]->entrytime, - (gpointer)((long)tid), (gpointer)entrytime); - } - } -#endif - -} - -#ifdef HAS_MYSQL -char *get_sqltype(char *fmt) -{ - if(strncmp(fmt, "INT8", 4) == 0) - return "TINYINT"; - if(strncmp(fmt, "INT16", 5) == 0) - return "SMALLINT"; - if(strncmp(fmt, "INT32", 5) == 0) - return "INT"; - if(strncmp(fmt, "INT64", 5) == 0) - return "BIGINT"; - if(strncmp(fmt, "STRING", 6) == 0) - return "VARCHAR(20)"; - return ""; -} -#endif - -void register_evt_desc(FILE *infp, size_t size) -{ -#ifdef HAS_MYSQL - static int has_table = 0; -#endif - int grpid, hookid; - int len = 0; - char *evt_body; - evt_body = malloc(size); - fread(evt_body, size, 1, infp); - grpid = *(int8_t *)evt_body; - hookid = *(int8_t *)(evt_body+1); - len = strlen(evt_body+2)+2; - if(!events_des[_HOOKID_REGSYSEVT][grpid][hookid]) - events_des[_HOOKID_REGSYSEVT][grpid][hookid] = malloc(sizeof(event_desc)); - events_des[_HOOKID_REGSYSEVT][grpid][hookid]->description = malloc(len); - - strncpy(events_des[_HOOKID_REGSYSEVT][grpid][hookid]->description, evt_body+2, len); -#ifdef HAS_MYSQL - events_des[_HOOKID_REGSYSEVT][grpid][hookid]->entrytime = g_tree_new_full( - compareFunc, NULL, NULL, destroyTreeData); - if(into_db) { - if(!has_table) { - snprintf(sql, 1024, "create table table_desc ( table_name varchar(6), table_desc varchar(32))"); - if(mysql_query(&mysql, sql)) { - b2a_error("Failed exec SQL: \n %s \n, Error: %s\n", - sql, mysql_error(&mysql)); - } - has_table = 1; - } - - snprintf(sql, 1024, "insert into table_desc ( table_name, table_desc) values ( \"%d_%d\", \"%s\")", grpid, hookid, - evt_body+2); - - if(mysql_query(&mysql, sql)) { - b2a_error("Failed exec SQL:\n %s \n, Error: %s\n", - sql, mysql_error(&mysql)); - } - } -#endif - free(evt_body); -} - -void register_events(int evt_type, FILE *infp, size_t size) -{ - int cnt=0, len=0; - - char *evt_body, *evt_fmt, *evt_names, *tmp, *fmt, *name; - int8_t grpid, hookid; - - evt_body = malloc(size); - - fread(evt_body, size, 1, infp); - - grpid = *(int8_t *)evt_body; - hookid = *(int8_t *)(evt_body+1); - - if(!events_des[evt_type][grpid][hookid]) - events_des[evt_type][grpid][hookid] = malloc(sizeof(event_desc)); - if(!events_des[evt_type][grpid][hookid]) { - b2a_error("error when malloc for event_des[%d][%d][%d]\n", - evt_type, grpid, hookid); - } - -#ifdef HAS_MYSQL - if(into_db) { - if(evt_type==_HOOKID_REGSYSEVT) { /* if sys event, create a table */ - if(!(hookid%2)) {/* if this is a return type event, should record - the entry time of this event */ - snprintf(sql, 1024, "create table %d_%d ( groupid TINYINT, hookid TINYINT, usec BIGINT, thread_id INT, process_id INT, parentprocess_id INT, cpu_id TINYINT, entry_usec BIGINT,", grpid, hookid); - } else { - snprintf(sql, 1024, "create table %d_%d ( groupid TINYINT, hookid TINYINT, usec BIGINT, thread_id INT, process_id INT, parentprocess_id INT, cpu_id TINYINT,", grpid, hookid); - } - } - if(evt_type==_HOOKID_REGUSREVT) { /* if user event, alter an existing table */ - snprintf(sql, 1024, "alter table %d_%d ", grpid, hookid); - } - } - - if(size == 2) // skip if no event format is provided - goto gen_sql; -#endif - - evt_fmt = evt_body+2; - - for(tmp=evt_fmt; *tmp!=0; tmp++); - - evt_names = tmp+1; - - fmt = strsep(&evt_fmt, ":"); - name = strsep(&evt_names, ":"); - - if(fmt==NULL || name==NULL) { - b2a_error("error in event format/names string\n"); - } - - while(fmt!=NULL && name!=NULL) { -#ifdef HAS_MYSQL - if(into_db) { - if(evt_type==_HOOKID_REGSYSEVT) { - strcat(sql, "`"); - strcat(sql, name); - strcat(sql, "` "); - strcat(sql, get_sqltype(fmt)); - strcat(sql, ","); - } - if(evt_type==_HOOKID_REGUSREVT) { - strcat(sql, "add "); - strcat(sql, "`"); - strcat(sql, name); - strcat(sql, "` "); - strcat(sql, get_sqltype(fmt)); - strcat(sql, ","); - } - } -#endif - strncpy(events_des[evt_type][grpid][hookid]->evt_fmt[cnt], fmt, 7); - strncpy(events_des[evt_type][grpid][hookid]->evt_names[cnt], - name, MAX_FIELDNAME_LEN); - strncpy(events_des[evt_type][grpid][hookid]->fmt+len, get_fmtstr(fmt), 8); - len+=strlen(get_fmtstr(fmt)); - fmt = strsep(&evt_fmt, ":"); - name = strsep(&evt_names, ":"); - cnt++; - } - events_des[evt_type][grpid][hookid]->count = cnt; - *(events_des[evt_type][grpid][hookid]->fmt+len)='\0'; - -#ifdef HAS_MYSQL -gen_sql: - if(into_db) { - if(evt_type==_HOOKID_REGSYSEVT) - sql[strlen(sql)-1]=')'; - if(evt_type==_HOOKID_REGUSREVT) - sql[strlen(sql)-1]='\0'; - - if(mysql_query(&mysql, sql)) { - b2a_error("Failed exec SQL: \n %s \n, Error: %s\n", - sql, mysql_error(&mysql)); - } - } -#endif - free(evt_body); -} - -char *get_fmtstr(char *fmt) -{ - if(strncmp(fmt, "INT8", 4) == 0) - return "%1b"; - if(strncmp(fmt, "INT16", 5) == 0) - return "%2b"; - if(strncmp(fmt, "INT32", 5) == 0) - return "%4b"; - if(strncmp(fmt, "INT64", 5) == 0) - return "%8b"; - if(strncmp(fmt, "STRING", 6) == 0) - return "%0s"; - return ""; -} - -int dump_data(lket_pkt_header header, FILE *infp) -{ - int i, c, j; - int16_t stemp; - int32_t ntemp; - long long lltemp; - int readbytes = 0; - int total_bytes = 0; - int size = 0; - int evt_num = 1; - - char tmp_int[32]; - - char *fmt, *name, *buffer; - int grpid = HDR_GroupID(&header); - int hookid = HDR_HookID(&header); - - print_pkt_header(&header); - - /* if the data contains user appended extra data */ - if(header.total_size != header.sys_size) - evt_num = 3; - - /* iterate the sys and user event */ - for(j=1; j<= evt_num; j+=2) { - - readbytes = 0; - - if(j == 1) /* if current one is a sys event */ - size = header.sys_size; - if(j == 2) /* if current one is a user event */ - size = header.total_size - header.sys_size; - - if(into_file && (events_des[j][grpid][hookid] == NULL || - events_des[j][grpid][hookid]->count <= 0)) { - //no format is provided, dump in hex - buffer = malloc(size); - fread(buffer, size, 1, infp); - fwrite(buffer, size, 1, outfp); - free(buffer); - total_bytes += size; - continue; - } - - events_des[j][grpid][hookid]->flag = 1; - - for(i=0; icount; i++) { - fmt = events_des[j][grpid][hookid]->evt_fmt[i]; - name = events_des[j][grpid][hookid]->evt_names[i]; -#ifdef HAS_MYSQL - if(into_db) { - strcat(sql_col, "`"); - strcat(sql_col, name); - strcat(sql_col, "`,"); - } -#endif - - if(into_file) { - fwrite(name, strlen(name), 1, outfp); - fwrite(":", 1, 1, outfp); - } - if(strncmp(fmt, "INT8", 4)==0) { - c = fgetc_unlocked(infp); - if(into_file) - fprintf(outfp, "%d,", (int8_t)c); - sprintf(tmp_int, "%d,", (int8_t)c); -#ifdef HAS_MYSQL - if(into_db) - strcat(sql_val, tmp_int); -#endif - readbytes+=1; - } else if(strncmp(fmt, "INT16", 5)==0) { - fread(&stemp, 2, 1, infp); - if(into_file) - fprintf(outfp, "%d,", (int16_t)stemp); - sprintf(tmp_int, "%d,", (int16_t)stemp); -#ifdef HAS_MYSQL - if(into_db) - strcat(sql_val, tmp_int); -#endif - readbytes+=2; - } else if(strncmp(fmt, "INT32", 5)==0) { - fread(&ntemp, 4, 1, infp); - if(into_file) - fprintf(outfp, "%d,", (int32_t)ntemp); - snprintf(tmp_int, 20, "%d,", (int32_t)ntemp); -#ifdef HAS_MYSQL - if(into_db) - strcat(sql_val, tmp_int); -#endif - readbytes+=4; - } else if(strncmp(fmt, "INT64", 5)==0) { - fread(&lltemp, 8, 1, infp); - if(into_file) - fprintf(outfp, "%lld,",lltemp); - snprintf(tmp_int, 30, "%lld,", lltemp); -#ifdef HAS_MYSQL - if(into_db) - strcat(sql_val, tmp_int); -#endif - readbytes+=8; - } else if(strncmp(fmt, "STRING", 6)==0) { - -#ifdef HAS_MYSQL - int tmplen=0; - if(into_db) { - tmplen=strlen(sql_val); - sql_val[tmplen++]='"'; - } -#endif - c = fgetc_unlocked(infp); - ++readbytes; - while (c && readbytes < size) { - if(into_file) - fputc_unlocked(c, outfp); -#ifdef HAS_MYSQL - if(into_db) - sql_val[tmplen++]=c; -#endif - c = fgetc_unlocked(infp); - ++readbytes; - } - if(!c) { - if(into_file) - fputc_unlocked(',', outfp); -#ifdef HAS_MYSQL - if(into_db) { - sql_val[tmplen++]='"'; - sql_val[tmplen++]=','; - sql_val[tmplen]='\0'; - } -#endif - continue; - } - else { - b2a_error("error processing STRING\n"); - } - } - } - total_bytes += readbytes; - } - -#ifdef HAS_MYSQL - if(into_db) { - sql_col[strlen(sql_col)-1] = '\0'; - sql_val[strlen(sql_val)-1] = '\0'; - snprintf(sql, 1024, "insert into %d_%d (%s) values (%s)", - grpid, hookid, sql_col, sql_val); - - if(sql_count >= INSERT_THRESHOLD) { - if(mysql_query(&mysql, sqlStatement)) { - b2a_error("Failed exec SQL:\n%s\n, Error:\n%s\n", - sqlStatement, mysql_error(&mysql)); - } - while(!mysql_next_result(&mysql)); - sql_count=0; - sqlStatement[0]='\0'; - } else { - //strncpy(sqlStatement, sql, 2048); - strcat(sqlStatement, sql); - strcat(sqlStatement, ";"); - sql_count++; - } - } -#endif - - return total_bytes; -} diff --git a/runtime/lket/b2a/lket_b2a.h b/runtime/lket/b2a/lket_b2a.h deleted file mode 100644 index 46ca91f6..00000000 --- a/runtime/lket/b2a/lket_b2a.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef _LKET_B2A_H -#define _LKET_B2A_H - -#include - -#ifdef HAS_MYSQL -#include -#endif - -typedef struct _percpu_header { - int32_t seq; - int32_t len; -} percpu_header; - -#define LKET_MAGIC 0xAEFCDB6B - -#define MAX_STRINGLEN 256 - -#define MAX_GRPID 255 -#define MAX_HOOKID 255 -#define MAX_EVT_TYPES 3 - -#define DEFAULT_OUTFILE_NAME "lket.out" - -/* Group ID Definitions */ -int _GROUP_REGEVT = 1; -int _GROUP_PROCESS = 3; -int _GROUP_CPUFREQ = 15; - -/* hookIDs defined inside each group */ -int _HOOKID_REGSYSEVT = 1; -int _HOOKID_REGUSREVT = 3; -int _HOOKID_REGEVTDESC = 5; - -int _HOOKID_PROCESS_SNAPSHOT = 1; -int _HOOKID_PROCESS_EXECVE = 3; -int _HOOKID_PROCESS_FORK = 5; - -//int _HOOKID_INIT_CPUFREQ = 1; -int _HOOKID_SWITCH_CPUFREQ = 1; - -typedef struct _lket_pkt_header { - int16_t total_size; - int16_t sys_size; - int64_t microsecond; - /* tid_pid is (tid<<32|pid) */ - int64_t tid_pid; - /* aggr is the bit-OP of: - (int64_t)current->parent->tgid << 32 | - (int32_t)GroupID << 24 | (int32_t)hookID << 16 | - (int16_t)current->thread_info->cpu << 8 - */ - int64_t aggr; -} __attribute__((packed)) lket_pkt_header; - -#define HDR_TID(ptr) (int32_t)(((ptr)->tid_pid)>>32) -#define HDR_PID(ptr) (int32_t)((ptr)->tid_pid) -#define HDR_PPID(ptr) (int32_t)(((ptr)->aggr)>>32) -#define HDR_GroupID(ptr) (int8_t)(((ptr)->aggr)>>24) -#define HDR_HookID(ptr) (int8_t)(((ptr)->aggr)>>16) -#define HDR_CpuID(ptr) (int8_t)(((ptr)->aggr)>>8) - -#define MAX_FIELDS 32 /* max fields in a record */ -#define MAX_FIELDNAME_LEN 16 /* max len of a field */ - -typedef struct { -#ifdef HAS_MYSQL - GTree *entrytime; -#endif - char evt_fmt[MAX_FIELDS][7]; /* e.g. INT8,STRING,INT16,... */ - char evt_names[MAX_FIELDS][MAX_FIELDNAME_LEN]; /* e.g. protocal,dev_name,buff_len,... */ - char fmt[256]; /* e.g. %1b,%0s,%2b,... */ - char *description; /* a string description of this event, such as "iosyscall.read.entry" */ - int count; /* # of fields */ - int flag; /* a flag indicates whether exists trace data for this event */ -} event_desc; - -/* - * search the lket_init_header structure in a set of input files - */ -static void find_init_header(FILE **fp, const int total_infiles); - -/* - * read the lket_pkt_header structure at the begining of the input file - */ -static int get_pkt_header(FILE *fp, lket_pkt_header *phdr); - -/* - * print the lket_pkt_header structure into the output file - */ -static void print_pkt_header(lket_pkt_header *phdr); - -void register_appname(int i, FILE *fp, lket_pkt_header *phdr); -gint compareFunc(gconstpointer a, gconstpointer b, gpointer user_data); -void destroyTreeData(gpointer data); -void register_evt_desc(FILE *infp, size_t size); -void register_events(int evt_type, FILE *infp, size_t size); -int dump_data(lket_pkt_header header, FILE *infp); -char *get_fmtstr(char *fmt); - -#endif -- cgit From 5eba3ad6104a45c4bc6e1b3b2283f0fb05fbef87 Mon Sep 17 00:00:00 2001 From: Masami Hiramatsu Date: Fri, 4 Apr 2008 15:16:39 -0400 Subject: 2008-04-04 Masami Hiramatsu PR 5528 * systemtap.stress/conversions.exp: Update a script to catch up recently changes of conversions.stp. --- testsuite/ChangeLog | 6 ++++++ testsuite/systemtap.stress/conversions.exp | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index da789127..95c1f117 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-04-04 Masami Hiramatsu + + PR 5528 + * systemtap.stress/conversions.exp: Update a script to catch up + recently changes of conversions.stp. + 2008-03-31 Frank Ch. Eigler * configure.ac: Bump version to 0.7. diff --git a/testsuite/systemtap.stress/conversions.exp b/testsuite/systemtap.stress/conversions.exp index 34cd3889..9c2c2fa9 100644 --- a/testsuite/systemtap.stress/conversions.exp +++ b/testsuite/systemtap.stress/conversions.exp @@ -12,13 +12,12 @@ foreach value {0 0xffffffff 0xffffffffffffffff} { verbose -log "exp $test $errs" expect { -timeout 180 - -re {ERROR[^\r\n]*\r\n} { incr errs; exp_continue } - -re {WARNING[^\r\n]*\r\n} { incr errs; exp_continue } + -re {(ERROR|WARNING)[^\r\n]*\r\n} { incr errs; exp_continue } eof { } timeout { fail "$test (timeout)" } } verbose -log "done exp $test $errs" wait - if {$errs == 9} { pass $test } else { fail "$test ($errs)" } + if {$errs == 14} { pass $test } else { fail "$test ($errs)" } verbose -log "done $test $errs" } -- cgit From f76710250cf57a06162abb476b13077edd766abe Mon Sep 17 00:00:00 2001 From: David Smith Date: Fri, 4 Apr 2008 15:06:33 -0500 Subject: 2008-04-04 David Smith PR 5961 (partial) * task_finder.c: New file. --- runtime/ChangeLog | 5 + runtime/task_finder.c | 410 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 415 insertions(+) create mode 100644 runtime/task_finder.c diff --git a/runtime/ChangeLog b/runtime/ChangeLog index e66a048e..bcac9e80 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,8 @@ +2008-04-04 David Smith + + PR 5961 (partial) + * task_finder.c: New file. + 2008-04-01 Frank Ch. Eigler * lket/*: Belatedly remove retired LKET code. diff --git a/runtime/task_finder.c b/runtime/task_finder.c new file mode 100644 index 00000000..d2e57a6b --- /dev/null +++ b/runtime/task_finder.c @@ -0,0 +1,410 @@ +#include + +static LIST_HEAD(__stp_task_finder_list); + +struct stap_task_finder_target; + +typedef int (*stap_task_finder_callback)(struct task_struct *tsk, + int register_p, + struct stap_task_finder_target *tgt); + +struct stap_task_finder_target { +/* private: */ + struct list_head list; /* __stp_task_finder_list linkage */ + struct list_head callback_list_head; + struct list_head callback_list; + struct utrace_engine_ops ops; + int engine_attached; + size_t pathlen; + +/* public: */ + const char *pathname; + pid_t pid; + stap_task_finder_callback callback; +}; + +static int +stap_register_task_finder_target(struct stap_task_finder_target *new_tgt) +{ + // Since this __stp_task_finder_list is (currently) only + // written to in one big setup operation before the task + // finder process is started, we don't need to lock it. + struct list_head *node; + struct stap_task_finder_target *tgt = NULL; + int found_node = 0; + + if (new_tgt->pathname != NULL) + new_tgt->pathlen = strlen(new_tgt->pathname); + else + new_tgt->pathlen = 0; + + // Search the list for an existing entry for pathname/pid. + list_for_each(node, &__stp_task_finder_list) { + tgt = list_entry(node, struct stap_task_finder_target, list); + if (tgt != NULL + /* pathname-based target */ + && ((new_tgt->pathlen > 0 + && tgt->pathlen == new_tgt->pathlen + && strcmp(tgt->pathname, new_tgt->pathname) == 0) + /* pid-based target */ + || (new_tgt->pid != 0 && tgt->pid == new_tgt->pid))) { + found_node = 1; + break; + } + } + + // If we didn't find a matching existing entry, add the new + // target to the task list. + if (! found_node) { + INIT_LIST_HEAD(&new_tgt->callback_list_head); + list_add(&new_tgt->list, &__stp_task_finder_list); + tgt = new_tgt; + } + + // Add this target to the callback list for this task. + new_tgt->engine_attached = 0; + list_add_tail(&new_tgt->callback_list, &tgt->callback_list_head); + return 0; +} + +static void +stap_utrace_detach_ops(struct utrace_engine_ops *ops) +{ + struct task_struct *tsk; + struct utrace_attached_engine *engine; + long error = 0; + pid_t pid = 0; + + rcu_read_lock(); + for_each_process(tsk) { + struct mm_struct *mm; + mm = get_task_mm(tsk); + if (mm) { + mmput(mm); + engine = utrace_attach(tsk, UTRACE_ATTACH_MATCH_OPS, + ops, 0); + if (IS_ERR(engine)) { + error = -PTR_ERR(engine); + if (error != ENOENT) { + pid = tsk->pid; + break; + } + error = 0; + } + else if (engine != NULL) { + utrace_detach(tsk, engine); + } + } + } + rcu_read_unlock(); + + if (error != 0) { + _stp_error("utrace_attach returned error %d on pid %d", + error, pid); + } +} + +static void +__stp_task_finder_cleanup(void) +{ + struct list_head *tgt_node, *tgt_next; + struct list_head *cb_node, *cb_next; + struct stap_task_finder_target *tgt; + + // Walk the main list, cleaning up as we go. + list_for_each_safe(tgt_node, tgt_next, &__stp_task_finder_list) { + tgt = list_entry(tgt_node, struct stap_task_finder_target, + list); + if (tgt == NULL) + continue; + + list_for_each_safe(cb_node, cb_next, + &tgt->callback_list_head) { + struct stap_task_finder_target *cb_tgt; + cb_tgt = list_entry(cb_node, + struct stap_task_finder_target, + callback_list); + if (cb_tgt == NULL) + continue; + + if (cb_tgt->engine_attached) { + stap_utrace_detach_ops(&cb_tgt->ops); + cb_tgt->engine_attached = 0; + } + + list_del(&cb_tgt->callback_list); + } + list_del(&tgt->list); + } +} + +static char * +__stp_get_mm_path(struct mm_struct *mm, char *buf, int buflen) +{ + struct vm_area_struct *vma; + char *rc = NULL; + + down_read(&mm->mmap_sem); + vma = mm->mmap; + while (vma) { + if ((vma->vm_flags & VM_EXECUTABLE) && vma->vm_file) + break; + vma = vma->vm_next; + } + if (vma) { + struct vfsmount *mnt = mntget(vma->vm_file->f_path.mnt); + struct dentry *dentry = dget(vma->vm_file->f_path.dentry); + rc = d_path(dentry, mnt, buf, buflen); + dput(dentry); + mntput(mnt); + } + else { + *buf = '\0'; + rc = ERR_PTR(ENOENT); + } + up_read(&mm->mmap_sem); + return rc; +} + +#define __STP_UTRACE_TASK_FINDER_EVENTS (UTRACE_EVENT(CLONE) \ + | UTRACE_EVENT(EXEC)) + +#define __STP_UTRACE_ATTACHED_TASK_EVENTS (UTRACE_EVENT(DEATH)) + +static u32 +__stp_utrace_task_finder_clone(struct utrace_attached_engine *engine, + struct task_struct *parent, + unsigned long clone_flags, + struct task_struct *child) +{ + struct utrace_attached_engine *child_engine; + struct mm_struct *mm; + + // On clone, attach to the child. Ignore threads with no mm + // (which are kernel threads). + mm = get_task_mm(child); + if (mm) { + mmput(mm); + child_engine = utrace_attach(child, UTRACE_ATTACH_CREATE, + engine->ops, 0); + if (IS_ERR(child_engine)) + _stp_error("attach to clone child %d failed: %ld", + (int)child->pid, PTR_ERR(child_engine)); + else { + utrace_set_flags(child, child_engine, + __STP_UTRACE_TASK_FINDER_EVENTS); + } + } + return UTRACE_ACTION_RESUME; +} + +static u32 +__stp_utrace_task_finder_death(struct utrace_attached_engine *engine, + struct task_struct *tsk) +{ + struct stap_task_finder_target *tgt = engine->data; + + // The first implementation of this added a + // UTRACE_EVENT(DEATH) handler to + // __stp_utrace_task_finder_ops. However, dead threads don't + // have a mm_struct, so we can't find the exe's path. So, we + // don't know which callback(s) to call. + // + // So, now when an "interesting" thread is found, we add a + // separate UTRACE_EVENT(DEATH) handler for every probe. + + if (tgt != NULL && tgt->callback != NULL) { + int rc; + + // Call the callback + rc = tgt->callback(tsk, 0, tgt); + if (rc != 0) { + _stp_error("death callback for %d failed: %d", + (int)tsk->pid, rc); + } + } + return UTRACE_ACTION_RESUME; +} + +static u32 +__stp_utrace_task_finder_exec(struct utrace_attached_engine *engine, + struct task_struct *tsk, + const struct linux_binprm *bprm, + struct pt_regs *regs) +{ + size_t filelen; + struct list_head *tgt_node; + struct stap_task_finder_target *tgt; + int found_node = 0; + + // On exec, check bprm + if (bprm->filename == NULL) + return UTRACE_ACTION_RESUME; + + filelen = strlen(bprm->filename); + list_for_each(tgt_node, &__stp_task_finder_list) { + tgt = list_entry(tgt_node, struct stap_task_finder_target, + list); + // Note that we don't bother with looking for pids + // here, since they are handled at startup. + if (tgt != NULL && tgt->pathlen > 0 + && tgt->pathlen == filelen + && strcmp(tgt->pathname, bprm->filename) == 0) { + found_node = 1; + break; + } + } + if (found_node) { + struct list_head *cb_node; + list_for_each(cb_node, &tgt->callback_list_head) { + struct stap_task_finder_target *cb_tgt; + cb_tgt = list_entry(cb_node, + struct stap_task_finder_target, + callback_list); + if (cb_tgt == NULL) + continue; + + if (cb_tgt->callback != NULL) { + int rc = cb_tgt->callback(tsk, 1, cb_tgt); + if (rc != 0) { + _stp_error("exec callback for %d failed: %d", + (int)tsk->pid, rc); + break; + } + } + + // Set up thread death notification. + memset(&cb_tgt->ops, 0, sizeof(cb_tgt->ops)); + cb_tgt->ops.report_death + = &__stp_utrace_task_finder_death; + + engine = utrace_attach(tsk, + UTRACE_ATTACH_CREATE, + &cb_tgt->ops, cb_tgt); + if (IS_ERR(engine)) { + _stp_error("attach to exec'ed %d failed: %ld", + (int)tsk->pid, + PTR_ERR(engine)); + } + else { + utrace_set_flags(tsk, engine, + __STP_UTRACE_ATTACHED_TASK_EVENTS); + cb_tgt->engine_attached = 1; + } + } + } + return UTRACE_ACTION_RESUME; +} + +struct utrace_engine_ops __stp_utrace_task_finder_ops = { + .report_clone = __stp_utrace_task_finder_clone, + .report_exec = __stp_utrace_task_finder_exec, +}; + +int +stap_start_task_finder(void) +{ + int rc = 0; + struct task_struct *tsk; + char *mmpath_buf; + + mmpath_buf = _stp_kmalloc(PATH_MAX); + if (mmpath_buf == NULL) { + _stp_error("Unable to allocate space for path"); + return ENOMEM; + } + + rcu_read_lock(); + for_each_process(tsk) { + struct utrace_attached_engine *engine; + struct mm_struct *mm; + char *mmpath; + size_t mmpathlen; + struct list_head *tgt_node; + + mm = get_task_mm(tsk); + if (! mm) { + /* If the thread doesn't have a mm_struct, it is + * a kernel thread which we need to skip. */ + continue; + } + + /* Attach to the thread */ + engine = utrace_attach(tsk, UTRACE_ATTACH_CREATE, + &__stp_utrace_task_finder_ops, 0); + if (IS_ERR(engine)) { + int error = -PTR_ERR(engine); + if (error != ENOENT) { + mmput(mm); + _stp_error("utrace_attach returned error %d on pid %d", + error, (int)tsk->pid); + rc = error; + break; + } + } + else if (unlikely(engine == NULL)) { + mmput(mm); + _stp_error("utrace_attach returned NULL on pid %d", + (int)tsk->pid); + rc = EFAULT; + break; + } + utrace_set_flags(tsk, engine, __STP_UTRACE_TASK_FINDER_EVENTS); + + /* Check the thread's exe's path/pid against our list. */ + mmpath = __stp_get_mm_path(mm, mmpath_buf, PATH_MAX); + mmput(mm); /* We're done with mm */ + if (IS_ERR(mmpath)) { + rc = -PTR_ERR(mmpath); + _stp_error("Unable to get path (error %d) for pid %d", + rc, (int)tsk->pid); + break; + } + + mmpathlen = strlen(mmpath); + list_for_each(tgt_node, &__stp_task_finder_list) { + struct stap_task_finder_target *tgt; + struct list_head *cb_node; + + tgt = list_entry(tgt_node, + struct stap_task_finder_target, list); + if (tgt == NULL) + continue; + /* pathname-based target */ + else if (tgt->pathlen > 0 + && (tgt->pathlen != mmpathlen + || strcmp(tgt->pathname, mmpath) != 0)) + continue; + /* pid-based target */ + else if (tgt->pid != 0 && tgt->pid != tsk->pid) + continue; + + list_for_each(cb_node, &tgt->callback_list_head) { + struct stap_task_finder_target *cb_tgt; + cb_tgt = list_entry(cb_node, + struct stap_task_finder_target, + callback_list); + if (cb_tgt == NULL || cb_tgt->callback == NULL) + continue; + + // Call the callback. + rc = cb_tgt->callback(tsk, 1, cb_tgt); + if (rc != 0) { + _stp_error("attach callback for %d failed: %d", + (int)tsk->pid, rc); + break; + } + } + } + } + rcu_read_unlock(); + _stp_kfree(mmpath_buf); + return rc; +} + +static void +stap_stop_task_finder(void) +{ + stap_utrace_detach_ops(&__stp_utrace_task_finder_ops); + __stp_task_finder_cleanup(); +} -- cgit From b916df9c10dddd0ae49a9029c8758759a319fb71 Mon Sep 17 00:00:00 2001 From: Masami Hiramatsu Date: Fri, 4 Apr 2008 16:52:30 -0400 Subject: 2008-04-04 Masami Hiramatsu PR 6028 * translate.cxx (c_unparser::emit_common_header): Add unwaddr for caching unwound address. * tapsets.cxx (common_probe_entryfn_prologue): Clear unwaddr. * loc2c-runtime.h (fetch_register): Call ia64_fetch_register with the address of c->unwaddr. * regs-ia64.c (ia64_fetch_register): Don't unwind stack if it has already unwound stack in same probe. --- ChangeLog | 7 +++++++ runtime/ChangeLog | 8 ++++++++ runtime/loc2c-runtime.h | 2 +- runtime/regs-ia64.c | 15 +++++++++------ tapsets.cxx | 2 ++ translate.cxx | 2 ++ 6 files changed, 29 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad961375..e35d90b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-04-04 Masami Hiramatsu + + PR 6028 + * translate.cxx (c_unparser::emit_common_header): Add unwaddr for + caching unwound address. + * tapsets.cxx (common_probe_entryfn_prologue): Clear unwaddr. + 2008-04-01 Frank Ch. Eigler * safety/*: Removed subdirectory containing abandoned experiment. diff --git a/runtime/ChangeLog b/runtime/ChangeLog index e66a048e..7e1b0748 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,11 @@ +2008-04-04 Masami Hiramatsu + + PR 6028 + * loc2c-runtime.h (fetch_register): Call ia64_fetch_register with + the address of c->unwaddr. + * regs-ia64.c (ia64_fetch_register): Don't unwind stack if it has + already unwound stack in same probe. + 2008-04-01 Frank Ch. Eigler * lket/*: Belatedly remove retired LKET code. diff --git a/runtime/loc2c-runtime.h b/runtime/loc2c-runtime.h index 7ea1b1e4..66fd1e43 100644 --- a/runtime/loc2c-runtime.h +++ b/runtime/loc2c-runtime.h @@ -129,7 +129,7 @@ #undef fetch_register #undef store_register -#define fetch_register(regno) ia64_fetch_register(regno, c->regs) +#define fetch_register(regno) ia64_fetch_register(regno, c->regs, &c->unwaddr) #define store_register(regno,value) ia64_store_register(regno, c->regs, value) #elif defined __x86_64__ diff --git a/runtime/regs-ia64.c b/runtime/regs-ia64.c index 2a5a1d17..66dc60f3 100644 --- a/runtime/regs-ia64.c +++ b/runtime/regs-ia64.c @@ -35,7 +35,7 @@ static void ia64_stap_get_arbsp(struct unw_frame_info *info, void *arg) lp->address = 0; } -static long ia64_fetch_register(int regno, struct pt_regs *pt_regs) +static long ia64_fetch_register(int regno, struct pt_regs *pt_regs, unsigned long **cache) { struct ia64_stap_get_arbsp_param pa; @@ -47,12 +47,15 @@ static long ia64_fetch_register(int regno, struct pt_regs *pt_regs) else if (regno < 32 || regno > 127) return 0; - pa.ip = pt_regs->cr_iip; - unw_init_running(ia64_stap_get_arbsp, &pa); - if (pa.address == 0) - return 0; + if (!*cache) { + pa.ip = pt_regs->cr_iip; + unw_init_running(ia64_stap_get_arbsp, &pa); + if (pa.address == 0) + return 0; + *cache = pa.address; + } - return *ia64_rse_skip_regs(pa.address, regno-32); + return *ia64_rse_skip_regs(*cache, regno-32); } static void ia64_store_register(int regno, diff --git a/tapsets.cxx b/tapsets.cxx index 079d87e8..ceda9015 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -205,6 +205,8 @@ common_probe_entryfn_prologue (translator_output* o, string statestr, o->newline() << "c->last_error = 0;"; o->newline() << "c->nesting = 0;"; o->newline() << "c->regs = 0;"; + o->newline() << "c->unwaddr = 0;"; + // reset unwound address cache o->newline() << "c->pi = 0;"; o->newline() << "c->probe_point = 0;"; if (! interruptible) diff --git a/translate.cxx b/translate.cxx index f30fca7b..c9ec094a 100644 --- a/translate.cxx +++ b/translate.cxx @@ -874,6 +874,8 @@ c_unparser::emit_common_header () // See c_unparser::visit_statement() o->newline() << "const char *last_stmt;"; o->newline() << "struct pt_regs *regs;"; + o->newline() << "unsigned long *unwaddr;"; + // unwaddr is caching unwound address in each probe handler on ia64. o->newline() << "struct kretprobe_instance *pi;"; o->newline() << "va_list *mark_va_list;"; o->newline() << "void *data;"; -- cgit From a291e87b97bd7eefcd63cc63f37c14ccdae1a268 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 9 Apr 2008 13:00:36 -0500 Subject: 2008-04-09 David Smith * .gitignore: Added more files to ignore. * doc/.gitignore: New file. --- .gitignore | 2 ++ ChangeLog | 4 ++++ doc/.gitignore | 8 ++++++++ doc/ChangeLog | 4 ++++ 4 files changed, 18 insertions(+) create mode 100644 doc/.gitignore diff --git a/.gitignore b/.gitignore index 69bd5e97..4984fad5 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ systemtap.spec testresults stapio stap_merge +SNAPSHOT +*.o diff --git a/ChangeLog b/ChangeLog index e35d90b6..7d2853d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-04-09 David Smith + + * .gitignore: Added more files to ignore. + 2008-04-04 Masami Hiramatsu PR 6028 diff --git a/doc/.gitignore b/doc/.gitignore new file mode 100644 index 00000000..d8a93302 --- /dev/null +++ b/doc/.gitignore @@ -0,0 +1,8 @@ +*.aux +*.glo +*.idx +*.log +*.lot +*.out +*.pdf +*.toc diff --git a/doc/ChangeLog b/doc/ChangeLog index e652078d..21b3cbf7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2008-04-09 David Smith + + * .gitignore: New file. + 2008-03-25 Frank Ch. Eigler * langref.tex: Clarify utility of epilogue-type probe aliases. -- cgit From c0f9d4b0f1e4d1d49d238e4b2546de46f51166eb Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 10 Apr 2008 13:09:19 -0400 Subject: PR6393: git version tagging at build time 2008-04-10 Frank Ch. Eigler PR 6393. * git_version.sh: New file, copied from radeonhd. * configure.ac: No longer generate $builddir/SNAPSHOT. * Makefile.am: Generate $builddir/git_version.h. (EXTRA_DIST): Add git_version.h and git_version.sh. * main.cxx (version): Print generated GIT_MESSAGE therefrom. * Makefile.in, configure: Regenerated. --- ChangeLog | 10 ++ Makefile.am | 7 +- Makefile.in | 7 +- configure | 7 -- configure.ac | 7 -- git_version.sh | 348 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ main.cxx | 2 + 7 files changed, 372 insertions(+), 16 deletions(-) create mode 100755 git_version.sh diff --git a/ChangeLog b/ChangeLog index 7d2853d2..fc720484 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-04-10 Frank Ch. Eigler + + PR 6393. + * git_version.sh: New file, copied from radeonhd. + * configure.ac: No longer generate $builddir/SNAPSHOT. + * Makefile.am: Generate $builddir/git_version.h. + (EXTRA_DIST): Add git_version.h and git_version.sh. + * main.cxx (version): Print generated GIT_MESSAGE therefrom. + * Makefile.in, configure: Regenerated. + 2008-04-09 David Smith * .gitignore: Added more files to ignore. diff --git a/Makefile.am b/Makefile.am index 1fc4dbec..b09bbc05 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,6 +17,9 @@ stap_SOURCES = main.cxx \ tapsets.cxx buildrun.cxx loc2c.c hash.cxx mdfour.c \ cache.cxx util.cxx coveragedb.cxx stap_LDADD = @stap_LIBS@ @sqlite3_LIBS@ +main.o: git_version.h +git_version.h: + $(srcdir)/git_version.sh -k --srcdir $(srcdir) -o git_version.h stap_CXXFLAGS = $(AM_CXXFLAGS) stap_CPPFLAGS = $(AM_CPPFLAGS) @@ -102,7 +105,8 @@ LDADD = EXTRA_DIST = buildrun.h elaborate.h loc2c.h session.h \ parse.h staptree.h tapsets.h translate.h \ cache.h hash.h mdfour.h util.h staplog.c coveragedb.h \ - examples testsuite systemtap.spec runtime tapset + examples testsuite systemtap.spec runtime tapset \ + git_version.h git_version.sh SAMPLE_DEST_DIR = $(distdir)/examples/samples @@ -156,6 +160,7 @@ clean-local: rm -rf $(TEST_COV_DIR) rm -rf stap.info rm -rf staplog.so + rm -f git_version.h uninstall-local: rm -rf $(DESTDIR)$(pkgdatadir) diff --git a/Makefile.in b/Makefile.in index e82d66a3..e1259bde 100644 --- a/Makefile.in +++ b/Makefile.in @@ -311,7 +311,8 @@ LDADD = EXTRA_DIST = buildrun.h elaborate.h loc2c.h session.h \ parse.h staptree.h tapsets.h translate.h \ cache.h hash.h mdfour.h util.h staplog.c coveragedb.h \ - examples testsuite systemtap.spec runtime tapset + examples testsuite systemtap.spec runtime tapset \ + git_version.h git_version.sh SAMPLE_DEST_DIR = $(distdir)/examples/samples SAMPLE_SRC = $(srcdir)/testsuite/systemtap.samples/iotask.stp \ @@ -1458,6 +1459,9 @@ uninstall-man: uninstall-man1 uninstall-man5 uninstall-man8 uninstall-man uninstall-man1 uninstall-man5 uninstall-man8 \ uninstall-pkglibexecPROGRAMS +main.o: git_version.h +git_version.h: + $(srcdir)/git_version.sh -k --srcdir $(srcdir) -o git_version.h @BUILD_ELFUTILS_TRUE@stamp-elfutils: config.status @BUILD_ELFUTILS_TRUE@ $(MAKE) $(AM_MAKEFLAGS) -C build-elfutils all @BUILD_ELFUTILS_TRUE@ for dir in libelf libebl libdw libdwfl backends; do \ @@ -1525,6 +1529,7 @@ clean-local: rm -rf $(TEST_COV_DIR) rm -rf stap.info rm -rf staplog.so + rm -f git_version.h uninstall-local: rm -rf $(DESTDIR)$(pkgdatadir) diff --git a/configure b/configure index c8be8582..819c6f06 100755 --- a/configure +++ b/configure @@ -6812,13 +6812,6 @@ cap_LIBS="$LIBS" LIBS="$SAVE_LIBS" CFLAGS="$SAVE_CFLAGS" -if test -d $srcdir/.git -a ! -f $srcdir/SNAPSHOT; then - snapshot=`cd $srcdir; git-rev-list --abbrev-commit --max-count=1 HEAD` - echo $snapshot > SNAPSHOT - { echo "$as_me:$LINENO: Created git SNAPSHOT $snapshot" >&5 -echo "$as_me: Created git SNAPSHOT $snapshot" >&6;} -fi - ac_config_headers="$ac_config_headers config.h:config.in" ac_config_files="$ac_config_files Makefile doc/Makefile systemtap.spec stap.1 stapprobes.5 stapfuncs.5 stapex.5 staprun.8 man/stapprobes.iosched.5 man/stapprobes.netdev.5 man/stapprobes.nfs.5 man/stapprobes.nfsd.5 man/stapprobes.pagefault.5 man/stapprobes.process.5 man/stapprobes.rpc.5 man/stapprobes.scsi.5 man/stapprobes.signal.5 man/stapprobes.socket.5 man/stapprobes.tcp.5 man/stapprobes.udp.5" diff --git a/configure.ac b/configure.ac index fa14516c..51ed83a7 100644 --- a/configure.ac +++ b/configure.ac @@ -204,13 +204,6 @@ AC_SUBST(cap_LIBS) LIBS="$SAVE_LIBS" CFLAGS="$SAVE_CFLAGS" -dnl Create SNAPSHOT file from git commit id if possible -if test -d $srcdir/.git -a ! -f $srcdir/SNAPSHOT; then - snapshot=`cd $srcdir; git-rev-list --abbrev-commit --max-count=1 HEAD` - echo $snapshot > SNAPSHOT - AC_MSG_NOTICE([Created git SNAPSHOT $snapshot]) -fi - AC_CONFIG_HEADERS([config.h:config.in]) AC_CONFIG_FILES(Makefile doc/Makefile systemtap.spec stap.1 stapprobes.5 stapfuncs.5 stapex.5 staprun.8 man/stapprobes.iosched.5 man/stapprobes.netdev.5 man/stapprobes.nfs.5 man/stapprobes.nfsd.5 man/stapprobes.pagefault.5 man/stapprobes.process.5 man/stapprobes.rpc.5 man/stapprobes.scsi.5 man/stapprobes.signal.5 man/stapprobes.socket.5 man/stapprobes.tcp.5 man/stapprobes.udp.5) AC_CONFIG_SUBDIRS(testsuite) diff --git a/git_version.sh b/git_version.sh new file mode 100755 index 00000000..69eb0f24 --- /dev/null +++ b/git_version.sh @@ -0,0 +1,348 @@ +#!/bin/sh +# +# Generate some basic versioning information which can be piped to a header. +# +# Copyright (c) 2006-2007 Luc Verhaegen +# Copyright (C) 2007 Hans Ulrich Niedermann +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +# This script is based on the one written for xf86-video-unichrome by +# Luc Verhaegen, but was rewritten almost completely by Hans Ulrich +# Niedermann. The script contains a few bug fixes from Egbert Eich, +# Matthias Hopf, Joerg Sonnenberger, and possibly others. +# +# The author thanks the nice people on #git for the assistance. +# +# Simple testing of this script: +# /sbin/busybox sh git_version.sh --example > moo.c \ +# && gcc -Wall -Wextra -Wno-unused -o moo moo.c \ +# && ./moo +# (bash should also do) +# +# For how to hook this up to your automake- and/or imake-based build +# system, best take a look at how the RadeonHD.am and/or RadeonHD.tmpl +# work in the xf86-video-radeonhd build system. For non-recursive make, +# you can probably make things a little bit simpler. +# +# KNOWN BUGS: +# * Uses hyphenated ("git-foo-bar") program names, which git upstream +# have declared deprecated. +# + +# Help messages +USAGE="[