create directories branches, tags, trunk
[lttv.git] / ltt-control / liblttctl / liblttctl.c
index d6f411b921d65c841c3e0faaa49a0b064fb62999..61bca62e769e5f0a316e8cb550820acd0c09a415 100644 (file)
@@ -18,7 +18,7 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.        See the
  * GNU General Public License for more details.
  *     
  */
@@ -57,7 +57,7 @@ enum {
        LTTCTL_ERR_SUPP,
        LTTCTL_ERR_RECVBUF,
        LTTCTL_ERR_TIMEOUT,
-        LTTCTL_ERR_PROTOCOL
+                               LTTCTL_ERR_PROTOCOL
 };
 #define LTTCTL_MAXERR LTTCTL_ERR_PROTOCOL
 
@@ -89,25 +89,25 @@ static int lttctl_errno = LTTCTL_ERR_NONE;
 
 
 static ssize_t lttctl_netlink_sendto(const struct lttctl_handle *h,
-                                  const void *msg, size_t len);
+                                                                                                                                       const void *msg, size_t len);
 
 static ssize_t lttctl_netlink_recvfrom(const struct lttctl_handle *h,
-                                    unsigned char *buf, size_t len,
-                                    int timeout);
+                                                                                                                                               unsigned char *buf, size_t len,
+                                                                                                                                               int timeout);
 
 static ssize_t lttctl_netlink_sendmsg(const struct lttctl_handle *h,
-                                   const struct msghdr *msg,
-                                   unsigned int flags);
+                                                                                                                                        const struct msghdr *msg,
+                                                                                                                                        unsigned int flags);
 
 static char *lttctl_strerror(int errcode);
 
 void lttctl_perror(const char *s);
 
 static ssize_t lttctl_netlink_sendto(const struct lttctl_handle *h,
-                                  const void *msg, size_t len)
+                                                                                                                                       const void *msg, size_t len)
 {
        int status = sendto(h->fd, msg, len, 0,
-                           (struct sockaddr *)&h->peer, sizeof(h->peer));
+                       (struct sockaddr *)&h->peer, sizeof(h->peer));
        if (status < 0)
                lttctl_errno = LTTCTL_ERR_SEND;
        
@@ -115,8 +115,8 @@ static ssize_t lttctl_netlink_sendto(const struct lttctl_handle *h,
 }
 
 static ssize_t lttctl_netlink_sendmsg(const struct lttctl_handle *h,
-                                   const struct msghdr *msg,
-                                   unsigned int flags)
+                                                                                                                                        const struct msghdr *msg,
+                                                                                                                                        unsigned int flags)
 {
        int status = sendmsg(h->fd, msg, flags);
        if (status < 0)
@@ -125,8 +125,8 @@ static ssize_t lttctl_netlink_sendmsg(const struct lttctl_handle *h,
 }
 
 static ssize_t lttctl_netlink_recvfrom(const struct lttctl_handle *h,
-                                    unsigned char *buf, size_t len,
-                                    int timeout)
+                                                                                                                                               unsigned char *buf, size_t len,
+                                                                                                                                               int timeout)
 {
        int addrlen, status;
        struct nlmsghdr *nlh;
@@ -172,7 +172,7 @@ static ssize_t lttctl_netlink_recvfrom(const struct lttctl_handle *h,
                }
        }
        status = recvfrom(h->fd, buf, len, 0,
-                             (struct sockaddr *)&h->peer, &addrlen);
+                       (struct sockaddr *)&h->peer, &addrlen);
        
        if (status < 0) {
                lttctl_errno = LTTCTL_ERR_RECV;
@@ -251,8 +251,8 @@ struct lttctl_handle *lttctl_create_handle(void)
        
        memset(h, 0, sizeof(struct lttctl_handle));
        
-  h->fd = socket(PF_NETLINK, SOCK_RAW, NETLINK_LTT);
-        
+       h->fd = socket(PF_NETLINK, SOCK_RAW, NETLINK_LTT);
+                               
        if (h->fd == -1) {
                lttctl_errno = LTTCTL_ERR_SOCKET;
                lttctl_perror("Create handle");
@@ -298,7 +298,10 @@ int lttctl_destroy_handle(struct lttctl_handle *h)
 
 
 int lttctl_create_trace(const struct lttctl_handle *h,
-               char *name, enum trace_mode mode, unsigned subbuf_size, unsigned n_subbufs)
+               char *name, enum trace_mode mode, char *trace_type,
+               unsigned subbuf_size_low, unsigned n_subbufs_low,
+               unsigned subbuf_size_med, unsigned n_subbufs_med,
+               unsigned subbuf_size_high, unsigned n_subbufs_high)
 {
        int err;
        
@@ -320,10 +323,15 @@ int lttctl_create_trace(const struct lttctl_handle *h,
        req.nlh.nlmsg_seq = 0;
 
        strncpy(req.msg.trace_name, name, NAME_MAX);
+       strncpy(req.msg.trace_type, trace_type, NAME_MAX);
        req.msg.op = OP_CREATE;
        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;
+       req.msg.args.new_trace.subbuf_size_low = subbuf_size_low;
+       req.msg.args.new_trace.n_subbufs_low = n_subbufs_low;
+       req.msg.args.new_trace.subbuf_size_med = subbuf_size_med;
+       req.msg.args.new_trace.n_subbufs_med = n_subbufs_med;
+       req.msg.args.new_trace.subbuf_size_high = subbuf_size_high;
+       req.msg.args.new_trace.n_subbufs_high = n_subbufs_high;
 
        err = lttctl_netlink_sendto(h, (void *)&req, req.nlh.nlmsg_len);
        if(err < 0) goto senderr;
@@ -342,7 +350,7 @@ int lttctl_create_trace(const struct lttctl_handle *h,
 
 senderr:
        lttctl_perror("Create Trace Error");
-  err = EPERM;
+       err = EPERM;
        return err;
 }
 
@@ -386,7 +394,7 @@ int lttctl_destroy_trace(const struct lttctl_handle *h,
 
 senderr:
        lttctl_perror("Destroy Trace Channels Error");
-  err = EPERM;
+       err = EPERM;
        return err;
 
 }
@@ -431,7 +439,7 @@ int lttctl_start(const struct lttctl_handle *h,
        return 0;
 
 senderr:
-  err = EPERM;
+       err = EPERM;
        lttctl_perror("Start Trace Error");
        return err;
 
@@ -442,12 +450,12 @@ int lttctl_stop(const struct lttctl_handle *h,
 {
        struct {
                struct nlmsghdr nlh;
-               lttctl_peer_msg_t       msg;
+               lttctl_peer_msg_t msg;
        } req;
        struct {
                struct nlmsghdr nlh;
                struct nlmsgerr nlerr;
-               lttctl_peer_msg_t       msg;
+               lttctl_peer_msg_t msg;
        } ack;
        int err;
 
@@ -476,7 +484,7 @@ int lttctl_stop(const struct lttctl_handle *h,
        return 0;
 
 senderr:
-  err = EPERM;
+       err = EPERM;
        lttctl_perror("Stop Trace Error");
        return err;
 }
This page took 0.025359 seconds and 4 git commands to generate.