4 * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
8 * Vitaliy Cherepanov <v.cherepanov@samsung.com>
10 * This library is free software; you can redistribute it and/or modify it under
11 * the terms of the GNU Lesser General Public License as published by the
12 * Free Software Foundation; either version 2.1 of the License, or (at your option)
15 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
16 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this library; if not, write to the Free Software Foundation, Inc., 51
22 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30 #include "common_probe_init.h"
41 void probe_terminate_with_err(const char *msg, const char *func_name,
46 sprintf(error_msg, "%s : [%s], %s", msg, func_name, lib_string[id]);
55 ////////////////////////////////////////////////////////////////////////////
56 //egl init probe function
58 // func_name - original function name for dlsym search
59 // func_pointer - original function pointer (return)
62 // search original function by name
63 // function have no return becouse on error it terminates main application
65 void init_probe_egl(__attribute__ ((unused))const char *func_name, void **func_pointer,
66 __attribute__ ((unused))ORIGINAL_LIBRARY id)
69 *func_pointer = (void *)dummy;
72 void init_probe_egl(const char *func_name, void **func_pointer,
78 if (lib_handle[id] == ((void *)0)) {
79 lib_handle[id] = dlopen(lib_string[id],
80 RTLD_LAZY | RTLD_GLOBAL);
82 if (lib_handle[id] == ((void *)0))
83 probe_terminate_with_err("dlopen failed", func_name, id);
85 faddr = dlsym(lib_handle[id], func_name);
86 if (faddr == __null || dlerror() != __null)
87 probe_terminate_with_err("dlsym failed", func_name, id);
88 memcpy(func_pointer, &faddr, sizeof(faddr));