summaryrefslogtreecommitdiffstats
path: root/module-template.h
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-26 08:42:14 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-26 08:42:14 +0000
commitc75d3b93480469abfd2cb8332bcc0e58c95ef5e3 (patch)
treec2e9041e09276e8960f2cc96b580b5cb78283376 /module-template.h
parent229aa9e64424cf05fc2391ad2e7e2baefc37542f (diff)
downloadrsyslog-c75d3b93480469abfd2cb8332bcc0e58c95ef5e3.tar.gz
rsyslog-c75d3b93480469abfd2cb8332bcc0e58c95ef5e3.tar.xz
rsyslog-c75d3b93480469abfd2cb8332bcc0e58c95ef5e3.zip
- implemented onSelectReadyWrite() interface
- milestone reached: no more access to f->f_un in syslogd.c
Diffstat (limited to 'module-template.h')
-rw-r--r--module-template.h30
1 files changed, 28 insertions, 2 deletions
diff --git a/module-template.h b/module-template.h
index 3a8b9129..200a48c0 100644
--- a/module-template.h
+++ b/module-template.h
@@ -76,7 +76,7 @@ static rsRetVal freeInstance(selector_t *f, void* pModData)\
/* isCompatibleWithFeature()
*/
#define BEGINisCompatibleWithFeature \
-static rsRetVal isCompatibleWithFeature(syslogFeature eFeat)\
+static rsRetVal isCompatibleWithFeature(syslogFeature __attribute__((unused)) eFeat)\
{\
rsRetVal iRet = RS_RET_INCOMPATIBLE;
@@ -120,10 +120,34 @@ static rsRetVal dbgPrintInstInfo(selector_t *f, void *pModData)\
}
+/* onSelectReadyWrite()
+ * Extra comments:
+ * This is called when select() returned with a writable file descriptor
+ * for this module. The fd was most probably obtained by getWriteFDForSelect()
+ * before.
+ */
+#define BEGINonSelectReadyWrite \
+static rsRetVal onSelectReadyWrite(selector_t *f, void *pModData)\
+{\
+ rsRetVal iRet = RS_RET_NONE;\
+ instanceData *pData = NULL;
+
+#define CODESTARTonSelectReadyWrite \
+ assert(f != NULL);\
+ pData = (instanceData*) pModData;
+
+#define ENDonSelectReadyWrite \
+ return iRet;\
+}
+
/* getWriteFDForSelect()
* Extra comments:
- * Print debug information about this instance.
+ * Gets writefd for select call. Must only be returned when the selector must
+ * be written to. If the module has no such fds, it must return RS_RET_NONE.
+ * In this case, the default implementation is sufficient.
+ * This interface will probably go away over time, but we need it now to
+ * continue modularization.
*/
#define BEGINgetWriteFDForSelect \
static rsRetVal getWriteFDForSelect(selector_t *f, void *pModData, short *fd)\
@@ -198,6 +222,8 @@ static rsRetVal queryEtryPt(uchar *name, rsRetVal (**pEtryPoint)())\
*pEtryPoint = freeInstance;\
} else if(!strcmp((char*) name, "getWriteFDForSelect")) {\
*pEtryPoint = getWriteFDForSelect;\
+ } else if(!strcmp((char*) name, "onSelectReadyWrite")) {\
+ *pEtryPoint = onSelectReadyWrite;\
}
/* modInit()