From 527da08d3bca74c84823fecf4d9ce84c7daa0a35 Mon Sep 17 00:00:00 2001 From: Klaas Freitag Date: Wed, 12 Jun 2013 15:46:01 +0200 Subject: [PATCH] src: Add function csync_vio_local_getfd(). --- src/vio/csync_vio_local.c | 15 ++++++++++++++- src/vio/csync_vio_local.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/vio/csync_vio_local.c b/src/vio/csync_vio_local.c index 33194ee7d..1296d40a2 100644 --- a/src/vio/csync_vio_local.c +++ b/src/vio/csync_vio_local.c @@ -30,13 +30,26 @@ #include "c_private.h" #include "c_lib.h" #include "c_string.h" - +#include "vio/csync_vio_handle.h" #include "vio/csync_vio_local.h" +#include "vio/csync_vio_handle_private.h" typedef struct fhandle_s { int fd; } fhandle_t; +int csync_vio_local_getfd(csync_vio_handle_t *hnd) +{ + fhandle_t *fh; + + if (hnd == NULL) { + return -1; + } + + fh = (struct fhandle_s*)(hnd->method_handle); + + return fh->fd; +} /* the url comes in as utf-8 and in windows, it needs to be multibyte. */ csync_vio_method_handle_t *csync_vio_local_open(const char *durl, int flags, mode_t mode) { diff --git a/src/vio/csync_vio_local.h b/src/vio/csync_vio_local.h index 8f70265eb..5ea872c48 100644 --- a/src/vio/csync_vio_local.h +++ b/src/vio/csync_vio_local.h @@ -26,6 +26,8 @@ #include "vio/csync_vio_method.h" #include +int csync_vio_local_getfd(csync_vio_handle_t *hnd); + csync_vio_method_handle_t *csync_vio_local_open(const char *durl, int flags, mode_t mode); csync_vio_method_handle_t *csync_vio_local_creat(const char *durl, mode_t mode); int csync_vio_local_close(csync_vio_method_handle_t *fhandle);