int lttctl_create_trace(const struct lttctl_handle *h,
- char *name, enum trace_mode mode)
+ char *name, enum trace_mode mode, unsigned subbuf_size, unsigned n_subbufs)
{
int err;
strncpy(req.msg.trace_name, name, NAME_MAX);
req.msg.op = OP_CREATE;
- req.msg.args.mode = mode;
+ req.msg.args.new_trace.mode = mode;
+ req.msg.args.new_trace.subbuf_size = subbuf_size;
+ req.msg.args.new_trace.n_subbufs = n_subbufs;
err = lttctl_netlink_sendto(h, (void *)&req, req.nlh.nlmsg_len);
if(err < 0) goto senderr;
lttctl_perror("Stop Trace Error");
return err;
}
+
+
+int lttctl_align(const struct lttctl_handle *h,
+ char *name, unsigned alignment)
+{
+ struct {
+ struct nlmsghdr nlh;
+ lttctl_peer_msg_t msg;
+ } req;
+ struct {
+ struct nlmsghdr nlh;
+ struct nlmsgerr nlerr;
+ lttctl_peer_msg_t msg;
+ } ack;
+ int err;
+
+ memset(&req, 0, sizeof(req));
+ req.nlh.nlmsg_len = NLMSG_LENGTH(sizeof(lttctl_peer_msg_t));
+ req.nlh.nlmsg_flags = NLM_F_REQUEST;
+ req.nlh.nlmsg_type = LTTCTLM_CONTROL;
+ req.nlh.nlmsg_pid = h->local.nl_pid;
+
+ strncpy(req.msg.trace_name, name, NAME_MAX);
+ req.msg.op = OP_ALIGN;
+ req.msg.args.alignment = alignment;
+
+ err = lttctl_netlink_sendto(h, (void *)&req, req.nlh.nlmsg_len);
+ if(err < 0) goto senderr;
+
+ err = lttctl_netlink_recvfrom(h, (void*)&ack, sizeof(ack), 0);
+ if(err < 0) goto senderr;
+
+ err = ack.nlerr.error;
+ if(err != 0) {
+ errno = err;
+ lttctl_perror("Align Trace Error");
+ return -1;
+ }
+
+ return 0;
+
+senderr:
+ lttctl_perror("Align Trace Error");
+ return err;
+}
OP_DESTROY,
OP_START,
OP_STOP,
+ OP_ALIGN,
OP_NONE
};
LTT_TRACE_FLIGHT
};
+typedef struct lttctl_peer_msg {
+ char trace_name[NAME_MAX];
+ enum trace_op op;
+ union {
+ struct {
+ enum trace_mode mode;
+ unsigned subbuf_size;
+ unsigned n_subbufs;
+ } new_trace;
+ unsigned alignment;
+ } args;
+} lttctl_peer_msg_t;
+
struct lttctl_handle
{
struct sockaddr_nl peer;
};
-typedef struct lttctl_peer_msg {
- char trace_name[NAME_MAX];
- enum trace_op op;
- union {
- enum trace_mode mode;
- } args;
-} lttctl_peer_msg_t;
-
typedef struct lttctl_resp_msg {
int err;
} lttctl_resp_msg_t;
int lttctl_destroy_handle(struct lttctl_handle *h);
-int lttctl_create_trace(const struct lttctl_handle * handle,
- char *name, enum trace_mode mode);
+int lttctl_create_trace(const struct lttctl_handle *h,
+ char *name, enum trace_mode mode, unsigned subbuf_size, unsigned n_subbufs);
int lttctl_destroy_trace(const struct lttctl_handle *handle, char *name);