summaryrefslogtreecommitdiffstats
path: root/runtime/lket
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lket')
-rw-r--r--runtime/lket/b2a/Makefile.am6
-rw-r--r--runtime/lket/b2a/Makefile.in425
-rw-r--r--runtime/lket/b2a/README48
-rw-r--r--runtime/lket/b2a/lket_b2a.c562
-rw-r--r--runtime/lket/b2a/lket_b2a.h96
5 files changed, 1137 insertions, 0 deletions
diff --git a/runtime/lket/b2a/Makefile.am b/runtime/lket/b2a/Makefile.am
new file mode 100644
index 00000000..dc8dbd92
--- /dev/null
+++ b/runtime/lket/b2a/Makefile.am
@@ -0,0 +1,6 @@
+bin_PROGRAMS = lket-b2a
+lket_b2a_SOURCES = lket_b2a.c
+lket_b2a_DEPENDENCIES = lket_b2a.h
+#b2a_LDADD = `pkg-config --libs glib-2.0`
+lket_b2a_LDFLAGS = `pkg-config --libs glib-2.0`
+lket_b2a_CFLAGS = -O2 -D_GNU_SOURCE -Wall `pkg-config --cflags glib-2.0`
diff --git a/runtime/lket/b2a/Makefile.in b/runtime/lket/b2a/Makefile.in
new file mode 100644
index 00000000..4ea748cb
--- /dev/null
+++ b/runtime/lket/b2a/Makefile.in
@@ -0,0 +1,425 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 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@
+
+SOURCES = $(lket_b2a_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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)
+subdir = runtime/lket/b2a
+DIST_COMMON = README $(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)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+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@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_ELFUTILS_FALSE = @BUILD_ELFUTILS_FALSE@
+BUILD_ELFUTILS_TRUE = @BUILD_ELFUTILS_TRUE@
+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@
+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@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+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@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+U = @U@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+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@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+stap_LIBS = @stap_LIBS@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+lket_b2a_SOURCES = lket_b2a.c
+lket_b2a_DEPENDENCIES = lket_b2a.h
+#b2a_LDADD = `pkg-config --libs glib-2.0`
+lket_b2a_LDFLAGS = `pkg-config --libs glib-2.0`
+lket_b2a_CFLAGS = -O2 -D_GNU_SOURCE -Wall `pkg-config --cflags glib-2.0`
+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)
+ $(LINK) $(lket_b2a_LDFLAGS) $(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@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@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@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@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@ if $(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@ then mv -f "$(DEPDIR)/lket_b2a-lket_b2a.Tpo" "$(DEPDIR)/lket_b2a-lket_b2a.Po"; else rm -f "$(DEPDIR)/lket_b2a-lket_b2a.Tpo"; exit 1; fi
+@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@ if $(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@ then mv -f "$(DEPDIR)/lket_b2a-lket_b2a.Tpo" "$(DEPDIR)/lket_b2a-lket_b2a.Po"; else rm -f "$(DEPDIR)/lket_b2a-lket_b2a.Tpo"; exit 1; fi
+@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`
+uninstall-info-am:
+
+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)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ 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-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+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 uninstall-info-am
+
+.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-exec install-exec-am \
+ install-info install-info-am install-man 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 uninstall-info-am
+
+# 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/README b/runtime/lket/b2a/README
new file mode 100644
index 00000000..004cc640
--- /dev/null
+++ b/runtime/lket/b2a/README
@@ -0,0 +1,48 @@
+b2a: a binary2ascii converter for LKET
+
+It is used to convert the binary trace data generated by systemtap
+with LKET into readable data in ascii format.
+
+It uses the pre-cpu binary trace data files as inputs, and generates
+an output file named "lket.out". You can use "stap -b -M" with LKET
+to get those pre-cpu files (stpd_cpu*) before using it.
+
+How to build:
+ gcc -O2 -o b2a lket_b2a.c
+
+How to use:
+ ./b2a stpd_cpuX [stpd_cpuY ...]
+ or
+ ./b2a stpd_cpu*
+
+The following is a typical output of b2a:
+
+LKET Magic: 0xAEFCDB6B
+InitHdrLen: 4
+Version Major: 0
+Version Minor: 1
+Big endian: YES
+Bits width: 2
+0.0 App1[PID:24456 PPID:24371 TID:24456] CPU:3 HOOKGRP:2 HOOKID:1 HOOKDATA:0 swapper
+0.3 App1[PID:24456 PPID:24371 TID:24456] CPU:3 HOOKGRP:2 HOOKID:1 HOOKDATA:1 init
+...
+0.723810 App9[PID:3345 PPID:1 TID:3345] CPU:7 HOOKGRP:1 HOOKID:1 HOOKDATA:sys_gettimeofday
+0.723814 App9[PID:3345 PPID:1 TID:3345] CPU:7 HOOKGRP:1 HOOKID:2 HOOKDATA:sys_gettimeofday
+0.723820 App9[PID:3345 PPID:1 TID:3345] CPU:7 HOOKGRP:1 HOOKID:1 HOOKDATA:sys_poll
+0.723837 App9[PID:3345 PPID:1 TID:3345] CPU:7 HOOKGRP:4 HOOKID:2 HOOKDATA:3345 c0000000004418c4 c000000007400040 c0000000004418b4 c0000000004433cc c0000000000cce80 c00000000002a408 80d0b2154c 80d2da7b40
+...
+36.365564 App35[PID:24491 PPID:18767 TID:24491] CPU:3 HOOKGRP:6 HOOKID:1 HOOKDATA:268585192 0
+36.365571 App35[PID:24491 PPID:18767 TID:24491] CPU:3 HOOKGRP:1 HOOKID:1 HOOKDATA:compat_sys_execve
+36.365579 App35[PID:24491 PPID:18767 TID:24491] CPU:3 HOOKGRP:2 HOOKID:2 HOOKDATA:/bin/ls
+...
+37.495705 App35[PID:24491 PPID:18767 TID:24491] CPU:4 HOOKGRP:1 HOOKID:1 HOOKDATA:sys_getdents64
+37.495730 App35[PID:24491 PPID:18767 TID:24491] CPU:4 HOOKGRP:3 HOOKID:2 HOOKDATA:anticipatory 8 0
+37.495738 App35[PID:24491 PPID:18767 TID:24491] CPU:4 HOOKGRP:3 HOOKID:1 HOOKDATA:anticipatory -1 -1
+37.495769 App35[PID:24491 PPID:18767 TID:24491] CPU:4 HOOKGRP:5 HOOKID:1 HOOKDATA:8 0 2 c0000000002fd8dc c000000002a52d48 c0000000001f160c
+37.495775 App35[PID:24491 PPID:18767 TID:24491] CPU:4 HOOKGRP:5 HOOKID:1 HOOKDATA:8 0 2
+37.495784 App35[PID:24491 PPID:18767 TID:24491] CPU:4 HOOKGRP:5 HOOKID:2 HOOKDATA:2 1 2 -4611686018331225216 4096 45812
+...
+37.516707 App32[PID:18763 PPID:3079 TID:18763] CPU:5 HOOKGRP:7 HOOKID:2 HOOKDATA:eth0 106 2048 1880
+...
+37.517938 App4[PID:0 PPID:1 TID:0] CPU:1 HOOKGRP:7 HOOKID:1 HOOKDATA:eth0 46 2048 728
+...
diff --git a/runtime/lket/b2a/lket_b2a.c b/runtime/lket/b2a/lket_b2a.c
new file mode 100644
index 00000000..0aa0124b
--- /dev/null
+++ b/runtime/lket/b2a/lket_b2a.c
@@ -0,0 +1,562 @@
+// Copyright (C) 2005, 2006 IBM Corp.
+//
+// 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 <sys/types.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <ctype.h>
+#include <assert.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "lket_b2a.h"
+
+static long long start_timestamp;
+
+/* mapping table for [group, id, fmt] */
+int **groups[MAX_HOOKGROUP+1] = {NULL};
+
+/* Balanced binary search tree to store the
+ mapping of <pid, process name> */
+GTree *appNameTree;
+
+/*
+ * default hook format table,
+ * based on tapsets/hookid_defs.stp and other hook specific files
+ */
+static hook_fmt default_hook_fmts[] = {
+ //_GROUP_SYSCALL
+ {1, 1, "%s"}, //HOOKID_SYSCALL_ENTRY
+ {1, 2, "%s"}, //HOOKID_SYSCALL_RETURN
+ //_GROUP_PROCESS
+ {2, 1, "%4b%s"},//HOOKID_PROCESS_SNAPSHOT
+ {2, 2, "%s"}, //HOOKID_PROCESS_EXECVE
+ {2, 3, "%4b"}, //HOOKID_PROCESS_FORK
+ //_GROUP_IOSCHED
+ {3, 1, "%s%1b%1b"}, //HOOKID_IOSCHED_NEXT_REQ
+ {3, 2, "%s%1b%1b"}, //HOOKID_IOSCHED_ADD_REQ
+ {3, 3, "%s%1b%1b"}, //HOOKID_IOSCHED_REMOVE_REQ
+ //_GROUP_TASK
+ {4, 1, "%4b%4b%1b"},//HOOKID_TASK_CTXSWITCH
+ {4, 2, "%4b"}, //HOOKID_TASK_CPUIDLE
+ //_GROUP_SCSI
+ {5, 1, "%1b%1b%1b"}, //HOOKID_SCSI_IOENTRY
+ {5, 2, "%1b%4b%1b%8b%4b%8b"}, //HOOKID_SCSI_IO_TO_LLD
+ {5, 3, "%4b%1b%8b"}, //HOOKID_SCSI_IODONE_BY_LLD
+ {5, 4, "%4b%1b%8b%4b"}, //HOOKID_SCSI_IOCOMP_BY_MIDLEVEL
+ //_GROUP_PAGEFAULT
+ {6, 1, "%8b%1b"}, //HOOKID_PAGEFAULT
+ //_GROUP_NETDEV
+ {7, 1, "%s%4b%2b%4b"}, //HOOKID_NETDEV_RECEIVE
+ {7, 2, "%s%4b%2b%4b"} //HOOKID_NETDEV_TRANSMIT
+};
+
+int main(int argc, char *argv[])
+{
+ lket_pkt_header *hdrs = NULL;
+ FILE **infps = NULL;
+ FILE *outfp = NULL;
+ char outfilename[MAX_STRINGLEN]={0};
+ int i, j, total_infiles = 0;
+ long long min;
+
+ if(argc < 2) {
+ printf("Usage: %s inputfile1 [inputfile2...]\n", argv[0]);
+ return 1;
+ }
+ total_infiles = argc - 1;
+
+ // open the input files and the output file
+ infps = (FILE **)malloc(total_infiles * sizeof(FILE *));
+ if(!infps) {
+ printf("Unable to malloc infps\n");
+ return 1;
+ }
+ memset(infps, 0, total_infiles * sizeof(FILE *));
+ for(i=0; i < total_infiles; i++) {
+ infps[i] = fopen(argv[i+1], "r");
+ if(infps[i] == NULL) {
+ printf("Unable to open %s\n", argv[i+1]);
+ goto failed;
+ }
+ }
+
+ if(strnlen(outfilename, MAX_STRINGLEN) == 0)
+ strncpy(outfilename, DEFAULT_OUTFILE_NAME, MAX_STRINGLEN);
+ outfp = fopen(outfilename, "w");
+ if(outfp == NULL) {
+ printf("Unable to create %s\n", outfilename);
+ goto failed;
+ }
+
+ /* create the search tree */
+ appNameTree = g_tree_new_full(compareFunc, NULL, NULL, destroyAppName);
+
+ // register all hookdata formats here
+ register_formats();
+
+ // find the lket header
+ find_init_header(infps, total_infiles, outfp);
+
+ // allocate packet headers array
+ hdrs = malloc(total_infiles * sizeof(lket_pkt_header));
+ if(!hdrs) {
+ printf("Unable to malloc hdrs \n");
+ 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].sec*1000000LL + hdrs[i].usec) < start_timestamp
+ || (start_timestamp == 0)) {
+ start_timestamp = hdrs[i].sec*1000000LL + hdrs[i].usec;
+ j = i;
+ }
+ }
+
+ // main loop of parsing & merging
+ min = start_timestamp;
+ do {
+ // j is the next
+ if(min) {
+ print_pkt_header(outfp, &hdrs[j]);
+
+ if(hdrs[j].hookgroup==2 &&
+ (hdrs[j].hookid==1 || hdrs[j].hookid==2))
+ register_appname(j, infps[j], &hdrs[j]);
+
+ // write the remaining content from infd[j] to outfile
+ b2a_vsnprintf(get_fmt(hdrs[j].hookgroup, hdrs[j].hookid),
+ infps[j], outfp, hdrs[j].size);
+ // update hdr[j]
+ get_pkt_header(infps[j], &hdrs[j]);
+ }
+ // recalculate the smallest timestamp
+ min = hdrs[0].sec*1000000LL + hdrs[0].usec;
+ j = 0;
+ for(i=1; i < total_infiles ; i++) {
+ if((min == 0) ||
+ ((hdrs[i].sec*1000000LL + hdrs[i].usec) < min)) {
+ min = hdrs[i].sec*1000000LL + hdrs[i].usec;
+ 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
+ for(i=0; i <= MAX_HOOKGROUP; i++) {
+ if(groups[i]) {
+ for(j=0; j <= MAX_HOOKID; j++)
+ if(groups[i][j]) {
+ free(groups[i][j]);
+ groups[i][j] = NULL;
+ }
+ }
+ }
+ if(infps)
+ free(infps);
+ if(hdrs)
+ free(hdrs);
+
+ g_tree_destroy(appNameTree);
+
+ return 0;
+}
+
+/* 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;
+ char *appname;
+ int count;
+ int len;
+ int c;
+ len=0;
+ count=0;
+
+ appname = (char *)malloc(1024);
+
+ if(phdr->hookid ==1 ) { /* process_snapshot */
+ len = fread(&pid, 1, 4, fp);
+ c = fgetc_unlocked(fp);
+ ++len;
+ while (c && len < 1024) {
+ appname[count++] = (char)c;
+ c = fgetc_unlocked(fp);
+ ++len;
+ }
+ appname[count]='\0';
+ fseek(fp, 0-len, SEEK_CUR);
+ } else if (phdr->hookid == 2) { /* process.execve */
+ pid = phdr->pid;
+
+ c = fgetc_unlocked(fp);
+ ++len;
+ while (c && len < 1024) {
+ appname[count++] = (char)c;
+ c = fgetc_unlocked(fp);
+ ++len;
+ }
+ appname[count]='\0';
+ fseek(fp, 0-len, SEEK_CUR);
+ } else {
+ free(appname);
+ return;
+ }
+ g_tree_insert(appNameTree, (gpointer)pid, (gpointer)appname);
+}
+
+
+gint compareFunc(gconstpointer a, gconstpointer b, gpointer user_data)
+{
+ if((int)(a) > (int)(b)) return 1;
+ else if ((int)(a) < (int)(b)) return -1;
+ else return 0;
+}
+
+void destroyAppName(gpointer data)
+{
+ free(data);
+}
+
+/* The following are all supporting sub-functions */
+
+/*
+ * register one hookdata fmt string for a [hookgroup, hookid] pair
+ */
+int register_one_fmt(int hookgroup, int hookid, const char *fmt, size_t maxlen)
+{
+ void *ptr;
+
+ if(hookgroup < 0 || hookgroup > MAX_HOOKGROUP)
+ return -1;
+ if(hookid < 0 || hookid > MAX_HOOKID)
+ return -1;
+ if(!fmt || maxlen <= 0)
+ return -1;
+ if(groups[hookgroup] == NULL) {
+ // allocate hook aray for new group
+ ptr = malloc((MAX_HOOKID+1) * sizeof(char *));
+ if(!ptr)
+ return -1;
+ memset(ptr,0,(MAX_HOOKID+1) * sizeof(char *));
+ groups[hookgroup] = ptr;
+ }
+ if(groups[hookgroup][hookid] != NULL) {
+ free(groups[hookgroup][hookid]);
+ groups[hookgroup][hookid] = NULL;
+ }
+ assert(groups[hookgroup][hookid] == NULL);
+ ptr = malloc(maxlen);
+ if(!ptr)
+ return -1;
+ memset(ptr, 0, maxlen);
+ strncpy(ptr, fmt, maxlen);
+ groups[hookgroup][hookid] = ptr;
+ return 0;
+}
+
+/*
+ * initialize all the hookdata fmt strings as required
+ * called at the beginning of main()
+ */
+void register_formats(void)
+{
+ int i, total;
+
+ total = sizeof(default_hook_fmts)/sizeof(default_hook_fmts[0]);
+ if(total <= 0)
+ return;
+ for(i=0; i<total; i++)
+ register_one_fmt( default_hook_fmts[i].hookgrp,
+ default_hook_fmts[i].hookid,
+ default_hook_fmts[i].fmt,
+ strlen(default_hook_fmts[i].fmt) + 1 );
+}
+
+/*
+ * get the format string with [hookgroup, hookid] pair
+ */
+const char *get_fmt(int hookgroup, int hookid)
+{
+ assert(hookgroup >= 0 && hookgroup <= MAX_HOOKGROUP );
+ assert(hookid >= 0 && hookid <= MAX_HOOKID );
+ if(groups[hookgroup] && groups[hookgroup][hookid])
+ return (const char *)groups[hookgroup][hookid];
+ else
+ return "<Bad Fmt>";
+}
+
+/*
+ * handle the bothering sequence id generated by systemtap
+ */
+int skip_sequence_id(FILE *fp)
+{
+ return (fseek(fp, (off_t)SEQID_SIZE, SEEK_CUR) == -1);
+}
+
+/*
+ * 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, FILE *outfp)
+{
+ int i, j;
+ int32_t magic;
+
+ /* information from lket_init_header */
+ int16_t inithdr_len;
+ int8_t ver_major;
+ int8_t ver_minor;
+ int8_t big_endian;
+ int8_t bits_width;
+
+ if(total_infiles <= 0 )
+ return;
+ j = total_infiles;
+ for(i=0; i<total_infiles; i++) {
+ if(skip_sequence_id(infps[i]))
+ continue;
+ if(fread(&magic, 1, sizeof(magic), infps[i]) < sizeof(magic))
+ continue;
+ if(magic == (int32_t)LKET_MAGIC) {
+ //found
+ j = i;
+ fprintf(outfp, "LKET Magic:\t0x%X\n", magic);
+ //read other content of lket_int_header
+ if(fread(&inithdr_len, 1, sizeof(inithdr_len), infps[i]) < sizeof(inithdr_len))
+ break;
+ fprintf(outfp, "InitHdrLen:\t%d\n", inithdr_len);
+ if(fread(&ver_major, 1, sizeof(ver_major), infps[i]) < sizeof(ver_major))
+ break;
+ fprintf(outfp, "Version Major:\t%d\n", ver_major);
+ if(fread(&ver_minor, 1, sizeof(ver_minor), infps[i]) < sizeof(ver_minor))
+ break;
+ fprintf(outfp, "Version Minor:\t%d\n", ver_minor);
+ if(fread(&big_endian, 1, sizeof(big_endian), infps[i]) < sizeof(big_endian))
+ break;
+ fprintf(outfp, "Big endian:\t%s\n", big_endian ? "YES":"NO");
+ if(fread(&bits_width, 1, sizeof(bits_width), infps[i]) < sizeof(bits_width))
+ break;
+ fprintf(outfp, "Bits width:\t%d\n", bits_width);
+ // skip the null terminater
+ fseek(infps[i], 1LL, SEEK_CUR);
+ break;
+ }
+ }
+ for(i=0; i<total_infiles && i!=j; i++)
+ fseek(infps[i], 0LL, SEEK_SET);
+ return;
+}
+
+/*
+ * read the lket_pkt_header structure at the begining of the input file
+ */
+int get_pkt_header(FILE *fp, lket_pkt_header *phdr)
+{
+ if(skip_sequence_id(fp))
+ goto bad;
+
+ if(fread(phdr, 1, sizeof(lket_pkt_header), fp) < sizeof(lket_pkt_header))
+ goto bad;
+
+ phdr->size -= sizeof(lket_pkt_header)-sizeof(phdr->flag)-sizeof(phdr->size)-1;
+
+ return 0;
+
+bad:
+ memset(phdr, 0, sizeof(lket_pkt_header));
+ return -1;
+}
+
+/*
+ * print the lket_pkt_header structure into the output file
+ */
+void print_pkt_header(FILE *fp, lket_pkt_header *phdr)
+{
+ if(!fp || !phdr)
+ return;
+ fprintf(fp, "%lld.%lld APPNAME: %s PID:%d PPID:%d TID:%d CPU:%d HOOKGRP:%d HOOKID:%d HOOKDATA:",
+ (phdr->sec*1000000LL + phdr->usec - start_timestamp)/1000000LL,
+ (phdr->sec*1000000LL + phdr->usec- start_timestamp)%1000000LL,
+ (char *)(g_tree_lookup(appNameTree, (gconstpointer)phdr->pid)),
+ phdr->pid,
+ phdr->ppid,
+ phdr->tid,
+ phdr->cpu,
+ phdr->hookgroup,
+ phdr->hookid);
+}
+static int skip_atoi(const char **s)
+{
+ int i=0;
+ while (isdigit(**s))
+ i = i*10 + *((*s)++) - '0';
+ return i;
+}
+
+/*
+ * read fixed-length from the input binary file and write into
+ * the output file, based on the fmt string
+ */
+void b2a_vsnprintf(const char *fmt, FILE *infp, FILE *outfile, size_t size)
+{
+
+ int field_width, qualifier;
+ int readbytes = 0;
+ int c;
+ int16_t stemp;
+ int32_t ntemp;
+ long ltemp;
+ long long lltemp;
+
+ if(size <= 0 || !outfile)
+ return;
+
+ for(; *fmt; ++fmt) {
+
+ if (*fmt != '%') {
+ if (readbytes < size) {
+ c = fgetc_unlocked(infp);
+ ++readbytes;
+ fputc_unlocked(*fmt, outfile);
+ continue;
+ }
+ goto filled;
+ }
+
+ ++fmt;
+ qualifier = -1;
+ if (*fmt == 'l' || *fmt == 'L') {
+ qualifier = *fmt;
+ ++fmt;
+ if (qualifier == 'l' && *fmt == 'l') {
+ qualifier = 'L';
+ ++fmt;
+ }
+ }
+
+ field_width = -1;
+ if (isdigit(*fmt))
+ field_width = skip_atoi(&fmt);
+
+ switch (*fmt) {
+ case 's':
+ c = fgetc_unlocked(infp);
+ ++readbytes;
+ while (c && readbytes < size) {
+ fputc_unlocked(c, outfile);
+ c = fgetc_unlocked(infp);
+ ++readbytes;
+ }
+ if(!c) {
+ fputc_unlocked(' ', outfile);
+ continue;
+ }
+ else
+ goto filled;
+ case 'd':
+ case 'i':
+ if (qualifier == 'l') {
+ if(readbytes + sizeof(long) > size)
+ goto filled;
+ fread(&ltemp, sizeof(long), 1, infp);
+ readbytes += sizeof(long);
+ fprintf(outfile,"%ld ", (long)ltemp);
+ }
+ else if (qualifier == 'L') {
+ if(readbytes + sizeof(long long) > size)
+ goto filled;
+ fread(&lltemp, sizeof(long long), 1, infp);
+ readbytes += sizeof(long long);
+ fprintf(outfile,"%lld ", (long long)lltemp);
+ }
+ else {
+ if(readbytes + 4 > size)
+ goto filled;
+ fread(&ntemp, 4, 1, infp);
+ readbytes += 4;
+ fprintf(outfile,"%d ", (int32_t)ntemp);
+ }
+ break;
+ case 'b':
+ if(field_width != 1 && field_width != 2
+ && field_width != 4 && field_width != 8)
+ field_width = 4;
+ if(readbytes + field_width > size)
+ goto filled;
+
+ //read(infd, &temp, field_width);
+ switch(field_width) {
+ case 1:
+ c = fgetc_unlocked(infp);
+ fprintf(outfile, "%d ", (int8_t)c);
+ break;
+ case 2:
+ fread(&stemp, 2, 1, infp);
+ fprintf(outfile, "%d ", (int16_t)stemp);
+ break;
+ case 8:
+ fread(&lltemp, 8, 1, infp);
+ fprintf(outfile, "%lld ",(int64_t)lltemp);
+ break;
+ case 4:
+ default:
+ fread(&ntemp, 4, 1, infp);
+ fprintf(outfile, "%d ", (int32_t)ntemp);
+ break;
+ }
+ readbytes += field_width;
+ break;
+ default:
+ if(readbytes >= size)
+ goto filled;
+ c = fgetc_unlocked(infp);
+ ++readbytes;
+ fputc_unlocked(c, outfile);
+ if (*fmt) {
+ if( readbytes >= size)
+ goto filled;
+ c = fgetc_unlocked(infp);
+ ++readbytes;
+ fputc_unlocked(c, outfile);
+ } else {
+ --fmt;
+ }
+ continue;
+ }
+ }
+
+filled:
+ // print possible backtrace string
+ while(readbytes++ < size ) {
+ if((c=fgetc_unlocked(infp)) != EOF)
+ break;
+ if(!c)
+ break;
+ fputc_unlocked(c, outfile);
+ }
+ if(readbytes < size)
+ fseek(infp, size - readbytes, SEEK_CUR);
+ fprintf(outfile, "\n");
+}
diff --git a/runtime/lket/b2a/lket_b2a.h b/runtime/lket/b2a/lket_b2a.h
new file mode 100644
index 00000000..dd239126
--- /dev/null
+++ b/runtime/lket/b2a/lket_b2a.h
@@ -0,0 +1,96 @@
+#ifndef _LKET_B2A_H
+#define _LKET_B2A_H
+#include <glib.h>
+
+#define LKET_MAGIC 0xAEFCDB6B
+
+#define MAX_STRINGLEN 256
+#define MAX_HOOKGROUP 255
+#define MAX_HOOKID 255
+
+#define APPNAMELIST_LEN 256
+
+#define SEQID_SIZE 4
+
+#define DEFAULT_OUTFILE_NAME "lket.out"
+
+typedef struct _lket_pkt_header {
+ int8_t flag;
+ int16_t size;
+ int8_t hookgroup;
+ int8_t hookid;
+ int32_t sec;
+ int32_t usec;
+ int32_t pid;
+ int32_t ppid;
+ int32_t tid;
+ int8_t cpu;
+} __attribute__((packed)) lket_pkt_header;
+
+typedef struct _appname_info {
+ int pid;
+ int ppid;
+ int tid;
+ long index;
+ struct _appname_info *next;
+} appname_info;
+
+typedef struct _hook_fmt {
+ int hookgrp;
+ int hookid;
+ const char *fmt;
+} hook_fmt;
+
+/*
+ * register one hookdata fmt string for a [hookgroup, hookid] pair
+ */
+static int register_one_fmt(int hookgroup, int hookid, const char *fmt, size_t maxlen);
+
+/*
+ * initialize all the hookdata fmt strings as required
+ * called at the beginning of main()
+ */
+static void register_formats(void);
+
+/*
+ * get the format string with [hookgroup, hookid] pair
+ */
+static const char *get_fmt(int hookgroup, int hookid);
+
+/*
+ * handle the bothering sequence id generated by systemtap
+ */
+static int skip_sequence_id(FILE *fp);
+
+/*
+ * search the lket_init_header structure in a set of input files
+ */
+static void find_init_header(FILE **fp, const int total_infiles, FILE *outfp);
+
+/*
+ * 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(FILE *fp, lket_pkt_header *phdr);
+
+/*
+ * Get the appropriate appname index based on the [pid, ppid, tid] triple
+ * If exists, return it; otherwise, assigned a new one.
+ */
+//static long appname_index(int pid, int ppid, int tid);
+
+/*
+ * read fixed-length from the input binary file and write into
+ * the output file, based on the fmt string
+ */
+static void b2a_vsnprintf(const char *fmt, FILE *infp, FILE *outfile, size_t size);
+
+void register_appname(int i, FILE *fp, lket_pkt_header *phdr);
+gint compareFunc(gconstpointer a, gconstpointer b, gpointer user_data);
+void destroyAppName(gpointer data);
+
+#endif