Commit | Line | Data |
---|---|---|
2298f329 NC |
1 | /* Copyright (C) 2009 Pierre-Marc Fournier |
2 | * | |
3 | * This library is free software; you can redistribute it and/or | |
4 | * modify it under the terms of the GNU Lesser General Public | |
5 | * License as published by the Free Software Foundation; either | |
6 | * version 2.1 of the License, or (at your option) any later version. | |
7 | * | |
8 | * This library is distributed in the hope that it will be useful, | |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
11 | * Lesser General Public License for more details. | |
12 | * | |
13 | * You should have received a copy of the GNU Lesser General Public | |
14 | * License along with this library; if not, write to the Free Software | |
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
16 | */ | |
17 | ||
18 | #ifndef _USTCTL_H | |
19 | #define _USTCTL_H | |
20 | ||
21 | #include <stdio.h> | |
22 | #include <unistd.h> | |
23 | #include <getopt.h> | |
24 | #include <stdlib.h> | |
25 | #include <fcntl.h> | |
26 | ||
27 | #define USTCTL_ERR_CONN 1 /* Process connection error */ | |
28 | #define USTCTL_ERR_ARG 2 /* Invalid function argument */ | |
29 | #define USTCTL_ERR_GEN 3 /* General ustctl error */ | |
30 | ||
31 | #define USTCTL_MS_CHR_OFF '0' /* Marker state 'on' character */ | |
32 | #define USTCTL_MS_CHR_ON '1' /* Marker state 'on' character */ | |
33 | #define USTCTL_MS_OFF 0 /* Marker state 'on' value */ | |
34 | #define USTCTL_MS_ON 1 /* Marker state 'on' value */ | |
35 | ||
36 | #define USTCTL_SOCK_PATH "/tmp/socks/" | |
37 | ||
38 | /* Channel/marker/state/format string (cmsf) info. structure */ | |
39 | struct marker_status { | |
40 | char *channel; /* Channel name (end of marker_status array if NULL) */ | |
41 | char *marker; /* Marker name (end of marker_status array if NULL) */ | |
42 | int state; /* State (0 := marker disabled, 1 := marker enabled) */ | |
43 | char *fs; /* Format string (end of marker_status array if NULL) */ | |
44 | }; | |
45 | ||
46 | struct trace_event_status { | |
47 | char *name; | |
48 | }; | |
49 | ||
50 | extern pid_t *ustctl_get_online_pids(void); | |
51 | extern int ustctl_set_marker_state(const char *trace, const char *channel, | |
52 | const char *marker, int state, pid_t pid); | |
53 | extern int ustctl_set_subbuf_size(const char *trace, const char *channel, | |
54 | unsigned int subbuf_size, pid_t pid); | |
55 | extern int ustctl_set_subbuf_num(const char *trace, const char *channel, | |
56 | unsigned int num, pid_t pid); | |
57 | extern int ustctl_get_subbuf_size(const char *trace, const char *channel, | |
58 | pid_t pid); | |
59 | extern int ustctl_get_subbuf_num(const char *trace, const char *channel, | |
60 | pid_t pid); | |
61 | extern int ustctl_destroy_trace(const char *trace, pid_t pid); | |
62 | extern int ustctl_setup_and_start(const char *trace, pid_t pid); | |
63 | extern int ustctl_stop_trace(const char *trace, pid_t pid); | |
64 | extern int ustctl_create_trace(const char *trace, pid_t pid); | |
65 | extern int ustctl_start_trace(const char *trace, pid_t pid); | |
66 | extern int ustctl_alloc_trace(const char *trace, pid_t pid); | |
67 | extern int ustctl_free_cmsf(struct marker_status *); | |
68 | extern unsigned int ustctl_count_nl(const char *); | |
69 | extern int ustctl_get_cmsf(struct marker_status **, pid_t); | |
70 | extern int ustctl_free_tes(struct trace_event_status *); | |
71 | extern int ustctl_get_tes(struct trace_event_status **, pid_t); | |
72 | extern int ustctl_set_sock_path(const char *sock_path, pid_t pid); | |
73 | extern int ustctl_get_sock_path(char **sock_path, pid_t pid); | |
74 | extern int ustctl_force_switch(pid_t pid); | |
75 | ||
76 | #endif /* _USTCTL_H */ |