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
25 * - Samsung RnD Institute Russia
28 #ifndef __DAFORKEXEC_H_
29 #define __DAFORKEXEC_H_
31 #define INIT_FUNC_EXEC(FUNCNAME) \
33 void *tmpPtr = dlsym(RTLD_NEXT , #FUNCNAME); \
34 if (tmpPtr == NULL || dlerror() != NULL) { \
35 perror("dlsym failed : " #FUNCNAME); \
38 memcpy(&FUNCNAME##_p, &tmpPtr, sizeof(tmpPtr)); \
41 #define DECLARE(RET, FUNCTION, ...) \
42 typedef RET (* FUNCTION ## _p_t)(__VA_ARGS__); \
43 static FUNCTION ## _p_t FUNCTION ## _p = 0
45 void init_exec_fork();
47 #endif /* __DAFORKEXEC_H_ */