* @param * * @return * */
| 123 | * |
| 124 | */ |
| 125 | void ans_mod_init() |
| 126 | { |
| 127 | int rc; |
| 128 | |
| 129 | #define INIT_FUNCTION(func) \ |
| 130 | real_##func = dlsym(RTLD_NEXT, #func); \ |
| 131 | assert(real_##func) |
| 132 | |
| 133 | INIT_FUNCTION(socket); |
| 134 | INIT_FUNCTION(bind); |
| 135 | INIT_FUNCTION(connect); |
| 136 | INIT_FUNCTION(close); |
| 137 | INIT_FUNCTION(listen); |
| 138 | INIT_FUNCTION(accept); |
| 139 | INIT_FUNCTION(accept4); |
| 140 | INIT_FUNCTION(recv); |
| 141 | INIT_FUNCTION(send); |
| 142 | INIT_FUNCTION(shutdown); |
| 143 | |
| 144 | INIT_FUNCTION(writev); |
| 145 | INIT_FUNCTION(write); |
| 146 | INIT_FUNCTION(read); |
| 147 | INIT_FUNCTION(readv); |
| 148 | |
| 149 | INIT_FUNCTION(setsockopt); |
| 150 | INIT_FUNCTION(getpeername); |
| 151 | INIT_FUNCTION(getsockname); |
| 152 | |
| 153 | INIT_FUNCTION(ioctl); |
| 154 | |
| 155 | INIT_FUNCTION(epoll_create); |
| 156 | INIT_FUNCTION(epoll_ctl); |
| 157 | INIT_FUNCTION(epoll_wait); |
| 158 | /* |
| 159 | INIT_FUNCTION(); |
| 160 | INIT_FUNCTION(); |
| 161 | INIT_FUNCTION(); |
| 162 | */ |
| 163 | |
| 164 | #undef INIT_FUNCTION |
| 165 | |
| 166 | if(ans_sock_enable != 1) |
| 167 | { |
| 168 | printf("ans socket is disable \n"); |
| 169 | return; |
| 170 | } |
| 171 | |
| 172 | rc = anssock_init(NULL); |
| 173 | assert(0 == rc); |
| 174 | |
| 175 | inited = 1; |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * @param |