| 1 |
/**************************************************************************/ |
| 2 |
/* */ |
| 3 |
/* This file is part of Frama-C. */ |
| 4 |
/* */ |
| 5 |
/* Copyright (C) 2007-2022 */ |
| 6 |
/* CEA (Commissariat à l'énergie atomique et aux énergies */ |
| 7 |
/* alternatives) */ |
| 8 |
/* */ |
| 9 |
/* you can redistribute it and/or modify it under the terms of the GNU */ |
| 10 |
/* Lesser General Public License as published by the Free Software */ |
| 11 |
/* Foundation, version 2.1. */ |
| 12 |
/* */ |
| 13 |
/* It is distributed in the hope that it will be useful, */ |
| 14 |
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 15 |
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
| 16 |
/* GNU Lesser General Public License for more details. */ |
| 17 |
/* */ |
| 18 |
/* See the GNU Lesser General Public License version 2.1 */ |
| 19 |
/* for more details (enclosed in the file licenses/LGPLv2.1). */ |
| 20 |
/* */ |
| 21 |
/**************************************************************************/ |
| 22 |
|
| 23 |
#ifndef __FC_TRACE |
| 24 |
#define __FC_TRACE |
| 25 |
#include "features.h" |
| 26 |
__PUSH_FC_STDLIB |
| 27 |
#include "__fc_define_pid_t.h" |
| 28 |
#include "__fc_define_pthread_types.h" |
| 29 |
#include "__fc_define_size_t.h" |
| 30 |
#include "__fc_define_timespec.h" |
| 31 |
|
| 32 |
__BEGIN_DECLS |
| 33 |
|
| 34 |
typedef unsigned int trace_event_id_t; |
| 35 |
|
| 36 |
typedef unsigned int trace_id_t; |
| 37 |
|
| 38 |
typedef struct __fc_trace_attr_t { |
| 39 |
int _fc ; |
| 40 |
} trace_attr_t; |
| 41 |
|
| 42 |
typedef struct __fc_trace_event_set_t { |
| 43 |
int _fc ; |
| 44 |
} trace_event_set_t; |
| 45 |
|
| 46 |
struct posix_trace_event_info { |
| 47 |
trace_event_id_t posix_event_id; |
| 48 |
pid_t posix_pid; |
| 49 |
void *posix_prog_address; |
| 50 |
pthread_t posix_thread_id; |
| 51 |
struct timespec posix_timestamp; |
| 52 |
int posix_truncation_status; |
| 53 |
}; |
| 54 |
|
| 55 |
struct posix_trace_status_info { |
| 56 |
int posix_stream_full_status; |
| 57 |
int posix_stream_overrun_status; |
| 58 |
int posix_stream_status; |
| 59 |
int posix_log_full_status; |
| 60 |
int posix_log_overrun_status; |
| 61 |
int posix_stream_flush_error; |
| 62 |
int posix_stream_flush_status; |
| 63 |
}; |
| 64 |
|
| 65 |
// Note: the constants below are not defined in most Linux systems, |
| 66 |
// so arbitrary values were chosen. |
| 67 |
|
| 68 |
#define POSIX_TRACE_ALL_EVENTS 1 |
| 69 |
|
| 70 |
#define POSIX_TRACE_APPEND 2 |
| 71 |
|
| 72 |
#define POSIX_TRACE_CLOSE_FOR_CHILD 3 |
| 73 |
|
| 74 |
#define POSIX_TRACE_FILTER 4 |
| 75 |
|
| 76 |
#define POSIX_TRACE_FLUSH 5 |
| 77 |
#define POSIX_TRACE_FLUSH_START 6 |
| 78 |
#define POSIX_TRACE_FLUSH_STOP 7 |
| 79 |
#define POSIX_TRACE_FLUSHING 8 |
| 80 |
|
| 81 |
#define POSIX_TRACE_FULL 9 |
| 82 |
#define POSIX_TRACE_LOOP 10 |
| 83 |
#define POSIX_TRACE_NO_OVERRUN 11 |
| 84 |
|
| 85 |
#define POSIX_TRACE_NOT_FLUSHING 12 |
| 86 |
|
| 87 |
#define POSIX_TRACE_NOT_FULL 13 |
| 88 |
|
| 89 |
#define POSIX_TRACE_INHERITED 14 |
| 90 |
|
| 91 |
#define POSIX_TRACE_NOT_TRUNCATED 15 |
| 92 |
#define POSIX_TRACE_OVERFLOW 16 |
| 93 |
#define POSIX_TRACE_OVERRUN 17 |
| 94 |
#define POSIX_TRACE_RESUME 18 |
| 95 |
#define POSIX_TRACE_RUNNING 19 |
| 96 |
#define POSIX_TRACE_START 20 |
| 97 |
#define POSIX_TRACE_STOP 21 |
| 98 |
#define POSIX_TRACE_SUSPENDED 22 |
| 99 |
#define POSIX_TRACE_SYSTEM_EVENTS 23 |
| 100 |
#define POSIX_TRACE_TRUNCATED_READ 24 |
| 101 |
#define POSIX_TRACE_TRUNCATED_RECORD 25 |
| 102 |
#define POSIX_TRACE_UNNAMED_USER_EVENT 26 |
| 103 |
#define POSIX_TRACE_UNTIL_FULL 27 |
| 104 |
#define POSIX_TRACE_WOPID_EVENTS 28 |
| 105 |
|
| 106 |
extern int posix_trace_attr_destroy(trace_attr_t *); |
| 107 |
|
| 108 |
extern int posix_trace_attr_getclockres(const trace_attr_t *, |
| 109 |
struct timespec *); |
| 110 |
|
| 111 |
extern int posix_trace_attr_getcreatetime(const trace_attr_t *, |
| 112 |
struct timespec *); |
| 113 |
|
| 114 |
extern int posix_trace_attr_getgenversion(const trace_attr_t *, char *); |
| 115 |
|
| 116 |
extern int posix_trace_attr_getinherited(const trace_attr_t *restrict, |
| 117 |
int *restrict); |
| 118 |
|
| 119 |
extern int posix_trace_attr_getlogfullpolicy(const trace_attr_t *restrict, |
| 120 |
int *restrict); |
| 121 |
|
| 122 |
extern int posix_trace_attr_getlogsize(const trace_attr_t *restrict, |
| 123 |
size_t *restrict); |
| 124 |
|
| 125 |
extern int posix_trace_attr_getmaxdatasize(const trace_attr_t *restrict, |
| 126 |
size_t *restrict); |
| 127 |
|
| 128 |
extern int posix_trace_attr_getmaxsystemeventsize(const trace_attr_t *restrict, |
| 129 |
size_t *restrict); |
| 130 |
|
| 131 |
extern int posix_trace_attr_getmaxusereventsize(const trace_attr_t *restrict, |
| 132 |
size_t, size_t *restrict); |
| 133 |
|
| 134 |
extern int posix_trace_attr_getname(const trace_attr_t *, char *); |
| 135 |
|
| 136 |
extern int posix_trace_attr_getstreamfullpolicy(const trace_attr_t *restrict, |
| 137 |
int *restrict); |
| 138 |
|
| 139 |
extern int posix_trace_attr_getstreamsize(const trace_attr_t *restrict, |
| 140 |
size_t *restrict); |
| 141 |
|
| 142 |
extern int posix_trace_attr_init(trace_attr_t *); |
| 143 |
|
| 144 |
extern int posix_trace_attr_setinherited(trace_attr_t *, int); |
| 145 |
|
| 146 |
extern int posix_trace_attr_setlogfullpolicy(trace_attr_t *, int); |
| 147 |
|
| 148 |
extern int posix_trace_attr_setlogsize(trace_attr_t *, size_t); |
| 149 |
|
| 150 |
extern int posix_trace_attr_setmaxdatasize(trace_attr_t *, size_t); |
| 151 |
|
| 152 |
extern int posix_trace_attr_setname(trace_attr_t *, const char *); |
| 153 |
|
| 154 |
extern int posix_trace_attr_setstreamfullpolicy(trace_attr_t *, int); |
| 155 |
|
| 156 |
extern int posix_trace_attr_setstreamsize(trace_attr_t *, size_t); |
| 157 |
|
| 158 |
extern int posix_trace_clear(trace_id_t); |
| 159 |
|
| 160 |
extern int posix_trace_close(trace_id_t); |
| 161 |
|
| 162 |
extern int posix_trace_create(pid_t, const trace_attr_t *restrict, |
| 163 |
trace_id_t *restrict); |
| 164 |
|
| 165 |
extern int posix_trace_create_withlog(pid_t, const trace_attr_t *restrict, |
| 166 |
int, trace_id_t *restrict); |
| 167 |
|
| 168 |
extern void posix_trace_event(trace_event_id_t, const void *restrict, size_t); |
| 169 |
|
| 170 |
extern int posix_trace_eventid_equal(trace_id_t, trace_event_id_t, |
| 171 |
trace_event_id_t); |
| 172 |
|
| 173 |
extern int posix_trace_eventid_get_name(trace_id_t, trace_event_id_t, char *); |
| 174 |
|
| 175 |
extern int posix_trace_eventid_open(const char *restrict, |
| 176 |
trace_event_id_t *restrict); |
| 177 |
|
| 178 |
extern int posix_trace_eventset_add(trace_event_id_t, trace_event_set_t *); |
| 179 |
|
| 180 |
extern int posix_trace_eventset_del(trace_event_id_t, trace_event_set_t *); |
| 181 |
|
| 182 |
extern int posix_trace_eventset_empty(trace_event_set_t *); |
| 183 |
|
| 184 |
extern int posix_trace_eventset_fill(trace_event_set_t *, int); |
| 185 |
|
| 186 |
extern int posix_trace_eventset_ismember(trace_event_id_t, |
| 187 |
const trace_event_set_t *restrict, |
| 188 |
int *restrict); |
| 189 |
|
| 190 |
extern int posix_trace_eventtypelist_getnext_id(trace_id_t, |
| 191 |
trace_event_id_t *restrict, |
| 192 |
int *restrict); |
| 193 |
|
| 194 |
int posix_trace_eventtypelist_rewind(trace_id_t); |
| 195 |
|
| 196 |
extern int posix_trace_flush(trace_id_t); |
| 197 |
|
| 198 |
extern int posix_trace_get_attr(trace_id_t, trace_attr_t *); |
| 199 |
|
| 200 |
extern int posix_trace_get_filter(trace_id_t, trace_event_set_t *); |
| 201 |
|
| 202 |
extern int posix_trace_get_status(trace_id_t, |
| 203 |
struct posix_trace_status_info *); |
| 204 |
|
| 205 |
extern int posix_trace_getnext_event(trace_id_t, |
| 206 |
struct posix_trace_event_info *restrict, |
| 207 |
void *restrict, size_t, size_t *restrict, |
| 208 |
int *restrict); |
| 209 |
|
| 210 |
extern int posix_trace_open(int, trace_id_t *); |
| 211 |
|
| 212 |
extern int posix_trace_rewind(trace_id_t); |
| 213 |
|
| 214 |
extern int posix_trace_set_filter(trace_id_t, const trace_event_set_t *, int); |
| 215 |
|
| 216 |
extern int posix_trace_shutdown(trace_id_t); |
| 217 |
|
| 218 |
extern int posix_trace_start(trace_id_t); |
| 219 |
|
| 220 |
extern int posix_trace_stop(trace_id_t); |
| 221 |
|
| 222 |
extern int posix_trace_timedgetnext_event(trace_id_t, |
| 223 |
struct posix_trace_event_info |
| 224 |
*restrict, void *restrict, size_t, |
| 225 |
size_t *restrict, int *restrict, |
| 226 |
const struct timespec *restrict); |
| 227 |
|
| 228 |
extern int posix_trace_trid_eventid_open(trace_id_t, const char *restrict, |
| 229 |
trace_event_id_t *restrict); |
| 230 |
|
| 231 |
extern int posix_trace_trygetnext_event(trace_id_t, |
| 232 |
struct posix_trace_event_info |
| 233 |
*restrict, void *restrict, size_t, |
| 234 |
size_t *restrict, int *restrict); |
| 235 |
|
| 236 |
__END_DECLS |
| 237 |
|
| 238 |
__POP_FC_STDLIB |
| 239 |
#endif |