From: Alexander Aksenov Date: Mon, 15 May 2017 13:10:22 +0000 (+0300) Subject: Code style fix X-Git-Tag: submit/tizen/20180109.094207~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F04%2F130704%2F18;p=platform%2Fcore%2Fsystem%2Fswap-probe.git Code style fix Change-Id: I0162eae75320bc265f03fd2933655ab9ca7b7ed5 Signed-off-by: Alexander Aksenov --- diff --git a/helper/common_probe_init.c b/helper/common_probe_init.c index 9900fe1..17d52f8 100644 --- a/helper/common_probe_init.c +++ b/helper/common_probe_init.c @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd diff --git a/helper/da_call_original.S b/helper/da_call_original.S index f086131..636dae4 100644 --- a/helper/da_call_original.S +++ b/helper/da_call_original.S @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia diff --git a/helper/dacollection.c b/helper/dacollection.c index 2e40516..a2195af 100755 --- a/helper/dacollection.c +++ b/helper/dacollection.c @@ -11,17 +11,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd diff --git a/helper/daforkexec.c b/helper/daforkexec.c index fbe5d4f..6b8affe 100644 --- a/helper/daforkexec.c +++ b/helper/daforkexec.c @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia @@ -35,13 +35,13 @@ DECLARE(int, execl , const char *path, const char *arg, ...); DECLARE(int, execlp, const char *file, const char *arg, ...); -DECLARE(int, execle, const char *path, const char *arg, ... - /*, char * const envp[] */); +DECLARE(int, execle, const char *path, const char *arg, ...); + /*, char * const envp[]); */ DECLARE(int, execv, const char *path, char *const argv[]); DECLARE(int, execve, const char *filename, char *const argv[], char *const envp[]); DECLARE(int, execvp, const char *file, char *const argv[]); -DECLARE(int, execvpe, const char *file, char *const argv[],char *const envp[]); +DECLARE(int, execvpe, const char *file, char *const argv[], char *const envp[]); DECLARE(pid_t, fork, void); void init_exec_fork() @@ -56,12 +56,12 @@ void init_exec_fork() INIT_FUNC_EXEC(execvpe); } -#define prepare_params( FUNCTION , p1, p2) \ +#define prepare_params(FUNCTION , p1, p2) \ va_list ap; \ int args_count = 0; \ int i; \ \ - INIT_FUNC_EXEC( FUNCTION ); \ + INIT_FUNC_EXEC(FUNCTION); \ \ va_start(ap, p2); \ do \ @@ -92,7 +92,7 @@ int _da_call_original(void *funcp, char *args[], int args_count); p += sprintf(p, " \"%s\",", p1); \ p += sprintf(p, " \"%s\",", p2); \ va_start(par, p2); \ - while ( (pp = va_arg(par, char *)) != NULL) \ + while ((pp = va_arg(par, char *)) != NULL) \ p += sprintf(p, " \"%s\",", pp); \ va_end(par); \ p += sprintf(p, ">"); @@ -171,7 +171,8 @@ int PROBE_NAME(execvp)(const char *file, char *const argv[]) return res; } -int PROBE_NAME(execve)(const char *filename, char *const argv[],char *const envp[]) +int PROBE_NAME(execve)(const char *filename, char *const argv[], + char *const envp[]) { int res; PRINTMSG("%s [%d] ", __FUNCTION__, getpid()); @@ -184,7 +185,8 @@ int PROBE_NAME(execve)(const char *filename, char *const argv[],char *const envp return res; } -int PROBE_NAME(execvpe)(const char *file, char *const argv[],char *const envp[]) +int PROBE_NAME(execvpe)(const char *file, char *const argv[], + char *const envp[]) { int res; PRINTMSG("%s [%d] ", __FUNCTION__, getpid()); diff --git a/helper/daforkexec.h b/helper/daforkexec.h index 320f6c1..a4df8b7 100644 --- a/helper/daforkexec.h +++ b/helper/daforkexec.h @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia diff --git a/helper/daforkexec_probes.h b/helper/daforkexec_probes.h index d484de0..eecec61 100644 --- a/helper/daforkexec_probes.h +++ b/helper/daforkexec_probes.h @@ -6,8 +6,10 @@ int PROBE_NAME(execlp)(const char *file, const char *arg, ...); int PROBE_NAME(execle)(const char *path, const char *arg, ...); int PROBE_NAME(execv)(const char *path, char *const argv[]); int PROBE_NAME(execvp)(const char *file, char *const argv[]); -int PROBE_NAME(execve)(const char *filename, char *const argv[],char *const envp[]); -int PROBE_NAME(execvpe)(const char *file, char *const argv[],char *const envp[]); +int PROBE_NAME(execve)(const char *filename, char *const argv[], + char *const envp[]); +int PROBE_NAME(execvpe)(const char *file, char *const argv[], + char *const envp[]); pid_t PROBE_NAME(fork)(void); #endif /* __DAFORKEXEC_PROBES_H__ */ diff --git a/helper/dahelper.c b/helper/dahelper.c index 2919c93..e70bf80 100755 --- a/helper/dahelper.c +++ b/helper/dahelper.c @@ -11,17 +11,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -82,7 +82,7 @@ int remove_indir(const char *dirname) DIR *dir; struct dirent *entry; char path[MAX_PATH_LENGTH]; - static char dirent_buffer[ sizeof(struct dirent) + PATH_MAX + 1 ] = {0,}; + static char dirent_buffer[sizeof(struct dirent) + PATH_MAX + 1] = {0,}; static struct dirent *dirent_r = (struct dirent *)dirent_buffer; dir = opendir(dirname); diff --git a/helper/dastdout.c b/helper/dastdout.c index 05fd0ac..c035a8c 100644 --- a/helper/dastdout.c +++ b/helper/dastdout.c @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -54,7 +54,8 @@ int __redirect_std(void) { #ifdef STDTOFILE char STDOUT[MAX_PATH_LENGTH]; - snprintf(STDOUT,sizeof(STDOUT), "/run/swap/tmp/da_preloaded_%d_%d.log", getppid(), getpid()); + snprintf(STDOUT, sizeof(STDOUT), "/run/swap/tmp/da_preloaded_%d_%d.log", + getppid(), getpid()); #else #define STDOUT "/dev/null" #endif diff --git a/helper/dastdout.h b/helper/dastdout.h index fd743e0..f68bbc0 100644 --- a/helper/dastdout.h +++ b/helper/dastdout.h @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd diff --git a/helper/features_list.h b/helper/features_list.h index 8e6d342..8820436 100644 --- a/helper/features_list.h +++ b/helper/features_list.h @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia @@ -39,22 +39,38 @@ static const char probelib_uihv[] = PROBELIB_UIHV; /* Features list, defined in probe_* headers */ #define FEATURES_LIST \ - X(FL_MEMORY_ALLOC_PROBING, 0, memory_feature, probelib_main) \ - X(FL_MEMORY_ALLOC_ALWAYS_PROBING, 0, memory_feature_always, probelib_main) \ - X(FL_ALWAYS_ON, 0, helper_feature, probelib_main) \ - X(FL_ALWAYS_ON, 0, multiprobe_helper_feature, probelib_main) \ - X(FL_ALWAYS_ON, 0, capi_feature, probelib_capi) \ - X(FL_USER_EVENT, 0, event_feature, probelib_event) \ - X(FL_FILE_API_PROBING, 0, file_feature, probelib_main) \ - X(FL_FILE_API_ALWAYS_PROBING, 0, file_feature_always, probelib_main) \ - X(FL_OPENGL_API_PROBING, 0, graphics_feature, probelib_graphics) \ - X(FL_OPENGL_API_ALWAYS_PROBING, 0, graphics_feature_always, probelib_graphics) \ - X(FL_NETWORK_API_PROBING, 0, network_feature, probelib_main) \ - X(FL_NETWORK_API_ALWAYS_PROBING, 0, network_feature_always, probelib_main) \ - X(FL_THREAD_API_PROBING, 0, thread_feature, probelib_main) \ - X(FL_THREAD_API_ALWAYS_PROBING, 0, thread_feature_always, probelib_main) \ - X(FL_UI_VIEWER_PROFILING, 0, ui_feature, probelib_uihv) \ - X(FL_SCREENSHOT, 0, screenshot_feature, probelib_screenshot) + X(FL_MEMORY_ALLOC_PROBING, 0, \ + memory_feature, probelib_main) \ + X(FL_MEMORY_ALLOC_ALWAYS_PROBING, 0, \ + memory_feature_always, probelib_main) \ + X(FL_ALWAYS_ON, 0, \ + helper_feature, probelib_main) \ + X(FL_ALWAYS_ON, 0, \ + multiprobe_helper_feature, probelib_main) \ + X(FL_ALWAYS_ON, 0, \ + capi_feature, probelib_capi) \ + X(FL_USER_EVENT, 0, \ + event_feature, probelib_event) \ + X(FL_FILE_API_PROBING, 0, \ + file_feature, probelib_main) \ + X(FL_FILE_API_ALWAYS_PROBING, 0, \ + file_feature_always, probelib_main) \ + X(FL_OPENGL_API_PROBING, 0, \ + graphics_feature, probelib_graphics) \ + X(FL_OPENGL_API_ALWAYS_PROBING, 0, \ + graphics_feature_always, probelib_graphics) \ + X(FL_NETWORK_API_PROBING, 0, \ + network_feature, probelib_main) \ + X(FL_NETWORK_API_ALWAYS_PROBING, 0, \ + network_feature_always, probelib_main) \ + X(FL_THREAD_API_PROBING, 0, \ + thread_feature, probelib_main) \ + X(FL_THREAD_API_ALWAYS_PROBING, 0, \ + thread_feature_always, probelib_main) \ + X(FL_UI_VIEWER_PROFILING, 0, \ + ui_feature, probelib_uihv) \ + X(FL_SCREENSHOT, 0, \ + screenshot_feature, probelib_screenshot) #endif /* __FEATURES_LIST_H__ */ diff --git a/helper/file_buffer.c b/helper/file_buffer.c index af9d393..d6f0ea7 100644 --- a/helper/file_buffer.c +++ b/helper/file_buffer.c @@ -6,17 +6,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia diff --git a/helper/get_got.c b/helper/get_got.c index d15aba0..68c5e88 100644 --- a/helper/get_got.c +++ b/helper/get_got.c @@ -36,9 +36,9 @@ enum { #endif -#define ELFW(type) _ElfW (ELF, __ELF_NATIVE_CLASS, type) -#define _ElfW(e,w,t) _ElfW_1 (e, w, _##t) -#define _ElfW_1(e,w,t) e##w##t +#define ELFW(type) _ELFW(ELF, __ELF_NATIVE_CLASS, type) +#define _ELFW(e, w, t) _ELFW_1(e, w, _##t) +#define _ELFW_1(e, w, t) e##w##t typedef long int Lmid_t; diff --git a/helper/get_got.h b/helper/get_got.h index 42c16ae..72e7b3d 100644 --- a/helper/get_got.h +++ b/helper/get_got.h @@ -15,9 +15,11 @@ struct phdr_info { const char *lmap_get_name(const struct link_map *map, unsigned long offset); /* Pass name - get .got.plt entry address */ -unsigned long lmap_reladdr_by_name(const struct link_map *map, const char *name); +unsigned long lmap_reladdr_by_name(const struct link_map *map, + const char *name); /* Pass name - get .got entry address */ -unsigned long lmap_gotaddr_by_name(const struct link_map *map, const char *name); +unsigned long lmap_gotaddr_by_name(const struct link_map *map, + const char *name); /* Pass offset - get GOT entry address */ unsigned long lmap_reladdr_by_offset(const struct link_map *map, diff --git a/helper/got_patching.c b/helper/got_patching.c index dcaeb73..f4b1e79 100644 --- a/helper/got_patching.c +++ b/helper/got_patching.c @@ -338,7 +338,8 @@ static struct link_map *_find_map(const char *path) return NULL; } -static int _patch_bin(struct dl_phdr_info *info, size_t __unused size, void *data) +static int _patch_bin(struct dl_phdr_info *info, size_t __unused size, + void *data) { struct link_map *map; struct phdr_info pi; @@ -432,7 +433,7 @@ static void _process_features(enum gp_indicate gpi, struct ext_bininfo_t *bins) #elif (defined __i386__) # define DL_FIXUP_VALUE_TYPE ElfW(Addr) -# define ARCH_FIXUP_ATTRIBUTE __attribute__ ((regparm (3), stdcall, unused)) +# define ARCH_FIXUP_ATTRIBUTE __attribute__((regparm(3), stdcall, unused)) #else # error "This arch is not supported" @@ -456,8 +457,8 @@ static dl_fixup_t dl_fixup_p = 0; * each of which contains an enormous amount of another data absolutely useless * here.*/ -DL_FIXUP_VALUE_TYPE __attribute ((noinline)) ARCH_FIXUP_ATTRIBUTE -__dl_fixup_wrapper ( +DL_FIXUP_VALUE_TYPE __attribute((noinline)) ARCH_FIXUP_ATTRIBUTE +__dl_fixup_wrapper( # ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS ELF_MACHINE_RUNTIME_FIXUP_ARGS, # endif @@ -468,6 +469,7 @@ __dl_fixup_wrapper ( unsigned int i, j; unsigned long got_addr; ElfW(Addr) exec_addr; + struct probe_desc_t *probe; func_name = lmap_get_name(l, reloc_arg); if (func_name == NULL) @@ -492,33 +494,37 @@ __dl_fixup_wrapper ( continue; for (j = 0; j < features[i]->cnt; j++) { + probe = &features[i]->probes[j]; /* Check binary */ - if ((features[i]->probes[j].flags != GT_ALWAYS_PROBE) && - ((features[i]->probes[j].flags != GT_TARGET_PROBE) && + if ((probe->flags != GT_ALWAYS_PROBE) && + ((probe->flags != GT_TARGET_PROBE) && target_bin)) continue; /* Using strcmp() cause orig_name is predefined */ - if (strcmp(features[i]->probes[j].orig_name, func_name) == 0) { - /* FIXME Possible race condition, cause GOT entry already - * patched by linker and points to an original handler, but not - * our handler. Ideas: + if (strcmp(probe->orig_name, + func_name) == 0) { + /* FIXME Possible race condition, cause GOT + * entry already patched by linker and points + * to an original handler, but not our handler. + * Ideas: * - set probe right after _dl_fixup() exec * and patch all entries by it; * - check where are treads when we starting. */ - features[i]->probes[j].orig_ptr = exec_addr; - *(ElfW(Addr) *)got_addr = features[i]->probes[j].handler_ptr; - exec_addr = (unsigned long)features[i]->probes[j].handler_ptr; + probe->orig_ptr = exec_addr; + *(ElfW(Addr) *)got_addr = + probe->handler_ptr; + exec_addr = (unsigned long)probe->handler_ptr; } } } - /* TODO generate header at compile time with linker _dl_fixup() address to - * use here. Let it be called dl_fixup_p */ + /* TODO generate header at compile time with linker _dl_fixup() address + * to use here. Let it be called dl_fixup_p */ - /* TODO Think of several handlers at the same time (malloc()/free() can be - * gathered always and profiled for a special binary, for example): which - * of them should be executed? */ + /* TODO Think of several handlers at the same time (malloc()/free() can + * be gathered always and profiled for a special binary, for example): + * which of them should be executed? */ return exec_addr; } @@ -541,6 +547,7 @@ void __dl_reloc_wrapper(struct link_map *l, struct r_scope_elem *scope[], bool is_for_all; struct gp_sym_patch gsp; int err; + struct probe_desc_t *probe; target_bin = _check_if_patch(path, NULL); @@ -565,16 +572,17 @@ void __dl_reloc_wrapper(struct link_map *l, struct r_scope_elem *scope[], } for (j = 0; j < features[i]->cnt; j++) { + probe = &features[i]->probes[j]; /* If feature is not always and flags doesn't satisfy * binary's status - continue */ - if ((features[i]->probes[j].flags != GT_ALWAYS_PROBE) && - ((features[i]->probes[j].flags != GT_TARGET_PROBE) && + if ((probe->flags != GT_ALWAYS_PROBE) && + ((probe->flags != GT_TARGET_PROBE) && target_bin)) continue; gsp.map = l; gsp.info = π - gsp.probe = &features[i]->probes[j]; + gsp.probe = probe; gsp.gpi = GP_PATCHING; _patch_sym(&gsp); diff --git a/helper/in_handler.c b/helper/in_handler.c index f858d14..70f45c2 100644 --- a/helper/in_handler.c +++ b/helper/in_handler.c @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia diff --git a/helper/libdaprobe.c b/helper/libdaprobe.c index 86f74a7..968c2f6 100755 --- a/helper/libdaprobe.c +++ b/helper/libdaprobe.c @@ -14,17 +14,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -36,7 +36,7 @@ #include /* for getenv */ #include /* for strstr */ #include /* for bool */ -#include /* for uint32_t,uint64_t */ +#include /* for uint32_t, uint64_t */ #include /* for va_list, va_arg(__appendTypeLog) */ #include /* for backtrace, backtrace_symbols */ #include /* for write, alarm function, syscall */ @@ -96,7 +96,8 @@ enum { static inline void _parse_config(char *configstr) { gTraceInfo.features.feature_0 = *(uint64_t *)configstr; - gTraceInfo.features.feature_1 = *(uint64_t *)(configstr + sizeof(uint64_t)); + gTraceInfo.features.feature_1 = *(uint64_t *)(configstr + + sizeof(uint64_t)); } /* runtime configure the probe option */ @@ -317,7 +318,7 @@ pid_t _getpid() /* return current thread id */ pid_t _gettid() { - if(gTid == -1) + if (gTid == -1) gTid = syscall(__NR_gettid); /* syscall is very expensive */ return gTid; @@ -584,7 +585,7 @@ void _uninit_(void) thread_handle_del_all(); for (i = 0; i < NUM_ORIGINAL_LIBRARY; i++) - if(lib_handle[i] != NULL) + if (lib_handle[i] != NULL) dlclose(lib_handle[i]); } @@ -605,14 +606,14 @@ void __attribute__((destructor)) _fini_probe() const char *msg_code_to_srt(enum AppMessageType type) { switch (type) { - case APP_MSG_MSG: - return "[INF]"; - case APP_MSG_ERROR: - return "[ERR]"; - case APP_MSG_WARNING: - return "[WRN]"; - default: - return "[???]"; + case APP_MSG_MSG: + return "[INF]"; + case APP_MSG_ERROR: + return "[ERR]"; + case APP_MSG_WARNING: + return "[WRN]"; + default: + return "[???]"; } } @@ -797,7 +798,7 @@ bool print_log_fmt(int msgType, const char *func_name, int line, ...) *************************************************************************/ int preBlockBegin(void) { - if(gTraceInfo.init_complete <= 0) + if (gTraceInfo.init_complete <= 0) return 0; return 1; diff --git a/helper/loader.c b/helper/loader.c index dd28d18..59e7d7c 100644 --- a/helper/loader.c +++ b/helper/loader.c @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia @@ -44,16 +44,26 @@ #define LOAD_FEATURES_LIST \ - X(0, FL_MEMORY_ALLOC_PROBING_PRELOAD, preload_mem, probelib_main) \ - X(0, FL_FILE_API_PROBING_PRELOAD, preload_file, probelib_main) \ - X(0, FL_THREAD_API_PROBING_PRELOAD, preload_thread, probelib_main) \ - X(0, FL_NETWORK_API_PROBING_PRELOAD, preload_net, probelib_main) \ - X(0, FL_OPENGL_API_PROBING_PRELOAD, preload_gl, probelib_graphics) \ - X(0, FL_MEMORY_ALLOC_ALWAYS_PROBING_PRELOAD, preload_mem_always, probelib_main) \ - X(0, FL_FILE_API_ALWAYS_PROBING_PRELOAD, preload_file_always, probelib_main) \ - X(0, FL_THREAD_API_ALWAYS_PROBING_PRELOAD, preload_thread_always, probelib_main) \ - X(0, FL_NETWORK_API_ALWAYS_PROBING_PRELOAD, preload_net_always, probelib_main) \ - X(0, FL_OPENGL_API_ALWAYS_PROBING_PRELOAD, preload_gl_always, probelib_graphics) + X(0, FL_MEMORY_ALLOC_PROBING_PRELOAD, \ + preload_mem, probelib_main) \ + X(0, FL_FILE_API_PROBING_PRELOAD, \ + preload_file, probelib_main) \ + X(0, FL_THREAD_API_PROBING_PRELOAD, \ + preload_thread, probelib_main) \ + X(0, FL_NETWORK_API_PROBING_PRELOAD, \ + preload_net, probelib_main) \ + X(0, FL_OPENGL_API_PROBING_PRELOAD, \ + preload_gl, probelib_graphics) \ + X(0, FL_MEMORY_ALLOC_ALWAYS_PROBING_PRELOAD, \ + preload_mem_always, probelib_main) \ + X(0, FL_FILE_API_ALWAYS_PROBING_PRELOAD, \ + preload_file_always, probelib_main) \ + X(0, FL_THREAD_API_ALWAYS_PROBING_PRELOAD, \ + preload_thread_always, probelib_main) \ + X(0, FL_NETWORK_API_ALWAYS_PROBING_PRELOAD, \ + preload_net_always, probelib_main) \ + X(0, FL_OPENGL_API_ALWAYS_PROBING_PRELOAD, \ + preload_gl_always, probelib_graphics) #define FULL_FEATURES_LIST \ FEATURES_LIST \ diff --git a/helper/loader.h b/helper/loader.h index 29435c8..73c025f 100644 --- a/helper/loader.h +++ b/helper/loader.h @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia diff --git a/helper/lsan_open.c b/helper/lsan_open.c index 9890548..c20af29 100644 --- a/helper/lsan_open.c +++ b/helper/lsan_open.c @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributed by Maxim Ostapenko * @@ -188,7 +188,8 @@ free_report_msg: free(report_msg); } -static char *get_report_file_name() { +static char *get_report_file_name() +{ const char report_file_name_base[] = "/run/swap/tmp/lsan.log"; static char report_file_name[MAX_PATH_LENGTH]; snprintf(report_file_name, MAX_PATH_LENGTH, "%s.%d", diff --git a/helper/multiprobe.cpp b/helper/multiprobe.cpp index f55ccd2..9c6ddc7 100644 --- a/helper/multiprobe.cpp +++ b/helper/multiprobe.cpp @@ -6,17 +6,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia diff --git a/helper/multiprobe_helper.cpp b/helper/multiprobe_helper.cpp index 0e147aa..005f903 100644 --- a/helper/multiprobe_helper.cpp +++ b/helper/multiprobe_helper.cpp @@ -6,17 +6,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia diff --git a/helper/multiprobe_helper.h b/helper/multiprobe_helper.h index 18a6ddb..0636a27 100644 --- a/helper/multiprobe_helper.h +++ b/helper/multiprobe_helper.h @@ -6,17 +6,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia diff --git a/helper/private_link.h b/helper/private_link.h index 443d911..638fd4b 100644 --- a/helper/private_link.h +++ b/helper/private_link.h @@ -35,11 +35,10 @@ #undef la_objopen struct link_map; -extern unsigned int la_objopen (struct link_map *__map, Lmid_t __lmid, uintptr_t *__cookie); +extern unsigned int la_objopen (struct link_map *__map, Lmid_t __lmid, + uintptr_t *__cookie); -#include // for ptrdiff_t -//#include -//#include +#include /* for ptrdiff_t */ /* Number of extra dynamic section entries for this architecture. By default there are none. */ @@ -47,16 +46,17 @@ extern unsigned int la_objopen (struct link_map *__map, Lmid_t __lmid, uintptr_t // The type of the return value of fixup/profile_fixup. #define DL_FIXUP_VALUE_TYPE ElfW(Addr) -// Construct a value of type DL_FIXUP_VALUE_TYPE from a code address and a link map. +/* Construct a value of type DL_FIXUP_VALUE_TYPE from a code address and a + * link map. */ #define DL_FIXUP_MAKE_VALUE(map, addr) (addr) -// Extract the code address from a value of type DL_FIXUP_MAKE_VALUE. +/* Extract the code address from a value of type DL_FIXUP_MAKE_VALUE. */ #define DL_FIXUP_VALUE_CODE_ADDR(value) (value) #define DL_FIXUP_VALUE_ADDR(value) (value) #define DL_FIXUP_ADDR_VALUE(addr) (addr) struct link_map_machine { - // empty by default + /* empty by default */ }; /* Some internal data structures of the dynamic linker used in the @@ -78,14 +78,16 @@ enum r_dir_status { unknown, nonexisting, existing }; struct r_search_path_elem { - /* This link is only used in the `all_dirs' member of `r_search_path'. */ + /* This link is only used in the `all_dirs' member of + * `r_search_path'. */ struct r_search_path_elem *next; /* Strings saying where the definition came from. */ const char *what; const char *where; - /* Basename for this search path element. The string must end with a slash character. */ + /* Basename for this search path element. The string must end with + * a slash character. */ const char *dirname; size_t dirnamelen; @@ -98,7 +100,7 @@ struct libname_list const char *name; /* Name requested (before search). */ struct libname_list *next; /* Link to next name for this object. */ int dont_free; /* Flag whether this element should be freed - if the object is not entirely unloaded. */ + *if the object is not entirely unloaded. */ }; /* Forward declaration. */ @@ -171,7 +173,7 @@ struct link_map ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM]; - const ElfW(Phdr) *l_phdr; /* Pointer to program header table in core. */ + const ElfW(Phdr) *l_phdr; /* Pointer to program header table in core. */ ElfW(Addr) l_entry; /* Entry point location. */ ElfW(Half) l_phnum; /* Number of program header entries. */ ElfW(Half) l_ldnum; /* Number of dynamic segment entries. */ @@ -216,10 +218,10 @@ struct link_map lt_library, /* Library needed by main executable. */ lt_loaded /* Extra run-time loaded shared object. */ } l_type:2; - unsigned int l_relocated:1; /* Nonzero if object's relocations done. */ - unsigned int l_init_called:1; /* Nonzero if DT_INIT function called. */ - unsigned int l_global:1; /* Nonzero if object in _dl_global_scope. */ - unsigned int l_reserved:2; /* Reserved for internal use. */ + unsigned int l_relocated:1; /* Nonzero if object's relocations done. */ + unsigned int l_init_called:1; /* Nonzero if DT_INIT function called. */ + unsigned int l_global:1; /* Nonzero if object in _dl_global_scope. */ + unsigned int l_reserved:2; /* Reserved for internal use. */ unsigned int l_phdr_allocated:1; /* Nonzero if the data structure pointed to by `l_phdr' is allocated. */ unsigned int l_soname_added:1; /* Nonzero if the SONAME is for sure in @@ -229,11 +231,11 @@ struct link_map unsigned int l_need_tls_init:1; /* Nonzero if GL(dl_init_static_tls) should be called on this link map when relocation finishes. */ - unsigned int l_used:1; /* Nonzero if the DSO is used. */ - unsigned int l_auditing:1; /* Nonzero if the DSO is used in auditing. */ + unsigned int l_used:1; /* Nonzero if the DSO is used. */ + unsigned int l_auditing:1; /* Nonzero if the DSO is used in auditing. */ unsigned int l_audit_any_plt:1; /* Nonzero if at least one audit module is interested in the PLT interception.*/ - unsigned int l_removed:1; /* Nozero if the object cannot be used anymore + unsigned int l_removed:1; /* Nozero if the object cannot be used anymore since it is removed. */ unsigned int l_contiguous:1; /* Nonzero if inter-segment holes are mprotected or if no holes are present at diff --git a/helper/thread_data.c b/helper/thread_data.c index 2500ad7..e4158da 100644 --- a/helper/thread_data.c +++ b/helper/thread_data.c @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia diff --git a/helper/thread_data.h b/helper/thread_data.h index 461391d..a9f7af8 100644 --- a/helper/thread_data.h +++ b/helper/thread_data.h @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia diff --git a/include/aliases.h b/include/aliases.h index dc3230a..a0db9f1 100644 --- a/include/aliases.h +++ b/include/aliases.h @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd diff --git a/include/api_names_global.h b/include/api_names_global.h index 8470292..f0810e8 100644 --- a/include/api_names_global.h +++ b/include/api_names_global.h @@ -1,8 +1,8 @@ #ifndef __API_NAMES_GLOBAL_H__ #define __API_NAMES_GLOBAL_H__ -#define GET_VALUE_2(x,y) x##y -#define GET_VALUE_1(x,y) GET_VALUE_2(x, y) +#define GET_VALUE_2(x, y) x##y +#define GET_VALUE_1(x, y) GET_VALUE_2(x, y) #define PROBE_NAME(func) GET_VALUE_1(PROBE_NAME_PREFIX, func) #define PROBE_NAME_PREFIX __PROBE__ diff --git a/include/app_protocol.h b/include/app_protocol.h index 02dec96..8430efa 100644 --- a/include/app_protocol.h +++ b/include/app_protocol.h @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd diff --git a/include/binproto.h b/include/binproto.h index 73aa6c7..dff5c0a 100644 --- a/include/binproto.h +++ b/include/binproto.h @@ -10,17 +10,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia @@ -474,9 +474,12 @@ static char __attribute__((used)) *pack_ret(char *to, char ret_type, ...) CONCAT(FUNC_ARGS_VA, N_ARG(__VA_ARGS__, C_SEQ_N())(__VA_ARGS__)) #define N_ARG(...) ARG_N(__VA_ARGS__) #define ARG_N(_1n, _1t, _2n, _2t, _3n, _3t, _4n, _4t, _5n, _5t, _6n, _6t, _7n, \ - _7t, _8n, _8t, _9n, _9t, _10n, _10t, _11n, _11t, _12n, _12t, N, ...) N -#define C_SEQ_N() 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0 -#define C_SEQ_NV() 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 0 + _7t, _8n, _8t, _9n, _9t, _10n, _10t, _11n, _11t, _12n, _12t, \ + N, ...) N +#define C_SEQ_N() 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3,\ + 2, 2, 1, 1, 0 +#define C_SEQ_NV() 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, \ + 3, 3, 2, 2, 1, 0 #define DEF_H(_ret_type, _func_name, ...) \ diff --git a/include/common_probe_init.h b/include/common_probe_init.h index be38538..4639945 100644 --- a/include/common_probe_init.h +++ b/include/common_probe_init.h @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd diff --git a/include/da_gl_api_func_list.h b/include/da_gl_api_func_list.h index 5da8ca0..d1e2e1c 100644 --- a/include/da_gl_api_func_list.h +++ b/include/da_gl_api_func_list.h @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia diff --git a/include/da_gles20.h b/include/da_gles20.h index c82b14e..cb2054f 100644 --- a/include/da_gles20.h +++ b/include/da_gles20.h @@ -11,17 +11,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -275,7 +275,7 @@ extern EGLContext eglGetCurrentContext(void); start_nsec = get_current_nsec(); /* FIXME fixed arguments num. increase if neccessary */ -#define PP_RSEQ_N() 10,9,8,7,6,5,4,3,2,1,0 +#define PP_RSEQ_N() 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 #define PP_ARG_N( _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N,...) N #define PP_NARG_(...) PP_ARG_N(__VA_ARGS__) #define GET_ARGS_NUM(...) PP_NARG_(__VA_ARGS__, PP_RSEQ_N()) @@ -293,9 +293,9 @@ extern EGLContext eglGetCurrentContext(void); #define NUM(...) GET_ARGS_NUM(__VA_ARGS__) -#define GET2(a,b) a ## b -#define GET1(a,b) GET2(a,b) -#define GET0(a,b) GET1(a,b) +#define GET2(a, b) a ## b +#define GET1(a, b) GET2(a, b) +#define GET0(a, b) GET1(a, b) #define GET_FIRST_(...) GET0(GET_FIRST_, NUM(__VA_ARGS__)) @@ -363,4 +363,3 @@ extern void (*real_glGetBufferParameteriv)(GLenum target, GLenum value, #endif #endif /* DA_GLES20_H_ */ - diff --git a/include/dacollection.h b/include/dacollection.h index 01312bc..7e43a01 100755 --- a/include/dacollection.h +++ b/include/dacollection.h @@ -11,17 +11,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd diff --git a/include/daerror.h b/include/daerror.h index 82025b4..6db6754 100755 --- a/include/daerror.h +++ b/include/daerror.h @@ -10,17 +10,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd diff --git a/include/dahelper.h b/include/dahelper.h index aae53ce..1040c94 100755 --- a/include/dahelper.h +++ b/include/dahelper.h @@ -11,17 +11,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd diff --git a/include/daprobe.h b/include/daprobe.h index 392a3d4..501b3ec 100644 --- a/include/daprobe.h +++ b/include/daprobe.h @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -47,8 +47,8 @@ extern "C"{ #endif #ifndef likely -#define likely(x) __builtin_expect((x),1) -#define unlikely(x) __builtin_expect((x),0) +#define likely(x) __builtin_expect((x), 1) +#define unlikely(x) __builtin_expect((x), 0) #endif #define __unused __attribute__((unused)) diff --git a/include/file_buffer.h b/include/file_buffer.h index 3d9995e..6ff1819 100644 --- a/include/file_buffer.h +++ b/include/file_buffer.h @@ -6,17 +6,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia diff --git a/include/in_handler.h b/include/in_handler.h index b187c82..ad23d85 100644 --- a/include/in_handler.h +++ b/include/in_handler.h @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia diff --git a/include/khash.h b/include/khash.h index dfc48ef..a72df42 100755 --- a/include/khash.h +++ b/include/khash.h @@ -139,13 +139,13 @@ typedef khint_t khiter_t; #endif #ifndef kcalloc -#define kcalloc(N,Z) calloc(N,Z) +#define kcalloc(N, Z) calloc(N, Z) #endif #ifndef kmalloc #define kmalloc(Z) malloc(Z) #endif #ifndef krealloc -#define krealloc(P,Z) realloc(P,Z) +#define krealloc(P, Z) realloc(P, Z) #endif #ifndef kfree #define kfree(P) free(P) @@ -538,9 +538,9 @@ static kh_inline khint_t __ac_Wang_hash(khint_t key) */ #define kh_foreach(h, kvar, vvar, code) { khint_t __i; \ for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \ - if (!kh_exist(h,__i)) continue; \ - (kvar) = kh_key(h,__i); \ - (vvar) = kh_val(h,__i); \ + if (!kh_exist(h, __i)) continue; \ + (kvar) = kh_key(h, __i); \ + (vvar) = kh_val(h, __i); \ code; \ } } @@ -552,8 +552,8 @@ static kh_inline khint_t __ac_Wang_hash(khint_t key) */ #define kh_foreach_value(h, vvar, code) { khint_t __i; \ for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \ - if (!kh_exist(h,__i)) continue; \ - (vvar) = kh_val(h,__i); \ + if (!kh_exist(h, __i)) continue; \ + (vvar) = kh_val(h, __i); \ code; \ } } diff --git a/include/probeinfo.h b/include/probeinfo.h index 47520c3..5082482 100755 --- a/include/probeinfo.h +++ b/include/probeinfo.h @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -177,42 +177,67 @@ extern "C"{ #define SYNC_API_NOTIFY_ALL 8 #define SYNC_API_OTHER 9 -enum feature_code_0 -{ - FL_MEMORY_ALLOC_PROBING = 0x000000000008ULL, // memory allocation API (glibc) - FL_FILE_API_PROBING = 0x000000000010ULL, // file API (glibc, OSP) - FL_THREAD_API_PROBING = 0x000000000020ULL, // thread API (glibc, OSP) - FL_OSP_UI_API_PROBING = 0x000000000040ULL, // UI API (OSP) - FL_SCREENSHOT = 0x000000000080ULL, // Screenshot - FL_USER_EVENT = 0x000000000100ULL, // events of Touch, Gesture, Orientation, Key - FL_RECORDING = 0x000000000200ULL, // recording the user event - FL_NETWORK_API_PROBING = 0x000000020000ULL, // network API (glibc, OSP, libsoap, openssl) - FL_OPENGL_API_PROBING = 0x000000040000ULL, // openGL API - - FL_MEMORY_ALLOC_ALWAYS_PROBING = 0x000010000000ULL, // all (include external) memory allocation API (glibc) always - FL_FILE_API_ALWAYS_PROBING = 0x000020000000ULL, // all (include external) file API (glibc, OSP) always - FL_THREAD_API_ALWAYS_PROBING = 0x000040000000ULL, // all (include external) thread API (glibc, OSP) always - FL_OSP_UI_API_ALWAYS_PROBING = 0x000080000000ULL, // all (include external) UI API (OSP) always - FL_NETWORK_API_ALWAYS_PROBING = 0x000100000000ULL, // all (include external) network API (glibc, OSP, libsoap, openssl) always - FL_OPENGL_API_ALWAYS_PROBING = 0x000200000000ULL, // all (include external) openGL API always - FL_UI_VIEWER_PROFILING = 0x2000000000000ULL, // ui viewer - FL_LSAN = 0x4000000000000ULL, // enable LSan - - FL_ALWAYS_ON = 0xfffffffffffffULL, // always on feature +enum feature_code_0 { + /* memory allocation API (glibc) */ + FL_MEMORY_ALLOC_PROBING = 0x000000000008ULL, + /* file API (glibc, OSP) */ + FL_FILE_API_PROBING = 0x000000000010ULL, + /* thread API (glibc, OSP) */ + FL_THREAD_API_PROBING = 0x000000000020ULL, + /* UI API (OSP) */ + FL_OSP_UI_API_PROBING = 0x000000000040ULL, + /* Screenshot */ + FL_SCREENSHOT = 0x000000000080ULL, + /* events of Touch, Gesture, Orientation, Key */ + FL_USER_EVENT = 0x000000000100ULL, + /* recording the user event */ + FL_RECORDING = 0x000000000200ULL, + /* network API (glibc, OSP, libsoap, openssl) */ + FL_NETWORK_API_PROBING = 0x000000020000ULL, + /* openGL API */ + FL_OPENGL_API_PROBING = 0x000000040000ULL, + /* all (include external) memory allocation API (glibc) always */ + FL_MEMORY_ALLOC_ALWAYS_PROBING = 0x000010000000ULL, + /* all (include external) file API (glibc, OSP) always */ + FL_FILE_API_ALWAYS_PROBING = 0x000020000000ULL, + /* all (include external) thread API (glibc, OSP) always */ + FL_THREAD_API_ALWAYS_PROBING = 0x000040000000ULL, + /* all (include external) UI API (OSP) always */ + FL_OSP_UI_API_ALWAYS_PROBING = 0x000080000000ULL, + /* all (include external) network API always */ + FL_NETWORK_API_ALWAYS_PROBING = 0x000100000000ULL, + /* all (include external) openGL API always */ + FL_OPENGL_API_ALWAYS_PROBING = 0x000200000000ULL, + /* ui viewer */ + FL_UI_VIEWER_PROFILING = 0x2000000000000ULL, + /* enable LSan */ + FL_LSAN = 0x4000000000000ULL, + /* always on feature */ + FL_ALWAYS_ON = 0xfffffffffffffULL, }; enum feature_code_1 { - FL_MEMORY_ALLOC_PROBING_PRELOAD = 0x0000000000001ULL, // 0x1 memory allocation API (glibc) based on preload - FL_FILE_API_PROBING_PRELOAD = 0x0000000000002ULL, // 0x2 file API (glibc, OSP) based on preload - FL_THREAD_API_PROBING_PRELOAD = 0x0000000000004ULL, // 0x4 thread API (glibc, OSP) based on preload - FL_NETWORK_API_PROBING_PRELOAD = 0x0000000000008ULL, // 0x8 network API (glibc, OSP, libsoap, openssl) based on preload - FL_OPENGL_API_PROBING_PRELOAD = 0x0000000000010ULL, // 0x10 openGL API based on preload - - FL_MEMORY_ALLOC_ALWAYS_PROBING_PRELOAD = 0x0000000000020ULL, // 0x20 all (include external) memory allocation API (glibc) always based on preload - FL_FILE_API_ALWAYS_PROBING_PRELOAD = 0x0000000000040ULL, // 0x40 all (include external) file API (glibc, OSP) always based on preload - FL_THREAD_API_ALWAYS_PROBING_PRELOAD = 0x0000000000080ULL, // 0x80 all (include external) thread API (glibc, OSP) always based on preload - FL_NETWORK_API_ALWAYS_PROBING_PRELOAD = 0x0000000000100ULL, // 0x100 all (include external) network API (glibc, OSP, libsoap, openssl) always based on preload - FL_OPENGL_API_ALWAYS_PROBING_PRELOAD = 0x0000000000200ULL, // 0x200 all (include external) openGL API always based on preload + /* 0x1 memory allocation API (glibc) based on preload */ + FL_MEMORY_ALLOC_PROBING_PRELOAD = 0x0000000000001ULL, + /* 0x2 file API (glibc, OSP) based on preload */ + FL_FILE_API_PROBING_PRELOAD = 0x0000000000002ULL, + /* 0x4 thread API (glibc, OSP) based on preload */ + FL_THREAD_API_PROBING_PRELOAD = 0x0000000000004ULL, + /* 0x8 network API (glibc, OSP, libsoap, openssl) based on preload */ + FL_NETWORK_API_PROBING_PRELOAD = 0x0000000000008ULL, + /* 0x10 openGL API based on preload */ + FL_OPENGL_API_PROBING_PRELOAD = 0x0000000000010ULL, + + /* 0x20 all (include external) memory API always based on preload */ + FL_MEMORY_ALLOC_ALWAYS_PROBING_PRELOAD = 0x0000000000020ULL, + /* 0x40 all (include external) file API always based on preload */ + FL_FILE_API_ALWAYS_PROBING_PRELOAD = 0x0000000000040ULL, + /* 0x80 all (include external) thread API always based on preload */ + FL_THREAD_API_ALWAYS_PROBING_PRELOAD = 0x0000000000080ULL, + /* 0x100 all (include external) network API always based on preload */ + FL_NETWORK_API_ALWAYS_PROBING_PRELOAD = 0x0000000000100ULL, + /* 0x200 all (include external) openGL API always based on preload */ + FL_OPENGL_API_ALWAYS_PROBING_PRELOAD = 0x0000000000200ULL, }; /* Probe flags: diff --git a/lsan/include/sanitizer_common/sanitizer_linux.h b/lsan/include/sanitizer_common/sanitizer_linux.h index eed4f78..39735f4 100644 --- a/lsan/include/sanitizer_common/sanitizer_linux.h +++ b/lsan/include/sanitizer_common/sanitizer_linux.h @@ -42,7 +42,8 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5); // internal_sigaction instead. int internal_sigaction_norestorer(int signum, const void *act, void *oldact); void internal_sigdelset(__sanitizer_sigset_t *set, int signum); -#if defined(__x86_64__) || defined(__mips__) || defined(__aarch64__) || defined(__arm__) || defined(__i386__) +#if defined(__x86_64__) || defined(__mips__) || defined(__aarch64__) \ + || defined(__arm__) || defined(__i386__) uptr internal_clone(int (*fn)(void *), void *child_stack, int flags, void *arg, int *parent_tidptr, void *newtls, int *child_tidptr); #endif diff --git a/probe_capi/capi_appfw.c b/probe_capi/capi_appfw.c index ffbb154..b79f6f9 100644 --- a/probe_capi/capi_appfw.c +++ b/probe_capi/capi_appfw.c @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -39,20 +39,22 @@ ui_app_lifecycle_callback_s uiAppCallback; -#define PACK_ORIGINAL_APPFWCYCLE(API_ID, RTYPE, RVAL, INPUTFORMAT, ...) \ - newerrno = errno; \ - do { \ - CREATE_GENERIC_PROBE_DATA((uint64_t)0xffffffff, blockresult, orig);\ - PREPARE_LOCAL_BUF(); \ - PACK_COMMON_BEGIN(MSG_PROBE_LIFECYCLE, API_ID, INPUTFORMAT, __VA_ARGS__); \ - /* TODO Check address */ \ - /* Always feature */ \ - PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ - FLUSH_LOCAL_BUF(); \ - } while(0); \ +#define PACK_ORIGINAL_APPFWCYCLE(API_ID, RTYPE, RVAL, INPUTFORMAT, ...) \ + newerrno = errno; \ + do { \ + CREATE_GENERIC_PROBE_DATA((uint64_t)0xffffffff, blockresult, \ + orig); \ + PREPARE_LOCAL_BUF(); \ + PACK_COMMON_BEGIN(MSG_PROBE_LIFECYCLE, API_ID, INPUTFORMAT, \ + __VA_ARGS__); \ + /* TODO Check address */ \ + /* Always feature */ \ + PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ + FLUSH_LOCAL_BUF(); \ + } while (0); \ errno = (newerrno != 0) ? newerrno : olderrno -/************************************ UI APP ******************************************/ +/******************************** UI APP **************************************/ static bool _ui_dalc_app_create(void *user_data) { bool bret = false; @@ -119,9 +121,12 @@ static void _ui_dalc_app_control(app_control_h handle, void *user_data) static void *handle_ui_app_main; -static int handler_ui_app_main(int argc, char **argv, ui_app_lifecycle_callback_s *callback, void *user_data) +static int handler_ui_app_main(int argc, char **argv, + ui_app_lifecycle_callback_s *callback, + void *user_data) { - typedef int (*func_t)(int, char **, ui_app_lifecycle_callback_s *, void *); + typedef int (*func_t)(int, char **, ui_app_lifecycle_callback_s *, + void *); int ret; uiAppCallback.create = callback->create; @@ -143,7 +148,8 @@ static int handler_ui_app_main(int argc, char **argv, ui_app_lifecycle_callback_ if (callback->app_control) callback->app_control = _ui_dalc_app_control; - ret = MULTIPROBE_CALL(handle_ui_app_main, func_t, argc, argv, callback, user_data); + ret = MULTIPROBE_CALL(handle_ui_app_main, func_t, argc, argv, callback, + user_data); callback->create = uiAppCallback.create; callback->terminate = uiAppCallback.terminate; @@ -156,5 +162,6 @@ static int handler_ui_app_main(int argc, char **argv, ui_app_lifecycle_callback_ static void __attribute__((constructor)) ctor() { - handle_ui_app_main = multiprobe_reg("ui_app_main", (void *)handler_ui_app_main, true); + handle_ui_app_main = multiprobe_reg("ui_app_main", + (void *)handler_ui_app_main, true); } diff --git a/probe_event/da_event.c b/probe_event/da_event.c index 83f765c..bee7c4a 100755 --- a/probe_event/da_event.c +++ b/probe_event/da_event.c @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -51,7 +51,7 @@ static int convert_angle(int angle) { int os = _OS_NONE; - switch(angle) { + switch (angle) { case 0: os = _OS_PORTRAIT; break; diff --git a/probe_event/da_event.h b/probe_event/da_event.h index 95db159..fe5448c 100755 --- a/probe_event/da_event.h +++ b/probe_event/da_event.h @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -104,8 +104,9 @@ enum _orientation_status * macros for event probe * * log format: - * SeqNumber`,ApiName`,Time`,Pid`,Tid`,InputParm`,Return`,PCAddr`,Error`,x`,y`,\n - * callstack_start`,callstack`,callstack_end + * SeqNumber`,ApiName`,Time`,Pid`,Tid`,InputParm`,Return`,PCAddr`, Error`, + * x`,y`,\n + * callstack_start`,callstack`,callstack_end * *******************************************************************/ @@ -140,7 +141,8 @@ enum _orientation_status POST_UNCONDITIONAL_BLOCK_BEGIN(LC_UIEVENT); \ APPEND_LOG_INPUT(INPUTFORMAT, __VA_ARGS__); \ log.length += sprintf(log.data + log.length, \ - "`,`,`,`,1`,`,%d`,%d`,%d", x, y, EVENTTYPE);\ + "`, `, `, `, 1`, `, %d`, %d`, %d", x, y, \ + EVENTTYPE); \ APPEND_LOG_NULL_CALLSTACK(); \ POST_UNCONDITIONAL_BLOCK_END(); \ oldtime = timestamp; \ diff --git a/probe_event/event_probes_list.h b/probe_event/event_probes_list.h index 7f99c5e..7ca718c 100644 --- a/probe_event/event_probes_list.h +++ b/probe_event/event_probes_list.h @@ -4,7 +4,8 @@ /* TODO generate PROBES_LIST with api_names.txt */ #define PROBES_LIST \ - X(PROBE_NAME(elm_gesture_layer_cb_set), elm_gesture_layer_cb_set, GT_TARGET_PROBE) + X(PROBE_NAME(elm_gesture_layer_cb_set), elm_gesture_layer_cb_set, \ + GT_TARGET_PROBE) /* X-macros replaced with func id's enumeration */ diff --git a/probe_event/gesture.c b/probe_event/gesture.c index e8adfeb..0559cbb 100755 --- a/probe_event/gesture.c +++ b/probe_event/gesture.c @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -204,7 +204,7 @@ Evas_Event_Flags __common_elm_gesture_layer_cb(void *data , void *event_info) res = d->cb(d->data, event_info); inc_current_event_index(); - CREATE_GENERIC_PROBE_DATA((uint64_t)0xffffffff, 0, 0); + CREATE_GENERIC_PROBE_DATA((uint64_t)0xffffffff, 0, 0); PREPARE_LOCAL_BUF(); PACK_COMMON_BEGIN(MSG_PROBE_UIEVENT, API_ID___common_elm_gesture_layer_cb, "p", CALLER_ADDRESS); /* Always feature */ @@ -248,4 +248,3 @@ void PROBE_NAME(elm_gesture_layer_cb_set)(Evas_Object *obj, Elm_Gesture_Type idx elm_gesture_layer_cb_setp(obj, idx, cb_type, __common_elm_gesture_layer_cb, elm); return; } - diff --git a/probe_event/gesture.cpp b/probe_event/gesture.cpp index 4bef206..c6338c7 100755 --- a/probe_event/gesture.cpp +++ b/probe_event/gesture.cpp @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -38,18 +38,21 @@ #include "gesture.h" #include "binproto.h" -#define PACK_GESTURE_EVENT(API_ID, _GESTURETYPE, _X, _Y, _INFO1, _INFO2, _ARGDETECTOR) \ +#define PACK_GESTURE_EVENT(API_ID, _GESTURETYPE, _X, _Y, _INFO1, _INFO2, \ + _ARGDETECTOR) \ do { \ char info1_str[16]; \ inc_current_event_index(); \ CREATE_GENERIC_PROBE_DATA((uint64_t)0xffffffff, 0, orig); \ PREPARE_LOCAL_BUF(); \ - PACK_COMMON_BEGIN(MSG_PROBE_UIEVENT, API_ID, "p", voidp_to_uint64(_ARGDETECTOR)); \ + PACK_COMMON_BEGIN(MSG_PROBE_UIEVENT, API_ID, "p", \ + voidp_to_uint64(_ARGDETECTOR)); \ /* TODO Check if address is really unused here */ \ /* Always feature */ \ PACK_COMMON_END('v', 0, 0, probe_data); \ sprintf(info1_str, "%d", _INFO1); \ - PACK_UIEVENT(_EVENT_GESTURE, _GESTURETYPE, _X, _Y, info1_str, _INFO2); \ + PACK_UIEVENT(_EVENT_GESTURE, _GESTURETYPE, _X, _Y, \ + info1_str, _INFO2); \ FLUSH_LOCAL_BUF(); \ } while (0) @@ -65,10 +68,9 @@ GestureEventListener::~GestureEventListener() } -void GestureEventListener::OnCustomGestureCanceled (TouchGestureDetector &gestureDetector) +void GestureEventListener::OnCustomGestureCanceled(TouchGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnCustomGestureCanceled__TouchGestureDetector__gestureDetector_, _GESTURE_CUSTOM, 0, 0, 0, 0, &gestureDetector); @@ -76,10 +78,9 @@ void GestureEventListener::OnCustomGestureCanceled (TouchGestureDetector &gestur } } -void GestureEventListener::OnCustomGestureChanged (TouchGestureDetector &gestureDetector) +void GestureEventListener::OnCustomGestureChanged(TouchGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnCustomGestureChanged__TouchGestureDetector__gestureDetector_, _GESTURE_CUSTOM, 0, 0, 0, 0, &gestureDetector); @@ -87,10 +88,9 @@ void GestureEventListener::OnCustomGestureChanged (TouchGestureDetector &gesture } } -void GestureEventListener::OnCustomGestureFinished (TouchGestureDetector &gestureDetector) +void GestureEventListener::OnCustomGestureFinished(TouchGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnCustomGestureFinished__TouchGestureDetector__gestureDetector_, _GESTURE_CUSTOM, 0, 0, 0, 0, &gestureDetector); @@ -98,10 +98,9 @@ void GestureEventListener::OnCustomGestureFinished (TouchGestureDetector &gestur } } -void GestureEventListener::OnCustomGestureStarted (TouchGestureDetector &gestureDetector) +void GestureEventListener::OnCustomGestureStarted(TouchGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnCustomGestureStarted__TouchGestureDetector__gestureDetector_, _GESTURE_CUSTOM, 0, 0, 0, 0, &gestureDetector); @@ -109,10 +108,9 @@ void GestureEventListener::OnCustomGestureStarted (TouchGestureDetector &gesture } } -void GestureEventListener::OnFlickGestureCanceled (TouchFlickGestureDetector &gestureDetector) +void GestureEventListener::OnFlickGestureCanceled(TouchFlickGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { int x = 0, y = 0, dur = 0; @@ -122,16 +120,16 @@ void GestureEventListener::OnFlickGestureCanceled (TouchFlickGestureDetector &ge dur = gestureDetector.GetDuration(); direction = gestureDetector.GetDirection(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnFlickGestureCanceled__TouchFlickGestureDetector__gestureDetector_, - _GESTURE_FLICK, x, y, dur, (int)direction, &gestureDetector); + _GESTURE_FLICK, x, y, dur, (int)direction, + &gestureDetector); } probeBlockEnd(); } } -void GestureEventListener::OnFlickGestureDetected (TouchFlickGestureDetector &gestureDetector) +void GestureEventListener::OnFlickGestureDetected(TouchFlickGestureDetector &gestureDetecto) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { int x = 0, y = 0, dur = 0; @@ -141,16 +139,16 @@ void GestureEventListener::OnFlickGestureDetected (TouchFlickGestureDetector &ge dur = gestureDetector.GetDuration(); direction = gestureDetector.GetDirection(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnFlickGestureDetected__TouchFlickGestureDetector__gestureDetector_, - _GESTURE_FLICK, x, y, dur, (int)direction, &gestureDetector); + _GESTURE_FLICK, x, y, dur, (int)direction, + &gestureDetector); } probeBlockEnd(); } } -void GestureEventListener::OnLongPressGestureCanceled (TouchLongPressGestureDetector &gestureDetector) +void GestureEventListener::OnLongPressGestureCanceled(TouchLongPressGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { int moveallow = 0, tcount = 0, dur = 0; @@ -159,16 +157,16 @@ void GestureEventListener::OnLongPressGestureCanceled (TouchLongPressGestureDete dur = gestureDetector.GetDuration(); tcount = gestureDetector.GetTouchCount(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnLongPressGestureCanceled__TouchLongPressGestureDetector__gestureDetector_, - _GESTURE_LONGPRESS, moveallow, 0, dur, tcount, &gestureDetector); + _GESTURE_LONGPRESS, moveallow, 0, dur, tcount, + &gestureDetector); } probeBlockEnd(); } } -void GestureEventListener::OnLongPressGestureDetected (TouchLongPressGestureDetector &gestureDetector) +void GestureEventListener::OnLongPressGestureDetected(TouchLongPressGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { int moveallow = 0, tcount = 0, dur = 0; @@ -177,16 +175,16 @@ void GestureEventListener::OnLongPressGestureDetected (TouchLongPressGestureDete dur = gestureDetector.GetDuration(); tcount = gestureDetector.GetTouchCount(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnLongPressGestureDetected__TouchLongPressGestureDetector__gestureDetector_, - _GESTURE_LONGPRESS, moveallow, 0, dur, tcount, &gestureDetector); + _GESTURE_LONGPRESS, moveallow, 0, dur, tcount, + &gestureDetector); } probeBlockEnd(); } } -void GestureEventListener::OnPanningGestureCanceled (TouchPanningGestureDetector &gestureDetector) +void GestureEventListener::OnPanningGestureCanceled(TouchPanningGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { int tcount = 0; @@ -199,10 +197,9 @@ void GestureEventListener::OnPanningGestureCanceled (TouchPanningGestureDetector } } -void GestureEventListener::OnPanningGestureChanged (TouchPanningGestureDetector &gestureDetector) +void GestureEventListener::OnPanningGestureChanged(TouchPanningGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { int tcount = 0; @@ -215,10 +212,9 @@ void GestureEventListener::OnPanningGestureChanged (TouchPanningGestureDetector } } -void GestureEventListener::OnPanningGestureFinished (TouchPanningGestureDetector &gestureDetector) +void GestureEventListener::OnPanningGestureFinished(TouchPanningGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { int tcount = 0; @@ -231,10 +227,9 @@ void GestureEventListener::OnPanningGestureFinished (TouchPanningGestureDetector } } -void GestureEventListener::OnPanningGestureStarted (TouchPanningGestureDetector &gestureDetector) +void GestureEventListener::OnPanningGestureStarted(TouchPanningGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { int tcount = 0; @@ -247,10 +242,9 @@ void GestureEventListener::OnPanningGestureStarted (TouchPanningGestureDetector } } -void GestureEventListener::OnPinchGestureCanceled (TouchPinchGestureDetector &gestureDetector) +void GestureEventListener::OnPinchGestureCanceled(TouchPinchGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { Tizen::Graphics::Point point; @@ -259,16 +253,16 @@ void GestureEventListener::OnPinchGestureCanceled (TouchPinchGestureDetector &ge point = gestureDetector.GetCenterPoint(); scale = gestureDetector.GetScale(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnPinchGestureCanceled__TouchPinchGestureDetector__gestureDetector_, - _GESTURE_PINCH, point.x, point.y, scale, 0, &gestureDetector); + _GESTURE_PINCH, point.x, point.y, scale, 0, + &gestureDetector); } probeBlockEnd(); } } -void GestureEventListener::OnPinchGestureChanged (TouchPinchGestureDetector &gestureDetector) +void GestureEventListener::OnPinchGestureChanged(TouchPinchGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { Tizen::Graphics::Point point; @@ -277,16 +271,16 @@ void GestureEventListener::OnPinchGestureChanged (TouchPinchGestureDetector &ges point = gestureDetector.GetCenterPoint(); scale = gestureDetector.GetScale(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnPinchGestureChanged__TouchPinchGestureDetector__gestureDetector_, - _GESTURE_PINCH, point.x, point.y, scale, 0, &gestureDetector); + _GESTURE_PINCH, point.x, point.y, scale, 0, + &gestureDetector); } probeBlockEnd(); } } -void GestureEventListener::OnPinchGestureFinished (TouchPinchGestureDetector &gestureDetector) +void GestureEventListener::OnPinchGestureFinished(TouchPinchGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { Tizen::Graphics::Point point; @@ -295,16 +289,16 @@ void GestureEventListener::OnPinchGestureFinished (TouchPinchGestureDetector &ge point = gestureDetector.GetCenterPoint(); scale = gestureDetector.GetScale(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnPinchGestureFinished__TouchPinchGestureDetector__gestureDetector_, - _GESTURE_PINCH, point.x, point.y, scale, 0, &gestureDetector); + _GESTURE_PINCH, point.x, point.y, scale, 0, + &gestureDetector); } probeBlockEnd(); } } -void GestureEventListener::OnPinchGestureStarted (TouchPinchGestureDetector &gestureDetector) +void GestureEventListener::OnPinchGestureStarted(TouchPinchGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { Tizen::Graphics::Point point; @@ -313,16 +307,16 @@ void GestureEventListener::OnPinchGestureStarted (TouchPinchGestureDetector &ges point = gestureDetector.GetCenterPoint(); scale = gestureDetector.GetScale(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnPinchGestureStarted__TouchPinchGestureDetector__gestureDetector_, - _GESTURE_PINCH, point.x, point.y, scale, 0, &gestureDetector); + _GESTURE_PINCH, point.x, point.y, scale, 0, + &gestureDetector); } probeBlockEnd(); } } -void GestureEventListener::OnRotationGestureCanceled (TouchRotationGestureDetector &gestureDetector) +void GestureEventListener::OnRotationGestureCanceled(TouchRotationGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { int distance = 0; @@ -331,16 +325,16 @@ void GestureEventListener::OnRotationGestureCanceled (TouchRotationGestureDetect distance = gestureDetector.GetDistance(); angle = gestureDetector.GetAngle(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnRotationGestureCanceled__TouchRotationGestureDetector__gestureDetector_, - _GESTURE_ROTATION, 0, 0, distance, static_cast(angle), &gestureDetector); + _GESTURE_ROTATION, 0, 0, distance, + static_cast(angle), &gestureDetector); } probeBlockEnd(); } } -void GestureEventListener::OnRotationGestureChanged (TouchRotationGestureDetector &gestureDetector) +void GestureEventListener::OnRotationGestureChanged(TouchRotationGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { int distance = 0; @@ -349,16 +343,16 @@ void GestureEventListener::OnRotationGestureChanged (TouchRotationGestureDetecto distance = gestureDetector.GetDistance(); angle = gestureDetector.GetAngle(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnRotationGestureChanged__TouchRotationGestureDetector__gestureDetector_, - _GESTURE_ROTATION, 0, 0, distance, static_cast(angle), &gestureDetector); + _GESTURE_ROTATION, 0, 0, distance, + static_cast(angle), &gestureDetector); } probeBlockEnd(); } } -void GestureEventListener::OnRotationGestureFinished (TouchRotationGestureDetector &gestureDetector) +void GestureEventListener::OnRotationGestureFinished(TouchRotationGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { int distance = 0; @@ -367,16 +361,16 @@ void GestureEventListener::OnRotationGestureFinished (TouchRotationGestureDetect distance = gestureDetector.GetDistance(); angle = gestureDetector.GetAngle(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnRotationGestureFinished__TouchRotationGestureDetector__gestureDetector_, - _GESTURE_ROTATION, 0, 0, distance, static_cast(angle), &gestureDetector); + _GESTURE_ROTATION, 0, 0, distance, + static_cast(angle), &gestureDetector); } probeBlockEnd(); } } -void GestureEventListener::OnRotationGestureStarted (TouchRotationGestureDetector &gestureDetector) +void GestureEventListener::OnRotationGestureStarted(TouchRotationGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { int distance = 0; @@ -385,16 +379,16 @@ void GestureEventListener::OnRotationGestureStarted (TouchRotationGestureDetecto distance = gestureDetector.GetDistance(); angle = gestureDetector.GetAngle(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnRotationGestureStarted__TouchRotationGestureDetector__gestureDetector_, - _GESTURE_ROTATION, 0, 0, distance, static_cast(angle), &gestureDetector); + _GESTURE_ROTATION, 0, 0, distance, + static_cast(angle), &gestureDetector); } probeBlockEnd(); } } -void GestureEventListener::OnTapGestureCanceled (TouchTapGestureDetector &gestureDetector) +void GestureEventListener::OnTapGestureCanceled(TouchTapGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { int move = 0, tapcount = 0, touchcount = 0, interval = 0; @@ -404,16 +398,16 @@ void GestureEventListener::OnTapGestureCanceled (TouchTapGestureDetector &gestur interval = gestureDetector.GetTapInterval(); touchcount = gestureDetector.GetTouchCount(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnTapGestureCanceled__TouchTapGestureDetector__gestureDetector_, - _GESTURE_TAP, move, tapcount, interval, touchcount, &gestureDetector); + _GESTURE_TAP, move, tapcount, interval, touchcount, + &gestureDetector); } probeBlockEnd(); } } -void GestureEventListener::OnTapGestureDetected (TouchTapGestureDetector &gestureDetector) +void GestureEventListener::OnTapGestureDetected(TouchTapGestureDetector &gestureDetector) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { + if(isOptionEnabled(FL_USER_EVENT, 0)) { probeBlockStart(); { int move = 0, tapcount = 0, touchcount = 0, interval = 0; @@ -423,7 +417,8 @@ void GestureEventListener::OnTapGestureDetected (TouchTapGestureDetector &gestur interval = gestureDetector.GetTapInterval(); touchcount = gestureDetector.GetTouchCount(); PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnTapGestureDetected__TouchTapGestureDetector__gestureDetector_, - _GESTURE_TAP, move, tapcount, interval, touchcount, &gestureDetector); + _GESTURE_TAP, move, tapcount, interval, touchcount, + &gestureDetector); } probeBlockEnd(); } diff --git a/probe_event/gesture.h b/probe_event/gesture.h index 9192328..4ca888a 100644 --- a/probe_event/gesture.h +++ b/probe_event/gesture.h @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd diff --git a/probe_event/gesture_probes.h b/probe_event/gesture_probes.h index 35b185e..f502442 100644 --- a/probe_event/gesture_probes.h +++ b/probe_event/gesture_probes.h @@ -1,8 +1,8 @@ #ifndef __GESTURE_PROBES_H__ #define __GESTURE_PROBES_H__ -void PROBE_NAME(elm_gesture_layer_cb_set)(Evas_Object *obj, Elm_Gesture_Type idx, - Elm_Gesture_State cb_type, Elm_Gesture_Event_Cb cb, - void *data); +void PROBE_NAME(elm_gesture_layer_cb_set)(Evas_Object *obj, + Elm_Gesture_Type idx, Elm_Gesture_State cb_type, + Elm_Gesture_Event_Cb cb, void *data); #endif /* __GESTURE_PROBES_H__ */ diff --git a/probe_event/keytouch.c b/probe_event/keytouch.c index 7f6a7ed..46c40bc 100755 --- a/probe_event/keytouch.c +++ b/probe_event/keytouch.c @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -50,8 +50,8 @@ bool touch_pressed = false; static Ecore_Event_Handler *ecore_event_evas_handlers[5]; -#define PACK_HW_EVENT(API_ID, _EVENTTYPE, _DETAILTYPE, _X, _Y, _KEYCODE, _EXTRA, \ - _ARGDATA, _ARGTYPE, _ARGEVENT) \ +#define PACK_HW_EVENT(API_ID, _EVENTTYPE, _DETAILTYPE, _X, _Y, _KEYCODE, \ + _EXTRA, _ARGDATA, _ARGTYPE, _ARGEVENT) \ do { \ CREATE_GENERIC_PROBE_DATA((uint64_t)0xffffffff, 0, 0); \ inc_current_event_index(); \ @@ -65,19 +65,15 @@ static Ecore_Event_Handler *ecore_event_evas_handlers[5]; FLUSH_LOCAL_BUF(); \ } while (0) -Eina_Bool PROBE_NAME(ecore_event_evas_key_down)(void *data, int type, void *event) +Eina_Bool PROBE_NAME(ecore_event_evas_key_down)(void *data, int type, + void *event) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { - if(event != NULL) - { - Ecore_Event_Key* pEv = (Ecore_Event_Key*)event; - if(strcasestr(pEv->keyname, "volume") == NULL) - { - PACK_HW_EVENT(API_ID_ecore_event_evas_key_down, - _EVENT_KEY, _KEY_PRESSED, 0, 0, pEv->keyname, 0, \ - data, type, event); - } + if (isOptionEnabled(FL_USER_EVENT, 0) && event) { + Ecore_Event_Key* pEv = (Ecore_Event_Key*)event; + if (strcasestr(pEv->keyname, "volume") == NULL) { + PACK_HW_EVENT(API_ID_ecore_event_evas_key_down, + _EVENT_KEY, _KEY_PRESSED, 0, 0, + pEv->keyname, 0, data, type, event); } } @@ -86,71 +82,58 @@ Eina_Bool PROBE_NAME(ecore_event_evas_key_down)(void *data, int type, void *even Eina_Bool PROBE_NAME(ecore_event_evas_key_up)(void *data, int type, void *event) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { - if(event != NULL) - { - Ecore_Event_Key* pEv = (Ecore_Event_Key*)event; - if(strcasestr(pEv->keyname, "volume") == NULL) - { - PACK_HW_EVENT(API_ID_ecore_event_evas_key_up, - _EVENT_KEY, _KEY_RELEASED, 0, 0, pEv->keyname, 0, \ - data, type, event); - } + if (isOptionEnabled(FL_USER_EVENT, 0) && event) { + Ecore_Event_Key* pEv = (Ecore_Event_Key*)event; + if (strcasestr(pEv->keyname, "volume") == NULL) { + PACK_HW_EVENT(API_ID_ecore_event_evas_key_up, + _EVENT_KEY, _KEY_RELEASED, 0, 0, + pEv->keyname, 0, data, type, event); } } return ECORE_CALLBACK_PASS_ON; } -Eina_Bool PROBE_NAME(ecore_event_evas_mouse_button_down)(void *data, int type, void *event) +Eina_Bool PROBE_NAME(ecore_event_evas_mouse_button_down)(void *data, int type, + void *event) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { - if(event != NULL) - { - Ecore_Event_Mouse_Button* pEv = (Ecore_Event_Mouse_Button*)event; - touch_pressed = true; - PACK_HW_EVENT(API_ID_ecore_event_evas_mouse_button_down, - _EVENT_TOUCH, _TOUCH_PRESSED, pEv->root.x, pEv->root.y, "", pEv->multi.device, \ - data, type, event); - } + if (isOptionEnabled(FL_USER_EVENT, 0) && event) { + Ecore_Event_Mouse_Button* pEv = + (Ecore_Event_Mouse_Button*)event; + touch_pressed = true; + PACK_HW_EVENT(API_ID_ecore_event_evas_mouse_button_down, + _EVENT_TOUCH, _TOUCH_PRESSED, pEv->root.x, + pEv->root.y, "", pEv->multi.device, + data, type, event); } return ECORE_CALLBACK_PASS_ON; } -Eina_Bool PROBE_NAME(ecore_event_evas_mouse_button_up)(void *data, int type, void *event) +Eina_Bool PROBE_NAME(ecore_event_evas_mouse_button_up)(void *data, int type, + void *event) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { - if(event != NULL) - { - Ecore_Event_Mouse_Button* pEv = (Ecore_Event_Mouse_Button*)event; - touch_pressed = false; - PACK_HW_EVENT(API_ID_ecore_event_evas_mouse_button_up, - _EVENT_TOUCH, _TOUCH_RELEASED, pEv->root.x, pEv->root.y, "", pEv->multi.device, \ - data, type, event); - } + if (isOptionEnabled(FL_USER_EVENT, 0) && event) { + Ecore_Event_Mouse_Button* pEv = + (Ecore_Event_Mouse_Button*)event; + touch_pressed = false; + PACK_HW_EVENT(API_ID_ecore_event_evas_mouse_button_up, + _EVENT_TOUCH, _TOUCH_RELEASED, pEv->root.x, + pEv->root.y, "", pEv->multi.device, + data, type, event); } return ECORE_CALLBACK_PASS_ON; } -Eina_Bool PROBE_NAME(ecore_event_evas_mouse_move)(void *data, int type, void *event) +Eina_Bool PROBE_NAME(ecore_event_evas_mouse_move)(void *data, int type, + void *event) { - if(isOptionEnabled(FL_USER_EVENT, 0)) - { - if(touch_pressed) - { - if(event != NULL) - { - Ecore_Event_Mouse_Move* pEv = (Ecore_Event_Mouse_Move*)event; - PACK_HW_EVENT(API_ID_ecore_event_evas_mouse_move, - _EVENT_TOUCH, _TOUCH_MOVED, pEv->root.x, pEv->root.y, "", pEv->multi.device, \ - data, type, event); - } - } + if (isOptionEnabled(FL_USER_EVENT, 0) && touch_pressed && event) { + Ecore_Event_Mouse_Move* pEv = (Ecore_Event_Mouse_Move*)event; + PACK_HW_EVENT(API_ID_ecore_event_evas_mouse_move, _EVENT_TOUCH, + _TOUCH_MOVED, pEv->root.x, pEv->root.y, "", + pEv->multi.device, data, type, event); } return ECORE_CALLBACK_PASS_ON; diff --git a/probe_event/keytouch.h b/probe_event/keytouch.h index 8a4ee32..6f5187e 100644 --- a/probe_event/keytouch.h +++ b/probe_event/keytouch.h @@ -1,11 +1,16 @@ #ifndef __KEYTOUCH_H__ #define __KEYTOUCH_H__ -Eina_Bool PROBE_NAME(ecore_event_evas_key_down)(void *data, int type, void *event); -Eina_Bool PROBE_NAME(ecore_event_evas_key_up)(void *data, int type, void *event); -Eina_Bool PROBE_NAME(ecore_event_evas_mouse_button_down)(void *data, int type, void *event); -Eina_Bool PROBE_NAME(ecore_event_evas_mouse_button_up)(void *data, int type, void *event); -Eina_Bool PROBE_NAME(ecore_event_evas_mouse_move)(void *data, int type, void *event); +Eina_Bool PROBE_NAME(ecore_event_evas_key_down)(void *data, int type, + void *event); +Eina_Bool PROBE_NAME(ecore_event_evas_key_up)(void *data, int type, + void *event); +Eina_Bool PROBE_NAME(ecore_event_evas_mouse_button_down)(void *data, int type, + void *event); +Eina_Bool PROBE_NAME(ecore_event_evas_mouse_button_up)(void *data, int type, + void *event); +Eina_Bool PROBE_NAME(ecore_event_evas_mouse_move)(void *data, int type, + void *event); void mouse_key_init(void); #endif /* __KEYTOUCH_H__ */ diff --git a/probe_event/orientation.c b/probe_event/orientation.c index 43f8eac..1675f77 100644 --- a/probe_event/orientation.c +++ b/probe_event/orientation.c @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd diff --git a/probe_event/probe_event.c b/probe_event/probe_event.c index 30ced30..ad0b150 100644 --- a/probe_event/probe_event.c +++ b/probe_event/probe_event.c @@ -38,7 +38,7 @@ enum event_funcs_id_t get_event_feature_id(void *ptr) /* X-macros replaced with structures defenitions */ /* Used only for probes from target file */ #define X(func_name, orig_name, type) \ - { (ElfW(Addr))& func_name, #orig_name, type, (ElfW(Addr))0 }, + { (ElfW(Addr)) &func_name, #orig_name, type, (ElfW(Addr))0 }, static struct probe_desc_t event_probes[] = { PROBES_LIST diff --git a/probe_file/da_io.h b/probe_file/da_io.h index f62696b..0b6302d 100755 --- a/probe_file/da_io.h +++ b/probe_file/da_io.h @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -44,18 +44,18 @@ /******************************************************************** * RESOURCE PROBE MACRO * - * log format - * SeqNumber`,ApiName`,Time`,Pid`,Tid`,InputParm`,Return`,PCAddr`,Error`, - * Size`,FDValue`,FDType`,FDApiType`, \n - * callstack_start`,callstack`,callstack_end + * - log format: + * SeqNumber`,ApiName`,Time`,Pid`,Tid`,InputParm`,Return`,PCAddr`,Error`, + * Size`,FDValue`,FDType`,FDApiType`, \n + * callstack_start`,callstack`,callstack_end * - * fd type - * FD_TYPE_FILE, FD_TYPE_SOCKET + * - fd type: + * FD_TYPE_FILE, FD_TYPE_SOCKET * - * fd api type - * FD_API_TYPE_OPEN, FD_API_TYPE_CLOSE, FD_API_TYPE_READ, FD_API_TYPE_WRITE, - * FD_API_TYPE_DIRECTORY, FD_API_TYPE_PERMISSION, FD_API_TYPE_OTHER, - * FD_API_TYPE_SEND, FD_API_TYPE_RECEIVE, FD_API_TYPE_OPTION, FD_API_TYPE_MANAGE + * - fd api type: + * FD_API_TYPE_OPEN, FD_API_TYPE_CLOSE, FD_API_TYPE_READ, FD_API_TYPE_WRITE, + * FD_API_TYPE_DIRECTORY, FD_API_TYPE_PERMISSION, FD_API_TYPE_OTHER, + * FD_API_TYPE_SEND, FD_API_TYPE_RECEIVE, FD_API_TYPE_OPTION, FD_API_TYPE_MANAGE * ************************************************************************/ @@ -80,11 +80,12 @@ // POST_PROBEBLOCK_MIDDLE for file // ================================================================= -#define POST_PACK_PROBEBLOCK_MIDDLE_FD(SIZE, FD, APITYPE) \ - do { \ - PACK_RESOURCE(SIZE, FD, APITYPE, \ - (_fstatret == 0 ? _statbuf.st_size : 0), _filepath); \ - FLUSH_LOCAL_BUF(); \ +#define POST_PACK_PROBEBLOCK_MIDDLE_FD(SIZE, FD, APITYPE) \ + do { \ + PACK_RESOURCE(SIZE, FD, APITYPE, \ + (_fstatret == 0 ? _statbuf.st_size : 0), \ + _filepath); \ + FLUSH_LOCAL_BUF(); \ } while (0) #define POST_PACK_PROBEBLOCK_MIDDLE_NOFD(SIZE, APITYPE) \ @@ -110,68 +111,80 @@ // macro for filesize // ================================================================== -#define DEFINE_FILESIZE_FD(fd) _fd = (fd); _filesize = get_fd_filesize(_fd); -#define DEFINE_FILESIZE_FP(fp) _fd = checked_fileno(fp); _filesize = get_fd_filesize(_fd); -#define DEFINE_FILESIZE_0() _fd = _filesize = 0; +#define DEFINE_FILESIZE_FD(fd) \ + _fd = (fd); \ + _filesize = get_fd_filesize(_fd); +#define DEFINE_FILESIZE_FP(fp) \ + _fd = checked_fileno(fp); \ + _filesize = get_fd_filesize(_fd); +#define DEFINE_FILESIZE_0() \ + _fd = _filesize = 0; /*! - * Macro AFTER_PACK_ORIGINAL_FD is used in and only in functions, which should report - * only about regular files or sockets, so this logic implemented in macro. - * Watch out when reusing it somewhere else + * Macro AFTER_PACK_ORIGINAL_FD is used in and only in functions, which should + * report only about regular files or sockets, so this logic implemented in + * macro. Watch out when reusing it somewhere else */ -#define AFTER_PACK_ORIGINAL_FD(API_ID, RTYPE, RVAL, SIZE, FD, APITYPE, \ - INPUTFORMAT, ...) \ -do { \ - POST_PACK_PROBEBLOCK_BEGIN(); \ - _fstatret = fstat(FD, &_statbuf); \ - if (_fstatret == -1) { \ - PRINTWRN("fstat returns error\n"); \ - } else if (stat_regular_or_socket_p(&_statbuf)) { \ - PREPARE_LOCAL_BUF(); \ - PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, __VA_ARGS__); \ - PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ - POST_PACK_PROBEBLOCK_MIDDLE_FD(SIZE, FD, APITYPE); \ - } \ - POST_PACK_PROBEBLOCK_END(); \ +#define AFTER_PACK_ORIGINAL_FD(API_ID, RTYPE, RVAL, SIZE, FD, APITYPE, \ + INPUTFORMAT, ...) \ +do { \ + POST_PACK_PROBEBLOCK_BEGIN(); \ + _fstatret = fstat(FD, &_statbuf); \ + if (_fstatret == -1) { \ + PRINTWRN("fstat returns error\n"); \ + } else if (stat_regular_or_socket_p(&_statbuf)) { \ + PREPARE_LOCAL_BUF(); \ + PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, \ + __VA_ARGS__); \ + PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ + POST_PACK_PROBEBLOCK_MIDDLE_FD(SIZE, FD, APITYPE); \ + } \ + POST_PACK_PROBEBLOCK_END(); \ } while(0) -#define AFTER_PACK_ORIGINAL_FD_MIDDLE(API_ID, RTYPE, RVAL, SIZE, FD, APITYPE, INPUTFORMAT, ...) \ -do { \ - POST_PACK_PROBEBLOCK_BEGIN(); \ - _fstatret = fstat(FD, &_statbuf); \ - if (_fstatret == -1) { \ - PRINTWRN("fstat returns error\n"); \ - } else if (stat_regular_or_socket_p(&_statbuf)) { \ - PREPARE_LOCAL_BUF(); \ - PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, __VA_ARGS__); \ - PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ - POST_PACK_PROBEBLOCK_MIDDLE_FD(SIZE, FD, APITYPE); \ - } \ - POST_PACK_PROBEBLOCK_ADD_END(); \ +#define AFTER_PACK_ORIGINAL_FD_MIDDLE(API_ID, RTYPE, RVAL, SIZE, FD, APITYPE, \ + INPUTFORMAT, ...) \ +do { \ + POST_PACK_PROBEBLOCK_BEGIN(); \ + _fstatret = fstat(FD, &_statbuf); \ + if (_fstatret == -1) { \ + PRINTWRN("fstat returns error\n"); \ + } else if (stat_regular_or_socket_p(&_statbuf)) { \ + PREPARE_LOCAL_BUF(); \ + PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, \ + __VA_ARGS__); \ + PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ + POST_PACK_PROBEBLOCK_MIDDLE_FD(SIZE, FD, APITYPE); \ + } \ + POST_PACK_PROBEBLOCK_ADD_END(); \ } while(0) -#define AFTER_PACK_ORIGINAL_NOFD(API_ID, RTYPE, RVAL, SIZE, APITYPE, INPUTFORMAT, ...) \ -do { \ - POST_PACK_PROBEBLOCK_BEGIN(); \ - PREPARE_LOCAL_BUF(); \ - PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, __VA_ARGS__); \ - PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ - POST_PACK_PROBEBLOCK_MIDDLE_NOFD(SIZE, APITYPE); \ - POST_PACK_PROBEBLOCK_END(); \ +#define AFTER_PACK_ORIGINAL_NOFD(API_ID, RTYPE, RVAL, SIZE, APITYPE, \ + INPUTFORMAT, ...) \ +do { \ + POST_PACK_PROBEBLOCK_BEGIN(); \ + PREPARE_LOCAL_BUF(); \ + PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, \ + __VA_ARGS__); \ + PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ + POST_PACK_PROBEBLOCK_MIDDLE_NOFD(SIZE, APITYPE); \ + POST_PACK_PROBEBLOCK_END(); \ } while(0) -#define AFTER_PACK_ORIGINAL_FILEP(API_ID, RTYPE, RVAL, SIZE, FILEP, APITYPE, INPUTFORMAT, ...) \ -do { \ - POST_PACK_PROBEBLOCK_BEGIN(); \ - GET_FD_FROM_FILEP(FILEP); \ - if(_fd != -1) { \ - _fstatret = fstat(_fd, &_statbuf); \ - } \ - PREPARE_LOCAL_BUF(); \ - PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, __VA_ARGS__); \ - PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ - POST_PACK_PROBEBLOCK_MIDDLE_FD(SIZE, _fd, APITYPE); \ - POST_PACK_PROBEBLOCK_END(); \ +#define AFTER_PACK_ORIGINAL_FILEP(API_ID, RTYPE, RVAL, SIZE, FILEP, APITYPE, \ + INPUTFORMAT, ...) \ +do { \ + POST_PACK_PROBEBLOCK_BEGIN(); \ + GET_FD_FROM_FILEP(FILEP); \ + if(_fd != -1) { \ + _fstatret = fstat(_fd, &_statbuf); \ + } \ + PREPARE_LOCAL_BUF(); \ + PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, \ + __VA_ARGS__); \ + PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ + POST_PACK_PROBEBLOCK_MIDDLE_FD(SIZE, _fd, APITYPE); \ + POST_PACK_PROBEBLOCK_END(); \ } while(0) /*! @@ -184,88 +197,100 @@ static inline bool stat_regular_or_socket_p(struct stat *buf) { return S_ISREG(buf->st_mode) || S_ISSOCK(buf->st_mode); } -#define BEFORE_ORIGINAL_START_END_FD(API_ID, RTYPE, FUNCNAME, LIBNAME, FD, APITYPE, INPUTFORMAT, ...) \ - DECLARE_VARIABLE_FD; \ - PRE_PROBEBLOCK_BEGIN(); \ - _fstatret = fstat(FD, &_statbuf); \ - if (_fstatret == -1) { \ - PRINTWRN("fstat returns error\n"); \ - } else if (stat_regular_or_socket_p(&_statbuf)) { \ - DEFINE_FILESIZE_FD(fd); \ - PREPARE_LOCAL_BUF(); \ - PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, __VA_ARGS__); \ - PACK_COMMON_END(RTYPE, 0, 0, probe_data); \ - PACK_RESOURCE(0, FD, APITYPE, _filesize, _filepath); \ - FLUSH_LOCAL_BUF(); \ - } \ - PRE_PROBEBLOCK_END(); \ - -#define AFTER_ORIGINAL_START_END_FD(API_ID, RTYPE, RVAL, SIZE, FD, APITYPE, INPUTFORMAT, ...) \ -do { \ - POST_PACK_PROBEBLOCK_BEGIN(); \ - inc_current_event_index(); \ - _fstatret = fstat(FD, &_statbuf); \ - if (_fstatret == -1) { \ - PRINTWRN("fstat returns error\n"); \ - } else if (stat_regular_or_socket_p(&_statbuf)) { \ - PREPARE_LOCAL_BUF(); \ - PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, __VA_ARGS__); \ - PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ - PACK_RESOURCE(SIZE, FD, APITYPE, _filesize, _filepath); \ - FLUSH_LOCAL_BUF(); \ - } \ - POST_PACK_PROBEBLOCK_END(); \ +#define BEFORE_ORIGINAL_START_END_FD(API_ID, RTYPE, FUNCNAME, LIBNAME, FD, \ + APITYPE, INPUTFORMAT, ...) \ + DECLARE_VARIABLE_FD; \ + PRE_PROBEBLOCK_BEGIN(); \ + _fstatret = fstat(FD, &_statbuf); \ + if (_fstatret == -1) { \ + PRINTWRN("fstat returns error\n"); \ + } else if (stat_regular_or_socket_p(&_statbuf)) { \ + DEFINE_FILESIZE_FD(fd); \ + PREPARE_LOCAL_BUF(); \ + PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, \ + __VA_ARGS__); \ + PACK_COMMON_END(RTYPE, 0, 0, probe_data); \ + PACK_RESOURCE(0, FD, APITYPE, _filesize, _filepath); \ + FLUSH_LOCAL_BUF(); \ + } \ + PRE_PROBEBLOCK_END(); \ + +#define AFTER_ORIGINAL_START_END_FD(API_ID, RTYPE, RVAL, SIZE, FD, APITYPE, \ + INPUTFORMAT, ...) \ +do { \ + POST_PACK_PROBEBLOCK_BEGIN(); \ + inc_current_event_index(); \ + _fstatret = fstat(FD, &_statbuf); \ + if (_fstatret == -1) { \ + PRINTWRN("fstat returns error\n"); \ + } else if (stat_regular_or_socket_p(&_statbuf)) { \ + PREPARE_LOCAL_BUF(); \ + PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, \ + __VA_ARGS__); \ + PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ + PACK_RESOURCE(SIZE, FD, APITYPE, _filesize, _filepath); \ + FLUSH_LOCAL_BUF(); \ + } \ + POST_PACK_PROBEBLOCK_END(); \ } while(0) -#define BEFORE_ORIGINAL_START_END_NOFD(API_ID, RTYPE, FUNCNAME, LIBNAME, APITYPE, INPUTFORMAT, ...) \ - DECLARE_VARIABLE_FD; \ - PRE_PROBEBLOCK_BEGIN(); \ - DEFINE_FILESIZE_0(); \ - PREPARE_LOCAL_BUF(); \ - PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, __VA_ARGS__); \ - PACK_COMMON_END(RTYPE, 0, 0, probe_data); \ - POST_PACK_PROBEBLOCK_MIDDLE_NOFD(0, APITYPE); \ +#define BEFORE_ORIGINAL_START_END_NOFD(API_ID, RTYPE, FUNCNAME, LIBNAME, \ + APITYPE, INPUTFORMAT, ...) \ + DECLARE_VARIABLE_FD; \ + PRE_PROBEBLOCK_BEGIN(); \ + DEFINE_FILESIZE_0(); \ + PREPARE_LOCAL_BUF(); \ + PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, \ + __VA_ARGS__); \ + PACK_COMMON_END(RTYPE, 0, 0, probe_data); \ + POST_PACK_PROBEBLOCK_MIDDLE_NOFD(0, APITYPE); \ PRE_PROBEBLOCK_END() -#define BEFORE_ORIGINAL_START_END_FILEP(API_ID, RTYPE, FUNCNAME, LIBNAME, FILEP, APITYPE, INPUTFORMAT, ...) \ - DECLARE_VARIABLE_FD; \ - PRE_PROBEBLOCK_BEGIN(); \ - GET_FD_FROM_FILEP(FILEP); \ - if(_fd != -1) { \ - _fstatret = fstat(_fd, &_statbuf); \ - } \ - PREPARE_LOCAL_BUF(); \ - PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, __VA_ARGS__); \ - PACK_COMMON_END(RTYPE, 0, 0, probe_data); \ - POST_PACK_PROBEBLOCK_MIDDLE_FD(0, _fd, APITYPE); \ +#define BEFORE_ORIGINAL_START_END_FILEP(API_ID, RTYPE, FUNCNAME, LIBNAME, \ + FILEP, APITYPE, INPUTFORMAT, ...) \ + DECLARE_VARIABLE_FD; \ + PRE_PROBEBLOCK_BEGIN(); \ + GET_FD_FROM_FILEP(FILEP); \ + if(_fd != -1) { \ + _fstatret = fstat(_fd, &_statbuf); \ + } \ + PREPARE_LOCAL_BUF(); \ + PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, \ + __VA_ARGS__); \ + PACK_COMMON_END(RTYPE, 0, 0, probe_data); \ + POST_PACK_PROBEBLOCK_MIDDLE_FD(0, _fd, APITYPE); \ PRE_PROBEBLOCK_END() -#define AFTER_ORIGINAL_START_END_NOFD(API_ID, RTYPE, RVAL, SIZE, APITYPE, INPUTFORMAT, ...) \ -do { \ - POST_PACK_PROBEBLOCK_BEGIN(); \ - inc_current_event_index(); \ - PREPARE_LOCAL_BUF(); \ - PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, __VA_ARGS__); \ - PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ - POST_PACK_PROBEBLOCK_MIDDLE_NOFD(SIZE, APITYPE); \ - POST_PACK_PROBEBLOCK_END(); \ +#define AFTER_ORIGINAL_START_END_NOFD(API_ID, RTYPE, RVAL, SIZE, APITYPE, \ + INPUTFORMAT, ...) \ +do { \ + POST_PACK_PROBEBLOCK_BEGIN(); \ + inc_current_event_index(); \ + PREPARE_LOCAL_BUF(); \ + PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, \ + __VA_ARGS__); \ + PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ + POST_PACK_PROBEBLOCK_MIDDLE_NOFD(SIZE, APITYPE); \ + POST_PACK_PROBEBLOCK_END(); \ } while(0) -#define AFTER_ORIGINAL_START_END_FILEP(API_ID, RTYPE, RVAL, SIZE, FILEP, APITYPE, INPUTFORMAT, ...) \ -do { \ - POST_PACK_PROBEBLOCK_BEGIN(); \ - inc_current_event_index(); \ - GET_FD_FROM_FILEP(FILEP); \ - if(_fd != -1) { \ - _fstatret = fstat(_fd, &_statbuf); \ - } \ - PREPARE_LOCAL_BUF(); \ - PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, __VA_ARGS__); \ - PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ - POST_PACK_PROBEBLOCK_MIDDLE_FD(SIZE, _fd, APITYPE); \ - POST_PACK_PROBEBLOCK_END(); \ +#define AFTER_ORIGINAL_START_END_FILEP(API_ID, RTYPE, RVAL, SIZE, FILEP, \ + APITYPE, INPUTFORMAT, ...) \ +do { \ + POST_PACK_PROBEBLOCK_BEGIN(); \ + inc_current_event_index(); \ + GET_FD_FROM_FILEP(FILEP); \ + if(_fd != -1) { \ + _fstatret = fstat(_fd, &_statbuf); \ + } \ + PREPARE_LOCAL_BUF(); \ + PACK_COMMON_BEGIN(MSG_PROBE_RESOURCE, API_ID, INPUTFORMAT, \ + __VA_ARGS__); \ + PACK_COMMON_END(RTYPE, RVAL, newerrno, probe_data); \ + POST_PACK_PROBEBLOCK_MIDDLE_FD(SIZE, _fd, APITYPE); \ + POST_PACK_PROBEBLOCK_END(); \ } while(0) diff --git a/probe_file/da_io_posix.c b/probe_file/da_io_posix.c index 3561b72..94e1775 100755 --- a/probe_file/da_io_posix.c +++ b/probe_file/da_io_posix.c @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -66,7 +66,8 @@ static inline char *get_abs_path(int fd, const char *fname, return path; } -HANDLER_WRAPPERS_VAR(file_feature, oflag, int, open, const char*, path, int, oflag, ...) +HANDLER_WRAPPERS_VAR(file_feature, oflag, int, open, const char*, path, + int, oflag, ...) { int (*openp)(const char* path, int oflag, ...); char buffer[PATH_MAX]; @@ -76,7 +77,7 @@ HANDLER_WRAPPERS_VAR(file_feature, oflag, int, open, const char*, path, int, ofl openp = (void *)PROBE_GET_FUNC(probe_data); - if(oflag & O_CREAT) + if (oflag & O_CREAT) mode = va_arg(args, int); ret = openp(path, oflag, mode); @@ -89,7 +90,8 @@ HANDLER_WRAPPERS_VAR(file_feature, oflag, int, open, const char*, path, int, ofl return ret; } -HANDLER_WRAPPERS_VAR(file_feature, oflag, int, openat, int, fd, const char*, path, int, oflag, ...) +HANDLER_WRAPPERS_VAR(file_feature, oflag, int, openat, int, fd, + const char*, path, int, oflag, ...) { int (*openatp)(int fd, const char* path, int oflag, ...); char buffer[PATH_MAX]; @@ -99,7 +101,7 @@ HANDLER_WRAPPERS_VAR(file_feature, oflag, int, openat, int, fd, const char*, pat openatp = (void *)PROBE_GET_FUNC(probe_data); - if(oflag & O_CREAT) + if (oflag & O_CREAT) mode = va_arg(args, int); ret = openatp(fd, path, oflag, mode); @@ -156,7 +158,8 @@ HANDLER_WRAPPERS(file_feature, int, close, int, fd) return ret; } -HANDLER_WRAPPERS(file_feature, off_t, lseek, int, fd, off_t, offset, int, whence) +HANDLER_WRAPPERS(file_feature, off_t, lseek, int, fd, off_t, offset, + int, whence) { int (*lseekp)(int fd, off_t offset, int whence); off_t offret; @@ -228,8 +231,8 @@ HANDLER_WRAPPERS(file_feature, int, fchown, int, fd, uid_t, owner, gid_t, group) fchownp = (void *)PROBE_GET_FUNC(probe_data); ret = fchownp(fd, owner, group); - AFTER_PACK_ORIGINAL_FD(API_ID_fchown, 'd', ret, 0, fd, FD_API_PERMISSION, - "ddd", fd, owner, group); + AFTER_PACK_ORIGINAL_FD(API_ID_fchown, 'd', ret, 0, fd, + FD_API_PERMISSION, "ddd", fd, owner, group); return ret; } @@ -290,8 +293,8 @@ HANDLER_WRAPPERS(file_feature, ssize_t, pread, int, fd, void *, buf, preadp = (void *)PROBE_GET_FUNC(probe_data); sret = preadp(fd, buf, nbyte, offset); - AFTER_ORIGINAL_START_END_FD(API_ID_pread, 'x', sret, (unsigned int)sret, fd, - FD_API_READ_END, "dpxx", fd, + AFTER_ORIGINAL_START_END_FD(API_ID_pread, 'x', sret, (unsigned int)sret, + fd, FD_API_READ_END, "dpxx", fd, voidp_to_uint64(buf), (uint64_t)(nbyte), (uint64_t)(offset)); @@ -299,21 +302,22 @@ HANDLER_WRAPPERS(file_feature, ssize_t, pread, int, fd, void *, buf, return sret; } -HANDLER_WRAPPERS(file_feature, ssize_t, read, int, fd, void *, buf, size_t, nbyte) +HANDLER_WRAPPERS(file_feature, ssize_t, read, int, fd, void *, buf, + size_t, nbyte) { ssize_t (*readp)(int fildes, void *buf, size_t nbyte); ssize_t sret; - BEFORE_ORIGINAL_START_END_FD(API_ID_read, 'x', read, LIBC, fd, FD_API_READ_START, - "dpx", fd, voidp_to_uint64(buf), - (uint64_t)(nbyte)); + BEFORE_ORIGINAL_START_END_FD(API_ID_read, 'x', read, LIBC, fd, + FD_API_READ_START, "dpx", fd, + voidp_to_uint64(buf), (uint64_t)(nbyte)); readp = (void *)PROBE_GET_FUNC(probe_data); sret = readp(fd, buf, nbyte); - AFTER_ORIGINAL_START_END_FD(API_ID_read, 'x', sret, (unsigned int)sret, fd, - FD_API_READ_END, "dpx", fd, + AFTER_ORIGINAL_START_END_FD(API_ID_read, 'x', sret, (unsigned int)sret, + fd, FD_API_READ_END, "dpx", fd, voidp_to_uint64(buf), (uint64_t)(nbyte)); @@ -326,9 +330,9 @@ HANDLER_WRAPPERS(file_feature, ssize_t, pwrite, int, fd, const void *, buf, ssize_t (*pwritep)(int fd, const void *buf, size_t nbyte, off_t offset); ssize_t sret; - BEFORE_ORIGINAL_START_END_FD(API_ID_pwrite, 'x', pwrite, LIBC, fd, FD_API_WRITE_START, - "dpxx", fd, voidp_to_uint64(buf), - (uint64_t)(nbyte), + BEFORE_ORIGINAL_START_END_FD(API_ID_pwrite, 'x', pwrite, LIBC, fd, + FD_API_WRITE_START, "dpxx", fd, + voidp_to_uint64(buf), (uint64_t)(nbyte), (uint64_t)(offset)); pwritep = (void *)PROBE_GET_FUNC(probe_data); @@ -336,9 +340,9 @@ HANDLER_WRAPPERS(file_feature, ssize_t, pwrite, int, fd, const void *, buf, sret = pwritep(fd, buf, nbyte, offset); DEFINE_FILESIZE_FD(fd); - AFTER_ORIGINAL_START_END_FD(API_ID_pwrite, 'x', sret, (unsigned int)sret, fd, - FD_API_WRITE_END, "dpxx", fd, - voidp_to_uint64(buf), + AFTER_ORIGINAL_START_END_FD(API_ID_pwrite, 'x', sret, + (unsigned int)sret, fd, FD_API_WRITE_END, + "dpxx", fd, voidp_to_uint64(buf), (uint64_t)(nbyte), (uint64_t)(offset)); @@ -351,16 +355,16 @@ HANDLER_WRAPPERS(file_feature, ssize_t, write, int, fd, const void *, buf, ssize_t (*writep)(int fildes, const void *buf, size_t nbyte); ssize_t sret; - BEFORE_ORIGINAL_START_END_FD(API_ID_write, 'x', write, LIBC, fd, FD_API_WRITE_START, - "dpx", fd, voidp_to_uint64(buf), - (uint64_t)(nbyte)); + BEFORE_ORIGINAL_START_END_FD(API_ID_write, 'x', write, LIBC, fd, + FD_API_WRITE_START, "dpx", fd, + voidp_to_uint64(buf), (uint64_t)(nbyte)); writep = (void *)PROBE_GET_FUNC(probe_data); sret = writep(fd, buf, nbyte); DEFINE_FILESIZE_FD(fd); - AFTER_ORIGINAL_START_END_FD(API_ID_write, 'x', sret, (unsigned int)sret, fd, - FD_API_WRITE_END, "dpx", fd, + AFTER_ORIGINAL_START_END_FD(API_ID_write, 'x', sret, (unsigned int)sret, + fd, FD_API_WRITE_END, "dpx", fd, voidp_to_uint64(buf), (uint64_t)(nbyte)); @@ -374,14 +378,15 @@ HANDLER_WRAPPERS(file_feature, ssize_t, readv, int, fd, ssize_t (*readvp)(int fd, const struct iovec *iov, int iovcnt); ssize_t sret; - BEFORE_ORIGINAL_START_END_FD(API_ID_readv, 'x', readv, LIBC, fd, FD_API_READ_START, - "dpd", fd, voidp_to_uint64(iov), iovcnt); + BEFORE_ORIGINAL_START_END_FD(API_ID_readv, 'x', readv, LIBC, fd, + FD_API_READ_START, "dpd", fd, + voidp_to_uint64(iov), iovcnt); readvp = (void *)PROBE_GET_FUNC(probe_data); - sret = readvp(fd,iov,iovcnt); + sret = readvp(fd, iov, iovcnt); - AFTER_ORIGINAL_START_END_FD(API_ID_readv, 'x', sret, (unsigned int)sret, fd, - FD_API_READ_END, "dpd", fd, + AFTER_ORIGINAL_START_END_FD(API_ID_readv, 'x', sret, (unsigned int)sret, + fd, FD_API_READ_END, "dpd", fd, voidp_to_uint64(iov), iovcnt); return sret; @@ -389,15 +394,18 @@ HANDLER_WRAPPERS(file_feature, ssize_t, readv, int, fd, // why writev is commented ? #if 0 -HANDLER_WRAPPERS(file_feature, ssize_t, writev, int, fd, const struct iovec *, iov, int, iovcnt) +HANDLER_WRAPPERS(file_feature, ssize_t, writev, int, fd, const struct iovec *, + iov, int, iovcnt) { ssize_t (*writevp)(int fd, const struct iovec *iov, int iovcnt); - MAKE_RESOURCE_PREBLOCK(writev, LIBC,3,VT_INT,fd,VT_PTR,iov,VT_INT,iovcnt); + MAKE_RESOURCE_PREBLOCK(writev, LIBC, 3, VT_INT, fd, VT_PTR, iov, + VT_INT, iovcnt); ssize_t ret; writevp = (void *)PROBE_GET_FUNC(probe_data); - ret = writevp(fd,iov,iovcnt); - MAKE_RESOURCE_POSTBLOCK(VT_SSIZE_T,ret,VT_SSIZE_T,ret,VT_INT,fd, FD_API_WRITE); + ret = writevp(fd, iov, iovcnt); + MAKE_RESOURCE_POSTBLOCK(VT_SSIZE_T, ret, VT_SSIZE_T, ret, VT_INT, fd, + FD_API_WRITE); return ret; } #endif @@ -490,8 +498,8 @@ HANDLER_WRAPPERS(file_feature, int, dup2, int, fd, int, fd2) dup2p = (void *)PROBE_GET_FUNC(probe_data); ret = dup2p(fd, fd2); - AFTER_PACK_ORIGINAL_FD(API_ID_dup2, - 'd', ret, 0, ret, FD_API_OPEN, "dd", fd, fd2); + AFTER_PACK_ORIGINAL_FD(API_ID_dup2, 'd', ret, 0, ret, FD_API_OPEN, + "dd", fd, fd2); return ret; } diff --git a/probe_file/da_io_posix.h b/probe_file/da_io_posix.h index 91e0007..80a88f3 100644 --- a/probe_file/da_io_posix.h +++ b/probe_file/da_io_posix.h @@ -12,16 +12,20 @@ HANDLER_WRAPPERS_DEF(int, ftruncate, int, fd, off_t, length); HANDLER_WRAPPERS_DEF(int, fchown, int, fd, uid_t, owner, gid_t, group); HANDLER_WRAPPERS_DEF(int, lockf, int, fd, int, function, off_t, size); HANDLER_WRAPPERS_DEF(int, fchmod, int, fd, mode_t, mode); -HANDLER_WRAPPERS_DEF(ssize_t, pread, int, fd, void *, buf, size_t, nbyte, off_t, offset); +HANDLER_WRAPPERS_DEF(ssize_t, pread, int, fd, void *, buf, size_t, nbyte, + off_t, offset); HANDLER_WRAPPERS_DEF(ssize_t, read, int, fd, void *, buf, size_t, nbyte); -HANDLER_WRAPPERS_DEF(ssize_t, pwrite, int, fd, const void *, buf, size_t, nbyte, off_t, offset); +HANDLER_WRAPPERS_DEF(ssize_t, pwrite, int, fd, const void *, buf, size_t, nbyte, + off_t, offset); HANDLER_WRAPPERS_DEF(ssize_t, write, int, fd, const void *, buf, size_t, nbyte); -HANDLER_WRAPPERS_DEF(ssize_t, readv, int, fd, const struct iovec *, iov, int, iovcnt); -//HANDLER_WRAPPERS_DEF(ssize_t, writev, int, fd, const struct iovec *, iov, int, iovcnt); +HANDLER_WRAPPERS_DEF(ssize_t, readv, int, fd, const struct iovec *, iov, + int, iovcnt); +/*HANDLER_WRAPPERS_DEF(ssize_t, writev, int, fd, const struct iovec *, iov, + int, iovcnt); */ HANDLER_WRAPPERS_DEF(int, fcntl, int, fd, int, cmd, ...); HANDLER_WRAPPERS_DEF(int, dup, int, fd); HANDLER_WRAPPERS_DEF(int, dup2, int, fd, int, fd2); -//HANDLER_WRAPPERS_DEF(int, fstat, int, fd, struct stat *, buf); +/* HANDLER_WRAPPERS_DEF(int, fstat, int, fd, struct stat *, buf); */ HANDLER_WRAPPERS_DEF(int, futimens, int, fd, const struct timespec *, times); #endif /* __DA_IO_POSIX_H__ */ diff --git a/probe_file/da_io_stdc.c b/probe_file/da_io_stdc.c index b2b0cee..886d8fe 100644 --- a/probe_file/da_io_stdc.c +++ b/probe_file/da_io_stdc.c @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -51,7 +51,7 @@ static inline char *get_abs_path(FILE *file, const char *fname, char *buf, size_t bufsiz) { - char *path = file ? real_abs_path(fileno(file), buf, bufsiz): NULL; + char *path = file ? real_abs_path(fileno(file), buf, bufsiz) : NULL; if (!path) path = absolutize_filepath(fname, buf, bufsiz); @@ -79,11 +79,12 @@ HANDLER_WRAPPERS(file_feature, FILE*, fopen, const char*, filename, return fret; } -HANDLER_WRAPPERS(file_feature, FILE*, freopen, const char *, filename, const char *, mode, FILE *, stream) +HANDLER_WRAPPERS(file_feature, FILE*, freopen, const char *, filename, + const char *, mode, FILE *, stream) { FILE* (*freopenp)(const char *filename, const char *mode, FILE *stream); char buffer[PATH_MAX]; - FILE* fret; + FILE* fret; BEFORE_ORIGINAL_FILE(freopen, LIBC); freopenp = (void *)PROBE_GET_FUNC(probe_data); @@ -91,8 +92,8 @@ HANDLER_WRAPPERS(file_feature, FILE*, freopen, const char *, filename, const cha _filepath = get_abs_path(fret, filename, buffer, PATH_MAX); - AFTER_PACK_ORIGINAL_FILEP(API_ID_freopen, 'p', fret, 0, fret, FD_API_OPEN, - "s4sp", filename, mode, + AFTER_PACK_ORIGINAL_FILEP(API_ID_freopen, 'p', fret, 0, fret, + FD_API_OPEN, "s4sp", filename, mode, voidp_to_uint64(stream)); return fret; @@ -101,14 +102,14 @@ HANDLER_WRAPPERS(file_feature, FILE*, freopen, const char *, filename, const cha HANDLER_WRAPPERS(file_feature, FILE*, fdopen, int, fildes, const char *, mode) { FILE* (*fdopenp)(int fildes, const char *mode); - FILE* fret; + FILE* fret; BEFORE_ORIGINAL_FILE(fdopen, LIBC); fdopenp = (void *)PROBE_GET_FUNC(probe_data); fret = fdopenp(fildes, mode); - AFTER_PACK_ORIGINAL_FILEP(API_ID_fdopen, - 'p', fret, 0, fret, FD_API_OPEN, "ds", fildes, mode); + AFTER_PACK_ORIGINAL_FILEP(API_ID_fdopen, 'p', fret, 0, fret, + FD_API_OPEN, "ds", fildes, mode); return fret; } @@ -135,9 +136,8 @@ HANDLER_WRAPPERS(file_feature, int, fclose, FILE*, stream) PRE_PROBEBLOCK_BEGIN(); GET_FD_FROM_FILEP(stream); - if(_fd != -1) { + if (_fd != -1) _fstatret = fstat(_fd, &_statbuf); - } PRE_PROBEBLOCK_END(); ret = fclosep(stream); @@ -156,7 +156,7 @@ HANDLER_WRAPPERS(file_feature, int, fclose, FILE*, stream) HANDLER_WRAPPERS(file_feature, FILE *, tmpfile) { - FILE* (*tmpfilep) ( void ); + FILE* (*tmpfilep) (void); FILE* fret; BEFORE_ORIGINAL_FILE(tmpfile, LIBC); @@ -182,7 +182,8 @@ HANDLER_WRAPPERS(file_feature, int, fgetpos, FILE*, stream, fpos_t*, position) return ret; } -HANDLER_WRAPPERS(file_feature, int, fseek, FILE*, stream, long int, offset, int, origin) +HANDLER_WRAPPERS(file_feature, int, fseek, FILE*, stream, long int, offset, + int, origin) { int (*fseekp)(FILE* stream, long int offset, int origin); @@ -190,8 +191,8 @@ HANDLER_WRAPPERS(file_feature, int, fseek, FILE*, stream, long int, offset, int, fseekp = (void *)PROBE_GET_FUNC(probe_data); ret = fseekp(stream, offset, origin); AFTER_PACK_ORIGINAL_FILEP(API_ID_fseek, - 'd', ret, (unsigned int)offset, stream, FD_API_OTHER, - "pxd", voidp_to_uint64(stream), + 'd', ret, (unsigned int)offset, stream, + FD_API_OTHER, "pxd", voidp_to_uint64(stream), (uint64_t)(offset), origin); return ret; } @@ -205,7 +206,8 @@ HANDLER_WRAPPERS(file_feature, int, fsetpos, FILE*, stream, const fpos_t*, pos) ret = fsetposp(stream, pos); AFTER_PACK_ORIGINAL_FILEP(API_ID_fsetpos, 'd', ret, 0, stream, FD_API_OTHER, "pp", - voidp_to_uint64(stream), voidp_to_uint64(pos)); + voidp_to_uint64(stream), + voidp_to_uint64(pos)); return ret; } @@ -296,12 +298,13 @@ HANDLER_WRAPPERS(file_feature, int, fileno, FILE*, stream) // File read / write APIs // ******************************************************************* -HANDLER_WRAPPERS(file_feature, int, vfprintf, FILE*, stream, const char*, format, va_list, arg) +HANDLER_WRAPPERS(file_feature, int, vfprintf, FILE*, stream, + const char*, format, va_list, arg) { int (*vfprintfp)(FILE* stream, const char* format, va_list arg); - BEFORE_ORIGINAL_START_END_FILEP(API_ID_vfprintf, 'd', vfprintf, LIBC, stream, - FD_API_WRITE_START, "ps", + BEFORE_ORIGINAL_START_END_FILEP(API_ID_vfprintf, 'd', vfprintf, LIBC, + stream, FD_API_WRITE_START, "ps", voidp_to_uint64(stream), format); vfprintfp = (void *)PROBE_GET_FUNC(probe_data); ret = vfprintfp(stream, format, arg); @@ -313,12 +316,13 @@ HANDLER_WRAPPERS(file_feature, int, vfprintf, FILE*, stream, const char*, format return ret; } -HANDLER_WRAPPERS(file_feature, int, vfscanf, FILE*, stream, const char*, format, va_list, arg) +HANDLER_WRAPPERS(file_feature, int, vfscanf, FILE*, stream, + const char*, format, va_list, arg) { int (*vfscanfp)(FILE* stream, const char* format, va_list arg); - BEFORE_ORIGINAL_START_END_FILEP(API_ID_vfscanf, 'd', vfscanf, LIBC, stream, - FD_API_READ_START, "ps", + BEFORE_ORIGINAL_START_END_FILEP(API_ID_vfscanf, 'd', vfscanf, LIBC, + stream, FD_API_READ_START, "ps", voidp_to_uint64(stream), format); vfscanfp = (void *)PROBE_GET_FUNC(probe_data); ret = vfscanfp(stream, format, arg); @@ -340,15 +344,16 @@ HANDLER_WRAPPERS(file_feature, int, fgetc, FILE*, stream) fgetcp = (void *)PROBE_GET_FUNC(probe_data); ret = fgetcp(stream); - AFTER_ORIGINAL_START_END_FILEP(API_ID_fgetc, 'd', ret, (ret != EOF), stream, - FD_API_READ_END, "p", + AFTER_ORIGINAL_START_END_FILEP(API_ID_fgetc, 'd', ret, (ret != EOF), + stream, FD_API_READ_END, "p", voidp_to_uint64(stream)); return ret; } #if 0 // why is this commented? -HANDLER_WRAPPERS(file_feature, char*, fgets, char*, str, int, size, FILE*, stream) +HANDLER_WRAPPERS(file_feature, char*, fgets, char*, str, int, size, + FILE*, stream) { static char* (*fgetsp)(char* str, int num, FILE* stream); char* cret; @@ -357,8 +362,10 @@ HANDLER_WRAPPERS(file_feature, char*, fgets, char*, str, int, size, FILE*, strea fgets, LIBC, stream, "sdp", str, size, stream); cret = fgetsp(str, size, stream); - AFTER_ORIGINAL_START_END_FILEP(API_ID_fgets, 'p', cret, (ret == NULL ? 0 : strlen(cret)), - stream, FD_API_READ_END, "sdp", str, size, stream); + AFTER_ORIGINAL_START_END_FILEP(API_ID_fgets, 'p', cret, + (ret == NULL ? 0 : strlen(cret)), + stream, FD_API_READ_END, "sdp", str, + size, stream); return cret; } @@ -374,9 +381,10 @@ HANDLER_WRAPPERS(file_feature, int, fputc, int, character, FILE*, stream) fputcp = (void *)PROBE_GET_FUNC(probe_data); ret = fputcp(character, stream); - AFTER_ORIGINAL_START_END_FILEP(API_ID_fputc, 'd', ret, (ret == EOF ? 0 : 1), - stream, FD_API_WRITE_END, "dp", - character, voidp_to_uint64(stream)); + AFTER_ORIGINAL_START_END_FILEP(API_ID_fputc, 'd', ret, + (ret == EOF ? 0 : 1), stream, + FD_API_WRITE_END, "dp", character, + voidp_to_uint64(stream)); return ret; } @@ -408,7 +416,8 @@ HANDLER_WRAPPERS(file_feature, int, getc, FILE*, stream) getcp = (void *)PROBE_GET_FUNC(probe_data); ret = getcp(stream); - AFTER_ORIGINAL_START_END_FILEP(API_ID_getc, 'd', ret, (ret == EOF ? 0 : 1), stream, + AFTER_ORIGINAL_START_END_FILEP(API_ID_getc, 'd', ret, + (ret == EOF ? 0 : 1), stream, FD_API_READ_END, "p", voidp_to_uint64(stream)); @@ -419,8 +428,8 @@ HANDLER_WRAPPERS(file_feature, int, _IO_getc, _IO_FILE*, stream) { int (*getcp)(_IO_FILE* stream); - BEFORE_ORIGINAL_START_END_FILEP(API_ID_getc, 'd', _IO_getc, LIBC, stream, - FD_API_READ_START, "p", + BEFORE_ORIGINAL_START_END_FILEP(API_ID_getc, 'd', _IO_getc, LIBC, + stream, FD_API_READ_START, "p", voidp_to_uint64(stream)); getcp = (void *)PROBE_GET_FUNC(probe_data); ret = getcp(stream); @@ -443,7 +452,8 @@ HANDLER_WRAPPERS(file_feature, int, putc, int, character, FILE*, stream) putcp = (void *)PROBE_GET_FUNC(probe_data); ret = putcp(character, stream); - AFTER_ORIGINAL_START_END_FILEP(API_ID_putc, 'd', ret, (ret == EOF ? 0 : 1), + AFTER_ORIGINAL_START_END_FILEP(API_ID_putc, 'd', ret, + (ret == EOF ? 0 : 1), stream, FD_API_WRITE_END, "dp", character, voidp_to_uint64(stream)); @@ -454,9 +464,9 @@ HANDLER_WRAPPERS(file_feature, int, _IO_putc, int, character, _IO_FILE*, stream) { int (*_IO_putcp)(int character, _IO_FILE* stream); - BEFORE_ORIGINAL_START_END_FILEP(API_ID_putc, 'd', _IO_putc, LIBC, stream, - FD_API_WRITE_START, "dp", character, - voidp_to_uint64(stream)); + BEFORE_ORIGINAL_START_END_FILEP(API_ID_putc, 'd', _IO_putc, LIBC, + stream, FD_API_WRITE_START, "dp", + character, voidp_to_uint64(stream)); _IO_putcp = (void *)PROBE_GET_FUNC(probe_data); ret = _IO_putcp(character, stream); @@ -472,9 +482,9 @@ HANDLER_WRAPPERS(file_feature, int, ungetc, int, character, FILE*, stream) { int (*ungetcp)(int character, FILE* stream); - BEFORE_ORIGINAL_START_END_FILEP(API_ID_ungetc, 'd', ungetc, LIBC, stream, - FD_API_WRITE_START, "dp", character, - voidp_to_uint64(stream)); + BEFORE_ORIGINAL_START_END_FILEP(API_ID_ungetc, 'd', ungetc, LIBC, + stream, FD_API_WRITE_START, "dp", + character, voidp_to_uint64(stream)); ungetcp = (void *)PROBE_GET_FUNC(probe_data); ret = ungetcp(character, stream); @@ -485,7 +495,8 @@ HANDLER_WRAPPERS(file_feature, int, ungetc, int, character, FILE*, stream) return ret; } -HANDLER_WRAPPERS(file_feature, size_t, fread, void*, ptr, size_t, size, size_t, count, FILE*, stream) +HANDLER_WRAPPERS(file_feature, size_t, fread, void*, ptr, size_t, size, + size_t, count, FILE*, stream) { size_t (*freadp)(void* ptr, size_t size, size_t count, FILE* stream); size_t tret; @@ -500,8 +511,8 @@ HANDLER_WRAPPERS(file_feature, size_t, fread, void*, ptr, size_t, size, size_t, freadp = (void *)PROBE_GET_FUNC(probe_data); tret = freadp(ptr, size, count, stream); - AFTER_ORIGINAL_START_END_FILEP(API_ID_fread, 'x', tret, tret*size, stream, - FD_API_READ_END, "pxxp", + AFTER_ORIGINAL_START_END_FILEP(API_ID_fread, 'x', tret, tret*size, + stream, FD_API_READ_END, "pxxp", voidp_to_uint64(ptr), (uint64_t)(size), (uint64_t)(count), @@ -510,13 +521,15 @@ HANDLER_WRAPPERS(file_feature, size_t, fread, void*, ptr, size_t, size, size_t, return tret; } -HANDLER_WRAPPERS(file_feature, size_t, fwrite, const void*, ptr, size_t, size, size_t, count, FILE*, stream) +HANDLER_WRAPPERS(file_feature, size_t, fwrite, const void*, ptr, size_t, size, + size_t, count, FILE*, stream) { - size_t (*fwritep)(const void* ptr, size_t size, size_t count, FILE* stream); + size_t (*fwritep)(const void* ptr, size_t size, size_t count, + FILE* stream); size_t tret; - BEFORE_ORIGINAL_START_END_FILEP(API_ID_fwrite, 'x', fwrite, LIBC, stream, - FD_API_WRITE_START, "pxxp", + BEFORE_ORIGINAL_START_END_FILEP(API_ID_fwrite, 'x', fwrite, LIBC, + stream, FD_API_WRITE_START, "pxxp", voidp_to_uint64(ptr), (uint64_t)(size), (uint64_t)(count), @@ -525,8 +538,8 @@ HANDLER_WRAPPERS(file_feature, size_t, fwrite, const void*, ptr, size_t, size, s fwritep = (void *)PROBE_GET_FUNC(probe_data); tret = fwritep(ptr, size, count, stream); - AFTER_ORIGINAL_START_END_FILEP(API_ID_fwrite, 'x', tret, tret*size, stream, - FD_API_WRITE_END, "pxxp", + AFTER_ORIGINAL_START_END_FILEP(API_ID_fwrite, 'x', tret, tret*size, + stream, FD_API_WRITE_END, "pxxp", voidp_to_uint64(ptr), (uint64_t)(size), (uint64_t)(count), @@ -538,10 +551,11 @@ HANDLER_WRAPPERS(file_feature, size_t, fwrite, const void*, ptr, size_t, size, s // ********************************************************* // variable parameter function // ********************************************************* -HANDLER_WRAPPERS_VAR(file_feature, format, int, fprintf, FILE*, stream, const char*, format, ...) +HANDLER_WRAPPERS_VAR(file_feature, format, int, fprintf, FILE*, stream, + const char*, format, ...) { - BEFORE_ORIGINAL_START_END_FILEP(API_ID_fprintf, 'd', vfprintf, LIBC, stream, - FD_API_WRITE_START, "ps", + BEFORE_ORIGINAL_START_END_FILEP(API_ID_fprintf, 'd', vfprintf, LIBC, + stream, FD_API_WRITE_START, "ps", voidp_to_uint64(stream), format); ret = vfprintf(stream, format, args); @@ -553,10 +567,11 @@ HANDLER_WRAPPERS_VAR(file_feature, format, int, fprintf, FILE*, stream, const ch return ret; } -HANDLER_WRAPPERS_VAR(file_feature, format, int, fscanf, FILE*, stream, const char*, format, ...) +HANDLER_WRAPPERS_VAR(file_feature, format, int, fscanf, FILE*, stream, + const char*, format, ...) { - BEFORE_ORIGINAL_START_END_FILEP(API_ID_fscanf, 'd', vfscanf, LIBC, stream, - FD_API_READ_START, "ps", + BEFORE_ORIGINAL_START_END_FILEP(API_ID_fscanf, 'd', vfscanf, LIBC, + stream, FD_API_READ_START, "ps", voidp_to_uint64(stream), format); ret = vfscanf(stream, format, args); @@ -569,7 +584,8 @@ HANDLER_WRAPPERS_VAR(file_feature, format, int, fscanf, FILE*, stream, const cha } #if !defined(DA_DEBUG_LOG) && !defined(PRINT_STDOUT) -HANDLER_WRAPPERS_VAR(file_feature, format, int, printf, const char*, format, ...) +HANDLER_WRAPPERS_VAR(file_feature, format, int, printf, + const char*, format, ...) { BEFORE_ORIGINAL_START_END_NOFD(API_ID_printf, 'd', vprintf, LIBC, FD_API_WRITE_START, "s", format); @@ -583,7 +599,8 @@ HANDLER_WRAPPERS_VAR(file_feature, format, int, printf, const char*, format, ... } #endif -HANDLER_WRAPPERS_VAR(file_feature, format, int, scanf, const char*, format, ...) +HANDLER_WRAPPERS_VAR(file_feature, format, int, scanf, + const char*, format, ...) { BEFORE_ORIGINAL_START_END_NOFD(API_ID_scanf, 'd', vscanf, LIBC, FD_API_READ_START, "s", format); @@ -607,8 +624,9 @@ HANDLER_WRAPPERS(file_feature, int, getchar) getcharp = (void *)PROBE_GET_FUNC(probe_data); ret = getcharp(); - AFTER_ORIGINAL_START_END_NOFD(API_ID_getchar, 'd', ret, (ret == EOF ? 0 : 1), - FD_API_READ_END, "", 0); + AFTER_ORIGINAL_START_END_NOFD(API_ID_getchar, 'd', ret, + (ret == EOF ? 0 : 1), FD_API_READ_END, + "", 0); return ret; } @@ -623,8 +641,9 @@ HANDLER_WRAPPERS(file_feature, int, putchar, int, c) putcharp = (void *)PROBE_GET_FUNC(probe_data); ret = putcharp(c); - AFTER_ORIGINAL_START_END_NOFD(API_ID_putchar, 'd', ret, (ret == EOF ? 0 : 1), - FD_API_WRITE_END, "d", c); + AFTER_ORIGINAL_START_END_NOFD(API_ID_putchar, 'd', ret, + (ret == EOF ? 0 : 1), FD_API_WRITE_END, + "d", c); return ret; } @@ -681,7 +700,8 @@ HANDLER_WRAPPERS_VOID(file_feature, void, setbuf, FILE*, stream, char*, buf) voidp_to_uint64(buf)); } -HANDLER_WRAPPERS_VOID(file_feature, void, setbuffer, FILE*, stream, char*, buf, size_t, size) +HANDLER_WRAPPERS_VOID(file_feature, void, setbuffer, FILE*, stream, char*, buf, + size_t, size) { void (*setbufferp)(FILE* stream, char* buf, size_t size); @@ -710,14 +730,15 @@ HANDLER_WRAPPERS_VOID(file_feature, void, setlinebuf, FILE*, stream) voidp_to_uint64(stream)); } -HANDLER_WRAPPERS(file_feature, int, setvbuf, FILE*, stream, char*, buf, int, mode, size_t, size) +HANDLER_WRAPPERS(file_feature, int, setvbuf, FILE*, stream, char*, buf, + int, mode, size_t, size) { int (*setvbufp)(FILE* stream, char* buf, int mode, size_t size); BEFORE_ORIGINAL_FILE(setvbuf, LIBC); setvbufp = (void *)PROBE_GET_FUNC(probe_data); - ret = setvbufp(stream,buf,mode,size); + ret = setvbufp(stream, buf, mode, size); AFTER_PACK_ORIGINAL_FILEP(API_ID_setvbuf, 'd', ret, size, stream, FD_API_OTHER, "ppdx", diff --git a/probe_file/da_io_stdc.h b/probe_file/da_io_stdc.h index 25e4726..c436170 100644 --- a/probe_file/da_io_stdc.h +++ b/probe_file/da_io_stdc.h @@ -2,7 +2,8 @@ #define __DA_IO_STDC_H__ HANDLER_WRAPPERS_DEF(FILE*, fopen, const char*, filename, const char*, mode); -HANDLER_WRAPPERS_DEF(FILE*, freopen, const char *, filename, const char *, mode, FILE *, stream); +HANDLER_WRAPPERS_DEF(FILE*, freopen, const char *, filename, const char *, mode, + FILE *, stream); HANDLER_WRAPPERS_DEF(FILE*, fdopen, int, fildes, const char *, mode); HANDLER_WRAPPERS_DEF(int, fflush, FILE*, stream); HANDLER_WRAPPERS_DEF(int, fclose, FILE*, stream); @@ -16,8 +17,10 @@ HANDLER_WRAPPERS_DEF(void, clearerr, FILE*, stream); HANDLER_WRAPPERS_DEF(int, feof, FILE*, stream); HANDLER_WRAPPERS_DEF(int, ferror, FILE*, stream); HANDLER_WRAPPERS_DEF(int, fileno, FILE*, stream); -HANDLER_WRAPPERS_DEF(int, vfprintf, FILE*, stream, const char*, format, va_list, arg); -HANDLER_WRAPPERS_DEF(int, vfscanf, FILE*, stream, const char*, format, va_list, arg); +HANDLER_WRAPPERS_DEF(int, vfprintf, FILE*, stream, const char*, format, + va_list, arg); +HANDLER_WRAPPERS_DEF(int, vfscanf, FILE*, stream, const char*, format, + va_list, arg); HANDLER_WRAPPERS_DEF(int, fgetc, FILE*, stream); //HANDLER_WRAPPERS_DEF(char*, fgets, char*, str, int, size, FILE*, stream); HANDLER_WRAPPERS_DEF(int, fputc, int, character, FILE*, stream); @@ -25,8 +28,10 @@ HANDLER_WRAPPERS_DEF(int, fputs, const char*, str, FILE*, stream); HANDLER_WRAPPERS_DEF(int, getc, FILE*, stream); HANDLER_WRAPPERS_DEF(int, putc, int, character, FILE*, stream); HANDLER_WRAPPERS_DEF(int, ungetc, int, character, FILE*, stream); -HANDLER_WRAPPERS_DEF(size_t, fread, void*, ptr, size_t, size, size_t, count, FILE*, stream); -HANDLER_WRAPPERS_DEF(size_t, fwrite, const void*, ptr, size_t, size, size_t, count, FILE*, stream); +HANDLER_WRAPPERS_DEF(size_t, fread, void*, ptr, size_t, size, size_t, count, + FILE*, stream); +HANDLER_WRAPPERS_DEF(size_t, fwrite, const void*, ptr, size_t, size, + size_t, count, FILE*, stream); HANDLER_WRAPPERS_DEF(int, fprintf, FILE*, stream, const char*, format, ...); HANDLER_WRAPPERS_DEF(int, fscanf, FILE*, stream, const char*, format, ...); HANDLER_WRAPPERS_DEF(int, printf, const char*, format, ...); @@ -38,7 +43,8 @@ HANDLER_WRAPPERS_DEF(int, puts, const char*, str); HANDLER_WRAPPERS_DEF(void, setbuf, FILE*, stream, char*, buf); HANDLER_WRAPPERS_DEF(void, setbuffer, FILE*, stream, char*, buf, size_t, size); HANDLER_WRAPPERS_DEF(void, setlinebuf, FILE*, stream); -HANDLER_WRAPPERS_DEF(int, setvbuf, FILE*, stream, char*, buf, int, mode, size_t, size); +HANDLER_WRAPPERS_DEF(int, setvbuf, FILE*, stream, char*, buf, int, mode, + size_t, size); #endif /* __DA_IO_STDC_H__ */ diff --git a/probe_file/probe_file.c b/probe_file/probe_file.c index a5a315e..096432c 100644 --- a/probe_file/probe_file.c +++ b/probe_file/probe_file.c @@ -40,7 +40,7 @@ enum file_funcs_id_t get_file_feature_id(void *ptr) } enum file_funcs_id_t get_file_feature_always_id(void *ptr) - __attribute__((alias("get_file_feature_id"))); + __attribute__((alias("get_file_feature_id"))); #undef X @@ -48,7 +48,7 @@ enum file_funcs_id_t get_file_feature_always_id(void *ptr) /* X-macros replaced by structures defenitions */ /* For target binaries probes */ #define X(func_name, orig_name) \ - { (ElfW(Addr))& func_name, #orig_name, GT_TARGET_PROBE, (ElfW(Addr))0 }, + { (ElfW(Addr))&func_name, #orig_name, GT_TARGET_PROBE, (ElfW(Addr))0 }, static struct probe_desc_t file_probes[] = { PROBES_LIST @@ -57,9 +57,9 @@ static struct probe_desc_t file_probes[] = { #undef X /* For all binaries probes */ -#define X(func_name, orig_name) \ - { (ElfW(Addr))& CONCAT(func_name, _always), #orig_name, \ - GT_ALWAYS_PROBE,(ElfW(Addr))0}, +#define X(func_name, orig_name) \ + { (ElfW(Addr))&CONCAT(func_name, _always), #orig_name, \ + GT_ALWAYS_PROBE, (ElfW(Addr))0}, static struct probe_desc_t file_always_probes[] = { PROBES_LIST diff --git a/probe_graphics/da_egl_tizen.cpp b/probe_graphics/da_egl_tizen.cpp index 900760a..0f7d861 100644 --- a/probe_graphics/da_egl_tizen.cpp +++ b/probe_graphics/da_egl_tizen.cpp @@ -332,8 +332,8 @@ HANDLER_WRAPPERS(graphics_feature, EGLBoolean, eglReleaseThread, void) return ret; } -HANDLER_WRAPPERS(graphics_feature, EGLSurface, eglCreatePbufferFromClientBuffer, EGLDisplay, dpy, - EGLenum, buftype, EGLClientBuffer, buffer, EGLConfig, config, +HANDLER_WRAPPERS(graphics_feature, EGLSurface, eglCreatePbufferFromClientBuffer, + EGLDisplay, dpy, EGLenum, buftype, EGLClientBuffer, buffer, EGLConfig, config, const EGLint *, attrib_list) { typedef EGLSurface (*methodType)(EGLDisplay dpy, EGLenum buftype, diff --git a/probe_graphics/da_evas_gl.c b/probe_graphics/da_evas_gl.c index 8d28bd0..c21199c 100644 --- a/probe_graphics/da_evas_gl.c +++ b/probe_graphics/da_evas_gl.c @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - Samsung RnD Institute Russia @@ -93,8 +93,8 @@ HANDLER_WRAPPERS(graphics_feature, Evas_GL_Config *, evas_gl_config_new) return res; } -HANDLER_WRAPPERS(graphics_feature, Evas_GL_Surface *, evas_gl_surface_create, Evas_GL *, evas_gl, - Evas_GL_Config *, cfg, int, w, int, h) +HANDLER_WRAPPERS(graphics_feature, Evas_GL_Surface *, evas_gl_surface_create, + Evas_GL *, evas_gl, Evas_GL_Config *, cfg, int, w, int, h) { typedef Evas_GL_Surface *(*methodType)(Evas_GL *evas_gl, Evas_GL_Config *cfg, @@ -106,8 +106,8 @@ HANDLER_WRAPPERS(graphics_feature, Evas_GL_Surface *, evas_gl_surface_create, Ev return res; } -HANDLER_WRAPPERS(graphics_feature, Evas_GL_Context *, evas_gl_context_create, Evas_GL *, evas_gl, - Evas_GL_Context *, share_ctx) +HANDLER_WRAPPERS(graphics_feature, Evas_GL_Context *, evas_gl_context_create, + Evas_GL *, evas_gl, Evas_GL_Context *, share_ctx) { typedef Evas_GL_Context *(*methodType)(Evas_GL *evas_gl, Evas_GL_Context *share_ctx); @@ -118,20 +118,22 @@ HANDLER_WRAPPERS(graphics_feature, Evas_GL_Context *, evas_gl_context_create, Ev return res; } -HANDLER_WRAPPERS(graphics_feature, Eina_Bool, evas_gl_make_current, Evas_GL *, evas_gl, - Evas_GL_Surface *, surf, Evas_GL_Context *, ctx) +HANDLER_WRAPPERS(graphics_feature, Eina_Bool, evas_gl_make_current, + Evas_GL *, evas_gl, Evas_GL_Surface *, surf, + Evas_GL_Context *, ctx) { typedef Eina_Bool (*methodType)(Evas_GL *evas_gl, Evas_GL_Surface *surf, Evas_GL_Context *ctx); BEFORE_EVAS_GL(evas_gl_make_current); Eina_Bool res = evas_gl_make_currentp(evas_gl, surf, ctx); AFTER_DIRECT('b', res, APITYPE_CONTEXT, "", "ppp", - voidp_to_uint64(evas_gl), voidp_to_uint64(surf), voidp_to_uint64(ctx)); + voidp_to_uint64(evas_gl), voidp_to_uint64(surf), + voidp_to_uint64(ctx)); return res; } -HANDLER_WRAPPERS(graphics_feature, const char *, evas_gl_string_query, Evas_GL *, evas_gl, - int, name) +HANDLER_WRAPPERS(graphics_feature, const char *, evas_gl_string_query, + Evas_GL *, evas_gl, int, name) { typedef const char *(*methodType)(Evas_GL *evas_gl, int name); BEFORE_EVAS_GL(evas_gl_string_query); @@ -141,8 +143,8 @@ HANDLER_WRAPPERS(graphics_feature, const char *, evas_gl_string_query, Evas_GL * return res; } -HANDLER_WRAPPERS(graphics_feature, Evas_GL_Func , evas_gl_proc_address_get, Evas_GL *, evas_gl, - const char *, name) +HANDLER_WRAPPERS(graphics_feature, Evas_GL_Func , evas_gl_proc_address_get, + Evas_GL *, evas_gl, const char *, name) { typedef Evas_GL_Func(*methodType)(Evas_GL *evas_gl, const char *name); BEFORE_EVAS_GL(evas_gl_proc_address_get); @@ -152,8 +154,9 @@ HANDLER_WRAPPERS(graphics_feature, Evas_GL_Func , evas_gl_proc_address_get, Evas return res; } -HANDLER_WRAPPERS(graphics_feature, Eina_Bool, evas_gl_native_surface_get, Evas_GL *, evas_gl, - Evas_GL_Surface *, surf, Evas_Native_Surface *, ns) +HANDLER_WRAPPERS(graphics_feature, Eina_Bool, evas_gl_native_surface_get, + Evas_GL *, evas_gl, Evas_GL_Surface *, surf, + Evas_Native_Surface *, ns) { typedef Eina_Bool(*methodType)(Evas_GL *evas_gl, Evas_GL_Surface *surf, Evas_Native_Surface *ns); @@ -167,7 +170,8 @@ HANDLER_WRAPPERS(graphics_feature, Eina_Bool, evas_gl_native_surface_get, Evas_G /* ----------------- api get functions -------------- */ -HANDLER_WRAPPERS(graphics_feature, Evas_GL_API *, evas_gl_api_get, Evas_GL *, evas_gl) +HANDLER_WRAPPERS(graphics_feature, Evas_GL_API *, evas_gl_api_get, + Evas_GL *, evas_gl) { typedef Evas_GL_API *(*methodType)(Evas_GL *evas_gl); BEFORE_EVAS_GL(evas_gl_api_get); @@ -187,7 +191,8 @@ HANDLER_WRAPPERS(graphics_feature, Evas_GL_API *, evas_gl_api_get, Evas_GL *, ev return res; } -HANDLER_WRAPPERS(graphics_feature, Evas_GL_API* , elm_glview_gl_api_get, const Evas_Object *, obj) +HANDLER_WRAPPERS(graphics_feature, Evas_GL_API* , elm_glview_gl_api_get, + const Evas_Object *, obj) { typedef Evas_GL_API *(*methodType)(const Evas_Object *obj); BEFORE_EVAS_GL(elm_glview_gl_api_get); @@ -207,10 +212,11 @@ HANDLER_WRAPPERS(graphics_feature, Evas_GL_API* , elm_glview_gl_api_get, const E return res; } -HANDLER_WRAPPERS(graphics_feature, Evas_GL_API *, evas_gl_context_api_get, Evas_GL *, evas_gl, - Evas_GL_Context *, ctx) +HANDLER_WRAPPERS(graphics_feature, Evas_GL_API *, evas_gl_context_api_get, + Evas_GL *, evas_gl, Evas_GL_Context *, ctx) { - typedef Evas_GL_API *(*methodType)(Evas_GL *evas_gl, Evas_GL_Context *ctx); + typedef Evas_GL_API *(*methodType)(Evas_GL *evas_gl, + Evas_GL_Context *ctx); BEFORE_EVAS_GL(evas_gl_context_api_get); Evas_GL_API *res = evas_gl_context_api_getp(evas_gl, ctx); diff --git a/probe_graphics/da_evas_gl.h b/probe_graphics/da_evas_gl.h index 98ebaa2..a40ece5 100644 --- a/probe_graphics/da_evas_gl.h +++ b/probe_graphics/da_evas_gl.h @@ -3,19 +3,29 @@ HANDLER_WRAPPERS_DEF(void, evas_gl_free, Evas_GL *, evas_gl); HANDLER_WRAPPERS_DEF(void, evas_gl_config_free, Evas_GL_Config *, cfg); -HANDLER_WRAPPERS_DEF(void, evas_gl_surface_destroy, Evas_GL *, evas_gl, Evas_GL_Surface *, surf); -HANDLER_WRAPPERS_DEF(void, evas_gl_context_destroy, Evas_GL *, evas_gl, Evas_GL_Context *, ctx); +HANDLER_WRAPPERS_DEF(void, evas_gl_surface_destroy, Evas_GL *, evas_gl, + Evas_GL_Surface *, surf); +HANDLER_WRAPPERS_DEF(void, evas_gl_context_destroy, Evas_GL *, evas_gl, + Evas_GL_Context *, ctx); HANDLER_WRAPPERS_DEF(Evas_GL *, evas_gl_new, Evas *, e); HANDLER_WRAPPERS_DEF(Evas_GL_Config *, evas_gl_config_new, void); -HANDLER_WRAPPERS_DEF(Evas_GL_Surface *, evas_gl_surface_create, Evas_GL *, evas_gl, Evas_GL_Config *, cfg, int, w, int, h); -HANDLER_WRAPPERS_DEF(Evas_GL_Context *, evas_gl_context_create, Evas_GL *, evas_gl, Evas_GL_Context *, share_ctx); -HANDLER_WRAPPERS_DEF(Eina_Bool, evas_gl_make_current, Evas_GL *, evas_gl, Evas_GL_Surface *, surf, Evas_GL_Context *, ctx); -HANDLER_WRAPPERS_DEF(const char *, evas_gl_string_query, Evas_GL *, evas_gl, int, name); -HANDLER_WRAPPERS_DEF(Evas_GL_Func, evas_gl_proc_address_get, Evas_GL *, evas_gl, const char *, name); -HANDLER_WRAPPERS_DEF(Eina_Bool, evas_gl_native_surface_get, Evas_GL *, evas_gl, Evas_GL_Surface *, surf, Evas_Native_Surface *, ns); +HANDLER_WRAPPERS_DEF(Evas_GL_Surface *, evas_gl_surface_create, + Evas_GL *, evas_gl, Evas_GL_Config *, cfg, int, w, int, h); +HANDLER_WRAPPERS_DEF(Evas_GL_Context *, evas_gl_context_create, + Evas_GL *, evas_gl, Evas_GL_Context *, share_ctx); +HANDLER_WRAPPERS_DEF(Eina_Bool, evas_gl_make_current, Evas_GL *, evas_gl, + Evas_GL_Surface *, surf, Evas_GL_Context *, ctx); +HANDLER_WRAPPERS_DEF(const char *, evas_gl_string_query, Evas_GL *, evas_gl, + int, name); +HANDLER_WRAPPERS_DEF(Evas_GL_Func, evas_gl_proc_address_get, Evas_GL *, evas_gl, + const char *, name); +HANDLER_WRAPPERS_DEF(Eina_Bool, evas_gl_native_surface_get, Evas_GL *, evas_gl, + Evas_GL_Surface *, surf, Evas_Native_Surface *, ns); HANDLER_WRAPPERS_DEF(Evas_GL_API *, evas_gl_api_get, Evas_GL *, evas_gl); -HANDLER_WRAPPERS_DEF(Evas_GL_API*, elm_glview_gl_api_get, const Evas_Object *, obj); -HANDLER_WRAPPERS_DEF(Evas_GL_API *, evas_gl_context_api_get, Evas_GL *, evas_gl, Evas_GL_Context *, ctx); +HANDLER_WRAPPERS_DEF(Evas_GL_API*, elm_glview_gl_api_get, + const Evas_Object *, obj); +HANDLER_WRAPPERS_DEF(Evas_GL_API *, evas_gl_context_api_get, Evas_GL *, evas_gl, + Evas_GL_Context *, ctx); #endif /* __DA_EVAS_GL_H__ */ diff --git a/probe_graphics/da_gl_api_init.c b/probe_graphics/da_gl_api_init.c index f601348..20ae13d 100644 --- a/probe_graphics/da_gl_api_init.c +++ b/probe_graphics/da_gl_api_init.c @@ -9,17 +9,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -56,7 +56,7 @@ void __init_gl_api__(void) __gl_api_fake.func = (typeof(api->func)) __local_##func; \ if (__gl_api_fake.func == NULL) \ PRINTWRN("api->%s not setted", #func); \ - } while(0); + } while (0); #include "da_gl_api_func_list.h" /* --------------------------------------------------------------------- */ diff --git a/probe_graphics/da_gles20.inc b/probe_graphics/da_gles20.inc index bdfe6a2..2e2bcad 100644 --- a/probe_graphics/da_gles20.inc +++ b/probe_graphics/da_gles20.inc @@ -36,7 +36,7 @@ static char contextValue[MAX_GL_CONTEXT_VALUE_SIZE]; /* maybe it should not be g static __thread GLenum gl_error_external = GL_NO_ERROR; static __thread int is_gl_error_external = 1; -static void __ui_array_to_str(char *to, GLuint *arr ,int count, size_t bufsize) +static void __ui_array_to_str(char *to, GLuint *arr, int count, size_t bufsize) { int i = 0, len = 0; @@ -824,7 +824,7 @@ DECLARE_VOID(void, glGetAttachedShaders, GLuint, program, GLsizei, maxCount, GLs } //lsh_get -DECLARE(int ,glGetAttribLocation, GLuint, program, const char *, name) +DECLARE(int, glGetAttribLocation, GLuint, program, const char *, name) { TYPEDEF(int (*methodType)(GLuint, const char*)); BEFORE(glGetAttribLocation); diff --git a/probe_graphics/da_gles20_tizen.cpp b/probe_graphics/da_gles20_tizen.cpp index 6bb4b57..b1226b1 100644 --- a/probe_graphics/da_gles20_tizen.cpp +++ b/probe_graphics/da_gles20_tizen.cpp @@ -41,7 +41,7 @@ extern "C" { #include "probe_graphics.h" #define DECLARE(TYPE, FUNCNAME, ...) \ - TYPE REAL_NAME(FUNCNAME)( FUNC_TA(__VA_ARGS__) ) + TYPE REAL_NAME(FUNCNAME)(FUNC_TA(__VA_ARGS__)) #define DECLARE_NOARGS(TYPE, FUNCNAME) TYPE REAL_NAME(FUNCNAME)() #define DECLARE_VOID(TYPE, FUNCNAME, ...) \ TYPE REAL_NAME(FUNCNAME)(FUNC_TA(__VA_ARGS__)) diff --git a/probe_graphics/da_gles30_native.cpp b/probe_graphics/da_gles30_native.cpp index e647a75..2009532 100644 --- a/probe_graphics/da_gles30_native.cpp +++ b/probe_graphics/da_gles30_native.cpp @@ -111,12 +111,18 @@ DECLARE_VOID(void, glUniformBlockBinding, GLuint, program, GLuint, UniformBlockI UniformBlockIndex, uniformBlockBinding); } -DECLARE_GL_DEFAULT_VOID(void, glUniformMatrix2x3fv, "dxbp", GLint, location, GLsizei, count, GLboolean, transpose, const GLfloat *, value) -DECLARE_GL_DEFAULT_VOID(void, glUniformMatrix3x2fv, "dxbp", GLint, location, GLsizei, count, GLboolean, transpose, const GLfloat *, value) -DECLARE_GL_DEFAULT_VOID(void, glUniformMatrix2x4fv, "dxbp", GLint, location, GLsizei, count, GLboolean, transpose, const GLfloat *, value) -DECLARE_GL_DEFAULT_VOID(void, glUniformMatrix4x2fv, "dxbp", GLint, location, GLsizei, count, GLboolean, transpose, const GLfloat *, value) -DECLARE_GL_DEFAULT_VOID(void, glUniformMatrix3x4fv, "dxbp", GLint, location, GLsizei, count, GLboolean, transpose, const GLfloat *, value) -DECLARE_GL_DEFAULT_VOID(void, glUniformMatrix4x3fv, "dxbp", GLint, location, GLsizei, count, GLboolean, transpose, const GLfloat *, value) +DECLARE_GL_DEFAULT_VOID(void, glUniformMatrix2x3fv, "dxbp", GLint, location, GLsizei, count, + GLboolean, transpose, const GLfloat *, value) +DECLARE_GL_DEFAULT_VOID(void, glUniformMatrix3x2fv, "dxbp", GLint, location, GLsizei, count, + GLboolean, transpose, const GLfloat *, value) +DECLARE_GL_DEFAULT_VOID(void, glUniformMatrix2x4fv, "dxbp", GLint, location, GLsizei, count, + GLboolean, transpose, const GLfloat *, value) +DECLARE_GL_DEFAULT_VOID(void, glUniformMatrix4x2fv, "dxbp", GLint, location, GLsizei, count, + GLboolean, transpose, const GLfloat *, value) +DECLARE_GL_DEFAULT_VOID(void, glUniformMatrix3x4fv, "dxbp", GLint, location, GLsizei, count, + GLboolean, transpose, const GLfloat *, value) +DECLARE_GL_DEFAULT_VOID(void, glUniformMatrix4x3fv, "dxbp", GLint, location, GLsizei, count, + GLboolean, transpose, const GLfloat *, value) DECLARE_VOID(void, glVertexAttribI2ui, GLuint, index, GLuint, x, GLuint, y) { @@ -219,7 +225,7 @@ DECLARE_VOID(void, glGetActiveUniformsiv, GLuint, program, GLsizei, uniformCount TYPEDEF(void (*methodType)(GLuint, GLsizei, const GLuint *, GLenum, GLint *)); BEFORE(glGetActiveUniformsiv); - CALL_ORIG(glGetActiveUniformsiv, program, uniformCount,uniformIndices, + CALL_ORIG(glGetActiveUniformsiv, program, uniformCount, uniformIndices, pname, params); GL_GET_ERROR(); AFTER('v', NO_RETURN_VALUE, APITYPE_CONTEXT, "", "dddxp", program, @@ -500,10 +506,14 @@ DECLARE_VOID(void, glClearColorIui, GLint, r, GLint, g, GLint, b, GLint, a) AFTER('v', NO_RETURN_VALUE, APITYPE_CONTEXT, "", "dddd", r, g, b, a); } -DECLARE_GL_DEFAULT_VOID(void, glClearBufferiv, "xdp", GLenum, buffer, GLint, drawBuffer, const GLuint *, value) -DECLARE_GL_DEFAULT_VOID(void, glClearBufferuiv, "xdp", GLenum, buffer, GLint, drawBuffer, const GLuint *, value) -DECLARE_GL_DEFAULT_VOID(void, glClearBufferfv, "xdp", GLenum, buffer, GLint, drawBuffer, const GLfloat *, value) -DECLARE_GL_DEFAULT_VOID(void, glClearBufferfi, "xdpd", GLenum, buffer, GLint, drawBuffer, GLfloat, depth, GLint, stencil) +DECLARE_GL_DEFAULT_VOID(void, glClearBufferiv, "xdp", GLenum, buffer, GLint, drawBuffer, + const GLuint *, value) +DECLARE_GL_DEFAULT_VOID(void, glClearBufferuiv, "xdp", GLenum, buffer, GLint, drawBuffer, + const GLuint *, value) +DECLARE_GL_DEFAULT_VOID(void, glClearBufferfv, "xdp", GLenum, buffer, GLint, drawBuffer, + const GLfloat *, value) +DECLARE_GL_DEFAULT_VOID(void, glClearBufferfi, "xdpd", GLenum, buffer, GLint, drawBuffer, + GLfloat, depth, GLint, stencil) DECLARE_VOID(void, glTexParameterIiv, GLenum, target, GLenum, pname, GLint *, params) @@ -580,7 +590,8 @@ DECLARE_VOID(void, glGetBooleanIndexedv, GLenum, value, GLint, index, GLboolean data); } -DECLARE_GL_DEFAULT_VOID(void, glGetInteger64i_v, "xdp", GLenum, target, GLuint, index, GLint64xx *, data) +DECLARE_GL_DEFAULT_VOID(void, glGetInteger64i_v, "xdp", GLenum, target, GLuint, index, + GLint64xx *, data) DECLARE_GL_DEFAULT_VOID(void, glGetInteger64v, "xp", GLenum, pname, GLint64xx *, data) DECLARE_GL_DEFAULT_VOID(void, glGetIntegeri_v, "xdp", GLenum, target, GLuint, index, GLint *, data) @@ -708,7 +719,7 @@ DECLARE_VOID(void, glFlushMappedBufferRange, GLenum, target, GLintptr, offset, CALL_ORIG(glFlushMappedBufferRange, target, offset, length); GL_GET_ERROR(); AFTER('v', NO_RETURN_VALUE, APITYPE_CONTEXT, "", "xpp", target, - offset, length ); + offset, length); } DECLARE(GLboolean, glUnmapBuffer, GLenum, target) @@ -1357,8 +1368,10 @@ DECLARE(GLboolean, glIsQuery, GLuint, id) return ret; } -DECLARE_GL_DEFAULT_VOID(void, glGetSamplerParameterfv, "dxp", GLuint, sampler, GLenum, pname, GLfloat *, params) -DECLARE_GL_DEFAULT_VOID(void, glGetSamplerParameteriv, "dxp", GLuint, sampler, GLenum, pname, GLint *, params) +DECLARE_GL_DEFAULT_VOID(void, glGetSamplerParameterfv, "dxp", GLuint, sampler, GLenum, pname, + GLfloat *, params) +DECLARE_GL_DEFAULT_VOID(void, glGetSamplerParameteriv, "dxp", GLuint, sampler, GLenum, pname, + GLint *, params) DECLARE_VOID(void, glGetSynciv, GLsync, sync, GLenum, pname, GLsizei, bufSize, GLsizei *, length, GLint *, values) @@ -1393,7 +1406,8 @@ DECLARE_VOID(void, glGetInternalformativ, GLenum, target, GLenum, internalformat target, internalformat, pname, bufSize, params); } -DECLARE_GL_DEFAULT_VOID(void, glGetBufferParameteri64v, "xxp", GLenum, target, GLenum, value, GLint64xx *, data) +DECLARE_GL_DEFAULT_VOID(void, glGetBufferParameteri64v, "xxp", GLenum, target, GLenum, value, + GLint64xx *, data) DECLARE_VOID(void, glGetBufferPointerv, GLenum, target, GLenum, pname, diff --git a/probe_graphics/init_gl.c b/probe_graphics/init_gl.c index 18c1f6f..2ecb300 100644 --- a/probe_graphics/init_gl.c +++ b/probe_graphics/init_gl.c @@ -39,7 +39,8 @@ void set_real_func(const char *func_name, void **func_pointer, faddr = dlsym(_id, func_name); if (faddr == NULL || dlerror() != NULL) { - PRINTWRN("[set_real_function] function <%s> not found in lib <%s>; dummy function will be seted", + PRINTWRN("[set_real_function] function <%s> not found in lib " + "<%s>; dummy function will be seted", func_name, lib_string[id]); faddr = __gl_dummy_function; } @@ -84,7 +85,8 @@ void dummy() return; } -void init_probe_egl(__attribute__ ((unused))const char *func_name, void **func_pointer, +void init_probe_egl(__attribute__ ((unused))const char *func_name, + void **func_pointer, __attribute__ ((unused))ORIGINAL_LIBRARY id) { PRINTMSG(func_name); @@ -131,7 +133,8 @@ void init_probe_gl(const char *func_name, void **func_pointer, real_glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVal[0]); real_glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxVal[1]); - snprintf(maxValString, sizeof(maxValString), "%d,%d", maxVal[0], maxVal[1]); + snprintf(maxValString, sizeof(maxValString), + "%d,%d", maxVal[0], maxVal[1]); CREATE_GENERIC_PROBE_DATA((uint64_t)0xffffffff, 0, orig); PREPARE_LOCAL_BUF(); PACK_COMMON_BEGIN(MSG_PROBE_GL, vAPI_ID, "", 0); diff --git a/probe_graphics/probe_graphics.c b/probe_graphics/probe_graphics.c index 4f3bf0f..69d6ae2 100644 --- a/probe_graphics/probe_graphics.c +++ b/probe_graphics/probe_graphics.c @@ -39,7 +39,7 @@ enum graphics_funcs_id_t get_graphics_feature_id(void *ptr) } enum graphics_funcs_id_t get_graphics_feature_always_id(void *ptr) - __attribute__((alias("get_graphics_feature_id"))); + __attribute__((alias("get_graphics_feature_id"))); #undef X @@ -47,7 +47,7 @@ enum graphics_funcs_id_t get_graphics_feature_always_id(void *ptr) /* X-macros replaced by structures defenitions */ /* For target binaries probes */ #define X(func_name, orig_name) \ - { (ElfW(Addr))& func_name, #orig_name, GT_TARGET_PROBE, (ElfW(Addr))0 }, + { (ElfW(Addr))&func_name, #orig_name, GT_TARGET_PROBE, (ElfW(Addr))0 }, static struct probe_desc_t graphics_probes[] = { PROBES_LIST diff --git a/probe_memory/da_memory.h b/probe_memory/da_memory.h index 7963e83..e67f13f 100644 --- a/probe_memory/da_memory.h +++ b/probe_memory/da_memory.h @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -45,9 +45,9 @@ * MEMORY PROBE MACRO * * log format - * SeqNumber`,ApiName`,Time`,Pid`,Tid`,InputParm`,Return`,PCAddr`,Error`, - * Size`,MemoryAPIType`,Addr`,\n - * callstack_start`,callstack`,callstack_end + * SeqNumber`,ApiName`,Time`,Pid`,Tid`,InputParm`,Return`,PCAddr`,Error`, + * Size`,MemoryAPIType`,Addr`,\n + * callstack_start`,callstack`,callstack_end * ********************************************************************/ diff --git a/probe_memory/libdamemalloc.c b/probe_memory/libdamemalloc.c index 7f8b644..9a98ff0 100755 --- a/probe_memory/libdamemalloc.c +++ b/probe_memory/libdamemalloc.c @@ -13,17 +13,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -99,8 +99,9 @@ HANDLER_WRAPPERS(memory_feature, void *, malloc, size_t, size) pret = (*mallocp)(size); - if(pret != NULL) - add_memory_hash(convert_addr_to_hash(pret), size, MEMTYPE_ALLOC, + if (pret) + add_memory_hash(convert_addr_to_hash(pret), size, + MEMTYPE_ALLOC, PROBE_GET_CALL_TYPE(probe_data)); POST_PACK_PROBEBLOCK_BEGIN(); @@ -133,7 +134,7 @@ HANDLER_WRAPPERS_VOID(memory_feature, void, free, void*, ptr) PRE_PROBEBLOCK(); - if(ptr != NULL) + if (ptr) del_memory_hash(convert_addr_to_hash(ptr), MEMTYPE_FREE, NULL); (*freep)(ptr); @@ -151,7 +152,8 @@ HANDLER_WRAPPERS_VOID(memory_feature, void, free, void*, ptr) } -HANDLER_WRAPPERS(memory_feature, void *, realloc, void *, memblock, size_t, size) +HANDLER_WRAPPERS(memory_feature, void *, realloc, void *, memblock, + size_t, size) { /* TODO Split LSan */ static void* (*lsan_reallocp)(void*, size_t); @@ -167,15 +169,16 @@ HANDLER_WRAPPERS(memory_feature, void *, realloc, void *, memblock, size_t, size (void *)PROBE_GET_FUNC(probe_data); PRE_PROBEBLOCK(); - if(memblock != NULL) + if (memblock) del_memory_hash(convert_addr_to_hash(memblock), MEMTYPE_FREE, NULL); pret = (*reallocp)(memblock, size); - if(pret != NULL) + if (pret) add_memory_hash(convert_addr_to_hash(pret), size, - MEMTYPE_ALLOC, PROBE_GET_CALL_TYPE(probe_data)); + MEMTYPE_ALLOC, + PROBE_GET_CALL_TYPE(probe_data)); POST_PACK_PROBEBLOCK_BEGIN(); @@ -231,9 +234,10 @@ HANDLER_WRAPPERS(memory_feature, void *, calloc, size_t, nelem, size_t, elsize) pret = (*callocp)(nelem, elsize); - if(pret != NULL) + if (pret) add_memory_hash(convert_addr_to_hash(pret), nelem * elsize, - MEMTYPE_ALLOC, PROBE_GET_CALL_TYPE(probe_data)); + MEMTYPE_ALLOC, + PROBE_GET_CALL_TYPE(probe_data)); POST_PACK_PROBEBLOCK_BEGIN(); diff --git a/probe_memory/libdamemmanage.c b/probe_memory/libdamemmanage.c index b4233f7..1f750d5 100644 --- a/probe_memory/libdamemmanage.c +++ b/probe_memory/libdamemmanage.c @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -47,9 +47,10 @@ -HANDLER_WRAPPERS(memory_feature, void *, memset, void *, memblock, int, c, size_t, n) +HANDLER_WRAPPERS(memory_feature, void *, memset, void *, memblock, int, c, + size_t, n) { - void *(*memsetp)(void *,int,size_t); + void *(*memsetp)(void *, int, size_t); DECLARE_VARIABLE_STANDARD; void *pret; @@ -75,10 +76,10 @@ HANDLER_WRAPPERS(memory_feature, void *, memset, void *, memblock, int, c, size_ return pret; } -HANDLER_WRAPPERS(memory_feature, int, memcmp, const void *, ptr1, const void *, ptr2, - size_t, num) +HANDLER_WRAPPERS(memory_feature, int, memcmp, const void *, ptr1, + const void *, ptr2, size_t, num) { - int(*memcmpp)(const void *,const void *,size_t); + int(*memcmpp)(const void *, const void *, size_t); DECLARE_VARIABLE_STANDARD; memcmpp = (void *)PROBE_GET_FUNC(probe_data); @@ -103,10 +104,10 @@ HANDLER_WRAPPERS(memory_feature, int, memcmp, const void *, ptr1, const void *, return ret; } -HANDLER_WRAPPERS(memory_feature, void *, memcpy, void *, destination, const void *, source, - size_t, num) +HANDLER_WRAPPERS(memory_feature, void *, memcpy, void *, destination, + const void *, source, size_t, num) { - void *(*memcpyp)(void *,const void *,size_t); + void *(*memcpyp)(void *, const void *, size_t); DECLARE_VARIABLE_STANDARD; void *pret; diff --git a/probe_memory/libdamemmanage.h b/probe_memory/libdamemmanage.h index 9178a44..5677da9 100644 --- a/probe_memory/libdamemmanage.h +++ b/probe_memory/libdamemmanage.h @@ -2,8 +2,10 @@ #define __LIBDAMEMMANAGE_H__ HANDLER_WRAPPERS_DEF(void *, memset, void *, memblock, int, c, size_t, n); -HANDLER_WRAPPERS_DEF(int, memcmp, const void *, ptr1, const void *, ptr2, size_t, num); -HANDLER_WRAPPERS_DEF(void *, memcpy, void *, destination, const void *, source, size_t, num); +HANDLER_WRAPPERS_DEF(int, memcmp, const void *, ptr1, const void *, ptr2, + size_t, num); +HANDLER_WRAPPERS_DEF(void *, memcpy, void *, destination, const void *, source, + size_t, num); #endif /* __LIBDAMEMMANAGE_H__ */ diff --git a/probe_memory/memory_probes_list.h b/probe_memory/memory_probes_list.h index 737a8ea..286b42d 100644 --- a/probe_memory/memory_probes_list.h +++ b/probe_memory/memory_probes_list.h @@ -24,7 +24,8 @@ X(CONCAT(PROBE_NAME(memset), _always), memset, GT_ALWAYS_PROBE) \ X(CONCAT(PROBE_NAME(memcmp), _always), memcmp, GT_ALWAYS_PROBE) \ X(CONCAT(PROBE_NAME(memcpy), _always), memcpy, GT_ALWAYS_PROBE) \ - X(CONCAT(PROBE_NAME(posix_memalign), _always), posix_memalign, GT_ALWAYS_PROBE) \ + X(CONCAT(PROBE_NAME(posix_memalign), _always), posix_memalign, \ + GT_ALWAYS_PROBE) \ X(CONCAT(PROBE_NAME(strdup), _always), strdup, GT_ALWAYS_PROBE) /* TODO generate PROBES_LIST with api_names.txt */ diff --git a/probe_memory/probe_memory.c b/probe_memory/probe_memory.c index e91c672..1342ccb 100644 --- a/probe_memory/probe_memory.c +++ b/probe_memory/probe_memory.c @@ -36,7 +36,7 @@ enum memory_funcs_id_t get_memory_feature_id(void *ptr) } enum memory_funcs_id_t get_memory_feature_always_id(void *ptr) - __attribute__((alias("get_memory_feature_id"))); + __attribute__((alias("get_memory_feature_id"))); #undef X @@ -44,7 +44,7 @@ enum memory_funcs_id_t get_memory_feature_always_id(void *ptr) /* X-macros replaced by structures defenitions */ /* For target binaries probes */ #define X(func_name, orig_name, type) \ - { (ElfW(Addr))& func_name, #orig_name, type, (ElfW(Addr))0 }, + { (ElfW(Addr))&func_name, #orig_name, type, (ElfW(Addr))0 }, static struct probe_desc_t memory_probes[] = { PROBES_LIST_MEMORY diff --git a/probe_screenshot/dacapture_wayland.c b/probe_screenshot/dacapture_wayland.c index dbd6d20..0d86753 100755 --- a/probe_screenshot/dacapture_wayland.c +++ b/probe_screenshot/dacapture_wayland.c @@ -14,17 +14,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -285,7 +285,7 @@ static Evas* create_canvas(int width, int height) einfo->info.func.new_update_region = NULL; einfo->info.func.free_update_region = NULL; - ret = __evas_engine_info_set_p(canvas,(Evas_Engine_Info*)einfo); + ret = __evas_engine_info_set_p(canvas, (Evas_Engine_Info*)einfo); if (unlikely(ret == EINA_FALSE)) { PRINTERR("could not set evas engine info!"); __evas_free_p(canvas); @@ -550,7 +550,8 @@ static int __capture_screnshot_wayland(const char *path) width = data->width + padding; height = data->height; - t_surface = tbm_surface_create(width, data->height, TBM_FORMAT_XRGB8888); + t_surface = tbm_surface_create(width, data->height, + TBM_FORMAT_XRGB8888); if (!t_surface) { PRINTERR("failed to create tbm_surface\n"); goto fail_tbm_client; @@ -590,7 +591,8 @@ static int __capture_screnshot_wayland(const char *path) checked4padding = true; goto wrong_padding; } else if (ret == -ECANCELED) { - PRINTERR("Checking for padding failed because of screen is black. Let's check next time.\n"); + PRINTERR("Checking for padding failed because of " + "screen is black. Let's check next time.\n"); } else { checked4padding = true; } @@ -763,18 +765,18 @@ void screenshot_set(void) pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); old = gTraceInfo.screenshot.state; - if(gTraceInfo.screenshot.state >= 0) + if (gTraceInfo.screenshot.state >= 0) gTraceInfo.screenshot.state = 1; pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); - if(old == 2 && isOptionEnabled(FL_SCREENSHOT, 0)) + if (old == 2 && isOptionEnabled(FL_SCREENSHOT, 0)) captureScreen(); } void screenshot_unset(void) { pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); - if(gTraceInfo.screenshot.state >= 0) + if (gTraceInfo.screenshot.state >= 0) gTraceInfo.screenshot.state = 0; pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); } diff --git a/probe_socket/da_socket.h b/probe_socket/da_socket.h index bb2c5f9..fedc907 100644 --- a/probe_socket/da_socket.h +++ b/probe_socket/da_socket.h @@ -11,17 +11,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -37,81 +37,102 @@ #define SOCKET_SEND_SIZE 1024 #define NO_TOTAL_INFO (NULL) -#define POST_PROBEBLOCK_MIDDLE_LIBC_SOCK(OBJECTPTR, FDVALUE, APITYPE, TOTAL_INFO) \ - do { \ - BUF_PTR = pack_int64(BUF_PTR, (uintptr_t)OBJECTPTR); \ - BUF_PTR = pack_int64(BUF_PTR, FDVALUE); \ - BUF_PTR = pack_int32(BUF_PTR, APITYPE); \ - struct sockaddr *tmp_dest = ((struct sockaddr *)TOTAL_INFO.sock); \ - if ( tmp_dest != NO_TOTAL_INFO) { \ - switch (tmp_dest->sa_family) { \ - case AF_INET:\ - BUF_PTR = pack_int32(BUF_PTR, ((struct sockaddr_in *)tmp_dest)->sin_addr.s_addr ); \ - BUF_PTR = pack_int32(BUF_PTR, ntohs(((struct sockaddr_in *)tmp_dest)->sin_port ) ); \ - break;\ - /*case AF_INET6:\ - BUF_PTR = pack_int32(BUF_PTR, ((struct sockaddr_in6 *)tmp_dest)->sin6_addr.s6_addr32 ); \ - BUF_PTR = pack_int32(BUF_PTR, ((struct sockaddr_in6 *)tmp_dest)->sin6_port ); \ - break;*/ \ - default:\ - BUF_PTR = pack_int32(BUF_PTR, (uint32_t) 0); \ - BUF_PTR = pack_int32(BUF_PTR, (uint32_t) 0); \ - break; \ - } \ - } else { \ - BUF_PTR = pack_int32(BUF_PTR, (uint32_t) 0); \ - BUF_PTR = pack_int32(BUF_PTR, (uint32_t) 0); \ - }; \ - BUF_PTR = pack_int64(BUF_PTR, TOTAL_INFO.msg_total_size); \ - BUF_PTR = pack_bin(BUF_PTR, TOTAL_INFO.msg_buf, TOTAL_INFO.msg_pack_size); \ - } while (0) +#define POST_PROBEBLOCK_MIDDLE_LIBC_SOCK(OBJECTPTR, FDVALUE, APITYPE, \ + TOTAL_INFO) \ +do { \ + BUF_PTR = pack_int64(BUF_PTR, (uintptr_t)OBJECTPTR); \ + BUF_PTR = pack_int64(BUF_PTR, FDVALUE); \ + BUF_PTR = pack_int32(BUF_PTR, APITYPE); \ + struct sockaddr *tmp_dest = \ + ((struct sockaddr *)TOTAL_INFO.sock); \ + if ( tmp_dest != NO_TOTAL_INFO) { \ + switch (tmp_dest->sa_family) { \ + case AF_INET: \ + { \ + struct sockaddr_in *tmp_in = \ + (struct sockaddr_in *)tmp_dest; \ + BUF_PTR = pack_int32(BUF_PTR, \ + tmp_in->sin_addr.s_addr); \ + BUF_PTR = pack_int32(BUF_PTR, \ + ntohs(tmp_in->sin_port)); \ + break; \ + } \ + default: \ + BUF_PTR = pack_int32(BUF_PTR, (uint32_t) 0); \ + BUF_PTR = pack_int32(BUF_PTR, (uint32_t) 0); \ + break; \ + } \ + } else { \ + BUF_PTR = pack_int32(BUF_PTR, (uint32_t) 0); \ + BUF_PTR = pack_int32(BUF_PTR, (uint32_t) 0); \ + }; \ + BUF_PTR = pack_int64(BUF_PTR, TOTAL_INFO.msg_total_size); \ + BUF_PTR = pack_bin(BUF_PTR, TOTAL_INFO.msg_buf, \ + TOTAL_INFO.msg_pack_size); \ +} while (0) //lib Common Function -#define AFTER_ORIGINAL_LIBC_SOCK(RTYPE, RVAL, OBJECTPTR, FDVALUE, APITYPE, TOTAL_INFO, INPUTFORMAT, ...) \ - POST_PROBEBLOCK_BEGIN(LC_SOCKET, RTYPE, RVAL, probe_data, INPUTFORMAT, __VA_ARGS__); \ - POST_PROBEBLOCK_MIDDLE_LIBC_SOCK(OBJECTPTR, FDVALUE, APITYPE, TOTAL_INFO ); \ +#define AFTER_ORIGINAL_LIBC_SOCK(RTYPE, RVAL, OBJECTPTR, FDVALUE, APITYPE, \ + TOTAL_INFO, INPUTFORMAT, ...) \ + POST_PROBEBLOCK_BEGIN(LC_SOCKET, RTYPE, RVAL, probe_data, \ + INPUTFORMAT, __VA_ARGS__); \ + POST_PROBEBLOCK_MIDDLE_LIBC_SOCK(OBJECTPTR, FDVALUE, APITYPE, \ + TOTAL_INFO); \ POST_PROBEBLOCK_END(); //lib START Function -#define AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(RTYPE, RVAL,OBJECTPTR, FDVALUE, APITYPE, TOTAL_INFO, INPUTFORMAT, ...) \ - POST_PROBEBLOCK_FUNC_START_BEGIN(LC_SOCKET, RTYPE, RVAL, INPUTFORMAT, __VA_ARGS__); \ - POST_PROBEBLOCK_MIDDLE_LIBC_SOCK(OBJECTPTR, FDVALUE, APITYPE, TOTAL_INFO ); \ - FLUSH_LOCAL_BUF(); \ +#define AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START(RTYPE, RVAL, OBJECTPTR, \ + FDVALUE, APITYPE, TOTAL_INFO, \ + INPUTFORMAT, ...) \ + POST_PROBEBLOCK_FUNC_START_BEGIN(LC_SOCKET, RTYPE, RVAL, INPUTFORMAT, \ + __VA_ARGS__); \ + POST_PROBEBLOCK_MIDDLE_LIBC_SOCK(OBJECTPTR, FDVALUE, APITYPE, \ + TOTAL_INFO); \ + FLUSH_LOCAL_BUF(); \ POST_PROBEBLOCK_FUNC_START_END() -#define POST_PROBEBLOCK_FUNC_START_BEGIN(LCTYPE, RTYPE, RETVALUE, INPUTFORMAT, ...) \ - newerrno = errno; \ - do { \ - PREPARE_LOCAL_BUF(); \ - PACK_COMMON_BEGIN(MSG_PROBE_NETWORK, vAPI_ID, INPUTFORMAT, __VA_ARGS__);\ - PACK_COMMON_END(RTYPE, RETVALUE, errno, probe_data) +#define POST_PROBEBLOCK_FUNC_START_BEGIN(LCTYPE, RTYPE, RETVALUE, \ + INPUTFORMAT, ...) \ + newerrno = errno; \ + do { \ + PREPARE_LOCAL_BUF(); \ + PACK_COMMON_BEGIN(MSG_PROBE_NETWORK, vAPI_ID, INPUTFORMAT, \ + __VA_ARGS__); \ + PACK_COMMON_END(RTYPE, RETVALUE, errno, probe_data) //lib END Function -#define AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(RTYPE, RVAL, OBJECTPTR, FDVALUE, APITYPE, TOTAL_INFO, INPUTFORMAT, ...) \ - POST_PROBEBLOCK_FUNC_END_BEGIN(LC_SOCKET, RTYPE, RVAL, INPUTFORMAT, __VA_ARGS__); \ - POST_PROBEBLOCK_MIDDLE_LIBC_SOCK(OBJECTPTR, FDVALUE, APITYPE, TOTAL_INFO ); \ +#define AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END(RTYPE, RVAL, OBJECTPTR, FDVALUE,\ + APITYPE, TOTAL_INFO, \ + INPUTFORMAT, ...) \ + POST_PROBEBLOCK_FUNC_END_BEGIN(LC_SOCKET, RTYPE, RVAL, INPUTFORMAT, \ + __VA_ARGS__); \ + POST_PROBEBLOCK_MIDDLE_LIBC_SOCK(OBJECTPTR, FDVALUE, APITYPE, \ + TOTAL_INFO); \ POST_PROBEBLOCK_END() -#define POST_PROBEBLOCK_FUNC_END_BEGIN(LCTYPE, RTYPE, RETVALUE, INPUTFORMAT, ...) \ - newerrno = errno; \ - do { \ - inc_current_event_index(); \ - PREPARE_LOCAL_BUF(); \ - PACK_COMMON_BEGIN(MSG_PROBE_NETWORK, vAPI_ID, INPUTFORMAT, __VA_ARGS__);\ +#define POST_PROBEBLOCK_FUNC_END_BEGIN(LCTYPE, RTYPE, RETVALUE, \ + INPUTFORMAT, ...) \ + newerrno = errno; \ + do { \ + inc_current_event_index(); \ + PREPARE_LOCAL_BUF(); \ + PACK_COMMON_BEGIN(MSG_PROBE_NETWORK, vAPI_ID, INPUTFORMAT, \ + __VA_ARGS__); \ PACK_COMMON_END(RTYPE, RETVALUE, errno, probe_data) -#define POST_PROBEBLOCK_MIDDLE_TIZEN_SOCK(OBJECTPTR, FDVALUE, APITYPE, TOTAL_INFO ) \ - do { \ - BUF_PTR = pack_int64(BUF_PTR, (uintptr_t)OBJECTPTR); \ - BUF_PTR = pack_int64(BUF_PTR, FDVALUE); \ - BUF_PTR = pack_int32(BUF_PTR, APITYPE); \ - BUF_PTR = pack_int32(BUF_PTR, TOTAL_INFO.host_ip); \ - BUF_PTR = pack_int32(BUF_PTR, TOTAL_INFO.host_port); \ - BUF_PTR = pack_int64(BUF_PTR, TOTAL_INFO.msg_total_size); \ - BUF_PTR = pack_bin(BUF_PTR, TOTAL_INFO.msg_buf, \ - TOTAL_INFO.msg_pack_size); \ +#define POST_PROBEBLOCK_MIDDLE_TIZEN_SOCK(OBJECTPTR, FDVALUE, APITYPE, \ + TOTAL_INFO) \ + do { \ + BUF_PTR = pack_int64(BUF_PTR, (uintptr_t)OBJECTPTR); \ + BUF_PTR = pack_int64(BUF_PTR, FDVALUE); \ + BUF_PTR = pack_int32(BUF_PTR, APITYPE); \ + BUF_PTR = pack_int32(BUF_PTR, TOTAL_INFO.host_ip); \ + BUF_PTR = pack_int32(BUF_PTR, TOTAL_INFO.host_port); \ + BUF_PTR = pack_int64(BUF_PTR, TOTAL_INFO.msg_total_size); \ + BUF_PTR = pack_bin(BUF_PTR, TOTAL_INFO.msg_buf, \ + TOTAL_INFO.msg_pack_size); \ } while (0) #define BEFORE_ORIGINAL_SOCK(FUNCNAME, LIBNAME) \ diff --git a/probe_socket/libdasocket.c b/probe_socket/libdasocket.c index 31d39b3..0cc515b 100644 --- a/probe_socket/libdasocket.c +++ b/probe_socket/libdasocket.c @@ -11,17 +11,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -58,7 +58,8 @@ #define OBJ_DUMMY 0 -void getAddress(const struct sockaddr *sa, char *address) { +void getAddress(const struct sockaddr *sa, char *address) +{ char buff[INET6_ADDRSTRLEN]; char *path; @@ -76,9 +77,10 @@ void getAddress(const struct sockaddr *sa, char *address) { break; case AF_INET6: snprintf(address, MAX_PATH_LENGTH, "%s:%d", - inet_ntop(AF_INET6, &(((struct sockaddr_in6 *) sa)->sin6_addr), - buff, sizeof(buff)), - ntohs(((struct sockaddr_in6*) sa)->sin6_port)); + inet_ntop(AF_INET6, + &(((struct sockaddr_in6 *)sa)->sin6_addr), + buff, sizeof(buff)), + ntohs(((struct sockaddr_in6*) sa)->sin6_port)); break; case AF_UNIX: path = ((struct sockaddr_un*)sa)->sun_path; @@ -95,7 +97,8 @@ void getAddress(const struct sockaddr *sa, char *address) { } //FD -HANDLER_WRAPPERS(network_feature, int , socket, int, domain, int, type, int, protocol) +HANDLER_WRAPPERS(network_feature, int , socket, int, domain, int, type, + int, protocol) { int (*socketp)(int domain, int type, int protocol); BEFORE_ORIGINAL_SOCK(socket, LIBC); @@ -107,8 +110,8 @@ HANDLER_WRAPPERS(network_feature, int , socket, int, domain, int, type, int, pro return ret; } -HANDLER_WRAPPERS(network_feature, int, accept, int, socket, struct sockaddr *, address, - socklen_t *, address_len) +HANDLER_WRAPPERS(network_feature, int, accept, int, socket, + struct sockaddr *, address, socklen_t *, address_len) { int (*acceptp)(int socket, struct sockaddr *address, socklen_t *address_len); @@ -136,8 +139,8 @@ HANDLER_WRAPPERS(network_feature, int, accept, int, socket, struct sockaddr *, a return ret; } -HANDLER_WRAPPERS(network_feature, int, accept4, int, sockfd, struct sockaddr *, addr, - socklen_t *, addrlen, int, flags) +HANDLER_WRAPPERS(network_feature, int, accept4, int, sockfd, + struct sockaddr *, addr, socklen_t *, addrlen, int, flags) { int (*accept4p)(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags); @@ -166,8 +169,8 @@ HANDLER_WRAPPERS(network_feature, int, accept4, int, sockfd, struct sockaddr *, return ret; } -HANDLER_WRAPPERS(network_feature, int, connect, int, socket, const struct sockaddr *, address, - socklen_t, address_len) +HANDLER_WRAPPERS(network_feature, int, connect, int, socket, + const struct sockaddr *, address, socklen_t, address_len) { int (*connectp)(int socket, const struct sockaddr *address, socklen_t address_len); @@ -180,9 +183,9 @@ HANDLER_WRAPPERS(network_feature, int, connect, int, socket, const struct sockad char callAddress[MAX_PATH_LENGTH]; getAddress(address, callAddress); - AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, socket, SOCKET_API_CONNECT, - info, "dsd", - socket, callAddress, address_len); + AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, socket, + SOCKET_API_CONNECT, info, "dsd", socket, + callAddress, address_len); return ret; } @@ -195,14 +198,14 @@ HANDLER_WRAPPERS(network_feature, int, shutdown, int, socket, int, how) ret = shutdownp(socket, how); - AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, socket, SOCKET_API_FD_CLOSE, - info, "dd", socket, how); + AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, socket, + SOCKET_API_FD_CLOSE, info, "dd", socket, how); return ret; } -HANDLER_WRAPPERS(network_feature, int, bind, int, socket, const struct sockaddr *, address, - socklen_t, address_len) +HANDLER_WRAPPERS(network_feature, int, bind, int, socket, + const struct sockaddr *, address, socklen_t, address_len) { int (*bindp)(int socket, const struct sockaddr *address, socklen_t address_len); @@ -233,8 +236,8 @@ HANDLER_WRAPPERS(network_feature, int, listen, int, socket, int, backlog) return ret; } -HANDLER_WRAPPERS(network_feature, ssize_t, send, int, socket, const void *, message, - size_t, length, int, flags) +HANDLER_WRAPPERS(network_feature, ssize_t, send, int, socket, + const void *, message, size_t, length, int, flags) { ssize_t (*sendp)(int socket, const void *message, size_t length, int flags); @@ -254,7 +257,8 @@ HANDLER_WRAPPERS(network_feature, ssize_t, send, int, socket, const void *, mess if (result < 0) result = 0; info.msg_total_size = (uint64_t)result; - info.msg_pack_size = result>SOCKET_SEND_SIZE?SOCKET_SEND_SIZE:result; + info.msg_pack_size = result > SOCKET_SEND_SIZE ? SOCKET_SEND_SIZE + : result; info.msg_buf = messagP; AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('x', sret, OBJ_DUMMY, socket, @@ -265,8 +269,8 @@ HANDLER_WRAPPERS(network_feature, ssize_t, send, int, socket, const void *, mess return sret; } -HANDLER_WRAPPERS(network_feature, ssize_t, recv, int, socket, void *, buffer, size_t, length, - int, flags) +HANDLER_WRAPPERS(network_feature, ssize_t, recv, int, socket, void *, buffer, + size_t, length, int, flags) { ssize_t (*recvp)(int socket, void *buffer, size_t length, int flags); ssize_t sret, result; @@ -286,7 +290,8 @@ HANDLER_WRAPPERS(network_feature, ssize_t, recv, int, socket, void *, buffer, si if (result < 0) result = 0; info.msg_total_size = (uint64_t)result; - info.msg_pack_size = result>SOCKET_SEND_SIZE?SOCKET_SEND_SIZE:result; + info.msg_pack_size = result > SOCKET_SEND_SIZE ? SOCKET_SEND_SIZE + : result; info.msg_buf = bufferP; AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('x', sret, OBJ_DUMMY, socket, @@ -297,12 +302,13 @@ HANDLER_WRAPPERS(network_feature, ssize_t, recv, int, socket, void *, buffer, si return sret; } -HANDLER_WRAPPERS(network_feature, ssize_t, sendto, int, socket, const void *, message, - size_t, length, int, flags, const struct sockaddr *, dest_addr, - socklen_t, dest_len) +HANDLER_WRAPPERS(network_feature, ssize_t, sendto, int, socket, + const void *, message, size_t, length, int, flags, + const struct sockaddr *, dest_addr, socklen_t, dest_len) { ssize_t (*sendtop)(int socket, const void *message, size_t length, - int flags, const struct sockaddr *dest_addr, socklen_t dest_len); + int flags, const struct sockaddr *dest_addr, + socklen_t dest_len); ssize_t sret, result; BEFORE_ORIGINAL_SOCK(sendto, LIBC); @@ -323,7 +329,8 @@ HANDLER_WRAPPERS(network_feature, ssize_t, sendto, int, socket, const void *, me if (result < 0) result = 0; info.msg_total_size = (uint64_t)result; - info.msg_pack_size = result>SOCKET_SEND_SIZE?SOCKET_SEND_SIZE:result; + info.msg_pack_size = result > SOCKET_SEND_SIZE ? SOCKET_SEND_SIZE + : result; info.msg_buf = bufferP; AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('x', sret, OBJ_DUMMY, socket, @@ -331,16 +338,19 @@ HANDLER_WRAPPERS(network_feature, ssize_t, sendto, int, socket, const void *, me "dpddpd", socket, voidp_to_uint64(bufferP), length, flags, - voidp_to_uint64(dest_addr), dest_len); + voidp_to_uint64(dest_addr), + dest_len); return sret; } -HANDLER_WRAPPERS(network_feature, ssize_t, recvfrom, int, socket, void *, buffer, size_t, length, +HANDLER_WRAPPERS(network_feature, ssize_t, recvfrom, int, socket, + void *, buffer, size_t, length, int, flags, struct sockaddr *, address, socklen_t *, address_len) { ssize_t (*recvfromp)(int socket, void *buffer, size_t length, - int flags, struct sockaddr *address, socklen_t *address_len); + int flags, struct sockaddr *address, + socklen_t *address_len); ssize_t sret, result; BEFORE_ORIGINAL_SOCK(recvfrom, LIBC); @@ -362,7 +372,8 @@ HANDLER_WRAPPERS(network_feature, ssize_t, recvfrom, int, socket, void *, buffer if (result < 0) result = 0; info.msg_total_size = (uint64_t)result; - info.msg_pack_size = result>SOCKET_SEND_SIZE?SOCKET_SEND_SIZE:result; + info.msg_pack_size = result > SOCKET_SEND_SIZE ? SOCKET_SEND_SIZE + : result; info.msg_buf = bufferP; AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_END('x', sret, OBJ_DUMMY, socket, @@ -375,8 +386,8 @@ HANDLER_WRAPPERS(network_feature, ssize_t, recvfrom, int, socket, void *, buffer return sret; } -HANDLER_WRAPPERS(network_feature, ssize_t, recvmsg, int, socket, struct msghdr *,message, - int, flags) +HANDLER_WRAPPERS(network_feature, ssize_t, recvmsg, int, socket, + struct msghdr *, message, int, flags) { ssize_t (*recvmsgp)(int socket, struct msghdr *message, int flags); ssize_t sret; @@ -400,8 +411,8 @@ HANDLER_WRAPPERS(network_feature, ssize_t, recvmsg, int, socket, struct msghdr * return sret; } -HANDLER_WRAPPERS(network_feature, ssize_t, sendmsg, int, socket, const struct msghdr *, message, - int, flags) +HANDLER_WRAPPERS(network_feature, ssize_t, sendmsg, int, socket, + const struct msghdr *, message, int, flags) { ssize_t (*sendmsgp)(int socket, const struct msghdr *message, int flags); @@ -426,8 +437,9 @@ HANDLER_WRAPPERS(network_feature, ssize_t, sendmsg, int, socket, const struct ms return sret; } -HANDLER_WRAPPERS(network_feature, int, getsockopt, int, socket, int, level, int, option_name, - void *, option_value, socklen_t *, option_len) +HANDLER_WRAPPERS(network_feature, int, getsockopt, int, socket, int, level, + int, option_name, void *, option_value, + socklen_t *, option_len) { int (*getsockoptp)(int socket, int level, int option_name, void *option_value, socklen_t *option_len); @@ -444,8 +456,9 @@ HANDLER_WRAPPERS(network_feature, int, getsockopt, int, socket, int, level, int, return ret; } -HANDLER_WRAPPERS(network_feature, int, setsockopt, int, socket, int, level, int, option_name, - const void *, option_value, socklen_t, option_len) +HANDLER_WRAPPERS(network_feature, int, setsockopt, int, socket, int, level, + int, option_name, const void *, option_value, + socklen_t, option_len) { int (*setsockoptp)(int socket, int level, int option_name, const void *option_value, socklen_t option_len); @@ -461,8 +474,8 @@ HANDLER_WRAPPERS(network_feature, int, setsockopt, int, socket, int, level, int, return ret; } -HANDLER_WRAPPERS(network_feature, int, getpeername, int, fd, struct sockaddr *, addr, - socklen_t *, len) +HANDLER_WRAPPERS(network_feature, int, getpeername, int, fd, + struct sockaddr *, addr, socklen_t *, len) { int (*getpeernamep)(int s, struct sockaddr *addr, socklen_t *len); @@ -480,8 +493,8 @@ HANDLER_WRAPPERS(network_feature, int, getpeername, int, fd, struct sockaddr *, return ret; } -HANDLER_WRAPPERS(network_feature, int, getsockname, int, sockfd, struct sockaddr *, addr, - socklen_t *, addrlen) +HANDLER_WRAPPERS(network_feature, int, getsockname, int, sockfd, + struct sockaddr *, addr, socklen_t *, addrlen) { int (*getsocknamep)(int sockfd, struct sockaddr *addr, socklen_t *addrlen); @@ -501,8 +514,8 @@ HANDLER_WRAPPERS(network_feature, int, getsockname, int, sockfd, struct sockaddr return ret; } -HANDLER_WRAPPERS(network_feature, int, socketpair, int, domain, int, type, int, protocol, - int *, socket_vector) +HANDLER_WRAPPERS(network_feature, int, socketpair, int, domain, int, type, + int, protocol, int *, socket_vector) { int (*socketpairp)(int domain, int type, int protocol, int socket_vector[2]); @@ -513,7 +526,8 @@ HANDLER_WRAPPERS(network_feature, int, socketpair, int, domain, int, type, int, AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, socket_vector[0], SOCKET_API_FD_OPEN, info, "ddddd", - domain, type, protocol, socket_vector[0], socket_vector[1]); + domain, type, protocol, socket_vector[0], + socket_vector[1]); return ret; } @@ -544,8 +558,9 @@ HANDLER_WRAPPERS(network_feature, int, isfdtype, int, __fd, int, __fdtype) return ret; } -HANDLER_WRAPPERS(network_feature, int, select, int, nfds, fd_set *, readfds, fd_set *, writefds, - fd_set *, exceptfds, struct timeval *, timeout) +HANDLER_WRAPPERS(network_feature, int, select, int, nfds, fd_set *, readfds, + fd_set *, writefds, fd_set *, exceptfds, + struct timeval *, timeout) { int (*selectp)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); @@ -573,9 +588,9 @@ HANDLER_WRAPPERS(network_feature, int, select, int, nfds, fd_set *, readfds, fd_ return ret; } -HANDLER_WRAPPERS(network_feature, int, pselect, int, nfds, fd_set *, readfds, fd_set *, writefds, - fd_set *, exceptfds, const struct timespec *, ntimeout, - const sigset_t *, sigmask) +HANDLER_WRAPPERS(network_feature, int, pselect, int, nfds, fd_set *, readfds, + fd_set *, writefds, fd_set *, exceptfds, + const struct timespec *, ntimeout, const sigset_t *, sigmask) { int (*pselectp)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timespec *ntimeout, @@ -585,7 +600,7 @@ HANDLER_WRAPPERS(network_feature, int, pselect, int, nfds, fd_set *, readfds, fd AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('d', NULL, OBJ_DUMMY, 0, SOCKET_API_EVENT_START, info, - "dppppp",nfds, + "dppppp", nfds, voidp_to_uint64(readfds), voidp_to_uint64(writefds), voidp_to_uint64(exceptfds), @@ -606,7 +621,8 @@ HANDLER_WRAPPERS(network_feature, int, pselect, int, nfds, fd_set *, readfds, fd return ret; } -HANDLER_WRAPPERS(network_feature, int, poll, struct pollfd *, fds, nfds_t, nfds, int, timeout) +HANDLER_WRAPPERS(network_feature, int, poll, struct pollfd *, fds, nfds_t, nfds, + int, timeout) { int (*pollp)(struct pollfd *ufds, unsigned int nfds, int timeout); @@ -627,11 +643,13 @@ HANDLER_WRAPPERS(network_feature, int, poll, struct pollfd *, fds, nfds_t, nfds, return ret; } -HANDLER_WRAPPERS(network_feature, int, ppoll, struct pollfd *, fds, nfds_t, nfds, - const struct timespec *, timeout_ts, const sigset_t *,sigmask) +HANDLER_WRAPPERS(network_feature, int, ppoll, struct pollfd *, fds, + nfds_t, nfds, const struct timespec *, timeout_ts, + const sigset_t *, sigmask) { int (*ppollp)(struct pollfd *fds, nfds_t nfds, - const struct timespec *timeout_ts, const sigset_t *sigmask); + const struct timespec *timeout_ts, + const sigset_t *sigmask); BEFORE_ORIGINAL_SOCK(ppoll, LIBC); @@ -680,8 +698,9 @@ HANDLER_WRAPPERS(network_feature, int, epoll_create1, int, __flags) return ret; } -HANDLER_WRAPPERS(network_feature, int, epoll_wait, int, __epfd, struct epoll_event *, __events, - int, __maxevents, int, __timeout) +HANDLER_WRAPPERS(network_feature, int, epoll_wait, int, __epfd, + struct epoll_event *, __events, int, __maxevents, + int, __timeout) { int (*epoll_waitp)(int __epfd, struct epoll_event *__events, int __maxevents, int __timeout); @@ -704,11 +723,13 @@ HANDLER_WRAPPERS(network_feature, int, epoll_wait, int, __epfd, struct epoll_eve return ret; } -HANDLER_WRAPPERS(network_feature, int, epoll_pwait, int, __epfd, struct epoll_event *, __events, - int, __maxevents, int, __timeout, __const __sigset_t *, __ss) +HANDLER_WRAPPERS(network_feature, int, epoll_pwait, int, __epfd, + struct epoll_event *, __events, int, __maxevents, + int, __timeout, __const __sigset_t *, __ss) { int (*epoll_pwaitp)(int __epfd, struct epoll_event *__events, - int __maxevents, int __timeout, __const __sigset_t *__ss); + int __maxevents, int __timeout, + __const __sigset_t *__ss); BEFORE_ORIGINAL_SOCK(epoll_pwait, LIBC); AFTER_ORIGINAL_LIBC_SOCK_WAIT_FUNC_START('d', NULL, OBJ_DUMMY, __epfd, @@ -730,8 +751,8 @@ HANDLER_WRAPPERS(network_feature, int, epoll_pwait, int, __epfd, struct epoll_ev return ret; } -HANDLER_WRAPPERS(network_feature, int, epoll_ctl, int, __epfd, int, __op, int, __fd, - struct epoll_event *, __event) +HANDLER_WRAPPERS(network_feature, int, epoll_ctl, int, __epfd, int, __op, + int, __fd, struct epoll_event *, __event) { int (*epoll_ctlp)(int __epfd, int __op, int __fd, struct epoll_event *__event); @@ -773,13 +794,14 @@ HANDLER_WRAPPERS(network_feature, uint16_t , htons, uint16_t, hostshort) uret = htonsp(hostshort); - AFTER_ORIGINAL_LIBC_SOCK('d', (uint32_t)uret, OBJ_DUMMY, 0, SOCKET_API_OTHER, - info, "d", hostshort); + AFTER_ORIGINAL_LIBC_SOCK('d', (uint32_t)uret, OBJ_DUMMY, 0, + SOCKET_API_OTHER, info, "d", hostshort); return uret; } -HANDLER_WRAPPERS(network_feature, int , inet_aton, const char *, cp, struct in_addr *, inp) +HANDLER_WRAPPERS(network_feature, int , inet_aton, const char *, cp, + struct in_addr *, inp) { static int (*inet_atonp)(const char *cp, struct in_addr *inp); @@ -863,8 +885,8 @@ HANDLER_WRAPPERS(network_feature, uint16_t , ntohs, uint16_t, netshort) uret = ntohsp(netshort); - AFTER_ORIGINAL_LIBC_SOCK('d', (uint32_t)uret, OBJ_DUMMY, 0, SOCKET_API_OTHER, - info, "d", netshort); + AFTER_ORIGINAL_LIBC_SOCK('d', (uint32_t)uret, OBJ_DUMMY, 0, + SOCKET_API_OTHER, info, "d", netshort); return uret; } @@ -899,8 +921,8 @@ HANDLER_WRAPPERS(network_feature, in_addr_t , inet_netof, struct in_addr, in) return iret; } -HANDLER_WRAPPERS(network_feature, const char *, inet_ntop, int, af, const void *, src, - char *, dst, socklen_t, size) +HANDLER_WRAPPERS(network_feature, const char *, inet_ntop, int, af, + const void *, src, char *, dst, socklen_t, size) { static const char* (*inet_ntopp)(int af, const void *src, char *dst, socklen_t size); @@ -911,12 +933,14 @@ HANDLER_WRAPPERS(network_feature, const char *, inet_ntop, int, af, const void * cret = inet_ntopp(af, src, dst, size); AFTER_ORIGINAL_LIBC_SOCK(cret, OBJ_DUMMY, 0, SOCKET_API_OTHER, - info, "dppd", af, voidp_to_uint64(src), voidp_to_uint64(dst), size); + info, "dppd", af, voidp_to_uint64(src), + voidp_to_uint64(dst), size); return cret; } -HANDLER_WRAPPERS(network_feature, int , inet_pton, int, af, const char *, src, void *, dst) +HANDLER_WRAPPERS(network_feature, int , inet_pton, int, af, const char *, src, + void *, dst) { static int (*inet_ptonp)(int af, const char *src, void *dst); @@ -925,13 +949,15 @@ HANDLER_WRAPPERS(network_feature, int , inet_pton, int, af, const char *, src, v ret = inet_ptonp(af, src, dst); AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, - info, "dpp", af, voidp_to_uint64(src), voidp_to_uint64(dst)); + info, "dpp", af, voidp_to_uint64(src), + voidp_to_uint64(dst)); return ret; } -HANDLER_WRAPPERS(network_feature, int, getaddrinfo, const char *, node, const char *, service, - const struct addrinfo *, hints, struct addrinfo **, res) +HANDLER_WRAPPERS(network_feature, int, getaddrinfo, const char *, node, + const char *, service, const struct addrinfo *, hints, + struct addrinfo **, res) { static int (*getaddrinfop)(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res); @@ -941,7 +967,9 @@ HANDLER_WRAPPERS(network_feature, int, getaddrinfo, const char *, node, const ch ret = getaddrinfop(node, service, hints, res); AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, - info, "pppp", voidp_to_uint64(node), voidp_to_uint64(service), voidp_to_uint64(hints), voidp_to_uint64(res)); + info, "pppp", voidp_to_uint64(node), + voidp_to_uint64(service), + voidp_to_uint64(hints), voidp_to_uint64(res)); return ret; } @@ -974,8 +1002,9 @@ HANDLER_WRAPPERS(network_feature, const char *, gai_strerror, int, errcode) return cret; } -HANDLER_WRAPPERS(network_feature, int, gai_suspend, const struct gaicb** const, list, - int, nitems, const struct timespec *, timeout) +HANDLER_WRAPPERS(network_feature, int, gai_suspend, + const struct gaicb** const, list, int, nitems, + const struct timespec *, timeout) { static int (*gai_suspendp)(const struct gaicb* const list[], int nitems, const struct timespec *timeout); @@ -985,7 +1014,8 @@ HANDLER_WRAPPERS(network_feature, int, gai_suspend, const struct gaicb** const, ret = gai_suspendp(list, nitems, timeout); AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, - info, "pdp", voidp_to_uint64(list), nitems, voidp_to_uint64(timeout)); + info, "pdp", voidp_to_uint64(list), nitems, + voidp_to_uint64(timeout)); return ret; } @@ -1018,8 +1048,8 @@ HANDLER_WRAPPERS(network_feature, int , gai_cancel, struct gaicb *, req) return ret; } -HANDLER_WRAPPERS(network_feature, int, getaddrinfo_a, int, mode, struct gaicb **, list, - int, nitems, struct sigevent *, sevp) +HANDLER_WRAPPERS(network_feature, int, getaddrinfo_a, int, mode, + struct gaicb **, list, int, nitems, struct sigevent *, sevp) { static int (*getaddrinfo_ap)(int mode, struct gaicb *list[], int nitems, struct sigevent *sevp); @@ -1029,12 +1059,14 @@ HANDLER_WRAPPERS(network_feature, int, getaddrinfo_a, int, mode, struct gaicb ** ret = getaddrinfo_ap(mode, list, nitems, sevp); AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, - info, "dpdp", mode, voidp_to_uint64(list), nitems, voidp_to_uint64(sevp)); + info, "dpdp", mode, voidp_to_uint64(list), + nitems, voidp_to_uint64(sevp)); return ret; } -HANDLER_WRAPPERS(network_feature, int , getdomainname, char *, name, size_t, len) +HANDLER_WRAPPERS(network_feature, int , getdomainname, char *, name, + size_t, len) { static int (*getdomainnamep)(char *name, size_t len); @@ -1048,7 +1080,8 @@ HANDLER_WRAPPERS(network_feature, int , getdomainname, char *, name, size_t, len return ret; } -HANDLER_WRAPPERS(network_feature, int , setdomainname, const char *, name, size_t, len) +HANDLER_WRAPPERS(network_feature, int , setdomainname, const char *, name, + size_t, len) { static int (*setdomainnamep)(const char *name, size_t len); @@ -1076,7 +1109,8 @@ HANDLER_WRAPPERS(network_feature, int , gethostname, char *, name, size_t, len) return ret; } -HANDLER_WRAPPERS(network_feature, int , sethostname, const char *, name, size_t, len) +HANDLER_WRAPPERS(network_feature, int , sethostname, const char *, name, + size_t, len) { static int (*sethostnamep)(const char *name, size_t len); @@ -1095,8 +1129,8 @@ HANDLER_WRAPPERS(network_feature, int, getnameinfo, const struct sockaddr *, sa, char *, serv, socklen_t, servlen, unsigned int, flags) { static int (*getnameinfop)(const struct sockaddr *sa, socklen_t salen, - char *host, socklen_t hostlen, char *serv, socklen_t servlen, - unsigned int flags); + char *host, socklen_t hostlen, char *serv, + socklen_t servlen, unsigned int flags); BEFORE_ORIGINAL_SOCK(getnameinfo, LIBC); @@ -1110,7 +1144,8 @@ HANDLER_WRAPPERS(network_feature, int, getnameinfo, const struct sockaddr *, sa, return ret; } -HANDLER_WRAPPERS(network_feature, struct hostent *, gethostbyname, const char *, name) +HANDLER_WRAPPERS(network_feature, struct hostent *, gethostbyname, + const char *, name) { static struct hostent * (*gethostbynamep)(const char *name); struct hostent* pret; @@ -1125,11 +1160,11 @@ HANDLER_WRAPPERS(network_feature, struct hostent *, gethostbyname, const char *, return pret; } -HANDLER_WRAPPERS(network_feature, struct hostent *, gethostbyaddr, const void *, addr, - socklen_t, len, int, type) +HANDLER_WRAPPERS(network_feature, struct hostent *, gethostbyaddr, + const void *, addr, socklen_t, len, int, type) { - static struct hostent * (*gethostbyaddrp)(const void *addr, socklen_t len, - int type); + static struct hostent * (*gethostbyaddrp)(const void *addr, + socklen_t len, int type); struct hostent* pret; BEFORE_ORIGINAL_SOCK(gethostbyaddr, LIBC); @@ -1208,7 +1243,8 @@ HANDLER_WRAPPERS(network_feature, struct hostent *, gethostent, void) return pret; } -HANDLER_WRAPPERS(network_feature, struct hostent *, gethostbyname2, const char *, name, int, af) +HANDLER_WRAPPERS(network_feature, struct hostent *, gethostbyname2, + const char *, name, int, af) { static struct hostent * (*gethostbyname2p)(const char *name, int af); struct hostent* pret; @@ -1223,11 +1259,13 @@ HANDLER_WRAPPERS(network_feature, struct hostent *, gethostbyname2, const char * return pret; } -HANDLER_WRAPPERS(network_feature, int, gethostent_r, struct hostent *, rret, char *, buf, - size_t, buflen, struct hostent **, result, int *, h_errnop) +HANDLER_WRAPPERS(network_feature, int, gethostent_r, struct hostent *, rret, + char *, buf, size_t, buflen, struct hostent **, result, + int *, h_errnop) { - static int (*gethostent_rp)(struct hostent *rret, char *buf, size_t buflen, - struct hostent **result, int *h_errnop); + static int (*gethostent_rp)(struct hostent *rret, char *buf, + size_t buflen, struct hostent **result, + int *h_errnop); BEFORE_ORIGINAL_SOCK(gethostent_r, LIBC); @@ -1242,13 +1280,14 @@ HANDLER_WRAPPERS(network_feature, int, gethostent_r, struct hostent *, rret, cha return ret; } -HANDLER_WRAPPERS(network_feature, int, gethostbyaddr_r, const void *, addr, socklen_t, len, - int, type, struct hostent *, rret, char *, buf, size_t, buflen, - struct hostent **, result, int *, h_errnop) +HANDLER_WRAPPERS(network_feature, int, gethostbyaddr_r, const void *, addr, + socklen_t, len, int, type, struct hostent *, rret, char *, buf, + size_t, buflen, struct hostent **, result, int *, h_errnop) { - static int (*gethostbyaddr_rp)(const void *addr, socklen_t len, int type, - struct hostent *rret, char *buf, size_t buflen, - struct hostent **result, int *h_errnop); + static int (*gethostbyaddr_rp)(const void *addr, socklen_t len, + int type, struct hostent *rret, + char *buf, size_t buflen, + struct hostent **result, int *h_errnop); BEFORE_ORIGINAL_SOCK(gethostbyaddr_r, LIBC); @@ -1270,7 +1309,8 @@ HANDLER_WRAPPERS(network_feature, int, gethostbyname_r, const char *, name, struct hostent **, result, int *, h_errnop) { static int (*gethostbyname_rp)(const char *name, struct hostent *rret, - char *buf, size_t buflen, struct hostent **result, int *h_errnop); + char *buf, size_t buflen, struct hostent **result, + int *h_errnop); BEFORE_ORIGINAL_SOCK(gethostbyname_r, LIBC); @@ -1285,8 +1325,8 @@ HANDLER_WRAPPERS(network_feature, int, gethostbyname_r, const char *, name, return ret; } -HANDLER_WRAPPERS(network_feature, int, gethostbyname2_r, const char *, name, int, af, - struct hostent *, rret, char *, buf, size_t, buflen, +HANDLER_WRAPPERS(network_feature, int, gethostbyname2_r, const char *, name, + int, af, struct hostent *, rret, char *, buf, size_t, buflen, struct hostent **, result, int *, h_errnop) { static int (*gethostbyname2_rp)(const char *name, int af, @@ -1306,8 +1346,8 @@ HANDLER_WRAPPERS(network_feature, int, gethostbyname2_r, const char *, name, int return ret; } -HANDLER_WRAPPERS(network_feature, struct servent *, getservbyname, const char *, name, - const char *, proto) +HANDLER_WRAPPERS(network_feature, struct servent *, getservbyname, + const char *, name, const char *, proto) { static struct servent * (*getservbynamep)(const char *name, const char *proto); @@ -1397,9 +1437,9 @@ HANDLED_WRAPPERS(int, getservent_r, struct servent *, result_buf, char *, buf, return ret; } -HANDLER_WRAPPERS(network_feature, int, getservbyname_r, const char *, name, const char *, proto, - struct servent *, result_buf, char *, buf, size_t, buflen, - struct servent **, result) +HANDLER_WRAPPERS(network_feature, int, getservbyname_r, const char *, name, + const char *, proto, struct servent *, result_buf, char *, buf, + size_t, buflen, struct servent **, result) { static int (*getservbyname_rp)(const char *name, const char *proto, struct servent *result_buf, char *buf, size_t buflen, @@ -1419,9 +1459,9 @@ HANDLER_WRAPPERS(network_feature, int, getservbyname_r, const char *, name, cons return ret; } -HANDLER_WRAPPERS(network_feature, int, getservbyport_r, int, port, const char *, proto, - struct servent *, result_buf, char *, buf, size_t, buflen, - struct servent **, result) +HANDLER_WRAPPERS(network_feature, int, getservbyport_r, int, port, + const char *, proto, struct servent *, result_buf, char *, buf, + size_t, buflen, struct servent **, result) { static int (*getservbyport_rp)(int port, const char *proto, struct servent *result_buf, char *buf, size_t buflen, @@ -1455,7 +1495,8 @@ HANDLER_WRAPPERS(network_feature, struct netent* , getnetent, void) return pret; } -HANDLER_WRAPPERS(network_feature, struct netent *, getnetbyname, const char *, name) +HANDLER_WRAPPERS(network_feature, struct netent *, getnetbyname, + const char *, name) { static struct netent * (*getnetbynamep)(const char *name); struct netent* pret; @@ -1470,7 +1511,8 @@ HANDLER_WRAPPERS(network_feature, struct netent *, getnetbyname, const char *, n return pret; } -HANDLER_WRAPPERS(network_feature, struct netent *, getnetbyaddr, uint32_t, net, int, type) +HANDLER_WRAPPERS(network_feature, struct netent *, getnetbyaddr, uint32_t, net, + int, type) { static struct netent * (*getnetbyaddrp)(uint32_t net, int type); struct netent * pret; @@ -1509,8 +1551,9 @@ HANDLER_WRAPPERS_VOID(network_feature, void , endnetent) info, "s", ""); } -HANDLER_WRAPPERS(network_feature, int, getnetent_r, struct netent *, result_buf, char *, buf, - size_t, buflen, struct netent **, result, int *, h_errnop) +HANDLER_WRAPPERS(network_feature, int, getnetent_r, struct netent *, result_buf, + char *, buf, size_t, buflen, struct netent **, result, + int *, h_errnop) { static int (*getnetent_rp)(struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop); @@ -1532,8 +1575,10 @@ HANDLER_WRAPPERS(network_feature, int, getnetbyname_r, const char *, name, struct netent *, result_buf, char *, buf, size_t, buflen, struct netent **, result, int *, h_errnop) { - static int (*getnetbyname_rp)(const char *name, struct netent *result_buf, - char *buf, size_t buflen, struct netent **result, int *h_errnop); + static int (*getnetbyname_rp)(const char *name, + struct netent *result_buf, char *buf, + size_t buflen, struct netent **result, + int *h_errnop); BEFORE_ORIGINAL_SOCK(getnetbyname_r, LIBC); @@ -1559,7 +1604,8 @@ HANDLER_WRAPPERS(network_feature, int, getnetbyaddr_r, uint32_t, net, int, type, BEFORE_ORIGINAL_SOCK(getnetbyaddr_r, LIBC); - ret = getnetbyaddr_rp(net, type, result_buf, buf, buflen, result, h_errnop); + ret = getnetbyaddr_rp(net, type, result_buf, buf, buflen, result, + h_errnop); AFTER_ORIGINAL_LIBC_SOCK('d', ret, OBJ_DUMMY, 0, SOCKET_API_OTHER, info, "ddppdpp", net, type, @@ -1586,7 +1632,8 @@ HANDLER_WRAPPERS(network_feature, struct protoent *, getprotoent, void) return pret; } -HANDLER_WRAPPERS(network_feature, struct protoent *, getprotobyname, const char *, name) +HANDLER_WRAPPERS(network_feature, struct protoent *, getprotobyname, + const char *, name) { static struct protoent * (*getprotobynamep)(const char *name); struct protoent * pret; @@ -1601,7 +1648,8 @@ HANDLER_WRAPPERS(network_feature, struct protoent *, getprotobyname, const char return pret; } -HANDLER_WRAPPERS(network_feature, struct protoent *, getprotobynumber, int, proto) +HANDLER_WRAPPERS(network_feature, struct protoent *, getprotobynumber, + int, proto) { static struct protoent * (*getprotobynumberp)(int proto); struct protoent * pret; @@ -1640,7 +1688,8 @@ HANDLER_WRAPPERS_VOID(network_feature, void , endprotoent) info, "s", ""); } -HANDLER_WRAPPERS(network_feature, int, getprotoent_r, struct protoent *, result_buf, char *, buf, +HANDLER_WRAPPERS(network_feature, int, getprotoent_r, + struct protoent *, result_buf, char *, buf, size_t, buflen, struct protoent **, result) { static int (*getprotoent_rp)(struct protoent *result_buf, char *buf, @@ -1683,8 +1732,10 @@ HANDLER_WRAPPERS(network_feature, int, getprotobynumber_r, int, proto, struct protoent *, result_buf, char *, buf, size_t, buflen, struct protoent **, result) { - static int (*getprotobynumber_rp)(int proto, struct protoent *result_buf, - char *buf, size_t buflen, struct protoent **result); + static int (*getprotobynumber_rp)(int proto, + struct protoent *result_buf, + char *buf, size_t buflen, + struct protoent **result); BEFORE_ORIGINAL_SOCK(getprotobynumber_r, LIBC); @@ -1699,7 +1750,8 @@ HANDLER_WRAPPERS(network_feature, int, getprotobynumber_r, int, proto, return ret; } -HANDLER_WRAPPERS(network_feature, unsigned int , if_nametoindex, __const char *, __ifname) +HANDLER_WRAPPERS(network_feature, unsigned int , if_nametoindex, + __const char *, __ifname) { static unsigned int (*if_nametoindexp)(__const char *__ifname); unsigned int uret; @@ -1714,10 +1766,11 @@ HANDLER_WRAPPERS(network_feature, unsigned int , if_nametoindex, __const char *, return uret; } -HANDLER_WRAPPERS(network_feature, char *, if_indextoname, unsigned int, __ifindex, - char *, __ifname) +HANDLER_WRAPPERS(network_feature, char *, if_indextoname, + unsigned int, __ifindex, char *, __ifname) { - static char * (*if_indextonamep)(unsigned int __ifindex, char *__ifname); + static char * (*if_indextonamep)(unsigned int __ifindex, + char *__ifname); char * cret; BEFORE_ORIGINAL_SOCK(if_indextoname, LIBC); @@ -1819,7 +1872,8 @@ HANDLER_WRAPPERS(network_feature, uint16_t , htole16, uint16_t, host_16bits) return uret; } -HANDLER_WRAPPERS(network_feature, uint16_t , be16toh, uint16_t, big_endian_16bits) +HANDLER_WRAPPERS(network_feature, uint16_t , be16toh, + uint16_t, big_endian_16bits) { static uint16_t (*be16tohp)(uint16_t big_endian_16bits); uint16_t uret; @@ -1834,7 +1888,8 @@ HANDLER_WRAPPERS(network_feature, uint16_t , be16toh, uint16_t, big_endian_16bit return uret; } -HANDLER_WRAPPERS(network_feature, uint16_t , le16toh, uint16_t, little_endian_16bits) +HANDLER_WRAPPERS(network_feature, uint16_t , le16toh, + uint16_t, little_endian_16bits) { static uint16_t (*le16tohp)(uint16_t little_endian_16bits); uint16_t uret; @@ -1879,7 +1934,8 @@ HANDLER_WRAPPERS(network_feature, uint32_t , htole32, uint32_t, host_32bits) return uret; } -HANDLER_WRAPPERS(network_feature, uint32_t , be32toh, uint32_t, big_endian_32bits) +HANDLER_WRAPPERS(network_feature, uint32_t , be32toh, + uint32_t, big_endian_32bits) { static uint32_t (*be32tohp)(uint32_t big_endian_32bits); uint32_t uret; @@ -1894,7 +1950,8 @@ HANDLER_WRAPPERS(network_feature, uint32_t , be32toh, uint32_t, big_endian_32bit return uret; } -HANDLER_WRAPPERS(network_feature, uint32_t , le32toh, uint32_t, little_endian_32bits) +HANDLER_WRAPPERS(network_feature, uint32_t , le32toh, + uint32_t, little_endian_32bits) { static uint32_t (*le32tohp)(uint32_t little_endian_32bits); uint32_t uret; @@ -1939,7 +1996,8 @@ HANDLER_WRAPPERS(network_feature, uint64_t , htole64, uint64_t, host_64bits) return uret; } -HANDLER_WRAPPERS(network_feature, uint64_t , be64toh, uint64_t, big_endian_64bits) +HANDLER_WRAPPERS(network_feature, uint64_t , be64toh, + uint64_t, big_endian_64bits) { static uint64_t (*be64tohp)(uint64_t big_endian_64bits); uint64_t uret; @@ -1954,7 +2012,8 @@ HANDLER_WRAPPERS(network_feature, uint64_t , be64toh, uint64_t, big_endian_64bit return uret; } -HANDLER_WRAPPERS(network_feature, uint64_t , le64toh, uint64_t, little_endian_64bits) +HANDLER_WRAPPERS(network_feature, uint64_t , le64toh, + uint64_t, little_endian_64bits) { static uint64_t (*le64tohp)(uint64_t little_endian_64bits); uint64_t uret; @@ -1969,14 +2028,15 @@ HANDLER_WRAPPERS(network_feature, uint64_t , le64toh, uint64_t, little_endian_64 return uret; } -HANDLER_WRAPPERS(network_feature, struct in_addr , inet_makeaddr, int, net, int, host) +HANDLER_WRAPPERS(network_feature, struct in_addr , inet_makeaddr, int, net, + int, host) { static struct in_addr (*inet_makeaddrp)(int net, int host); struct in_addr iret; BEFORE_ORIGINAL_SOCK(inet_makeaddr, LIBC); - iret = inet_makeaddrp(net,host); + iret = inet_makeaddrp(net, host); AFTER_ORIGINAL_NOSOCK_RET('d', iret.s_addr, 0, FD_API_OTHER, "dd", net, host); diff --git a/probe_socket/libdasocket.h b/probe_socket/libdasocket.h index af49b8c..f8ea215 100644 --- a/probe_socket/libdasocket.h +++ b/probe_socket/libdasocket.h @@ -2,34 +2,64 @@ #define __LIBDASOCKET_H__ HANDLER_WRAPPERS_DEF(int, socket, int, domain, int, type, int, protocol); -HANDLER_WRAPPERS_DEF(int, accept, int, socket, struct sockaddr *, address, socklen_t *, address_len); -HANDLER_WRAPPERS_DEF(int, accept4, int, sockfd, struct sockaddr *, addr, socklen_t *, addrlen, int, flags); -HANDLER_WRAPPERS_DEF(int, connect, int, socket, const struct sockaddr *, address, socklen_t, address_len); +HANDLER_WRAPPERS_DEF(int, accept, int, socket, struct sockaddr *, address, + socklen_t *, address_len); +HANDLER_WRAPPERS_DEF(int, accept4, int, sockfd, struct sockaddr *, addr, + socklen_t *, addrlen, int, flags); +HANDLER_WRAPPERS_DEF(int, connect, int, socket, + const struct sockaddr *, address, socklen_t, address_len); HANDLER_WRAPPERS_DEF(int, shutdown, int, socket, int, how); -HANDLER_WRAPPERS_DEF(int, bind, int, socket, const struct sockaddr *, address, socklen_t, address_len); +HANDLER_WRAPPERS_DEF(int, bind, int, socket, const struct sockaddr *, address, + socklen_t, address_len); HANDLER_WRAPPERS_DEF(int, listen, int, socket, int, backlog); -HANDLER_WRAPPERS_DEF(ssize_t, send, int, socket, const void *, message, size_t, length, int, flags); -HANDLER_WRAPPERS_DEF(ssize_t, recv, int, socket, void *, buffer, size_t, length, int, flags); -HANDLER_WRAPPERS_DEF(ssize_t, sendto, int, socket, const void *, message, size_t, length, int, flags, const struct sockaddr *, dest_addr, socklen_t, dest_len); -HANDLER_WRAPPERS_DEF(ssize_t, recvfrom, int, socket, void *, buffer, size_t, length, int, flags, struct sockaddr *, address, socklen_t *, address_len); -HANDLER_WRAPPERS_DEF(ssize_t, recvmsg, int, socket, struct msghdr *, message, int, flags); -HANDLER_WRAPPERS_DEF(ssize_t, sendmsg, int, socket, const struct msghdr *, message, int, flags); -HANDLER_WRAPPERS_DEF(int, getsockopt, int, socket, int, level, int, option_name, void *, option_value, socklen_t *, option_len); -HANDLER_WRAPPERS_DEF(int, setsockopt, int, socket, int, level, int, option_name, const void *, option_value, socklen_t, option_len); -HANDLER_WRAPPERS_DEF(int, getpeername, int, fd, struct sockaddr *, addr, socklen_t *, len); -HANDLER_WRAPPERS_DEF(int, getsockname, int, sockfd, struct sockaddr *, addr, socklen_t *, addrlen); -HANDLER_WRAPPERS_DEF(int, socketpair, int, domain, int, type, int, protocol, int *, socket_vector); +HANDLER_WRAPPERS_DEF(ssize_t, send, int, socket, const void *, message, + size_t, length, int, flags); +HANDLER_WRAPPERS_DEF(ssize_t, recv, int, socket, void *, buffer, size_t, length, + int, flags); +HANDLER_WRAPPERS_DEF(ssize_t, sendto, int, socket, const void *, message, + size_t, length, int, flags, + const struct sockaddr *, dest_addr, socklen_t, dest_len); +HANDLER_WRAPPERS_DEF(ssize_t, recvfrom, int, socket, void *, buffer, + size_t, length, int, flags, struct sockaddr *, address, + socklen_t *, address_len); +HANDLER_WRAPPERS_DEF(ssize_t, recvmsg, int, socket, struct msghdr *, message, + int, flags); +HANDLER_WRAPPERS_DEF(ssize_t, sendmsg, int, socket, + const struct msghdr *, message, int, flags); +HANDLER_WRAPPERS_DEF(int, getsockopt, int, socket, int, level, int, option_name, + void *, option_value, socklen_t *, option_len); +HANDLER_WRAPPERS_DEF(int, setsockopt, int, socket, int, level, int, option_name, + const void *, option_value, socklen_t, option_len); +HANDLER_WRAPPERS_DEF(int, getpeername, int, fd, struct sockaddr *, addr, + socklen_t *, len); +HANDLER_WRAPPERS_DEF(int, getsockname, int, sockfd, struct sockaddr *, addr, + socklen_t *, addrlen); +HANDLER_WRAPPERS_DEF(int, socketpair, int, domain, int, type, int, protocol, + int *, socket_vector); HANDLER_WRAPPERS_DEF(int, sockatmark, int, __fd); HANDLER_WRAPPERS_DEF(int, isfdtype, int, __fd, int, __fdtype); -HANDLER_WRAPPERS_DEF(int, select, int, nfds, fd_set *, readfds, fd_set *, writefds, fd_set *, exceptfds, struct timeval *, timeout); -HANDLER_WRAPPERS_DEF(int, pselect, int, nfds, fd_set *, readfds, fd_set *, writefds, fd_set *, exceptfds, const struct timespec *, ntimeout, const sigset_t *, sigmask); -HANDLER_WRAPPERS_DEF(int, poll, struct pollfd *, fds, nfds_t, nfds, int, timeout); -HANDLER_WRAPPERS_DEF(int, ppoll, struct pollfd *, fds, nfds_t, nfds, const struct timespec *, timeout_ts, const sigset_t *, sigmask); +HANDLER_WRAPPERS_DEF(int, select, int, nfds, fd_set *, readfds, + fd_set *, writefds, fd_set *, exceptfds, + struct timeval *, timeout); +HANDLER_WRAPPERS_DEF(int, pselect, int, nfds, fd_set *, readfds, + fd_set *, writefds, fd_set *, exceptfds, + const struct timespec *, ntimeout, + const sigset_t *, sigmask); +HANDLER_WRAPPERS_DEF(int, poll, struct pollfd *, fds, nfds_t, nfds, + int, timeout); +HANDLER_WRAPPERS_DEF(int, ppoll, struct pollfd *, fds, nfds_t, nfds, + const struct timespec *, timeout_ts, + const sigset_t *, sigmask); HANDLER_WRAPPERS_DEF(int, epoll_create, int, __size); HANDLER_WRAPPERS_DEF(int, epoll_create1, int, __flags); -HANDLER_WRAPPERS_DEF(int, epoll_wait, int, __epfd, struct epoll_event *, __events, int, __maxevents, int, __timeout); -HANDLER_WRAPPERS_DEF(int, epoll_pwait, int, __epfd, struct epoll_event *, __events, int, __maxevents, int, __timeout, __const __sigset_t *, __ss); -HANDLER_WRAPPERS_DEF(int, epoll_ctl, int, __epfd, int, __op, int, __fd, struct epoll_event *, __event); +HANDLER_WRAPPERS_DEF(int, epoll_wait, int, __epfd, + struct epoll_event *, __events, int, __maxevents, + int, __timeout); +HANDLER_WRAPPERS_DEF(int, epoll_pwait, int, __epfd, + struct epoll_event *, __events, int, __maxevents, + int, __timeout, __const __sigset_t *, __ss); +HANDLER_WRAPPERS_DEF(int, epoll_ctl, int, __epfd, int, __op, int, __fd, + struct epoll_event *, __event); //HANDLER_WRAPPERS_DEF(uint32_t, htonl, uint32_t, hostlong); //HANDLER_WRAPPERS_DEF(uint16_t, htons, uint16_t, hostshort); //HANDLER_WRAPPERS_DEF(int, inet_aton, const char *, cp, struct in_addr *, inp); @@ -40,58 +70,96 @@ HANDLER_WRAPPERS_DEF(int, epoll_ctl, int, __epfd, int, __op, int, __fd, struct e //HANDLER_WRAPPERS_DEF(uint16_t, ntohs, uint16_t, netshort); //HANDLER_WRAPPERS_DEF(in_addr_t, inet_lnaof, struct in_addr, in); //HANDLER_WRAPPERS_DEF(in_addr_t, inet_netof, struct in_addr, in); -//HANDLER_WRAPPERS_DEF(const char *, inet_ntop, int, af, const void *, src, char *, dst, socklen_t, size); +//HANDLER_WRAPPERS_DEF(const char *, inet_ntop, int, af, const void *, src, +// char *, dst, socklen_t, size); //HANDLER_WRAPPERS_DEF(int, inet_pton, int, af, const char *, src, void *, dst); -//HANDLER_WRAPPERS_DEF(int, getaddrinfo, const char *, node, const char *, service, const struct addrinfo *, hints, struct addrinfo **, res); +//HANDLER_WRAPPERS_DEF(int, getaddrinfo, const char *, node, +// const char *, service, const struct addrinfo *, hints, +// struct addrinfo **, res); //HANDLER_WRAPPERS_DEF(void, freeaddrinfo, struct addrinfo *res); //HANDLER_WRAPPERS_DEF(const char *PROBE_NAME(gai_strerror, int errcode); -//HANDLER_WRAPPERS_DEF(int, gai_suspend, const struct gaicb* const list[], int nitems, const struct timespec *timeout); +//HANDLER_WRAPPERS_DEF(int, gai_suspend, const struct gaicb* const list[], +// int nitems, const struct timespec *timeout); //HANDLER_WRAPPERS_DEF(int, gai_error, struct gaicb *req); //HANDLER_WRAPPERS_DEF(int, gai_cancel, struct gaicb *req); -//HANDLER_WRAPPERS_DEF(int, getaddrinfo_a, int mode, struct gaicb *list[], int nitems, struct sigevent *sevp); +//HANDLER_WRAPPERS_DEF(int, getaddrinfo_a, int mode, struct gaicb *list[], +// int nitems, struct sigevent *sevp); //HANDLER_WRAPPERS_DEF(int, getdomainname, char *name, size_t len); //HANDLER_WRAPPERS_DEF(int, setdomainname, const char *name, size_t len); //HANDLER_WRAPPERS_DEF(int, gethostname, char *name, size_t len); //HANDLER_WRAPPERS_DEF(int, sethostname, const char *name, size_t len); -//HANDLER_WRAPPERS_DEF(int, getnameinfo, const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags); -//HANDLER_WRAPPERS_DEF(struct hostent *PROBE_NAME(gethostbyname, const char *name); -//HANDLER_WRAPPERS_DEF(struct hostent *PROBE_NAME(gethostbyaddr, const void *addr, socklen_t len, int type); +//HANDLER_WRAPPERS_DEF(int, getnameinfo, const struct sockaddr *sa, +// socklen_t salen, char *host, socklen_t hostlen, +// char *serv, socklen_t servlen, unsigned int flags); +//HANDLER_WRAPPERS_DEF(struct hostent *PROBE_NAME(gethostbyname, +// const char *name); +//HANDLER_WRAPPERS_DEF(struct hostent *PROBE_NAME(gethostbyaddr, +// const void *addr, socklen_t len, int type); //HANDLER_WRAPPERS_DEF(void, sethostent, int stayopen); //HANDLER_WRAPPERS_DEF(void, endhostent, void); //HANDLER_WRAPPERS_DEF(void, herror, const char *s); //HANDLER_WRAPPERS_DEF(const char *PROBE_NAME(hstrerror, int err); //HANDLER_WRAPPERS_DEF(struct hostent *PROBE_NAME(gethostent, void); -//HANDLER_WRAPPERS_DEF(struct hostent *PROBE_NAME(gethostbyname2, const char *name, int af); -//HANDLER_WRAPPERS_DEF(int, gethostent_r, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop); -//HANDLER_WRAPPERS_DEF(int, gethostbyaddr_r, const void *addr, socklen_t len, int type, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop); -//HANDLER_WRAPPERS_DEF(int, gethostbyname_r, const char *name, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop); -//HANDLER_WRAPPERS_DEF(int, gethostbyname2_r, const char *name, int af, struct hostent *rret, char *buf, size_t buflen, struct hostent **result, int *h_errnop); -//HANDLER_WRAPPERS_DEF(struct servent *PROBE_NAME(getservbyname, const char *name, const char *proto); +//HANDLER_WRAPPERS_DEF(struct hostent *PROBE_NAME(gethostbyname2, +// const char *name, int af); +//HANDLER_WRAPPERS_DEF(int, gethostent_r, struct hostent *rret, char *buf, +// size_t buflen, struct hostent **result, int *h_errnop); +//HANDLER_WRAPPERS_DEF(int, gethostbyaddr_r, const void *addr, socklen_t len, +// int type, struct hostent *rret, char *buf, size_t buflen, +// struct hostent **result, int *h_errnop); +//HANDLER_WRAPPERS_DEF(int, gethostbyname_r, const char *name, +// struct hostent *rret, char *buf, size_t buflen, +// struct hostent **result, int *h_errnop); +//HANDLER_WRAPPERS_DEF(int, gethostbyname2_r, const char *name, int af, +// struct hostent *rret, char *buf, size_t buflen, +// struct hostent **result, int *h_errnop); +//HANDLER_WRAPPERS_DEF(struct servent *PROBE_NAME(getservbyname, +// const char *name, const char *proto); //HANDLER_WRAPPERS_DEF(void, setservent, int stayopen); //HANDLER_WRAPPERS_DEF(void, endservent, void); //HANDLER_WRAPPERS_DEF(struct servent *PROBE_NAME(getservent, void); -//HANDLER_WRAPPERS_DEF(struct servent *PROBE_NAME(getservbyport, int port, const char *proto); -//HANDLER_WRAPPERS_DEF(int, getservent_r, struct servent *result_buf, char *buf, size_t buflen, struct servent **result); -//HANDLER_WRAPPERS_DEF(int, getservbyname_r, const char *name, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result); -//HANDLER_WRAPPERS_DEF(int, getservbyport_r, int port, const char *proto, struct servent *result_buf, char *buf, size_t buflen, struct servent **result); +//HANDLER_WRAPPERS_DEF(struct servent *PROBE_NAME(getservbyport, int port, +// const char *proto); +//HANDLER_WRAPPERS_DEF(int, getservent_r, struct servent *result_buf, char *buf, +// size_t buflen, struct servent **result); +//HANDLER_WRAPPERS_DEF(int, getservbyname_r, const char *name, +// const char *proto, struct servent *result_buf, char *buf, +// size_t buflen, struct servent **result); +//HANDLER_WRAPPERS_DEF(int, getservbyport_r, int port, const char *proto, +// struct servent *result_buf, char *buf, size_t buflen, +// struct servent **result); //HANDLER_WRAPPERS_DEF(struct netent*, getnetent, void); -//HANDLER_WRAPPERS_DEF(struct netent *PROBE_NAME(getnetbyname, const char *name); -//HANDLER_WRAPPERS_DEF(struct netent *PROBE_NAME(getnetbyaddr, uint32_t net, int type); +//HANDLER_WRAPPERS_DEF(struct netent *PROBE_NAME(getnetbyname, +// const char *name); +//HANDLER_WRAPPERS_DEF(struct netent *PROBE_NAME(getnetbyaddr, uint32_t net, +// int type); //HANDLER_WRAPPERS_DEF(void, setnetent, int stayopen); //HANDLER_WRAPPERS_DEF(void, endnetent, void); -//HANDLER_WRAPPERS_DEF(int, getnetent_r, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop); -//HANDLER_WRAPPERS_DEF(int, getnetbyname_r, const char *name, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop); -//HANDLER_WRAPPERS_DEF(int, getnetbyaddr_r, uint32_t net, int type, struct netent *result_buf, char *buf, size_t buflen, struct netent **result, int *h_errnop); +//HANDLER_WRAPPERS_DEF(int, getnetent_r, struct netent *result_buf, char *buf, +// size_t buflen, struct netent **result, int *h_errnop); +//HANDLER_WRAPPERS_DEF(int, getnetbyname_r, const char *name, +// struct netent *result_buf, char *buf, size_t buflen, +// struct netent **result, int *h_errnop); +//HANDLER_WRAPPERS_DEF(int, getnetbyaddr_r, uint32_t net, int type, +// struct netent *result_buf, char *buf, size_t buflen, +// struct netent **result, int *h_errnop); //HANDLER_WRAPPERS_DEF(struct protoent *PROBE_NAME(getprotoent, void); -//HANDLER_WRAPPERS_DEF(struct protoent *PROBE_NAME(getprotobyname, const char *name); +//HANDLER_WRAPPERS_DEF(struct protoent *PROBE_NAME(getprotobyname, +// const char *name); //HANDLER_WRAPPERS_DEF(struct protoent *PROBE_NAME(getprotobynumber, int proto); //HANDLER_WRAPPERS_DEF(void, setprotoent, int stayopen); //HANDLER_WRAPPERS_DEF(void, endprotoent, void); -//HANDLER_WRAPPERS_DEF(int, getprotoent_r, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result); -//HANDLER_WRAPPERS_DEF(int, getprotobyname_r, const char *name, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result); -//HANDLER_WRAPPERS_DEF(int, getprotobynumber_r, int proto, struct protoent *result_buf, char *buf, size_t buflen, struct protoent **result); +//HANDLER_WRAPPERS_DEF(int, getprotoent_r, struct protoent *result_buf, +// char *buf, size_t buflen, struct protoent **result); +//HANDLER_WRAPPERS_DEF(int, getprotobyname_r, const char *name, +// struct protoent *result_buf, char *buf, size_t buflen, +// struct protoent **result); +//HANDLER_WRAPPERS_DEF(int, getprotobynumber_r, int proto, +// struct protoent *result_buf, char *buf, size_t buflen, +// struct protoent **result); //HANDLER_WRAPPERS_DEF(unsigned int, if_nametoindex, __const char *__ifname); -//HANDLER_WRAPPERS_DEF(char *PROBE_NAME(if_indextoname, unsigned int __ifindex, char *__ifname); +//HANDLER_WRAPPERS_DEF(char *PROBE_NAME(if_indextoname, unsigned int __ifindex, +// char *__ifname); //HANDLER_WRAPPERS_DEF(struct if_nameindex *PROBE_NAME(if_nameindex, void); //HANDLER_WRAPPERS_DEF(void, if_freenameindex, struct if_nameindex *__ptr); //HANDLER_WRAPPERS_DEF(int, getifaddrs, struct ifaddrs **ifap); diff --git a/probe_socket/probe_socket.c b/probe_socket/probe_socket.c index 369fed6..a2863de 100644 --- a/probe_socket/probe_socket.c +++ b/probe_socket/probe_socket.c @@ -40,7 +40,7 @@ enum network_funcs_id_t get_network_feature_id(void *ptr) } enum network_funcs_id_t get_network_feature_always_id(void *ptr) - __attribute__((alias("get_network_feature_id"))); + __attribute__((alias("get_network_feature_id"))); #undef X @@ -48,7 +48,7 @@ enum network_funcs_id_t get_network_feature_always_id(void *ptr) /* X-macros replaced by structures defenitions */ /* For target binaries probes */ #define X(func_name, orig_name) \ - { (ElfW(Addr))& func_name, #orig_name, GT_TARGET_PROBE, (ElfW(Addr))0 }, + { (ElfW(Addr))&func_name, #orig_name, GT_TARGET_PROBE, (ElfW(Addr))0 }, static struct probe_desc_t network_probes[] = { PROBES_LIST @@ -58,7 +58,7 @@ static struct probe_desc_t network_probes[] = { /* For all binaries probes */ #define X(func_name, orig_name) \ - { (ElfW(Addr))& CONCAT(func_name, _always), #orig_name, \ + { (ElfW(Addr))&CONCAT(func_name, _always), #orig_name, \ GT_ALWAYS_PROBE, (ElfW(Addr))0 }, static struct probe_desc_t network_always_probes[] = { diff --git a/probe_thread/da_sync.h b/probe_thread/da_sync.h index d857d9d..4013984 100644 --- a/probe_thread/da_sync.h +++ b/probe_thread/da_sync.h @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -63,4 +63,3 @@ int real_pthread_setcancelstate(int state, int *oldstate); #endif #endif // __DA_SYNC_H__ - diff --git a/probe_thread/da_thread.h b/probe_thread/da_thread.h index 6484eb3..13f36a3 100644 --- a/probe_thread/da_thread.h +++ b/probe_thread/da_thread.h @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -36,19 +36,19 @@ #include "daprobe.h" -#define BEFORE_ORIGINAL_THREAD(FUNCNAME, LIBNAME) \ - DECLARE_VARIABLE_STANDARD; \ - FUNCNAME ## p = (void *)PROBE_GET_FUNC(probe_data); \ +#define BEFORE_ORIGINAL_THREAD(FUNCNAME, LIBNAME) \ + DECLARE_VARIABLE_STANDARD; \ + FUNCNAME ## p = (void *)PROBE_GET_FUNC(probe_data); \ PRE_PROBEBLOCK() -#define AFTER_PACK_ORIGINAL_THREAD(API_ID, RTYPE, RVAL, THREADVAL, APITYPE, INPUTFORMAT, ...) \ - POST_PACK_PROBEBLOCK_BEGIN(); \ - PREPARE_LOCAL_BUF(); \ - PACK_COMMON_BEGIN(MSG_PROBE_THREAD, API_ID, INPUTFORMAT, __VA_ARGS__); \ - PACK_COMMON_END(RTYPE, RVAL, errno, probe_data); \ - PACK_THREAD(THREADVAL, THREAD_PTHREAD, APITYPE, THREAD_CLASS_BLANK); \ - FLUSH_LOCAL_BUF(); \ +#define AFTER_PACK_ORIGINAL_THREAD(API_ID, RTYPE, RVAL, THREADVAL, APITYPE, \ + INPUTFORMAT, ...) \ + POST_PACK_PROBEBLOCK_BEGIN(); \ + PREPARE_LOCAL_BUF(); \ + PACK_COMMON_BEGIN(MSG_PROBE_THREAD, API_ID, INPUTFORMAT, __VA_ARGS__); \ + PACK_COMMON_END(RTYPE, RVAL, errno, probe_data); \ + PACK_THREAD(THREADVAL, THREAD_PTHREAD, APITYPE, THREAD_CLASS_BLANK); \ + FLUSH_LOCAL_BUF(); \ POST_PACK_PROBEBLOCK_END() #endif // __DA_THREAD_H__ - diff --git a/probe_thread/libdasync.c b/probe_thread/libdasync.c index 5166ab6..d237b9f 100644 --- a/probe_thread/libdasync.c +++ b/probe_thread/libdasync.c @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -44,11 +44,11 @@ -HANDLER_WRAPPERS(thread_feature, int, pthread_mutex_init, pthread_mutex_t * ,mutex, - const pthread_mutexattr_t *, attr) +HANDLER_WRAPPERS(thread_feature, int, pthread_mutex_init, pthread_mutex_t *, + mutex, const pthread_mutexattr_t *, attr) { int (*pthread_mutex_initp)(pthread_mutex_t *mutex, - const pthread_mutexattr_t *attr); + const pthread_mutexattr_t *attr); BEFORE_ORIGINAL_SYNC(pthread_mutex_init, LIBPTHREAD); @@ -62,7 +62,8 @@ HANDLER_WRAPPERS(thread_feature, int, pthread_mutex_init, pthread_mutex_t * ,mut return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_mutex_destroy, pthread_mutex_t *, mutex) +HANDLER_WRAPPERS(thread_feature, int , pthread_mutex_destroy, + pthread_mutex_t *, mutex) { int (*pthread_mutex_destroyp)(pthread_mutex_t *mutex); @@ -78,7 +79,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_mutex_destroy, pthread_mutex_t *, } /* TODO Support old preload, useless with got patching */ -int real_pthread_mutex_lock(pthread_mutex_t *mutex) { +int real_pthread_mutex_lock(pthread_mutex_t *mutex) +{ static int (*pthread_mutex_lockp)(pthread_mutex_t *mutex) = NULL; GET_REAL_FUNC(pthread_mutex_lock, LIBPTHREAD); @@ -86,7 +88,8 @@ int real_pthread_mutex_lock(pthread_mutex_t *mutex) { return pthread_mutex_lockp(mutex); } -HANDLER_WRAPPERS(thread_feature, int , pthread_mutex_lock, pthread_mutex_t *, mutex) +HANDLER_WRAPPERS(thread_feature, int , pthread_mutex_lock, + pthread_mutex_t *, mutex) { int (*pthread_mutex_lockp)(pthread_mutex_t *mutex); @@ -124,8 +127,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_mutex_lock, pthread_mutex_t *, mu return ret; } -HANDLER_WRAPPERS(thread_feature, int, pthread_mutex_timedlock, pthread_mutex_t *, mutex, - const struct timespec *, abs_timeout) +HANDLER_WRAPPERS(thread_feature, int, pthread_mutex_timedlock, + pthread_mutex_t *, mutex, const struct timespec *, abs_timeout) { int (*pthread_mutex_timedlockp)(pthread_mutex_t *mutex, const struct timespec *abs_timeout); @@ -166,7 +169,8 @@ HANDLER_WRAPPERS(thread_feature, int, pthread_mutex_timedlock, pthread_mutex_t * return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_mutex_trylock, pthread_mutex_t *, mutex) +HANDLER_WRAPPERS(thread_feature, int , pthread_mutex_trylock, + pthread_mutex_t *, mutex) { int (*pthread_mutex_trylockp)(pthread_mutex_t *mutex); @@ -183,7 +187,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_mutex_trylock, pthread_mutex_t *, } /* TODO Support old preload, useless with got patching */ -int real_pthread_mutex_unlock(pthread_mutex_t *mutex) { +int real_pthread_mutex_unlock(pthread_mutex_t *mutex) +{ static int (*pthread_mutex_unlockp)(pthread_mutex_t *mutex) = NULL; GET_REAL_FUNC(pthread_mutex_unlock, LIBPTHREAD); @@ -191,7 +196,8 @@ int real_pthread_mutex_unlock(pthread_mutex_t *mutex) { return pthread_mutex_unlockp(mutex); } -HANDLER_WRAPPERS(thread_feature, int , pthread_mutex_unlock, pthread_mutex_t *, mutex) +HANDLER_WRAPPERS(thread_feature, int , pthread_mutex_unlock, + pthread_mutex_t *, mutex) { int (*pthread_mutex_unlockp)(pthread_mutex_t *mutex); @@ -207,7 +213,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_mutex_unlock, pthread_mutex_t *, return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_mutexattr_init, pthread_mutexattr_t *, attr) +HANDLER_WRAPPERS(thread_feature, int , pthread_mutexattr_init, + pthread_mutexattr_t *, attr) { int (*pthread_mutexattr_initp)(pthread_mutexattr_t *attr); @@ -223,7 +230,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_mutexattr_init, pthread_mutexattr return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_mutexattr_destroy, pthread_mutexattr_t *, attr) +HANDLER_WRAPPERS(thread_feature, int, pthread_mutexattr_destroy, + pthread_mutexattr_t *, attr) { int (*pthread_mutexattr_destroyp)(pthread_mutexattr_t *attr); @@ -395,8 +403,8 @@ int pthread_mutex_setprioceiling(pthread_mutex_t *mutex, int prioceiling, int *old_ceiling); */ -HANDLER_WRAPPERS(thread_feature, int , pthread_cond_init, pthread_cond_t *, cond, - const pthread_condattr_t *, attr) +HANDLER_WRAPPERS(thread_feature, int , pthread_cond_init, + pthread_cond_t *, cond, const pthread_condattr_t *, attr) { int (*pthread_cond_initp)(pthread_cond_t *cond, const pthread_condattr_t *attr); @@ -414,7 +422,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_cond_init, pthread_cond_t *, cond return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_cond_destroy, pthread_cond_t *, cond) +HANDLER_WRAPPERS(thread_feature, int , pthread_cond_destroy, + pthread_cond_t *, cond) { int (*pthread_cond_destroyp)(pthread_cond_t *cond); @@ -430,8 +439,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_cond_destroy, pthread_cond_t *, c return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_cond_wait, pthread_cond_t *, cond, - pthread_mutex_t *, mutex) +HANDLER_WRAPPERS(thread_feature, int , pthread_cond_wait, + pthread_cond_t *, cond, pthread_mutex_t *, mutex) { int (*pthread_cond_waitp)(pthread_cond_t *cond, pthread_mutex_t *mutex); @@ -475,8 +484,9 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_cond_wait, pthread_cond_t *, cond return ret; } -HANDLER_WRAPPERS(thread_feature, int, pthread_cond_timedwait, pthread_cond_t *, cond, - pthread_mutex_t *, mutex, const struct timespec *, abstime) +HANDLER_WRAPPERS(thread_feature, int, pthread_cond_timedwait, + pthread_cond_t *, cond, pthread_mutex_t *, mutex, + const struct timespec *, abstime) { int (*pthread_cond_timedwaitp)(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime); @@ -522,7 +532,8 @@ HANDLER_WRAPPERS(thread_feature, int, pthread_cond_timedwait, pthread_cond_t *, return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_cond_signal, pthread_cond_t *, cond) +HANDLER_WRAPPERS(thread_feature, int , pthread_cond_signal, + pthread_cond_t *, cond) { int (*pthread_cond_signalp)(pthread_cond_t *cond); @@ -537,7 +548,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_cond_signal, pthread_cond_t *, co return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_cond_broadcast, pthread_cond_t *, cond) +HANDLER_WRAPPERS(thread_feature, int , pthread_cond_broadcast, + pthread_cond_t *, cond) { int (*pthread_cond_broadcastp)(pthread_cond_t *cond); @@ -547,7 +559,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_cond_broadcast, pthread_cond_t *, AFTER_PACK_ORIGINAL_SYNC(API_ID_pthread_cond_broadcast, 'd', ret, cond, SYNC_PTHREAD_COND_VARIABLE, - SYNC_API_NOTIFY_ALL, "p", voidp_to_uint64(cond)); + SYNC_API_NOTIFY_ALL, "p", + voidp_to_uint64(cond)); return ret; } diff --git a/probe_thread/libdasync.h b/probe_thread/libdasync.h index 4bd364d..fd86687 100644 --- a/probe_thread/libdasync.h +++ b/probe_thread/libdasync.h @@ -1,26 +1,41 @@ #ifndef __LIBDASYNC_H__ #define __LIBDASYNC_H__ -HANDLER_WRAPPERS_DEF(int, pthread_mutex_init, pthread_mutex_t *, mutex, const pthread_mutexattr_t *, attr); +HANDLER_WRAPPERS_DEF(int, pthread_mutex_init, pthread_mutex_t *, mutex, + const pthread_mutexattr_t *, attr); HANDLER_WRAPPERS_DEF(int, pthread_mutex_destroy, pthread_mutex_t *, mutex); HANDLER_WRAPPERS_DEF(int, pthread_mutex_lock, pthread_mutex_t *, mutex); -HANDLER_WRAPPERS_DEF(int, pthread_mutex_timedlock, pthread_mutex_t *, mutex, const struct timespec *, abs_timeout); +HANDLER_WRAPPERS_DEF(int, pthread_mutex_timedlock, pthread_mutex_t *, mutex, + const struct timespec *, abs_timeout); HANDLER_WRAPPERS_DEF(int, pthread_mutex_trylock, pthread_mutex_t *, mutex); HANDLER_WRAPPERS_DEF(int, pthread_mutex_unlock, pthread_mutex_t *, mutex); HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_init, pthread_mutexattr_t *, attr); -HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_destroy, pthread_mutexattr_t *, attr); -HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_getprioceiling, const pthread_mutexattr_t *, attr, int *, prioceiling); -HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_setprioceiling, pthread_mutexattr_t *, attr, int, prioceiling); -HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_getprotocol, const pthread_mutexattr_t *, attr, int *, protocol); -HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_setprotocol, pthread_mutexattr_t *, attr, int, protocol); -HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_getpshared, const pthread_mutexattr_t *, attr, int *, pshared); -HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_setpshared, pthread_mutexattr_t *, attr, int, pshared); -HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_gettype, const pthread_mutexattr_t *, attr, int *, type); -HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_settype, pthread_mutexattr_t *, attr, int, type); -HANDLER_WRAPPERS_DEF(int, pthread_cond_init, pthread_cond_t *, cond, const pthread_condattr_t *, attr); +HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_destroy, + pthread_mutexattr_t *, attr); +HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_getprioceiling, + const pthread_mutexattr_t *, attr, int *, prioceiling); +HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_setprioceiling, + pthread_mutexattr_t *, attr, int, prioceiling); +HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_getprotocol, + const pthread_mutexattr_t *, attr, int *, protocol); +HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_setprotocol, + pthread_mutexattr_t *, attr, int, protocol); +HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_getpshared, + const pthread_mutexattr_t *, attr, int *, pshared); +HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_setpshared, + pthread_mutexattr_t *, attr, int, pshared); +HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_gettype, + const pthread_mutexattr_t *, attr, int *, type); +HANDLER_WRAPPERS_DEF(int, pthread_mutexattr_settype, + pthread_mutexattr_t *, attr, int, type); +HANDLER_WRAPPERS_DEF(int, pthread_cond_init, pthread_cond_t *, cond, + const pthread_condattr_t *, attr); HANDLER_WRAPPERS_DEF(int, pthread_cond_destroy, pthread_cond_t *, cond); -HANDLER_WRAPPERS_DEF(int, pthread_cond_wait, pthread_cond_t *, cond, pthread_mutex_t *, mutex); -HANDLER_WRAPPERS_DEF(int, pthread_cond_timedwait, pthread_cond_t *, cond, pthread_mutex_t *, mutex, const struct timespec *, abstime); +HANDLER_WRAPPERS_DEF(int, pthread_cond_wait, pthread_cond_t *, cond, + pthread_mutex_t *, mutex); +HANDLER_WRAPPERS_DEF(int, pthread_cond_timedwait, pthread_cond_t *, cond, + pthread_mutex_t *, mutex, + const struct timespec *, abstime); HANDLER_WRAPPERS_DEF(int, pthread_cond_signal, pthread_cond_t *, cond); HANDLER_WRAPPERS_DEF(int, pthread_cond_broadcast, pthread_cond_t *, cond); diff --git a/probe_thread/libdathread.c b/probe_thread/libdathread.c index edc8411..f10e95e 100644 --- a/probe_thread/libdathread.c +++ b/probe_thread/libdathread.c @@ -12,17 +12,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -65,9 +65,11 @@ HANDLER_WRAPPERS(thread_feature, int, pthread_create, pthread_t *, thread, { /* TODO Split LSan */ static int (*lsan_pthread_createp)(pthread_t *thread, - const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg); + const pthread_attr_t *attr, + void *(*start_routine)(void *), void *arg); int (*pthread_createp)(pthread_t *thread, - const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg); + const pthread_attr_t *attr, + void *(*start_routine)(void *), void *arg); DECLARE_VARIABLE_STANDARD; if (lsan_init_succeeded && lsan_pthread_createp == NULL) @@ -78,10 +80,9 @@ HANDLER_WRAPPERS(thread_feature, int, pthread_create, pthread_t *, thread, PRE_PROBEBLOCK(); - if(blockresult) - { + if (blockresult) { thread_routine_call *ptrc = - (thread_routine_call *)malloc(sizeof(thread_routine_call)); + (thread_routine_call *)malloc(sizeof(*ptrc)); if (!ptrc) { PRINTERR("Can't allocate memory for ptrc"); return EAGAIN; @@ -90,10 +91,9 @@ HANDLER_WRAPPERS(thread_feature, int, pthread_create, pthread_t *, thread, ptrc->thread_routine = start_routine; ptrc->argument = arg; - ret = pthread_createp(thread, attr, _da_ThreadProc, (void *) ptrc); - } - else // when pthread_create is called inside probe so (ex. custom chart, sampling thread) - { + ret = pthread_createp(thread, attr, _da_ThreadProc, + (void *)ptrc); + } else { ret = pthread_createp(thread, attr, start_routine, arg); } @@ -108,7 +108,8 @@ HANDLER_WRAPPERS(thread_feature, int, pthread_create, pthread_t *, thread, return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_join, pthread_t, thread, void **, retval) +HANDLER_WRAPPERS(thread_feature, int , pthread_join, pthread_t, thread, + void **, retval) { /* TODO Split LSan */ static int (*lsan_pthread_joinp)(pthread_t thread, void **retval); @@ -128,7 +129,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_join, pthread_t, thread, void **, API_ID_pthread_join, "xp", (uint64_t)(thread), voidp_to_uint64(retval)); PACK_COMMON_END('d', 0, 0, probe_data); - PACK_THREAD(thread, THREAD_PTHREAD, THREAD_API_WAIT_START, THREAD_CLASS_BLANK); + PACK_THREAD(thread, THREAD_PTHREAD, THREAD_API_WAIT_START, + THREAD_CLASS_BLANK); FLUSH_LOCAL_BUF(); PRE_PROBEBLOCK_END(); @@ -146,7 +148,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_join, pthread_t, thread, void **, (uint64_t)(thread), voidp_to_uint64(retval)); PACK_COMMON_END('d', ret, errno, probe_data); - PACK_THREAD(thread, THREAD_PTHREAD, THREAD_API_WAIT_END, THREAD_CLASS_BLANK); + PACK_THREAD(thread, THREAD_PTHREAD, THREAD_API_WAIT_END, + THREAD_CLASS_BLANK); FLUSH_LOCAL_BUF(); errno = (newerrno != 0) ? newerrno : olderrno; @@ -176,7 +179,7 @@ HANDLER_WRAPPERS_VOID(thread_feature, void , pthread_exit, void *, retval) PRE_PROBEBLOCK_END(); - errno = (newerrno != 0) ? newerrno : olderrno; + errno = (newerrno != 0) ? newerrno : olderrno; pthread_exitp(retval); @@ -224,12 +227,14 @@ HANDLER_WRAPPERS(thread_feature, pthread_t , pthread_self, void) newerrno = errno; AFTER_PACK_ORIGINAL_THREAD(API_ID_pthread_self, - 'p', ret_pthr, ret_pthr, THREAD_API_OTHER, "", 0); + 'p', ret_pthr, ret_pthr, THREAD_API_OTHER, + "", 0); return ret_pthr; } -HANDLER_WRAPPERS(thread_feature, int , pthread_equal, pthread_t, t1, pthread_t, t2) +HANDLER_WRAPPERS(thread_feature, int , pthread_equal, pthread_t, t1, + pthread_t, t2) { int (*pthread_equalp)(pthread_t t1, pthread_t t2); @@ -254,7 +259,8 @@ int real_pthread_setcancelstate(int state, int *oldstate) return pthread_setcancelstatep(state, oldstate); } -HANDLER_WRAPPERS(thread_feature, int , pthread_setcancelstate, int, state, int *, oldstate) +HANDLER_WRAPPERS(thread_feature, int , pthread_setcancelstate, int, state, + int *, oldstate) { pthread_t pSelf; int (*pthread_setcancelstatep)(int state, int *oldstate); @@ -271,7 +277,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_setcancelstate, int, state, int * return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_setcanceltype, int, type, int *, oldtype) +HANDLER_WRAPPERS(thread_feature, int , pthread_setcanceltype, int, type, + int *, oldtype) { pthread_t pSelf; int (*pthread_setcanceltypep)(int type, int *oldtype); @@ -288,7 +295,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_setcanceltype, int, type, int *, return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_attr_init, pthread_attr_t *, attr) +HANDLER_WRAPPERS(thread_feature, int , pthread_attr_init, + pthread_attr_t *, attr) { pthread_t thread = 0; int (*pthread_attr_initp)(pthread_attr_t *attr); @@ -304,7 +312,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_attr_init, pthread_attr_t *, attr return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_attr_destroy, pthread_attr_t *, attr) +HANDLER_WRAPPERS(thread_feature, int , pthread_attr_destroy, + pthread_attr_t *, attr) { pthread_t thread = 0; int (*pthread_attr_destroyp)(pthread_attr_t *attr); @@ -339,8 +348,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_attr_getdetachstate, return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setdetachstate, pthread_attr_t *, attr, - int, detachstate) +HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setdetachstate, + pthread_attr_t *, attr, int, detachstate) { pthread_t thread = 0; int (*pthread_attr_setdetachstatep)(pthread_attr_t *attr, @@ -358,8 +367,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setdetachstate, pthread_attr return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_attr_getstacksize, const pthread_attr_t *, attr, - size_t *, stacksize) +HANDLER_WRAPPERS(thread_feature, int , pthread_attr_getstacksize, + const pthread_attr_t *, attr, size_t *, stacksize) { pthread_t thread = 0; int (*pthread_attr_getstacksizep)(const pthread_attr_t *attr, @@ -377,8 +386,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_attr_getstacksize, const pthread_ return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setstacksize, pthread_attr_t *, attr, - size_t, stacksize) +HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setstacksize, + pthread_attr_t *, attr, size_t, stacksize) { pthread_t thread = 0; int (*pthread_attr_setstacksizep)(pthread_attr_t *attr, @@ -406,8 +415,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setstacksize, pthread_attr_t * * happens on pthread-2.18 (target TV emul), not happens on pthread-2.13 */ -HANDLER_WRAPPERS(thread_feature, int , pthread_attr_getstackaddr, const pthread_attr_t *, attr, - void **, stackaddr) +HANDLER_WRAPPERS(thread_feature, int , pthread_attr_getstackaddr, + const pthread_attr_t *, attr, void **, stackaddr) { pthread_t thread = 0; static int (*pthread_attr_getstackaddrp)(const pthread_attr_t *attr, @@ -425,8 +434,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_attr_getstackaddr, const pthread_ return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setstackaddr, pthread_attr_t *, attr, - void *, stackaddr) +HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setstackaddr, + pthread_attr_t *, attr, void *, stackaddr) { pthread_t thread = 0; static int (*pthread_attr_setstackaddrp)(pthread_attr_t *attr, @@ -465,8 +474,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_attr_getinheritsched, return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setinheritsched, pthread_attr_t *, attr, - int, inheritsched) +HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setinheritsched, + pthread_attr_t *, attr, int, inheritsched) { pthread_t thread = 0; int (*pthread_attr_setinheritschedp)(pthread_attr_t *attr, @@ -484,8 +493,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setinheritsched, pthread_att return ret; } -HANDLER_WRAPPERS(thread_feature, int, pthread_attr_getschedparam, const pthread_attr_t *, attr, - struct sched_param *, param) +HANDLER_WRAPPERS(thread_feature, int, pthread_attr_getschedparam, + const pthread_attr_t *, attr, struct sched_param *, param) { pthread_t thread = 0; int (*pthread_attr_getschedparamp)(const pthread_attr_t *attr, @@ -503,8 +512,8 @@ HANDLER_WRAPPERS(thread_feature, int, pthread_attr_getschedparam, const pthread_ return ret; } -HANDLER_WRAPPERS(thread_feature, int, pthread_attr_setschedparam, pthread_attr_t *, attr, - const struct sched_param *, param) +HANDLER_WRAPPERS(thread_feature, int, pthread_attr_setschedparam, + pthread_attr_t *, attr, const struct sched_param *, param) { pthread_t thread = 0; int (*pthread_attr_setschedparamp)(pthread_attr_t *attr, @@ -542,8 +551,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_attr_getschedpolicy, return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setschedpolicy, pthread_attr_t *, attr, - int, policy) +HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setschedpolicy, + pthread_attr_t *, attr, int, policy) { pthread_t thread = 0; int (*pthread_attr_setschedpolicyp)(pthread_attr_t *attr, @@ -561,8 +570,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setschedpolicy, pthread_attr return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_attr_getguardsize, const pthread_attr_t *, attr, - size_t *, guardsize) +HANDLER_WRAPPERS(thread_feature, int , pthread_attr_getguardsize, + const pthread_attr_t *, attr, size_t *, guardsize) { pthread_t thread = 0; int (*pthread_attr_getguardsizep)(const pthread_attr_t *attr, @@ -580,8 +589,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_attr_getguardsize, const pthread_ return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setguardsize, pthread_attr_t *, attr, - size_t, guardsize) +HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setguardsize, + pthread_attr_t *, attr, size_t, guardsize) { pthread_t thread = 0; int (*pthread_attr_setguardsizep)(pthread_attr_t *attr, @@ -599,8 +608,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setguardsize, pthread_attr_t return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_attr_getscope, const pthread_attr_t *, attr, - int *, contentionscope) +HANDLER_WRAPPERS(thread_feature, int , pthread_attr_getscope, + const pthread_attr_t *, attr, int *, contentionscope) { pthread_t thread = 0; int (*pthread_attr_getscopep)(const pthread_attr_t *attr, @@ -618,8 +627,8 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_attr_getscope, const pthread_attr return ret; } -HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setscope, pthread_attr_t *, attr, - int, contentionscope) +HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setscope, + pthread_attr_t *, attr, int, contentionscope) { pthread_t thread = 0; int (*pthread_attr_setscopep)(pthread_attr_t *attr, @@ -631,13 +640,15 @@ HANDLER_WRAPPERS(thread_feature, int , pthread_attr_setscope, pthread_attr_t *, AFTER_PACK_ORIGINAL_THREAD(API_ID_pthread_attr_setscope, 'd', ret, thread, THREAD_API_OTHER, - "pd", voidp_to_uint64(attr), contentionscope); + "pd", voidp_to_uint64(attr), + contentionscope); return ret; } -HANDLER_WRAPPERS(thread_feature, int, pthread_attr_getstack, const pthread_attr_t *, attr, - void **, stackaddr, size_t *, stacksize) +HANDLER_WRAPPERS(thread_feature, int, pthread_attr_getstack, + const pthread_attr_t *, attr, void **, stackaddr, + size_t *, stacksize) { pthread_t thread = 0; int (*pthread_attr_getstackp)(const pthread_attr_t *attr, @@ -656,8 +667,8 @@ HANDLER_WRAPPERS(thread_feature, int, pthread_attr_getstack, const pthread_attr_ return ret; } -HANDLER_WRAPPERS(thread_feature, int, pthread_attr_setstack, pthread_attr_t *, attr, - void *, stackaddr, size_t, stacksize) +HANDLER_WRAPPERS(thread_feature, int, pthread_attr_setstack, + pthread_attr_t *, attr, void *, stackaddr, size_t, stacksize) { pthread_t thread = 0; int (*pthread_attr_setstackp)(pthread_attr_t *attr, @@ -729,7 +740,8 @@ void _da_cleanup_handler(void *data) API_ID__da_cleanup_handler, "p", voidp_to_uint64(data)); PACK_COMMON_END('v', 0, 0, probe_data); - PACK_THREAD(pSelf, THREAD_PTHREAD, THREAD_API_INTERNAL_STOP, THREAD_CLASS_BLANK); + PACK_THREAD(pSelf, THREAD_PTHREAD, THREAD_API_INTERNAL_STOP, + THREAD_CLASS_BLANK); FLUSH_LOCAL_BUF(); PRE_UNCONDITIONAL_BLOCK_END(); @@ -764,7 +776,8 @@ void *_da_ThreadProc(void *params) API_ID__da_ThreadProc, "p", voidp_to_uint64(params)); PACK_COMMON_END('p', 0, 0, probe_data); - PACK_THREAD(pSelf, THREAD_PTHREAD, THREAD_API_INTERNAL_START, THREAD_CLASS_BLANK); + PACK_THREAD(pSelf, THREAD_PTHREAD, THREAD_API_INTERNAL_START, + THREAD_CLASS_BLANK); FLUSH_LOCAL_BUF(); PRE_UNCONDITIONAL_BLOCK_END(); @@ -790,7 +803,8 @@ void *_da_ThreadProc(void *params) API_ID__da_ThreadProc, "p", voidp_to_uint64(params)); PACK_COMMON_END('p', ret, 0, probe_data); - PACK_THREAD(pSelf, THREAD_PTHREAD, THREAD_API_INTERNAL_STOP, THREAD_CLASS_BLANK); + PACK_THREAD(pSelf, THREAD_PTHREAD, THREAD_API_INTERNAL_STOP, + THREAD_CLASS_BLANK); FLUSH_LOCAL_BUF(); PRE_UNCONDITIONAL_BLOCK_END(); diff --git a/probe_thread/libdathread.h b/probe_thread/libdathread.h index 2b2b644..1159859 100644 --- a/probe_thread/libdathread.h +++ b/probe_thread/libdathread.h @@ -3,7 +3,9 @@ typedef void *(*start_routine_t)(void *); -HANDLER_WRAPPERS_DEF(int, pthread_create, pthread_t *, thread, const pthread_attr_t *, attr, start_routine_t, start_routine, void *, arg); +HANDLER_WRAPPERS_DEF(int, pthread_create, pthread_t *, thread, + const pthread_attr_t *, attr, + start_routine_t, start_routine, void *, arg); HANDLER_WRAPPERS_DEF(int, pthread_join, pthread_t, thread, void **, retval); HANDLER_WRAPPERS_DEF(void, pthread_exit, void *, retval); HANDLER_WRAPPERS_DEF(int, pthread_cancel, pthread_t, thread); @@ -14,23 +16,41 @@ HANDLER_WRAPPERS_DEF(int, pthread_setcancelstate, int, state, int *, oldstate); HANDLER_WRAPPERS_DEF(int, pthread_setcanceltype, int, type, int *, oldtype); HANDLER_WRAPPERS_DEF(int, pthread_attr_init, pthread_attr_t *, attr); HANDLER_WRAPPERS_DEF(int, pthread_attr_destroy, pthread_attr_t *, attr); -HANDLER_WRAPPERS_DEF(int, pthread_attr_getdetachstate, const pthread_attr_t *, attr, int *, detachstate); -HANDLER_WRAPPERS_DEF(int, pthread_attr_setdetachstate, pthread_attr_t *, attr, int, detachstate); -HANDLER_WRAPPERS_DEF(int, pthread_attr_getstacksize, const pthread_attr_t *, attr, size_t *, stacksize); -HANDLER_WRAPPERS_DEF(int, pthread_attr_setstacksize, pthread_attr_t *, attr, size_t, stacksize); -//HANDLER_WRAPPERS_DEF(int, pthread_attr_getstackaddr, const pthread_attr_t *, attr, void **, stackaddr); -//HANDLER_WRAPPERS_DEF(int, pthread_attr_setstackaddr, pthread_attr_t *, attr, void *, stackaddr); -HANDLER_WRAPPERS_DEF(int, pthread_attr_getinheritsched, const pthread_attr_t *, attr, int *, inheritsched); -HANDLER_WRAPPERS_DEF(int, pthread_attr_setinheritsched, pthread_attr_t *, attr, int, inheritsched); -HANDLER_WRAPPERS_DEF(int, pthread_attr_getschedparam, const pthread_attr_t *, attr, struct sched_param *, param); -HANDLER_WRAPPERS_DEF(int, pthread_attr_setschedparam, pthread_attr_t *, attr, const struct sched_param *, param); -HANDLER_WRAPPERS_DEF(int, pthread_attr_getschedpolicy, const pthread_attr_t *, attr, int *, policy) -HANDLER_WRAPPERS_DEF(int, pthread_attr_setschedpolicy, pthread_attr_t *, attr, int, policy) -HANDLER_WRAPPERS_DEF(int, pthread_attr_getguardsize, const pthread_attr_t *, attr, size_t *, guardsize) -HANDLER_WRAPPERS_DEF(int, pthread_attr_setguardsize, pthread_attr_t *, attr, size_t, guardsize) -HANDLER_WRAPPERS_DEF(int, pthread_attr_getscope, const pthread_attr_t *, attr, int *, contentionscope) -HANDLER_WRAPPERS_DEF(int, pthread_attr_setscope, pthread_attr_t *, attr, int, contentionscope) -HANDLER_WRAPPERS_DEF(int, pthread_attr_getstack, const pthread_attr_t *, attr, void **, stackaddr, size_t *, stacksize); -HANDLER_WRAPPERS_DEF(int, pthread_attr_setstack, pthread_attr_t *, attr, void *, stackaddr, size_t, stacksize); +HANDLER_WRAPPERS_DEF(int, pthread_attr_getdetachstate, + const pthread_attr_t *, attr, int *, detachstate); +HANDLER_WRAPPERS_DEF(int, pthread_attr_setdetachstate, pthread_attr_t *, attr, + int, detachstate); +HANDLER_WRAPPERS_DEF(int, pthread_attr_getstacksize, + const pthread_attr_t *, attr, size_t *, stacksize); +HANDLER_WRAPPERS_DEF(int, pthread_attr_setstacksize, pthread_attr_t *, attr, + size_t, stacksize); +//HANDLER_WRAPPERS_DEF(int, pthread_attr_getstackaddr, +// const pthread_attr_t *, attr, void **, stackaddr); +//HANDLER_WRAPPERS_DEF(int, pthread_attr_setstackaddr, pthread_attr_t *, attr, +// void *, stackaddr); +HANDLER_WRAPPERS_DEF(int, pthread_attr_getinheritsched, + const pthread_attr_t *, attr, int *, inheritsched); +HANDLER_WRAPPERS_DEF(int, pthread_attr_setinheritsched, pthread_attr_t *, attr, + int, inheritsched); +HANDLER_WRAPPERS_DEF(int, pthread_attr_getschedparam, + const pthread_attr_t *, attr, struct sched_param *, param); +HANDLER_WRAPPERS_DEF(int, pthread_attr_setschedparam, pthread_attr_t *, attr, + const struct sched_param *, param); +HANDLER_WRAPPERS_DEF(int, pthread_attr_getschedpolicy, + const pthread_attr_t *, attr, int *, policy); +HANDLER_WRAPPERS_DEF(int, pthread_attr_setschedpolicy, pthread_attr_t *, attr, + int, policy); +HANDLER_WRAPPERS_DEF(int, pthread_attr_getguardsize, + const pthread_attr_t *, attr, size_t *, guardsize); +HANDLER_WRAPPERS_DEF(int, pthread_attr_setguardsize, pthread_attr_t *, attr, + size_t, guardsize); +HANDLER_WRAPPERS_DEF(int, pthread_attr_getscope, const pthread_attr_t *, attr, + int *, contentionscope); +HANDLER_WRAPPERS_DEF(int, pthread_attr_setscope, pthread_attr_t *, attr, + int, contentionscope); +HANDLER_WRAPPERS_DEF(int, pthread_attr_getstack, const pthread_attr_t *, attr, + void **, stackaddr, size_t *, stacksize); +HANDLER_WRAPPERS_DEF(int, pthread_attr_setstack, pthread_attr_t *, attr, + void *, stackaddr, size_t, stacksize); #endif /* __LIBDATHREAD_H__ */ diff --git a/probe_thread/thread_probes_list.h b/probe_thread/thread_probes_list.h index 72e5225..0c99a17 100644 --- a/probe_thread/thread_probes_list.h +++ b/probe_thread/thread_probes_list.h @@ -15,16 +15,22 @@ X(PROBE_NAME(pthread_setcanceltype), pthread_setcanceltype) \ X(PROBE_NAME(pthread_attr_init), pthread_attr_init) \ X(PROBE_NAME(pthread_attr_destroy), pthread_attr_destroy) \ - X(PROBE_NAME(pthread_attr_getdetachstate), pthread_attr_getdetachstate) \ - X(PROBE_NAME(pthread_attr_setdetachstate), pthread_attr_setdetachstate) \ + X(PROBE_NAME(pthread_attr_getdetachstate), \ + pthread_attr_getdetachstate) \ + X(PROBE_NAME(pthread_attr_setdetachstate), \ + pthread_attr_setdetachstate) \ X(PROBE_NAME(pthread_attr_getstacksize), pthread_attr_getstacksize) \ X(PROBE_NAME(pthread_attr_setstacksize), pthread_attr_setstacksize) \ - X(PROBE_NAME(pthread_attr_getinheritsched), pthread_attr_getinheritsched) \ - X(PROBE_NAME(pthread_attr_setinheritsched), pthread_attr_setinheritsched) \ + X(PROBE_NAME(pthread_attr_getinheritsched), \ + pthread_attr_getinheritsched) \ + X(PROBE_NAME(pthread_attr_setinheritsched), \ + pthread_attr_setinheritsched) \ X(PROBE_NAME(pthread_attr_getschedparam), pthread_attr_getschedparam) \ X(PROBE_NAME(pthread_attr_setschedparam), pthread_attr_setschedparam) \ - X(PROBE_NAME(pthread_attr_getschedpolicy), pthread_attr_getschedpolicy) \ - X(PROBE_NAME(pthread_attr_setschedpolicy), pthread_attr_setschedpolicy) \ + X(PROBE_NAME(pthread_attr_getschedpolicy), \ + pthread_attr_getschedpolicy) \ + X(PROBE_NAME(pthread_attr_setschedpolicy), \ + pthread_attr_setschedpolicy) \ X(PROBE_NAME(pthread_attr_getguardsize), pthread_attr_getguardsize) \ X(PROBE_NAME(pthread_attr_setguardsize), pthread_attr_setguardsize) \ X(PROBE_NAME(pthread_attr_getscope), pthread_attr_getscope) \ @@ -39,12 +45,18 @@ X(PROBE_NAME(pthread_mutex_unlock), pthread_mutex_unlock) \ X(PROBE_NAME(pthread_mutexattr_init), pthread_mutexattr_init) \ X(PROBE_NAME(pthread_mutexattr_destroy), pthread_mutexattr_destroy) \ - X(PROBE_NAME(pthread_mutexattr_getprioceiling), pthread_mutexattr_getprioceiling) \ - X(PROBE_NAME(pthread_mutexattr_setprioceiling), pthread_mutexattr_setprioceiling) \ - X(PROBE_NAME(pthread_mutexattr_getprotocol), pthread_mutexattr_getprotocol) \ - X(PROBE_NAME(pthread_mutexattr_setprotocol), pthread_mutexattr_setprotocol) \ - X(PROBE_NAME(pthread_mutexattr_getpshared), pthread_mutexattr_getpshared) \ - X(PROBE_NAME(pthread_mutexattr_setpshared), pthread_mutexattr_setpshared) \ + X(PROBE_NAME(pthread_mutexattr_getprioceiling), \ + pthread_mutexattr_getprioceiling) \ + X(PROBE_NAME(pthread_mutexattr_setprioceiling), \ + pthread_mutexattr_setprioceiling) \ + X(PROBE_NAME(pthread_mutexattr_getprotocol), \ + pthread_mutexattr_getprotocol) \ + X(PROBE_NAME(pthread_mutexattr_setprotocol), \ + pthread_mutexattr_setprotocol) \ + X(PROBE_NAME(pthread_mutexattr_getpshared), \ + pthread_mutexattr_getpshared) \ + X(PROBE_NAME(pthread_mutexattr_setpshared), \ + pthread_mutexattr_setpshared) \ X(PROBE_NAME(pthread_mutexattr_gettype), pthread_mutexattr_gettype) \ X(PROBE_NAME(pthread_mutexattr_settype), pthread_mutexattr_settype) \ X(PROBE_NAME(pthread_cond_init), pthread_cond_init) \ diff --git a/probe_ui/capi_capture.c b/probe_ui/capi_capture.c index 59d6a93..ccb7840 100755 --- a/probe_ui/capi_capture.c +++ b/probe_ui/capi_capture.c @@ -11,17 +11,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd diff --git a/probe_ui/da_ui.h b/probe_ui/da_ui.h index 548b09a..98617a5 100755 --- a/probe_ui/da_ui.h +++ b/probe_ui/da_ui.h @@ -11,17 +11,17 @@ * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the - * Free Software Foundation; either version 2.1 of the License, or (at your option) - * any later version. + * Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. * - * This library is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * along with this library; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Contributors: * - S-Core Co., Ltd @@ -38,14 +38,14 @@ * SNAPSHOT PROBE MACRO * * log format - * SeqNumber`,ApiName`,Time`,Pid`,Tid`,InputParm`,Return`,PCAddr`,Error`,Size`,FUNCTYPE`,\n - * callstack_start`,callstack`,callstack_end + * SeqNumber`,ApiName`,Time`,Pid`,Tid`,InputParm`,Return`,PCAddr`,Error`,Size`,FUNCTYPE`,\n + * callstack_start`,callstack`,callstack_end * * FUNCTYPE - * SNAPSHOT_API_TYPE_PAGER, - * SNAPSHOT_API_TYPE_CONTROLBAR, - * SNAPSHOT_API_TYPE_NAVIFRAME, - * SNAPSHOT_API_TYPE_OTHER + * SNAPSHOT_API_TYPE_PAGER, + * SNAPSHOT_API_TYPE_CONTROLBAR, + * SNAPSHOT_API_TYPE_NAVIFRAME, + * SNAPSHOT_API_TYPE_OTHER * **********************************************************************/ @@ -54,17 +54,23 @@ FUNCNAME ## p = (void *)GET_ORIG_FUNC(ui_feature, FUNCNAME) -#define AFTER_ORIGINAL_SNAPSHOT(EVASOBJECT) \ - do { \ - static void (*__evas_event_callback_add_p)(Evas *e, Evas_Callback_Type type, Evas_Event_Cb func, const void *data); \ - static Evas *(*__evas_object_evas_get_p)(Evas_Object *obj);\ - \ - rtld_default_set_once(__evas_event_callback_add_p, "evas_event_callback_add"); \ - rtld_default_set_once(__evas_object_evas_get_p, "evas_object_evas_get"); \ - \ - __evas_event_callback_add_p(__evas_object_evas_get_p(EVASOBJECT), \ - EVAS_CALLBACK_RENDER_FLUSH_POST, \ - get_render_post_cb(), NULL); \ +#define AFTER_ORIGINAL_SNAPSHOT(EVASOBJECT) \ + do { \ + static void (*__evas_event_callback_add_p)(Evas *e, \ + Evas_Callback_Type type, \ + Evas_Event_Cb func, \ + const void *data); \ + static Evas *(*__evas_object_evas_get_p)(Evas_Object *obj); \ + \ + rtld_default_set_once(__evas_event_callback_add_p, \ + "evas_event_callback_add"); \ + rtld_default_set_once(__evas_object_evas_get_p, \ + "evas_object_evas_get"); \ + \ + __evas_event_callback_add_p( \ + __evas_object_evas_get_p(EVASOBJECT), \ + EVAS_CALLBACK_RENDER_FLUSH_POST, \ + get_render_post_cb(), NULL); \ } while(0) #endif // __DA_SNAPSHOT_H__ diff --git a/probe_ui/tizen_frameani.h b/probe_ui/tizen_frameani.h index 07beba6..592fa2d 100644 --- a/probe_ui/tizen_frameani.h +++ b/probe_ui/tizen_frameani.h @@ -36,16 +36,18 @@ using namespace Tizen::Ui::Animations; using namespace Tizen::Ui::Controls; -class DAFrameAnimationEventListener : - public IFrameAnimatorEventListener +class DAFrameAnimationEventListener: public IFrameAnimatorEventListener { public: DAFrameAnimationEventListener(); virtual ~DAFrameAnimationEventListener(); - virtual void OnFormTransitionAnimationFinished (FrameAnimator &source, Frame &frame, Form &form1, Form &form2); - virtual void OnFormTransitionAnimationStarted (FrameAnimator &source, Frame &frame, Form &form1, Form &form2); - virtual void OnFormTransitionAnimationStopped (FrameAnimator &source, Frame &frame, Form &form1, Form &form2); + virtual void OnFormTransitionAnimationFinished(FrameAnimator &source, Frame &frame, + Form &form1, Form &form2); + virtual void OnFormTransitionAnimationStarted(FrameAnimator &source, Frame &frame, + Form &form1, Form &form2); + virtual void OnFormTransitionAnimationStopped(FrameAnimator &source, Frame &frame, + Form &form1, Form &form2); static DAFrameAnimationEventListener& GetInstance(void); @@ -55,4 +57,3 @@ private: #endif // __TIZEN_FRAMEANI_H__ -