From 75ec723f1dcb6e76b481e64f01d72a43df39b276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Tue, 8 Dec 2009 10:17:45 +0000 Subject: OTP-5037 Document debug support. Debug trace output for connection activity could be enabled setting the trace level as an integer to the EI_TRACELEVEL environment variable. This option could also be read and set from a running program using ei_get_tracelevel(void) and ei_set_tracelevel(int). --- lib/erl_interface/doc/src/ei_connect.xml | 21 +++++++++++++++++++++ lib/erl_interface/include/ei.h | 6 ++++++ lib/erl_interface/src/connect/ei_connect.c | 22 +++++++++++++++++++--- 3 files changed, 46 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/erl_interface/doc/src/ei_connect.xml b/lib/erl_interface/doc/src/ei_connect.xml index 08e7b122c6..abf705f9e2 100644 --- a/lib/erl_interface/doc/src/ei_connect.xml +++ b/lib/erl_interface/doc/src/ei_connect.xml @@ -619,6 +619,16 @@ typedef struct {

These are convenience functions for some common name lookup functions.

+ + intei_get_tracelevel(void) + voidei_set_tracelevel(int level) + Get and set functions for tracing. + +

These functions are used to set tracing on the distribution. The levels are different verbosity levels. A higher level means more information. + See also Debug Information and below.

+

and are not thread safe.

+
+
@@ -634,6 +644,17 @@ typedef struct { the environment variable is set correctly. +

The connection attempt can be traced by setting a tracelevel by either using + or by setting the environment variable . + The different tracelevels has the following messages:

+ + 1: Verbose error messages + 2: Above messages and verbose warning messages + 3: Above messages and progress reports for connection handling + 4: Above messages and progress reports for communication + 5: Above messages and progress reports for data conversion +
+ diff --git a/lib/erl_interface/include/ei.h b/lib/erl_interface/include/ei.h index 01272244e1..d1a697615a 100644 --- a/lib/erl_interface/include/ei.h +++ b/lib/erl_interface/include/ei.h @@ -339,7 +339,13 @@ const char *ei_thisalivename(const ei_cnode* ec); erlang_pid *ei_self(ei_cnode* ec); +/* + * settings + */ + void ei_set_compat_rel(unsigned rel); +void ei_set_tracelevel(int); +int ei_get_tracelevel(void); /* * We have erl_gethost*() so we include ei versions as well. diff --git a/lib/erl_interface/src/connect/ei_connect.c b/lib/erl_interface/src/connect/ei_connect.c index 9ac5a93c5a..265e133158 100644 --- a/lib/erl_interface/src/connect/ei_connect.c +++ b/lib/erl_interface/src/connect/ei_connect.c @@ -97,7 +97,11 @@ #include "ei_epmd.h" #include "ei_internal.h" +#ifdef _REENTRANT + +#else int ei_tracelevel = 0; +#endif #define COOKIE_FILE "/.erlang.cookie" #define EI_MAX_HOME_PATH 1024 @@ -249,8 +253,22 @@ ei_cnode *ei_fd_to_cnode(int fd) return &sockinfo->cnode; } + +/*************************************************************************** + * Get/Set tracelevel + ***************************************************************************/ + +void ei_set_tracelevel(int level) { + ei_tracelevel = level; +} + +int ei_get_tracelevel(void) { + return ei_tracelevel; +} + + /*************************************************************************** - * XXXX + * Distversion ***************************************************************************/ int ei_distversion(int fd) @@ -1282,8 +1300,6 @@ error: return -1; } -/* FIXME fix the signed/unsigned mess..... */ - static int send_name_or_challenge(int fd, char *nodename, int f_chall, unsigned challenge, -- cgit v1.2.3