Control timeout of socket connection, receive and send. Takes an integer
parameter: the timeout value, in milliseconds. A value of 0 or -1 uses
the timeout of the operating system (this is the default).
+.IP "LTTNG_SESSION_CONFIG_XSD_PATH"
+Specify the path that contains the XML session configuration schema (xsd).
.SH "SEE ALSO"
.PP
memset(ctx, 0, sizeof(struct session_config_validation_ctx));
}
+static
+char *get_session_config_xsd_path()
+{
+ char *xsd_path;
+ const char *base_path = getenv(DEFAULT_SESSION_CONFIG_XSD_PATH_ENV);
+ size_t base_path_len;
+ size_t max_path_len;
+
+ if (!base_path) {
+ base_path = DEFAULT_SESSION_CONFIG_XSD_PATH;
+ }
+
+ base_path_len = strlen(base_path);
+ max_path_len = base_path_len +
+ sizeof(DEFAULT_SESSION_CONFIG_XSD_FILENAME) + 1;
+ xsd_path = zmalloc(max_path_len);
+ if (!xsd_path) {
+ goto end;
+ }
+
+ strncpy(xsd_path, base_path, max_path_len);
+ if (xsd_path[base_path_len - 1] != '/') {
+ xsd_path[base_path_len++] = '/';
+ }
+
+ strncpy(xsd_path + base_path_len, DEFAULT_SESSION_CONFIG_XSD_FILENAME,
+ max_path_len - base_path_len);
+end:
+ return xsd_path;
+}
+
static
int init_session_config_validation_ctx(
struct session_config_validation_ctx *ctx)
{
int ret;
+ char *xsd_path = get_session_config_xsd_path();
+
+ if (!xsd_path) {
+ ret = -LTTNG_ERR_NOMEM;
+ goto end;
+ }
- ctx->parser_ctx = xmlSchemaNewParserCtxt(DEFAULT_SESSION_CONFIG_XSD_PATH);
+ ctx->parser_ctx = xmlSchemaNewParserCtxt(xsd_path);
if (!ctx->parser_ctx) {
ERR("XSD parser context creation failed");
ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
fini_session_config_validation_ctx(ctx);
}
+ free(xsd_path);
return ret;
}
#define DEFAULT_SESSION_SYSTEM_CONFIGPATH DEFAULT_SYSTEM_CONFIGPATH "/" \
DEFAULT_SESSION_PATH
#define DEFAULT_SESSION_CONFIG_FILE_EXTENSION ".lttng"
-#define DEFAULT_SESSION_CONFIG_XSD_PATH CONFIG_LTTNG_SYSTEM_DATADIR \
- "/xml/lttng/session.xsd"
-
+#define DEFAULT_SESSION_CONFIG_XSD_FILENAME "session.xsd"
+#define DEFAULT_SESSION_CONFIG_XSD_PATH CONFIG_LTTNG_SYSTEM_DATADIR "/xml/lttng/"
+#define DEFAULT_SESSION_CONFIG_XSD_PATH_ENV "LTTNG_SESSION_CONFIG_XSD_PATH"
#define DEFAULT_GLOBAL_APPS_UNIX_SOCK \
DEFAULT_LTTNG_RUNDIR "/" LTTNG_UST_SOCK_FILENAME