summaryrefslogtreecommitdiff
path: root/lib/socket_wrapper/socket_wrapper.h
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-08-12 14:28:03 +1000
committerAndrew Tridgell <tridge@samba.org>2011-08-12 09:38:26 +0200
commit63e5b395d00535c88274bafb9d5e4b0e9d753b36 (patch)
treea73b7f0bab0bc989153becbf6de4ed4cebac68c3 /lib/socket_wrapper/socket_wrapper.h
parentb4a730d353d67df3e42c427afb8051015a5e175b (diff)
downloadsamba-63e5b395d00535c88274bafb9d5e4b0e9d753b36.tar.gz
samba-63e5b395d00535c88274bafb9d5e4b0e9d753b36.tar.bz2
samba-63e5b395d00535c88274bafb9d5e4b0e9d753b36.zip
socket-wrapped: added wrappers for dup() and dup2()
The Samba4 standard process model uses dup() on incoming sockets as an optimisation (it makes select() a tiny bit faster when used). Adding dup() to socket wrapper allows us to use the standard process model in selftest Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/socket_wrapper/socket_wrapper.h')
-rw-r--r--lib/socket_wrapper/socket_wrapper.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/socket_wrapper/socket_wrapper.h b/lib/socket_wrapper/socket_wrapper.h
index 77af6feadd..32c9de6b68 100644
--- a/lib/socket_wrapper/socket_wrapper.h
+++ b/lib/socket_wrapper/socket_wrapper.h
@@ -58,6 +58,8 @@ ssize_t swrap_send(int s, const void *buf, size_t len, int flags);
int swrap_readv(int s, const struct iovec *vector, size_t count);
int swrap_writev(int s, const struct iovec *vector, size_t count);
int swrap_close(int);
+int swrap_dup(int oldfd);
+int swrap_dup2(int oldfd, int newfd);
#ifdef SOCKET_WRAPPER_REPLACE
@@ -160,7 +162,16 @@ int swrap_close(int);
#undef close
#endif
#define close(s) swrap_close(s)
+
+#ifdef dup
+#undef dup
#endif
+#define dup(s) swrap_dup(s)
+#ifdef dup2
+#undef dup2
+#endif
+#define dup2(s, s2) swrap_dup2(s, s2)
+#endif /* SOCKET_WRAPPER_REPLACE */
#endif /* __SOCKET_WRAPPER_H__ */