Complete change of the source directory tree For the sake of clearness and awesomeness :P, this change was needed for better semantic across the code and better organization of source files. src/ --> Contains source files of the project bin/ --> Contains every binaries this git tree builds (lttng, lttng-sessiond and lttng-consumerd). lib/ --> Contains exported libraries (lttng-ctl). common/ --> Contains shared code for the entire project. (internal libraries mostly) Every internal headers are moved from include/ to src/common. The include directory only contains exported public headers now (lttng/lttng.h). The -I$(top_srcdir)/src is also added for all Makefiles. The consumerd APIs are not exported anymore. The reason is that the consumer will get completely re-engineered in the next months. It's our safety net for the APIs breakage of the coming year concerning the consumerd library. Renaming is done also on some internal libraries to follow the naming convention. The public library liblttngctl is renamed to liblttng-ctl making it linkable now with "-llttng-ctl" deprecating the old "-llttngctl". No code is changed with this commit except #include statements added/removed/renamed. This is why there is yet files and internal API calls that does not follow the naming convention (Ex: lttngerr.h, lttng-share.h in src/common). Signed-off-by: David Goulet <dgoulet@efficios.com>
Add and support the new hash table library liblttng-ht/ is the library introduced for hash table management. This library uses the URCU ht-shrink branch (not yet upstream) making the lib completely lockless. Import git head URCU hashtables at commit: 91a75cc579698814e47877cc8927fcae1f573739 Note that urcu hash table files are copied from the urcu git ree to this git tree waiting for them to be upstream and stable. Old hash table files are removed from libcommon. Signed-off-by: David Goulet <dgoulet@efficios.com>
UST consumer: implement missing ust-specific callbacks + fixes. Also fix consumer handling of poll fd: a mask should be used. Also fix UST stream output passed to the consumer (the fix is a hack currently, left a FIXME). Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add sem_wait timeout on the kconsumerd thread It's unlikely to happen but is the kconsumerd was not able to send us the sock ready command, at least the session daemon will not stall forever. A 30 seconds timeout is added and error is handle after that. Also adds the handling of the sem_init ret value and adds mutex lock around the kconsumerd pid in the same function. There was also a problem on error code handling where LTTCOMM error was returned by spawn kconsumerd function but handled as if it might be negative at the end of the call chain. This was preventing to return the right error code to the client when the kconsumerd failed. Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Add poll/epoll compat layer for session daemon This is a big modification of the session daemon code base. Every thread is monitoring file descriptors using a poll set. This commit adds a compat wrapper for the use of poll(2) or epoll(7) determined at compile time on if the epoll API is available. Since epoll(7) is Linux specific, the poll(2) fallback is necessary for portability. By default, epoll(7) will be used having the --enable-epoll default to yes. To use the poll(2) API, simply run with --disable-epoll when running configure. With this implementation, some fixes are also introduced. * Two missing notification to the consumer when the default channel is created. * Memory and socket file descriptor leak when connect()/close() is done by the daemon alive check of the lttngctl API. * Root check (UID=0) on cleanup() before removing LTTNG_RUNDIR. * Comments here and there. At this commit, tests were made on the CPU hot plug feature, multiple UST registration at the same time and git tree tests. All passed for poll(2) and epoll(7) implementation. Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Modify default kernel channel size/number Too small kernel channels (4kB) leads to unwelcome delay at trace indexing and adds buffer switch overhead. Use a default closer to the 0.x LTTng for buffer size: 256kB subbuffer 4 subbuffers/buffer for 1MB per channel per CPU in normal tracing mode, and 1MB + 256kB per channel per CPU in overwrite mode. We currently plan to still use 4kB * 8 sub-buffers for UST because we allocate these buffers per process, which makes memory consumption more of a concern. The metadata channel is kept small (4kB), but we keep a number of subbuffer of 8 for now, as the behavior between "start" and spawning the consumer is in the wrong order: we will need to spawn the consumer before start is performed, because "start" returns blocks for 10 seconds and returns an error if the buffers are too small to write metadata (and they are not consumed). Also fix a memory leak in init_default_channel. process_client_msg() now uses a check / alloc / failure for channel lookup rather than an endless retry, which could have led to denial of service in case of internal error. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
New public API for lttng control Introduce the lttng domain that is used to identify the tracer. Remove all 'kernel' from the functions name and now take the domain struct as first parameter. Add channel feature is removed and merged with enable-channel. Move kernel specific data structure from lttng.h to lttng-kernel.h which is copied from the LTTng kernel modules ABI. Genereic structures are used to create a generic view of lttng event and attributes (agnostif of the Kernel and user-space). Default channel is NOT created unless it is needed. A lot of comments has been added to lttng.h Fix a bug in the liblttngctl. A return value was not set correctly. Signed-off-by: David Goulet <david.goulet@polymtl.ca>