Fixed TC-2074: Static analysis issues
[platform/upstream/corewatcher.git] / src / corewatcher.h
1 /*
2  * Copyright 2007,2012 Intel Corporation
3  *
4  * This program file is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11  * for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program in a file named COPYING; if not, write to the
15  * Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301 USA
18  *
19  * Authors:
20  *      Arjan van de Ven <arjan@linux.intel.com>
21  *      William Douglas <william.douglas@intel.com>
22  *      Tim Pepper <timothy.c.pepper@linux.intel.com>
23  */
24
25 #include "config.h"
26
27 #ifndef __INCLUDE_GUARD_KERNELOOPS_H_
28 #define __INCLUDE_GUARD_KERNELOOPS_H_
29
30 /* borrowed from the kernel */
31 #define __unused  __attribute__ ((__unused__))
32
33 #define MAX_URLS 2
34
35 #define FREE_OOPS(oops)                                 \
36         do {                                            \
37                 if (oops) {                             \
38                         if (oops->application) free(oops->application);         \
39                         if (oops->text) free(oops->text);                       \
40                         if (oops->filename) free(oops->filename);               \
41                         if (oops->detail_filename) free(oops->detail_filename); \
42                         free(oops);                     \
43                 }                                       \
44         } while(0)
45
46 struct oops {
47         struct oops *next;
48         char *application;
49         char *text;
50         char *filename;
51         char *detail_filename;
52 };
53
54 /* inotification.c */
55 extern void *inotify_loop(void __unused *unused);
56
57 /* submit.c */
58 extern GMutex *bt_mtx;
59 extern GCond *bt_work;
60 extern GHashTable *bt_hash;
61 extern void queue_backtrace(struct oops *oops);
62 extern char *replace_name(char *filename, char *replace, char *new);
63 extern void *submit_loop(void __unused *unused);
64
65 /* coredump.c */
66 extern GMutex *pq_mtx;
67 extern GCond *pq_work;
68 extern int scan_folders(void __unused *unused);
69 extern int scan_core_folder(void __unused *unused);
70 extern void *scan_processed_folder(void __unused *unused);
71 extern const char *core_folder;
72 extern const char *processed_folder;
73 extern void enable_corefiles(int diskfree);
74 extern char *strip_directories(char *fullpath);
75
76 /* configfile.c */
77 extern void read_config_file(char *filename);
78 extern int allow_distro_to_pass_on;
79 extern char *submit_url[MAX_URLS];
80 extern int url_count;
81
82 /* corewatcher.c */
83 extern int testmode;
84 extern int pinged;
85 extern struct core_status core_status;
86
87 /* find_file.c */
88 extern char *find_apppath(char *fragment);
89 extern char *find_causingapp(char *fullpath);
90
91 #endif