Hi,

As I mentioned, I'm building OpenWRT, therefore, part of the integration of LTTng into Busybox is managed at OpenWRT package level, but it is also true that you only need to add the dependency on lttng-ust (Makefile.patch and Makefile, where you can see the Busybox version being used). Adding the dependency directly into Busybox build system should be easy too. Regarding the patch to add tracepoints to Busybox codebase, it is an addition to the patches applied by OpenWRT (new patch 904-telnetd_lttng_events.patch), but no black magic there neither: - add a couple of new files for LTTng tracepoints definition/declaration: networking/telnetd_lttng_events.c and networking/telnetd_lttng_events.h
          - add tracepoints calls to telnetd.c
- add tracepoint provider to telnetd built: (Kbuild.src: lib-$(CONFIG_TELNETD) += telnetd.o telnetd_lttng_events.o)

And that's all. If this is not the info you are asking for, let me know.
    Thanks,

                 Santi

On 11/03/14 20:10, Mathieu Desnoyers wrote:
----- Original Message -----
From: "Santiago Font" <[email protected]>
To: [email protected]
Sent: Tuesday, March 11, 2014 2:28:11 PM
Subject: [lttng-dev]   LTTng-ust 2.4.0-rc2: no events when tracing busybox

Hi,

      I have an embedded scenario (openwrt over Freescale) working with
LTTng:

          lttng create TEST
          lttng enable-channel MYCHAN -u --buffers-uid --subbuf-size 64k
          lttng add-context -u -t procname -c MYCHAN
          lttng enable-event -u "*" -c MYCHAN
          lttng start
          /usr/sbin/sample &
          lttng stop
          lttng view

              - Several ust_baddr_statedump:soinfo events
              - An example of the events I defined
             (See below for details: dump_1)

      So far, so good.

      Now, I'm trying to add my events to busybox to trace telnetd (very
same provider .c file and event definition .h file, changing only the
provider name).
      When I follow exactly the same steps but changing "/usr/sbin/sample
&" for "/usr/sbin/telnetd -F &", I get the ust_baddr_statedump:soinfo
events, but none of my events (see dump_2)
      I have tried with/without TRACEPOINT_PROBE_DYNAMIC_LINKAGE,
with/without LD_PRELOAD=liblttng-ust-fork.so, but not success.
      Taking a look to the symbols inside the binary (dump 3), all LTTng
stuff seems to be there.

      LTTng (modules, tools, ust): 2.4.0

      Any idea?
Could you share with us your patch that adds your specific tracepoints
into the busybox codebase, along with the specific links/version info
needed for us to see how it integrate into the busybox build system ?

Thanks,

Mathieu

      Thank you,

                Santi



------- dump_1 ------------------

