projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement --shm-path option for UST sessions (per-uid channels)
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
buffer-registry.c
diff --git
a/src/bin/lttng-sessiond/buffer-registry.c
b/src/bin/lttng-sessiond/buffer-registry.c
index 93da2f12253270c54856bc9fe303ff392141d260..b96e585001c9bf7f420b0aac1ce274329550ce7c 100644
(file)
--- a/
src/bin/lttng-sessiond/buffer-registry.c
+++ b/
src/bin/lttng-sessiond/buffer-registry.c
@@
-16,6
+16,7
@@
*/
#define _GNU_SOURCE
*/
#define _GNU_SOURCE
+#define _LGPL_SOURCE
#include <inttypes.h>
#include <common/common.h>
#include <inttypes.h>
#include <common/common.h>
@@
-105,7
+106,8
@@
void buffer_reg_init_uid_registry(void)
* Return 0 on success else a negative value and regp is untouched.
*/
int buffer_reg_uid_create(uint64_t session_id, uint32_t bits_per_long, uid_t uid,
* Return 0 on success else a negative value and regp is untouched.
*/
int buffer_reg_uid_create(uint64_t session_id, uint32_t bits_per_long, uid_t uid,
- enum lttng_domain_type domain, struct buffer_reg_uid **regp)
+ enum lttng_domain_type domain, struct buffer_reg_uid **regp,
+ const char *shm_path)
{
int ret = 0;
struct buffer_reg_uid *reg = NULL;
{
int ret = 0;
struct buffer_reg_uid *reg = NULL;
@@
-130,7
+132,12
@@
int buffer_reg_uid_create(uint64_t session_id, uint32_t bits_per_long, uid_t uid
reg->bits_per_long = bits_per_long;
reg->uid = uid;
reg->domain = domain;
reg->bits_per_long = bits_per_long;
reg->uid = uid;
reg->domain = domain;
-
+ if (shm_path[0]) {
+ strncpy(reg->shm_path, shm_path, sizeof(reg->shm_path));
+ reg->shm_path[sizeof(reg->shm_path) - 1] = '\0';
+ DBG3("shm path '%s' is assigned to uid buffer registry for session id %" PRIu64,
+ reg->shm_path, session_id);
+ }
reg->registry->channels = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
if (!reg->registry->channels) {
ret = -ENOMEM;
reg->registry->channels = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
if (!reg->registry->channels) {
ret = -ENOMEM;
@@
-225,7
+232,8
@@
void buffer_reg_init_pid_registry(void)
*
* Return 0 on success else a negative value and regp is untouched.
*/
*
* Return 0 on success else a negative value and regp is untouched.
*/
-int buffer_reg_pid_create(uint64_t session_id, struct buffer_reg_pid **regp)
+int buffer_reg_pid_create(uint64_t session_id, struct buffer_reg_pid **regp,
+ const char *shm_path)
{
int ret = 0;
struct buffer_reg_pid *reg = NULL;
{
int ret = 0;
struct buffer_reg_pid *reg = NULL;
@@
-248,7
+256,12
@@
int buffer_reg_pid_create(uint64_t session_id, struct buffer_reg_pid **regp)
/* A cast is done here so we can use the session ID as a u64 ht node. */
reg->session_id = session_id;
/* A cast is done here so we can use the session ID as a u64 ht node. */
reg->session_id = session_id;
-
+ if (shm_path[0]) {
+ strncpy(reg->shm_path, shm_path, sizeof(reg->shm_path));
+ reg->shm_path[sizeof(reg->shm_path) - 1] = '\0';
+ DBG3("shm path '%s' is assigned to pid buffer registry for session id %" PRIu64,
+ reg->shm_path, session_id);
+ }
reg->registry->channels = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
if (!reg->registry->channels) {
ret = -ENOMEM;
reg->registry->channels = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
if (!reg->registry->channels) {
ret = -ENOMEM;
@@
-377,6
+390,7
@@
void buffer_reg_stream_add(struct buffer_reg_stream *stream,
pthread_mutex_lock(&channel->stream_list_lock);
cds_list_add_tail(&stream->lnode, &channel->streams);
pthread_mutex_lock(&channel->stream_list_lock);
cds_list_add_tail(&stream->lnode, &channel->streams);
+ channel->stream_count++;
pthread_mutex_unlock(&channel->stream_list_lock);
}
pthread_mutex_unlock(&channel->stream_list_lock);
}
@@
-504,6
+518,7
@@
void buffer_reg_channel_destroy(struct buffer_reg_channel *regp,
/* Wipe stream */
cds_list_for_each_entry_safe(sreg, stmp, ®p->streams, lnode) {
cds_list_del(&sreg->lnode);
/* Wipe stream */
cds_list_for_each_entry_safe(sreg, stmp, ®p->streams, lnode) {
cds_list_del(&sreg->lnode);
+ regp->stream_count--;
buffer_reg_stream_destroy(sreg, domain);
}
buffer_reg_stream_destroy(sreg, domain);
}
This page took
0.02509 seconds
and
4
git commands to generate.