diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-10-08 21:50:22 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:15:19 -0500 |
commit | ebc2f440e79677a3d25e99f9a9f154e05ec67226 (patch) | |
tree | df7d65239d90966c78c9dc18c97ad6f5b4c7031d /source3 | |
parent | e4e3dc064d7348e7267a4f42a78c0c059f1e6ec1 (diff) | |
download | samba-ebc2f440e79677a3d25e99f9a9f154e05ec67226.tar.gz samba-ebc2f440e79677a3d25e99f9a9f154e05ec67226.tar.bz2 samba-ebc2f440e79677a3d25e99f9a9f154e05ec67226.zip |
r19177: merge from samba4:
fix the standalone build of socket_wrapper by not using
samba's DLIST_ macros
metze
(This used to be commit bc7b2e8db8fb34d6f321cd6b13b74e58945d7124)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/socket_wrapper/socket_wrapper.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/source3/lib/socket_wrapper/socket_wrapper.c b/source3/lib/socket_wrapper/socket_wrapper.c index 68ee400a7b..20205b8f9e 100644 --- a/source3/lib/socket_wrapper/socket_wrapper.c +++ b/source3/lib/socket_wrapper/socket_wrapper.c @@ -46,10 +46,6 @@ #include "system/network.h" #include "system/filesys.h" -#ifndef _DLINKLIST_H -#include "lib/util/dlinklist.h" -#endif - #ifdef malloc #undef malloc #endif @@ -74,10 +70,39 @@ #include <string.h> #include <stdio.h> -#error "dlinklist.h missing" - #endif +#define SWRAP_DLIST_ADD(list,item) do { \ + if (!(list)) { \ + (item)->prev = NULL; \ + (item)->next = NULL; \ + (list) = (item); \ + } else { \ + (item)->prev = NULL; \ + (item)->next = (list); \ + (list)->prev = (item); \ + (list) = (item); \ + } \ +} while (0) + +#define SWRAP_DLIST_REMOVE(list,item) do { \ + if ((list) == (item)) { \ + (list) = (item)->next; \ + if (list) { \ + (list)->prev = NULL; \ + } \ + } else { \ + if ((item)->prev) { \ + (item)->prev->next = (item)->next; \ + } \ + if ((item)->next) { \ + (item)->next->prev = (item)->prev; \ + } \ + } \ + (item)->prev = NULL; \ + (item)->next = NULL; \ +} while (0) + /* LD_PRELOAD doesn't work yet, so REWRITE_CALLS is all we support * for now */ #define REWRITE_CALLS @@ -1072,7 +1097,7 @@ _PUBLIC_ int swrap_socket(int family, int type, int protocol) si->protocol = protocol; si->fd = fd; - DLIST_ADD(sockets, si); + SWRAP_DLIST_ADD(sockets, si); return si->fd; } @@ -1141,7 +1166,7 @@ _PUBLIC_ int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen) child_si->peername_len = *addrlen; child_si->peername = sockaddr_dup(addr, *addrlen); - DLIST_ADD(sockets, child_si); + SWRAP_DLIST_ADD(sockets, child_si); swrap_dump_packet(child_si, addr, SWRAP_ACCEPT_SEND, NULL, 0); swrap_dump_packet(child_si, addr, SWRAP_ACCEPT_RECV, NULL, 0); @@ -1541,7 +1566,7 @@ _PUBLIC_ int swrap_close(int fd) return real_close(fd); } - DLIST_REMOVE(sockets, si); + SWRAP_DLIST_REMOVE(sockets, si); if (si->myname && si->peername) { swrap_dump_packet(si, NULL, SWRAP_CLOSE_SEND, NULL, 0); |