[00:05:04.281094007] (+10.405305121) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "sample" }, { baddr = 0x10000000, sopath =
"/usr/sbin/sample", size = 9176, mtime = 1394554355 }
[00:05:04.281173138] (+0.000079131) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "sample" }, { baddr = 0x48018000, sopath =
"/lib/libdl-0.9.33.2.so", size = 12436, mtime = 1394229945 }
[00:05:04.281214310] (+0.000041172) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "sample" }, { baddr = 0x4802C000, sopath =
"/usr/lib/liblttng-ust.so.0.0.0", size = 224696, mtime = 1394554355 }
[00:05:04.281239239] (+0.000024929) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "sample" }, { baddr = 0x48074000, sopath =
"/lib/libgcc_s.so.1", size = 88200, mtime = 1394229944 }
[00:05:04.281271259] (+0.000032020) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "sample" }, { baddr = 0x4809A000, sopath =
"/lib/libuClibc-0.9.33.2.so", size = 326616, mtime = 1394229945 }
[00:05:04.281303562] (+0.000032303) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "sample" }, { baddr = 0x48000000, sopath =
"/lib/ld-uClibc-0.9.33.2.so", size = 29052, mtime = 1394229945 }
[00:05:04.281344714] (+0.000041152) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "sample" }, { baddr = 0x480FF000, sopath =
"/usr/lib/liblttng-ust-tracepoint.so.0.0.0", size = 25276, mtime =
1394554355 }
[00:05:04.281376996] (+0.000032282) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "sample" }, { baddr = 0x4811E000, sopath =
"/lib/librt-0.9.33.2.so", size = 12404, mtime = 1394229945 }
[00:05:04.281416532] (+0.000039536) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "sample" }, { baddr = 0x48132000, sopath =
"/usr/lib/liburcu-bp.so.1.0.0", size = 15388, mtime = 1394548454 }
[00:05:04.281456411] (+0.000039879) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "sample" }, { baddr = 0x48146000, sopath =
"/usr/lib/liburcu-cds.so.1.0.0", size = 18216, mtime = 1394548454 }
[00:05:04.281489138] (+0.000032727) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "sample" }, { baddr = 0x4815B000, sopath =
"/lib/libpthread-0.9.33.2.so", size = 70104, mtime = 1394229945 }
[00:05:04.281529501] (+0.000040363) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "sample" }, { baddr = 0x4817F000, sopath =
"/usr/lib/liburcu-common.so.1.0.0", size = 3188, mtime = 1394548454 }
[00:05:04.282903966] (+0.001374465) OpenWrt busybox_telnetd2:info: {
cpu_id = 0 }, { procname = "sample" }, { msg = "Hello World" }
[00:05:04.282922512] (+0.000018546) OpenWrt busybox_telnetd2:session: {
cpu_id = 0 }, { procname = "sample" }, { msg = "Session", client =
"10.0.2.5", server = "10.0.2.4", session_pid = 0 }
[00:05:04.282929643] (+0.000007131) OpenWrt busybox_telnetd2:err: {
cpu_id = 0 }, { procname = "sample" }, { call = "arg1", msg = "arg2",
errno_val = 0 }

------- dump_2 ------------------
[00:14:16.375740554] (+11.778441605) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "telnetd" }, { baddr = 0x10000000, sopath =
"/bin/busybox", size = 438834, mtime = 1394559555 }
[00:14:16.375818817] (+0.000078263) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "telnetd" }, { baddr = 0x48018000, sopath =
"/lib/libcrypt-0.9.33.2.so", size = 20724, mtime = 1394229945 }
[00:14:16.375852150] (+0.000033333) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "telnetd" }, { baddr = 0x4803F000, sopath =
"/lib/libdl-0.9.33.2.so", size = 12436, mtime = 1394229945 }
[00:14:16.375892474] (+0.000040324) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "telnetd" }, { baddr = 0x48053000, sopath =
"/usr/lib/liblttng-ust.so.0.0.0", size = 224696, mtime = 1394554355 }
[00:14:16.375941827] (+0.000049353) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "telnetd" }, { baddr = 0x4809B000, sopath =
"/lib/libm-0.9.33.2.so", size = 61540, mtime = 1394229945 }
[00:14:16.375967524] (+0.000025697) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "telnetd" }, { baddr = 0x480BB000, sopath =
"/lib/libgcc_s.so.1", size = 88200, mtime = 1394229944 }
[00:14:16.375999484] (+0.000031960) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "telnetd" }, { baddr = 0x480E1000, sopath =
"/lib/libuClibc-0.9.33.2.so", size = 326616, mtime = 1394229945 }
[00:14:16.376031585] (+0.000032101) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "telnetd" }, { baddr = 0x48000000, sopath =
"/lib/ld-uClibc-0.9.33.2.so", size = 29052, mtime = 1394229945 }
[00:14:16.376072696] (+0.000041111) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "telnetd" }, { baddr = 0x48146000, sopath =
"/usr/lib/liblttng-ust-tracepoint.so.0.0.0", size = 25276, mtime =
1394554355 }
[00:14:16.376104938] (+0.000032242) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "telnetd" }, { baddr = 0x48165000, sopath =
"/lib/librt-0.9.33.2.so", size = 12404, mtime = 1394229945 }
[00:14:16.376144635] (+0.000039697) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "telnetd" }, { baddr = 0x48179000, sopath =
"/usr/lib/liburcu-bp.so.1.0.0", size = 15388, mtime = 1394548454 }
[00:14:16.376184373] (+0.000039738) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "telnetd" }, { baddr = 0x4818D000, sopath =
"/usr/lib/liburcu-cds.so.1.0.0", size = 18216, mtime = 1394548454 }
[00:14:16.376217363] (+0.000032990) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "telnetd" }, { baddr = 0x481A2000, sopath =
"/lib/libpthread-0.9.33.2.so", size = 70104, mtime = 1394229945 }
[00:14:16.376257908] (+0.000040545) OpenWrt ust_baddr_statedump:soinfo:
{ cpu_id = 0 }, { procname = "telnetd" }, { baddr = 0x481C6000, sopath =
"/usr/lib/liburcu-common.so.1.0.0", size = 3188, mtime = 1394548454 }

