X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fcommon%2Frunas.c;h=849635c7f8fe9174676985ba8b0839da21d18c19;hb=b8e2fb80c105c5a8241f7b35744e4a86d7e4125c;hp=30bf4263aa3d55c365c99a2ff4e57ef61a7614ed;hpb=edf4b93e2f5c849cbec49e987990b3705ea49f6a;p=lttng-tools.git diff --git a/src/common/runas.c b/src/common/runas.c index 30bf4263a..849635c7f 100644 --- a/src/common/runas.c +++ b/src/common/runas.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -37,7 +38,6 @@ #include #include -#include #include "runas.h" @@ -124,7 +124,7 @@ struct run_as_extract_elf_symbol_offset_ret { struct run_as_extract_sdt_probe_offsets_ret { uint32_t num_offset; - uint64_t offsets[LTTNG_KERNEL_MAX_UPROBE_NUM]; + uint64_t offsets[LTTNG_KERNEL_ABI_MAX_UPROBE_NUM]; } LTTNG_PACKED; struct run_as_generate_filter_bytecode_ret { @@ -607,7 +607,7 @@ int _extract_sdt_probe_offsets(struct run_as_data *data, goto end; } - if (num_offset <= 0 || num_offset > LTTNG_KERNEL_MAX_UPROBE_NUM) { + if (num_offset <= 0 || num_offset > LTTNG_KERNEL_ABI_MAX_UPROBE_NUM) { DBG("Wrong number of probes."); ret = -1; ret_value->_error = true; @@ -1799,15 +1799,16 @@ error: LTTNG_HIDDEN int run_as_generate_filter_bytecode(const char *filter_expression, - uid_t uid, - gid_t gid, - struct lttng_filter_bytecode **bytecode) + const struct lttng_credentials *creds, + struct lttng_bytecode **bytecode) { int ret; struct run_as_data data = {}; struct run_as_ret run_as_ret = {}; - const struct lttng_filter_bytecode *view_bytecode = NULL; - struct lttng_filter_bytecode *local_bytecode = NULL; + const struct lttng_bytecode *view_bytecode = NULL; + struct lttng_bytecode *local_bytecode = NULL; + const uid_t uid = lttng_credentials_get_uid(creds); + const gid_t gid = lttng_credentials_get_gid(creds); DBG3("generate_filter_bytecode() from expression=\"%s\" for uid %d and gid %d", filter_expression, (int) uid, (int) gid); @@ -1825,7 +1826,7 @@ int run_as_generate_filter_bytecode(const char *filter_expression, goto error; } - view_bytecode = (const struct lttng_filter_bytecode *) run_as_ret.u.generate_filter_bytecode.bytecode; + view_bytecode = (const struct lttng_bytecode *) run_as_ret.u.generate_filter_bytecode.bytecode; local_bytecode = zmalloc(sizeof(*local_bytecode) + view_bytecode->len); if (!local_bytecode) {