2 * Copyright (C) 2009 Pierre-Marc Fournier
3 * 2011 David Goulet <david.goulet@polymtl.ca>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef _LTT_LIBUSTCTL_H
21 #define _LTT_LIBUSTCTL_H
23 #define USTCTL_ERR_CONN 1 /* Process connection error */
24 #define USTCTL_ERR_ARG 2 /* Invalid function argument */
25 #define USTCTL_ERR_GEN 3 /* General ustctl error */
27 #define USTCTL_MS_CHR_OFF '0' /* Marker state 'on' character */
28 #define USTCTL_MS_CHR_ON '1' /* Marker state 'on' character */
29 #define USTCTL_MS_OFF 0 /* Marker state 'on' value */
30 #define USTCTL_MS_ON 1 /* Marker state 'on' value */
33 * Channel/marker/state/format string (cmsf) data structure
35 struct ustctl_marker_status
{
36 char *channel
; /* Channel name (end of ustctl_marker_status array if NULL) */
37 char *ust_marker
; /* Marker name (end of ustctl_marker_status array if NULL) */
38 int state
; /* State (0 := marker disabled, 1 := marker enabled) */
39 char *fs
; /* Format string (end of ustctl_marker_status array if NULL) */
42 struct ustctl_trace_event_status
{
46 pid_t
*ustctl_get_online_pids(void);
48 int ustctl_alloc_trace(int sock
, const char *trace
);
49 int ustctl_connect_pid(pid_t pid
);
50 int ustctl_create_trace(int sock
, const char *trace
);
51 int ustctl_destroy_trace(int sock
, const char *trace
);
52 int ustctl_force_switch(int sock
, const char *trace
);
53 int ustctl_free_cmsf(struct ustctl_marker_status
*cmsf
);
54 int ustctl_free_tes(struct ustctl_trace_event_status
*tes
);
55 int ustctl_get_cmsf(int sock
, struct ustctl_marker_status
**cmsf
);
56 int ustctl_get_sock_path(int sock
, char **sock_path
);
57 int ustctl_get_subbuf_num(pid_t pid
, const char *trace
, const char *channel
);
58 int ustctl_get_subbuf_size(int sock
, const char *trace
, const char *channel
);
59 int ustctl_get_tes(int sock
, struct ustctl_trace_event_status
**tes
);
60 int ustctl_set_sock_path(int sock
, const char *sock_path
);
62 int ustctl_set_marker_state(int sock
, const char *trace
,
63 const char *channel
, const char *ust_marker
, int state
);
65 int ustctl_set_subbuf_size(int sock
, const char *trace
,
66 const char *channel
, unsigned int subbuf_size
);
68 int ustctl_set_subbuf_num(int sock
, const char *trace
,
69 const char *channel
, unsigned int num
);
71 int ustctl_setup_and_start(int sock
, const char *trace
);
72 int ustctl_start_trace(int sock
, const char *trace
);
73 int ustctl_stop_trace(int sock
, const char *trace
);
74 unsigned int ustctl_count_nl(const char *str
);
76 #endif /* _LTT_LIBUSTCTL_H */