X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=liblttd%2Fliblttd.h;fp=liblttd%2Fliblttd.h;h=d871dd726870a1ea26238b32b5bd1c6f1b9f7f9e;hb=d9cbca2728d5c8df929fe464e698abc07d1876ab;hp=02e7e9ce178056f52b3aecf8ed124741a83199f4;hpb=d6d516b717dfb30a882178494203bf4ceb4810fe;p=ltt-control.git diff --git a/liblttd/liblttd.h b/liblttd/liblttd.h index 02e7e9c..d871dd7 100644 --- a/liblttd/liblttd.h +++ b/liblttd/liblttd.h @@ -1,10 +1,11 @@ /* liblttd header file * + * Copyright 2005 - + * Mathieu Desnoyers * Copyright 2010- * Oumarou Dicko * Michael Sills-Lavoie * - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -21,6 +22,7 @@ #define _LIBLTTD_H #include +#include /** * struct fd_pair - Contains the data associated with the channel file @@ -43,7 +45,46 @@ struct fd_pair { void *user_data; }; -struct liblttd_instance; +struct channel_trace_fd { + struct fd_pair *pair; + int num_pairs; +}; + +struct inotify_watch { + int wd; + char path_channel[PATH_MAX]; + char *base_path_channel; +}; + +struct inotify_watch_array { + struct inotify_watch *elem; + int num; +}; + +struct liblttd_callbacks; + +/** + * struct liblttd_instance - Contains the data associated with a trace instance. + * The lib user can read but MUST NOT change any attributes but callbacks. + * @callbacks: Contains the necessary callbacks for a tracing session. + */ +struct liblttd_instance { + struct liblttd_callbacks *callbacks; + + int inotify_fd; + struct channel_trace_fd fd_pairs; + struct inotify_watch_array inotify_watch_array; + + /* protects fd_pairs and inotify_watch_array */ + pthread_rwlock_t fd_pairs_lock; + + char channel_name[PATH_MAX]; + unsigned long num_threads; + int quit_program; + int dump_flight_only; + int dump_normal_only; + int verbose_mode; +}; /** * struct liblttd_callbacks - Contains the necessary callbacks for a tracing @@ -116,17 +157,16 @@ struct liblttd_callbacks { * this time, all the channels have been closed and the threads have * been destroyed. * - * @data: pointeur to the callbacks struct that has been passed to the - * lib. + * @instance: pointeur to the instance struct that has been passed to + * the lib. * * Returns 0 if the callback succeeds else not 0. * - * It has to be thread safe, it'll be called by many threads. * After this callback is called, no other callback will be called * again and the tracing instance will be deleted automatically by * liblttd. After this call, the user must not use the liblttd instance. */ - int(*on_trace_end)(struct liblttd_callbacks *data); + int(*on_trace_end)(struct liblttd_instance *instance); /** * on_new_thread - Is called after a new thread has been created.