[FIX] merge from tizen_2.2
[platform/core/system/swap-probe.git] / probe_thread / da_sync.h
1 /*
2  *  DA probe
3  *
4  * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: 
7  *
8  * Woojin Jung <woojin2.jung@samsung.com>
9  * Jaewon Lim <jaewon81.lim@samsung.com>
10  * Juyoung Kim <j0.kim@samsung.com>
11  * Anastasia Lyupa <a.lyupa@samsung.com>
12  * 
13  * This library is free software; you can redistribute it and/or modify it under
14  * the terms of the GNU Lesser General Public License as published by the
15  * Free Software Foundation; either version 2.1 of the License, or (at your option)
16  * any later version.
17  * 
18  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
19  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
21  * License for more details.
22  *
23  * You should have received a copy of the GNU Lesser General Public License
24  * along with this library; if not, write to the Free Software Foundation, Inc., 51
25  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26  *
27  * Contributors:
28  * - S-Core Co., Ltd
29  * - Samsung RnD Institute Russia
30  * 
31  */
32
33 #ifndef __DA_SYNC_H__
34 #define __DA_SYNC_H__
35
36 #include "daprobe.h"
37
38 #ifdef __cplusplus
39 extern "C"{
40 #endif
41
42 int real_pthread_mutex_lock(pthread_mutex_t *mutex);
43 int real_pthread_mutex_unlock(pthread_mutex_t *mutex);
44
45 #define BEFORE_ORIGINAL_SYNC(FUNCNAME, LIBNAME)         \
46         DECLARE_VARIABLE_STANDARD;                                              \
47         GET_REAL_FUNC(FUNCNAME, LIBNAME);                               \
48         PRE_PROBEBLOCK()
49
50 #define AFTER_PACK_ORIGINAL_SYNC(API_ID, RVAL, SYNCVAL, SYNCTYPE, APITYPE, INPUTFORMAT, ...) \
51         POST_PACK_PROBEBLOCK_BEGIN();                                                                                                                           \
52         PREPARE_LOCAL_BUF();                                                                                                                                            \
53         PACK_COMMON_BEGIN(MSG_PROBE_SYNC, API_ID, INPUTFORMAT, __VA_ARGS__);                                            \
54         PACK_COMMON_END(RVAL, errno, blockresult);                                                                                                      \
55         PACK_SYNC(SYNCVAL, SYNCTYPE, APITYPE);                                                                                                          \
56         FLUSH_LOCAL_BUF();                                                                                                                                                      \
57         POST_PACK_PROBEBLOCK_END()
58
59 #ifdef __cplusplus
60 }
61 #endif
62
63 #endif // __DA_SYNC_H__
64