From b62c2acf81af75d100df24eeb31e939d1c8453d9 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 24 Aug 2011 23:17:52 +0000 Subject: [PATCH] add method for isc_socket_getfd --- lib/isc/include/isc/socket.h | 3 ++- lib/isc/socket_api.c | 9 ++++++++- lib/isc/unix/socket.c | 7 +++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/isc/include/isc/socket.h b/lib/isc/include/isc/socket.h index 036025c0ee..5749f8272f 100644 --- a/lib/isc/include/isc/socket.h +++ b/lib/isc/include/isc/socket.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.h,v 1.97 2011/07/28 23:47:59 tbox Exp $ */ +/* $Id: socket.h,v 1.98 2011/08/24 23:17:52 marka Exp $ */ #ifndef ISC_SOCKET_H #define ISC_SOCKET_H 1 @@ -298,6 +298,7 @@ typedef struct isc_socketmethods { isc_result_t (*fdwatchpoke)(isc_socket_t *sock, int flags); isc_result_t (*dup)(isc_socket_t *socket, isc_socket_t **socketp); + int (*getfd)(isc_socket_t *socket); } isc_socketmethods_t; /*% diff --git a/lib/isc/socket_api.c b/lib/isc/socket_api.c index bbf371b1df..e2afe05f04 100644 --- a/lib/isc/socket_api.c +++ b/lib/isc/socket_api.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket_api.c,v 1.7 2011/07/28 23:47:59 tbox Exp $ */ +/* $Id: socket_api.c,v 1.8 2011/08/24 23:17:52 marka Exp $ */ #include @@ -222,3 +222,10 @@ isc_socket_dup(isc_socket_t *sock, isc_socket_t **socketp) { return(sock->methods->dup(sock, socketp)); } + +int +isc_socket_getfd(isc_socket_t *sock) { + REQUIRE(ISCAPI_SOCKET_VALID(sock)); + + return(sock->methods->getfd(sock)); +} diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 2ae0bce77b..aa0227c87a 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.c,v 1.345 2011/08/23 17:02:53 each Exp $ */ +/* $Id: socket.c,v 1.346 2011/08/24 23:17:52 marka Exp $ */ /*! \file */ @@ -553,6 +553,8 @@ ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_fdwatchpoke(isc_socket_t *sock, int flags); ISC_SOCKETFUNC_SCOPE isc_result_t isc__socket_dup(isc_socket_t *sock, isc_socket_t **socketp); +ISC_SOCKETFUNC_SCOPE int +isc__socket_getfd(isc_socket_t *sock); static struct { isc_socketmethods_t methods; @@ -577,7 +579,8 @@ static struct { isc__socket_gettype, isc__socket_ipv6only, isc__socket_fdwatchpoke, - isc__socket_dup + isc__socket_dup, + isc__socket_getfd } #ifndef BIND9 ,