int *wait_fd;
uint64_t *memory_map_size;
} stream;
+ struct {
+ struct lttng_ust_field_iter entry;
+ } field_list;
};
struct lttng_ust_objd_ops {
int ustctl_tracepoint_list_get(int sock, int tp_list_handle,
struct lttng_ust_tracepoint_iter *iter);
+/*
+ * ustctl_tracepoint_field_list returns a tracepoint field list handle,
+ * or negative error value.
+ */
+int ustctl_tracepoint_field_list(int sock);
+
+/*
+ * ustctl_tracepoint_field_list_get is used to iterate on the tp field
+ * list handle. End is iteration is reached when -ENOENT is returned.
+ */
+int ustctl_tracepoint_field_list_get(int sock, int tp_field_list_handle,
+ struct lttng_ust_field_iter *iter);
+
int ustctl_tracer_version(int sock, struct lttng_ust_tracer_version *v);
int ustctl_wait_quiescent(int sock);
} u;
};
+/*
+ * LTTNG_UST_TRACEPOINT_FIELD_LIST reply is followed by a
+ * struct lttng_ust_field_iter field.
+ */
+
extern int ustcomm_create_unix_sock(const char *pathname);
extern int ustcomm_connect_unix_sock(const char *pathname);
extern int ustcomm_accept_unix_sock(int sock);
return 0;
}
+int ustctl_tracepoint_field_list(int sock)
+{
+ struct ustcomm_ust_msg lum;
+ struct ustcomm_ust_reply lur;
+ int ret, tp_field_list_handle;
+
+ memset(&lum, 0, sizeof(lum));
+ lum.handle = LTTNG_UST_ROOT_HANDLE;
+ lum.cmd = LTTNG_UST_TRACEPOINT_FIELD_LIST;
+ ret = ustcomm_send_app_cmd(sock, &lum, &lur);
+ if (ret)
+ return ret;
+ tp_field_list_handle = lur.ret_val;
+ DBG("received tracepoint field list handle %u", tp_field_list_handle);
+ return tp_field_list_handle;
+}
+
+int ustctl_tracepoint_field_list_get(int sock, int tp_field_list_handle,
+ struct lttng_ust_field_iter *iter)
+{
+ struct ustcomm_ust_msg lum;
+ struct ustcomm_ust_reply lur;
+ int ret;
+ ssize_t len;
+
+ if (!iter)
+ return -EINVAL;
+
+ memset(&lum, 0, sizeof(lum));
+ lum.handle = tp_field_list_handle;
+ lum.cmd = LTTNG_UST_TRACEPOINT_FIELD_LIST_GET;
+ ret = ustcomm_send_app_cmd(sock, &lum, &lur);
+ if (ret)
+ return ret;
+ len = ustcomm_recv_unix_sock(sock, iter, sizeof(*iter));
+ if (len != sizeof(*iter)) {
+ return -EINVAL;
+ }
+ DBG("received tracepoint field list entry event_name %s event_loglevel %d field_name %s field_type %d",
+ iter->event_name,
+ iter->loglevel,
+ iter->field_name,
+ iter->type);
+ return 0;
+}
+
int ustctl_tracer_version(int sock, struct lttng_ust_tracer_version *v)
{
struct ustcomm_ust_msg lum;
event_field->name,
LTTNG_UST_SYM_NAME_LEN);
list_entry->field.field_name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
+ switch (event_field->type.atype) {
+ case atype_integer:
+ list_entry->field.type = LTTNG_UST_FIELD_INTEGER;
+ break;
+ case atype_string:
+ list_entry->field.type = LTTNG_UST_FIELD_STRING;
+ break;
+ case atype_array:
+ if (event_field->type.u.array.elem_type.atype != atype_integer
+ || event_field->type.u.array.elem_type.u.basic.integer.encoding == lttng_encode_none)
+ list_entry->field.type = LTTNG_UST_FIELD_OTHER;
+ else
+ list_entry->field.type = LTTNG_UST_FIELD_STRING;
+ break;
+ case atype_sequence:
+ if (event_field->type.u.sequence.elem_type.atype != atype_integer
+ || event_field->type.u.sequence.elem_type.u.basic.integer.encoding == lttng_encode_none)
+ list_entry->field.type = LTTNG_UST_FIELD_OTHER;
+ else
+ list_entry->field.type = LTTNG_UST_FIELD_STRING;
+ break;
+ case atype_float:
+ list_entry->field.type = LTTNG_UST_FIELD_FLOAT;
+ break;
+ case atype_enum:
+ list_entry->field.type = LTTNG_UST_FIELD_ENUM;
+ break;
+ default:
+ list_entry->field.type = LTTNG_UST_FIELD_OTHER;
+ }
if (!event_desc->loglevel) {
list_entry->field.loglevel = TRACE_DEFAULT;
} else {
unsigned long arg, union ust_args *uargs)
{
struct lttng_ust_field_list *list = objd_private(objd);
- struct lttng_ust_field_iter *tp =
- (struct lttng_ust_field_iter *) arg;
+ struct lttng_ust_field_iter *tp = &uargs->field_list.entry;
struct lttng_ust_field_iter *iter;
switch (cmd) {
struct ustcomm_ust_reply lur;
int shm_fd, wait_fd;
union ust_args args;
+ ssize_t len;
ust_lock();
goto error;
}
}
+ /*
+ * LTTNG_UST_TRACEPOINT_FIELD_LIST_GET needs to send the field
+ * after the reply.
+ */
+ if (lur.ret_code == USTCOMM_OK) {
+ switch (lum->cmd) {
+ case LTTNG_UST_TRACEPOINT_FIELD_LIST_GET:
+ len = ustcomm_send_unix_sock(sock,
+ &args.field_list.entry,
+ sizeof(args.field_list.entry));
+ if (len != sizeof(args.field_list.entry)) {
+ ret = -1;
+ goto error;
+ }
+ }
+ }
/*
* We still have the memory map reference, and the fds have been
* sent to the sessiond. We can therefore close those fds. Note