diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-10-31 11:16:55 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-10-31 11:16:55 +0100 |
commit | 17e8ec15961dc69d8874d0c07113f22cfcb0d788 (patch) | |
tree | 82b1354343b1858ccfef54319e6d0782704782f7 /tools/ompipe.c | |
parent | 4ebd5779f63801dd15100b2567d1c057287bcf9c (diff) | |
download | rsyslog-17e8ec15961dc69d8874d0c07113f22cfcb0d788.tar.gz rsyslog-17e8ec15961dc69d8874d0c07113f22cfcb0d788.tar.bz2 rsyslog-17e8ec15961dc69d8874d0c07113f22cfcb0d788.zip |
ompipe: make play well with v8 output module interface
Diffstat (limited to 'tools/ompipe.c')
-rw-r--r-- | tools/ompipe.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/ompipe.c b/tools/ompipe.c index eab7f694..8d886509 100644 --- a/tools/ompipe.c +++ b/tools/ompipe.c @@ -69,6 +69,7 @@ typedef struct _instanceData { uchar *pipe; /* pipe or template name (display only) */ uchar *tplName; /* format template to use */ short fd; /* pipe descriptor for (current) pipe */ + pthread_mutex_t mutWrite; /* guard against multiple instances writing to same pipe */ sbool bHadError; /* did we already have/report an error on this pipe? */ } instanceData; @@ -280,6 +281,7 @@ CODESTARTcreateInstance pData->pipe = NULL; pData->fd = -1; pData->bHadError = 0; + pthread_mutex_init(&pData->mutWrite, NULL); ENDcreateInstance @@ -290,6 +292,7 @@ ENDcreateWrkrInstance BEGINfreeInstance CODESTARTfreeInstance + pthread_mutex_destroy(&pData->mutWrite); free(pData->pipe); if(pData->fd != -1) close(pData->fd); @@ -308,7 +311,10 @@ ENDtryResume BEGINdoAction CODESTARTdoAction DBGPRINTF(" (%s)\n", pData->pipe); + /* this module is single-threaded by nature */ + pthread_mutex_lock(&pData->mutWrite); iRet = writePipe(ppString, pData); + pthread_mutex_unlock(&pData->mutWrite); ENDdoAction |