sync with master
[platform/core/system/swap-probe.git] / probe_socket / da_socket.h
1 /*
2  *  DA probe
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: 
7  *
8  * Jaewon Lim <jaewon81.lim@samsung.com>
9  * Woojin Jung <woojin2.jung@samsung.com>
10  * Juyoung Kim <j0.kim@samsung.com>
11  * 
12  * This library is free software; you can redistribute it and/or modify it under
13  * the terms of the GNU Lesser General Public License as published by the
14  * Free Software Foundation; either version 2.1 of the License, or (at your option)
15  * any later version.
16  * 
17  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
18  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
19  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20  * License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * along with this library; if not, write to the Free Software Foundation, Inc., 51
24  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25  *
26  * Contributors:
27  * - S-Core Co., Ltd
28  * 
29  */
30
31 #ifndef __DA_SOCKET_H__
32 #define __DA_SOCKET_H__
33
34 #include "daprobe.h"
35
36 #define POST_PROBEBLOCK_MIDDLE_SOCK(SIZE, FD, APITYPE, PATH)                            \
37         log.length += sprintf(log.data + log.length, "`,%u`,%d`,%d`,%d`,0`,%s", \
38                         SIZE, FD, FD_SOCKET, APITYPE, PATH)
39  
40 #define POST_PROBEBLOCK_MIDDLE_NOSOCK(SIZE, APITYPE, PATH)                              \
41         log.length += sprintf(log.data + log.length, "`,%u`,`,%d`,%d`,0`,%s",   \
42                         SIZE, FD_SOCKET, APITYPE, PATH)
43
44 #define POST_PROBEBLOCK_CALLSTACK_SOCKET()      \
45         POST_PROBEBLOCK_CALLSTACK()
46
47 #define AFTER_ORIGINAL_SOCK_RET(RTYPE, RVAL, SIZE, FD, APITYPE, INPUTFORMAT, ...)       \
48         POST_PROBEBLOCK_BEGIN(LC_RESOURCE, RTYPE, RVAL, INPUTFORMAT, __VA_ARGS__);              \
49         POST_PROBEBLOCK_MIDDLE_SOCK(SIZE, FD, APITYPE, "");                                                             \
50         POST_PROBEBLOCK_CALLSTACK_SOCKET();                                                                                             \
51         POST_PROBEBLOCK_END()
52
53 #define AFTER_ORIGINAL_NOSOCK_RET(RTYPE, RVAL, SIZE, APITYPE, INPUTFORMAT, ...) \
54         POST_PROBEBLOCK_BEGIN(LC_RESOURCE, RTYPE, RVAL, INPUTFORMAT, __VA_ARGS__);      \
55         POST_PROBEBLOCK_MIDDLE_NOSOCK(SIZE, APITYPE, "");                                                       \
56         POST_PROBEBLOCK_CALLSTACK_SOCKET();                                                                                     \
57         POST_PROBEBLOCK_END()
58
59 #define AFTER_ORIGINAL_SOCK(SIZE, FD, APITYPE, INPUTFORMAT, ...)        \
60         AFTER_ORIGINAL_SOCK_RET(VT_INT, ret, SIZE, FD, APITYPE, INPUTFORMAT, __VA_ARGS__)
61
62 #define AFTER_ORIGINAL_NOSOCK(SIZE, APITYPE, INPUTFORMAT, ...)  \
63         AFTER_ORIGINAL_NOSOCK_RET(VT_INT, ret, SIZE, APITYPE, INPUTFORMAT, __VA_ARGS__)
64         
65 #endif // __DA_SOCKET_H__