----- dump 3 ------------
nm ipkg-install/bin/busybox | grep 'tracepoint\|busybox_telnetd\|lttng'

1007b124 d __event_desc___busybox_telnetd
1005f7d0 R __event_desc___busybox_telnetd_err
1005fee4 R __event_desc___busybox_telnetd_info
1005fea4 R __event_desc___busybox_telnetd_session
1005f998 r __event_fields___busybox_telnetd___err
1005f868 r __event_fields___busybox_telnetd___info
1005ff24 r __event_fields___busybox_telnetd___session
10016624 t __event_probe__busybox_telnetd___err
100164a4 t __event_probe__busybox_telnetd___info
10016878 t __event_probe__busybox_telnetd___session
1007b134 d _format___busybox_telnetd___err
1007b130 d _format___busybox_telnetd___info
1007b138 d _format___busybox_telnetd___session
           w _loglevel___busybox_telnetd___err
           w _loglevel___busybox_telnetd___info
           w _loglevel___busybox_telnetd___session
10016ca0 t __lttng_events_exit__busybox_telnetd
10016c3c t __lttng_events_init__busybox_telnetd
           U lttng_probe_register
           U lttng_probe_unregister
           w _model_emf_uri___busybox_telnetd___err
           w _model_emf_uri___busybox_telnetd___info
           w _model_emf_uri___busybox_telnetd___session
1007b13c d __probe_desc___busybox_telnetd
1007c228 b __probe_register_refcount___busybox_telnetd
1007b1ec A __start___tracepoints_ptrs
1007b1f8 A __stop___tracepoints_ptrs
1005fe70 R __tp_event_signature___busybox_telnetd___err
1005f858 R __tp_event_signature___busybox_telnetd___info
1005f810 R __tp_event_signature___busybox_telnetd___session
1006ac80 r __tp_strtab_busybox_telnetd___err
1006ac94 r __tp_strtab_busybox_telnetd___info
1006ac68 r __tp_strtab_busybox_telnetd___session
1007b180 D __tracepoint_busybox_telnetd___err
1007b1c8 D __tracepoint_busybox_telnetd___info
1007b1a4 D __tracepoint_busybox_telnetd___session
1007c210 V tracepoint_dlopen
100155e8 t __tracepoint__init_urcu_sym
1007b250 S __tracepoint_provider_busybox_telnetd
1007b1f0 d __tracepoint_ptr_busybox_telnetd___err
1007b1f4 d __tracepoint_ptr_busybox_telnetd___info
1007b1ec d __tracepoint_ptr_busybox_telnetd___session
1007b248 V __tracepoint_ptrs_registered
1007b24c V __tracepoint_registered
10015708 t __tracepoints__destroy
10016ba4 t __tracepoints__destroy
10015684 t __tracepoints__init
10016ac4 t __tracepoints__init
10015868 t __tracepoints__ptrs_destroy
100157a0 t __tracepoints__ptrs_init


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


--- a/package/utils/busybox/Makefile
+++ b/package/utils/busybox/Makefile
@@ -46,7 +46,7 @@ define Package/busybox
   MAINTAINER:=Nicolas Thill <[email protected]>
   TITLE:=Core utilities for embedded Linux
   URL:=http://busybox.net/
-  DEPENDS:=+BUSYBOX_CONFIG_FEATURE_HAVE_RPC:librpc
+  DEPENDS:=+BUSYBOX_CONFIG_FEATURE_HAVE_RPC:librpc +lttng-ust
   MENU:=1
 endef
 
@@ -76,12 +76,18 @@ ifdef CONFIG_GCC_VERSION_LLVM
 endif
 
 LDLIBS:=m crypt
