X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fjul.h;h=f7d3c48f8d078afd83eb4f015c3d6cb8ad3e3c72;hp=1f7f6cdcd8e0a176e31095526882c20f51fc528d;hb=f20baf8e44b5d8a1c90b8b029b876762f6f916a6;hpb=4d0762229f4950d4ad21f6f47870d3b767dd61fa diff --git a/src/bin/lttng-sessiond/jul.h b/src/bin/lttng-sessiond/jul.h index 1f7f6cdcd..f7d3c48f8 100644 --- a/src/bin/lttng-sessiond/jul.h +++ b/src/bin/lttng-sessiond/jul.h @@ -18,9 +18,53 @@ #ifndef _JUL_H #define _JUL_H +#define _GNU_SOURCE +#include + #include #include +/* + * Hash table that contains the JUL app created upon registration indexed by + * socket. + */ +struct lttng_ht *jul_apps_ht_by_sock; + +/* + * Registration message payload from a JUL application. The PID is used to find + * back the corresponding UST app object so both socket can be linked. + */ +struct jul_register_msg { + uint32_t pid; +}; + +/* + * JUL application object created after a successful registration. This object + * is kept inside an UST app. + */ +struct jul_app { + /* + * PID sent during registration of a JUL application. + */ + pid_t pid; + + /* + * JUL TCP socket that was created upon registration. + */ + struct lttcomm_sock *sock; + + /* + * Associated UST app. socket. To get a reference to the ust application + * object corresponding to that socket, a lookup MUST be done each time + * since there is important synchronization issue for the lockless hash + * table shared accross multiple threads. + */ + int ust_app_sock; + + /* Initialized with the JUL sock value. */ + struct lttng_ht_node_ulong node; +}; + /* * Java Util Logging event representation. */ @@ -53,12 +97,32 @@ struct jul_domain { struct lttng_ht *events; }; +/* Initialize JUL domain subsystem. */ +int jul_init(void); + +/* Initialize an already allocated JUL domain. */ int jul_init_domain(struct jul_domain *dom); +void jul_destroy_domain(struct jul_domain *dom); + +/* JUL event API. */ struct jul_event *jul_create_event(const char *name); void jul_add_event(struct jul_event *event, struct jul_domain *dom); struct jul_event *jul_find_by_name(const char *name, struct jul_domain *dom); void jul_delete_event(struct jul_event *event, struct jul_domain *dom); void jul_destroy_event(struct jul_event *event); -void jul_destroy_domain(struct jul_domain *dom); + +/* JUL app API. */ +struct jul_app *jul_create_app(pid_t pid, struct lttcomm_sock *sock); +void jul_add_app(struct jul_app *app); +void jul_delete_app(struct jul_app *app); +struct jul_app *jul_find_app_by_sock(int sock); +void jul_attach_app(struct jul_app *japp); +void jul_detach_app(struct jul_app *app); +void jul_destroy_app(struct jul_app *app); + +/* JUL action API */ +int jul_enable_event(struct jul_event *event); +int jul_disable_event(struct jul_event *event); +void jul_update(struct jul_domain *domain, int sock); #endif /* _JUL_H */