openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/rsyslog/8.1903.0-r0/rsyslog-8.1903.0/runtime/stream.c
static rsRetVal strmPhysWrite(strm_t* pThis, uchar* pBuf, size_t lenBuf)
{
    size_t iWritten;
    DEFiRet;
    ISOBJ_TYPE_assert(pThis, strm);

    DBGPRINTF("strmPhysWrite, stream %p, len %u\n", pThis, (unsigned)lenBuf);
    if (pThis->fd == -1)
        CHKiRet(strmOpenFile(pThis));

    /* here we place our crypto interface */
    if (pThis->cryprov != NULL)
    {
        pThis->cryprov->Encrypt(pThis->cryprovFileData, pBuf, &lenBuf);
    }
    /* end crypto */

    iWritten = lenBuf;
    CHKiRet(doWriteCall(pThis, pBuf, &iWritten));

    pThis->iCurrOffs += iWritten;
    /* update user counter, if provided */
    if (pThis->pUsrWCntr != NULL)
        *pThis->pUsrWCntr += iWritten;

    if (pThis->bSync)
    {
        CHKiRet(syncFile(pThis));
    }

    if (pThis->sType == STREAMTYPE_FILE_CIRCULAR)
    {
        CHKiRet(strmCheckNextOutputFile(pThis));
    }
    else if (pThis->iSizeLimit != 0)
    {
        CHKiRet(doSizeLimitProcessing(pThis));
    }

finalize_it:
    RETiRet;
}
/* physically write to the output file. the provided data is ready for
 * writing (e.g. zipped if we are requested to do that).
 * Note that if the write() API fails, we do not reset any pointers, but return
 * an error code. That means we may redo work in the next iteration.
 * rgerhards, 2009-06-04
 */
physically write to the output file. the provided data is ready for
writing .
Note that if the write() API fails, we do not reset any pointers, but return
an error code. That means we may redo work in the next iteration.
physically write to the output file . the provided data is ready for writing . Note that if the write () API fails we do not reset any pointers but return an error code . That means we may redo work in the next iteration .
static rsRetVal strmPhysWrite(strm_t* pThis, uchar* pBuf, size_t lenBuf)
{
    size_t iWritten;
    DEFiRet;
    ISOBJ_TYPE_assert(pThis, strm);
    DBGPRINTF("strmPhysWrite, stream %p, len %u\n", pThis, (unsigned)lenBuf);
    if (pThis->fd == -1)
        CHKiRet(strmOpenFile(pThis));
    if (pThis->cryprov != NULL)
    {
        pThis->cryprov->Encrypt(pThis->cryprovFileData, pBuf, &lenBuf);
    }
    iWritten = lenBuf;
    CHKiRet(doWriteCall(pThis, pBuf, &iWritten));
    pThis->iCurrOffs += iWritten;
    if (pThis->pUsrWCntr != NULL)
        *pThis->pUsrWCntr += iWritten;
    if (pThis->bSync)
    {
        CHKiRet(syncFile(pThis));
    }
    if (pThis->sType == STREAMTYPE_FILE_CIRCULAR)
    {
        CHKiRet(strmCheckNextOutputFile(pThis));
    }
    else if (pThis->iSizeLimit != 0)
    {
        CHKiRet(doSizeLimitProcessing(pThis));
    }
finalize_it:
    RETiRet;
}
static rsRetVal strmPhysWrite ( strm_t * pThis , uchar * pBuf , size_t lenBuf ) { size_t iWritten ; DEFiRet ; ISOBJ_TYPE_assert ( pThis , strm ) ; DBGPRINTF ( " \n " , pThis , ( unsigned ) lenBuf ) ; if ( pThis -> fd == -1 ) CHKiRet ( strmOpenFile ( pThis ) ) ; if ( pThis -> cryprov != NULL ) { pThis -> cryprov -> Encrypt ( pThis -> cryprovFileData , pBuf , & lenBuf ) ; } iWritten = lenBuf ; CHKiRet ( doWriteCall ( pThis , pBuf , & iWritten ) ) ; pThis -> iCurrOffs += iWritten ; if ( pThis -> pUsrWCntr != NULL ) * pThis -> pUsrWCntr += iWritten ; if ( pThis -> bSync ) { CHKiRet ( syncFile ( pThis ) ) ; } if ( pThis -> sType == STREAMTYPE_FILE_CIRCULAR ) { CHKiRet ( strmCheckNextOutputFile ( pThis ) ) ; } else if ( pThis -> iSizeLimit != 0 ) { CHKiRet ( doSizeLimitProcessing ( pThis ) ) ; } finalize_it : RETiRet ; }
physically write to the output file.
physically write to the output file .
/* here we place our crypto interface */ /* end crypto */ /* update user counter, if provided */