+
 ifdef CONFIG_BUSYBOX_CONFIG_FEATURE_HAVE_RPC
   TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
   export LDFLAGS=$(TARGET_LDFLAGS)
   LDLIBS += rpc
 endif
 
+ifdef CONFIG_PACKAGE_lttng-ust
+  TARGET_CFLAGS += -I.
+  LDLIBS += lttng-ust dl
+endif
+
 define Build/Compile
 	+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
 		CC="$(TARGET_CC)" \
# 
# Copyright (C) 2006-2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=busybox
PKG_VERSION:=1.19.4
PKG_RELEASE:=7
PKG_FLAGS:=essential

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://www.busybox.net/downloads \
                http://distfiles.gentoo.org/distfiles/
PKG_MD5SUM:=9c0cae5a0379228e7b55e5b29528df8e

PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_FEATURE_HAVE_RPC:librpc
PKG_BUILD_PARALLEL:=1

PKG_LICENSE:=GPLv2 BSD-4c
PKG_LICENSE_FILES:=LICENSE archival/libarchive/bz/LICENSE

include $(INCLUDE_DIR)/package.mk

ifeq ($(DUMP),)
  STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) grep 
'^CONFIG_BUSYBOX_' $(TOPDIR)/.config | md5s)
endif

ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
  BB_MAKE_VERBOSE := V=1
else
  BB_MAKE_VERBOSE :=
endif

init-y :=
init-$(CONFIG_BUSYBOX_CONFIG_CROND) += cron
init-$(CONFIG_BUSYBOX_CONFIG_NTPD) += sysntpd
init-$(CONFIG_BUSYBOX_CONFIG_TELNETD) += telnet

define Package/busybox
  SECTION:=base
  CATEGORY:=Base system
  MAINTAINER:=Nicolas Thill <[email protected]>
  TITLE:=Core utilities for embedded Linux
  URL:=http://busybox.net/
  DEPENDS:=+BUSYBOX_CONFIG_FEATURE_HAVE_RPC:librpc +lttng-ust
  MENU:=1
endef

define Package/busybox/description
 The Swiss Army Knife of embedded Linux.
 It slices, it dices, it makes Julian Fries.
endef

define Package/busybox/config
        source "$(SOURCE)/Config.in"
endef

define Build/Configure
        rm -f $(PKG_BUILD_DIR)/.configured*
        grep 'CONFIG_BUSYBOX_' $(TOPDIR)/.config | sed -e "s,\\(# 
\)\\?CONFIG_BUSYBOX_\\(.*\\),\\1\\2,g" > $(PKG_BUILD_DIR)/.config
        yes 'n' | $(MAKE) -C $(PKG_BUILD_DIR) \
                CC="$(TARGET_CC)" \
                CROSS_COMPILE="$(TARGET_CROSS)" \
                KBUILD_HAVE_NLS=no \
                ARCH="$(ARCH)" \
                $(BB_MAKE_VERBOSE) \
                oldconfig
endef

ifdef CONFIG_GCC_VERSION_LLVM
  TARGET_CFLAGS += -fnested-functions
endif

LDLIBS:=m crypt

ifdef CONFIG_BUSYBOX_CONFIG_FEATURE_HAVE_RPC
  TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
  export LDFLAGS=$(TARGET_LDFLAGS)
  LDLIBS += rpc
endif

ifdef CONFIG_PACKAGE_lttng-ust
  TARGET_CFLAGS += -I.
  LDLIBS += lttng-ust dl
endif

define Build/Compile
        +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
                CC="$(TARGET_CC)" \
                CROSS_COMPILE="$(TARGET_CROSS)" \
                KBUILD_HAVE_NLS=no \
                EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
                ARCH="$(ARCH)" \
                SKIP_STRIP=y \
                LDLIBS="$(LDLIBS)" \
                $(BB_MAKE_VERBOSE) \
                all
        rm -rf $(PKG_INSTALL_DIR)
        $(FIND) $(PKG_BUILD_DIR) -lname "*busybox" -exec rm \{\} \;
        $(MAKE) -C $(PKG_BUILD_DIR) \
                CC="$(TARGET_CC)" \
                CROSS_COMPILE="$(TARGET_CROSS)" \
                EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
                ARCH="$(ARCH)" \
                CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
                LDLIBS="$(LDLIBS)" \
                $(BB_MAKE_VERBOSE) \
                install
