summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-14 11:55:24 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-14 11:55:24 +0000
commit77a338e180fd51811041363f615760a14a2dc889 (patch)
tree8edab9c877db4c25e6291d68f833b5bd4e6feb57 /stream.c
parentdd36718bd11c85af49546ab589fa42bf512075ce (diff)
downloadrsyslog-77a338e180fd51811041363f615760a14a2dc889.tar.gz
rsyslog-77a338e180fd51811041363f615760a14a2dc889.tar.xz
rsyslog-77a338e180fd51811041363f615760a14a2dc889.zip
- implemented $MainMsgQueueTimeoutActionCompletion config directive
- implemented $MainMsgQueueTimeoutEnqueue config directive - implemented $MainMsgQueueTimeoutShutdown config directive - some cleanup
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/stream.c b/stream.c
index 811012ae..a641637b 100644
--- a/stream.c
+++ b/stream.c
@@ -87,9 +87,10 @@ dbgprintf("strmOpenFile actual open %p, iFileNumDigits: %d\n", pThis, pThis->iFi
if(pThis->tOperationsMode == STREAMMODE_READ)
iFlags = O_RDONLY;
else
- //iFlags = O_WRONLY | O_TRUNC | O_CREAT | O_APPEND;
iFlags = O_WRONLY | O_CREAT;
+ iFlags |= pThis->iAddtlOpenFlags;
+
pThis->fd = open((char*)pThis->pszCurrFName, iFlags, pThis->tOpenMode);
if(pThis->fd == -1) {
int ierrnoSave = errno;
@@ -388,8 +389,8 @@ static rsRetVal strmWriteInternal(strm_t *pThis, uchar *pBuf, size_t lenBuf)
CHKiRet(strmOpenFile(pThis));
iWritten = write(pThis->fd, pBuf, lenBuf);
- dbgprintf("Stream 0x%lx: write wrote %d bytes to file %d, errno: %d, err %s\n", (unsigned long) pThis,
- iWritten, pThis->fd, errno, strerror(errno));
+ dbgprintf("Stream 0x%lx: write wrote %d bytes to file %d, errno: %d\n", (unsigned long) pThis,
+ iWritten, pThis->fd, errno);
/* TODO: handle error case -- rgerhards, 2008-01-07 */
/* Now indicate buffer empty again. We do this in any case, because there
@@ -564,10 +565,22 @@ rsRetVal strmSetiMaxFiles(strm_t *pThis, int iNewVal)
{
pThis->iMaxFiles = iNewVal;
pThis->iFileNumDigits = getNumberDigits(iNewVal);
-dbgprintf("strmSetiMaxFiles %p val %d, digits %d\n", pThis, iNewVal, pThis->iFileNumDigits);
return RS_RET_OK;
}
+rsRetVal strmSetiAddtlOpenFlags(strm_t *pThis, int iNewVal)
+{
+ DEFiRet;
+
+ if(iNewVal & O_APPEND)
+ ABORT_FINALIZE(RS_RET_PARAM_ERROR);
+
+ pThis->iAddtlOpenFlags = iNewVal;
+
+finalize_it:
+ return iRet;
+}
+
/* set the stream's file prefix
* The passed-in string is duplicated. So if the caller does not need
@@ -704,10 +717,6 @@ rsRetVal strmSerialize(strm_t *pThis, strm_t *pStrm)
l = (long) pThis->iCurrOffs;
objSerializeSCALAR_VAR(pStrm, iCurrOffs, LONG, l);
- // TODO: really serialize?
- //l = (long) pThis->iMaxFileSize;
- //objSerializeSCALAR_VAR(pStrm, iMaxFileSize, LONG, l);
-
CHKiRet(objEndSerialize(pStrm));
finalize_it: