projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Check for num cpus
[lttng-ust.git]
/
libust
/
ltt-context.c
diff --git
a/libust/ltt-context.c
b/libust/ltt-context.c
index 634694b968d4c06f6cf5066b684c80efc10d68d9..83aa297592929d9d900cb52940fd25974e62ae03 100644
(file)
--- a/
libust/ltt-context.c
+++ b/
libust/ltt-context.c
@@
-8,21
+8,21
@@
* Dual LGPL v2.1/GPL v2 license.
*/
* Dual LGPL v2.1/GPL v2 license.
*/
-#include <linux/module.h>
-#include <linux/list.h>
-#include <linux/mutex.h>
-#include <linux/slab.h>
-#include "wrapper/vmalloc.h" /* for wrapper_vmalloc_sync_all() */
-#include "ltt-events.h"
-#include "ltt-tracer.h"
+#include <ust/lttng-events.h>
+#include <ust/core.h>
+#include <string.h>
+#include <ust/usterr-signal-safe.h>
+/*
+ * Note: as we append context information, the pointer location may change.
+ */
struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx_p)
{
struct lttng_ctx_field *field;
struct lttng_ctx *ctx;
if (!*ctx_p) {
struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx_p)
{
struct lttng_ctx_field *field;
struct lttng_ctx *ctx;
if (!*ctx_p) {
- *ctx_p =
kzalloc(sizeof(struct lttng_ctx), GFP_KERNEL
);
+ *ctx_p =
zmalloc(sizeof(struct lttng_ctx)
);
if (!*ctx_p)
return NULL;
}
if (!*ctx_p)
return NULL;
}
@@
-31,20
+31,22
@@
struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx_p)
struct lttng_ctx_field *new_fields;
ctx->allocated_fields = max_t(size_t, 1, 2 * ctx->allocated_fields);
struct lttng_ctx_field *new_fields;
ctx->allocated_fields = max_t(size_t, 1, 2 * ctx->allocated_fields);
- new_fields =
kzalloc(ctx->allocated_fields * sizeof(struct lttng_ctx_field), GFP_KERNEL
);
+ new_fields =
zmalloc(ctx->allocated_fields * sizeof(struct lttng_ctx_field)
);
if (!new_fields)
return NULL;
if (ctx->fields)
memcpy(new_fields, ctx->fields, sizeof(*ctx->fields) * ctx->nr_fields);
if (!new_fields)
return NULL;
if (ctx->fields)
memcpy(new_fields, ctx->fields, sizeof(*ctx->fields) * ctx->nr_fields);
-
k
free(ctx->fields);
+ free(ctx->fields);
ctx->fields = new_fields;
}
field = &ctx->fields[ctx->nr_fields];
ctx->nr_fields++;
return field;
}
ctx->fields = new_fields;
}
field = &ctx->fields[ctx->nr_fields];
ctx->nr_fields++;
return field;
}
-EXPORT_SYMBOL_GPL(lttng_append_context);
+/*
+ * Remove last context field.
+ */
void lttng_remove_context_field(struct lttng_ctx **ctx_p,
struct lttng_ctx_field *field)
{
void lttng_remove_context_field(struct lttng_ctx **ctx_p,
struct lttng_ctx_field *field)
{
@@
-52,9
+54,9
@@
void lttng_remove_context_field(struct lttng_ctx **ctx_p,
ctx = *ctx_p;
ctx->nr_fields--;
ctx = *ctx_p;
ctx->nr_fields--;
+ WARN_ON_ONCE(&ctx->fields[ctx->nr_fields] != field);
memset(&ctx->fields[ctx->nr_fields], 0, sizeof(struct lttng_ctx_field));
}
memset(&ctx->fields[ctx->nr_fields], 0, sizeof(struct lttng_ctx_field));
}
-EXPORT_SYMBOL_GPL(lttng_remove_context_field);
void lttng_destroy_context(struct lttng_ctx *ctx)
{
void lttng_destroy_context(struct lttng_ctx *ctx)
{
@@
-66,6
+68,6
@@
void lttng_destroy_context(struct lttng_ctx *ctx)
if (ctx->fields[i].destroy)
ctx->fields[i].destroy(&ctx->fields[i]);
}
if (ctx->fields[i].destroy)
ctx->fields[i].destroy(&ctx->fields[i]);
}
-
k
free(ctx->fields);
-
k
free(ctx);
+ free(ctx->fields);
+ free(ctx);
}
}
This page took
0.025562 seconds
and
4
git commands to generate.