endef

define Package/busybox/install
        $(INSTALL_DIR) $(1)/etc/init.d
        $(CP) $(PKG_INSTALL_DIR)/* $(1)/
        for tmp in $(init-y); do \
                $(INSTALL_BIN) ./files/$$$$tmp $(1)/etc/init.d/$$$$tmp; \
        done
        -rm -rf $(1)/lib64
endef

$(eval $(call BuildPackage,busybox))
--- a/networking/Kbuild.src
+++ b/networking/Kbuild.src
@@ -36,7 +36,7 @@
 lib-$(CONFIG_SLATTACH)     += slattach.o
 lib-$(CONFIG_TC)           += tc.o
 lib-$(CONFIG_TELNET)       += telnet.o
-lib-$(CONFIG_TELNETD)      += telnetd.o
+lib-$(CONFIG_TELNETD)      += telnetd.o telnetd_lttng_events.o
 lib-$(CONFIG_TFTP)         += tftp.o
 lib-$(CONFIG_TFTPD)        += tftp.o
 lib-$(CONFIG_TRACEROUTE)   += traceroute.o

--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -45,6 +45,8 @@
 #include "libbb.h"
 #include <syslog.h>
+#define TRACEPOINT_DEFINE
+#include "telnetd_lttng_events.h"
 
 #if DEBUG
 # define TELCMDS

@@ -68,6 +70,10 @@
 #define TS_BUF2(ts) (((unsigned char*)(ts + 1)) + BUFSIZE)
 	int rdidx1, wridx1, size1;
 	int rdidx2, wridx2, size2;
+        struct {
+           char *client;
+           char *server;
+        } tp;
 };
 
 /* Two buffers are directly after tsession in malloced memory.
@@ -252,6 +258,11 @@
 	char tty_name[GETPTY_BUFSIZE];
 	struct tsession *ts = xzalloc(sizeof(struct tsession) + BUFSIZE * 2);
 
+        if (!ts) {
+            tracepoint(busybox_telnetd, err, "xzalloc", "struct tsession", errno);
+            return 0; 
+        }
+
 	/*ts->buf1 = (char *)(ts + 1);*/
 	/*ts->buf2 = ts->buf1 + BUFSIZE;*/
 
@@ -317,6 +328,7 @@
 		close(fd);
 		/* sock will be closed by caller */
 		bb_perror_msg("vfork");
+                tracepoint(busybox_telnetd, err, "vfork", "session", errno);
 		return NULL;
 	}
 	if (pid > 0) {
@@ -344,7 +356,22 @@
 		write_new_utmp(pid, LOGIN_PROCESS, tty_name, /*username:*/ "LOGIN", hostname);
 		free(hostname);
 	}
-
+        
+        //if (tracepoint_enabled(busybox_telnetd, session))
+        if (1)
+        {        
+            len_and_sockaddr *client_lsa = get_peer_lsa(sock);
+            len_and_sockaddr *server_lsa = get_sock_lsa(sock);
+            if (client_lsa) {
+                ts->tp.client = xmalloc_sockaddr2dotted(&client_lsa->u.sa);
+                free(client_lsa);
+            }
+            if (server_lsa) {
+                ts->tp.server = xmalloc_sockaddr2dotted(&server_lsa->u.sa);
+                free(server_lsa);
+            }
+            tracepoint(busybox_telnetd, session, "new", ts->tp.client, ts->tp.server, pid);
+        }
 	/* Make new session and process group */
 	setsid();

@@ -384,6 +411,7 @@
 	 * fd has CLOEXEC set on it too. These two fds will be closed here.
 	 */
 	BB_EXECVP(G.loginpath, (char **)login_argv);
+        tracepoint(busybox_telnetd, err, "execv", G.loginpath, errno);
 	/* _exit is safer with vfork, and we shouldn't send message
 	 * to remote clients anyway */
 	_exit(EXIT_FAILURE); /*bb_perror_msg_and_die("execv %s", G.loginpath);*/
@@ -421,6 +449,8 @@
 	/* We do not need to close(ts->sockfd_write), it's the same
 	 * as sockfd_read unless we are in inetd mode. But in inetd mode
 	 * we do not reach this */
+        if (ts->tp.client) free(ts->tp.client);
+        if (ts->tp.server) free(ts->tp.server);
 	free(ts);
 
 	/* Scan all sessions and find new maxfd */
@@ -462,6 +492,7 @@
 		while (ts) {
 			if (ts->shell_pid == pid) {
 				ts->shell_pid = -1;
+                                tracepoint(busybox_telnetd, session, "dead", ts->tp.client, ts->tp.server, pid);
 // man utmp:
 // When init(8) finds that a process has exited, it locates its utmp entry
 // by ut_pid, sets ut_type to DEAD_PROCESS, and clears ut_user, ut_host
@@ -501,6 +532,8 @@
 #endif
 	INIT_G();
 
+        tracepoint(busybox_telnetd, info, "Start");
+
 	/* -w NUM, and implies -F. -w and -i don't mix */
 	IF_FEATURE_TELNETD_INETD_WAIT(opt_complementary = "wF:w+:i--w:w--i";)
 	/* Even if !STANDALONE, we accept (and ignore) -i, thus people
@@ -513,6 +546,7 @@
 			IF_FEATURE_TELNETD_INETD_WAIT(, &sec_linger)
 	);
 	if (!IS_INETD /*&& !re_execed*/) {
+                tracepoint(busybox_telnetd, info, "Standalone mode enabled");
 		/* inform that we start in standalone mode?
 		 * May be useful when people forget to give -i */
 		/*bb_error_msg("listening for connections");*/
@@ -524,6 +558,7 @@
 	}
 	/* Redirect log to syslog early, if needed */
 	if (IS_INETD || (opt & OPT_SYSLOG) || !(opt & OPT_FOREGROUND)) {
+                tracepoint(busybox_telnetd, info, "Syslog redirection enabled");
 		openlog(applet_name, LOG_PID, LOG_DAEMON);
 		logmode = LOGMODE_SYSLOG;
 	}

--- a/dev/null
+++ b/networking/telnetd_lttng_events.h
@@ -0,0 +1,59 @@
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER busybox_telnetd
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "networking/telnetd_lttng_events.h"
+
+#if !defined(_TELNETD_EVENTS_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define _TELNETD_EVENTS_H
+#include <lttng/tracepoint.h> 
+
+//TRACEPOINT_FORMAT(busybox_telnetd, info, "TELNETD.1 Info") 
+TRACEPOINT_EVENT(
+    busybox_telnetd,
+    info,
+    TP_ARGS(
+        char *, msg_arg
+    ),
+    TP_FIELDS(
+        ctf_string(msg, msg_arg)
+    )
+)
+
+//TRACEPOINT_FORMAT(busybox_telnetd, err, "TELNETD.2 Err") 
+TRACEPOINT_EVENT(
+    busybox_telnetd,
+    err,
+    TP_ARGS(
+        char *, call_arg,
+        char *, msg_arg,
+        int, errno_arg
+    ),
+    TP_FIELDS(
+        ctf_string(call, call_arg)
+        ctf_string(msg, msg_arg)
+        ctf_integer(int, errno_val, errno_arg)
+    )
+)
+
+//TRACEPOINT_FORMAT(busybox_telnetd, session, "TELNETD.3 Session") 
+TRACEPOINT_EVENT(
+    busybox_telnetd,
+    session,
+    TP_ARGS(
+        char *, msg_arg,
+        char *, client_arg,
+        char *, server_arg,
+        pid_t,  pid_arg
+    ),
+    TP_FIELDS(
+        ctf_string(msg, msg_arg)
+        ctf_string(client, client_arg)
+        ctf_string(server, server_arg)
+        ctf_integer(pid_t, session_pid, pid_arg)
+    )
+)
+
+#endif
+
+#include <lttng/tracepoint-event.h>

--- a/dev/null
+++ b/networking/telnetd_lttng_events.c
@@ -0,0 +1,2 @@
+#define TRACEPOINT_CREATE_PROBES
+#include "telnetd_lttng_events.h"

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to