Example #1
0
//!
//! This is the function that ultimately dumps a buffer into a log.
//!
//! @param[in] line the string buffer to log
//!
//! @return EUCA_OK on success or EUCA_ERROR on failure
//!
//! @pre The given line pointer must not be NULL.
//!
//! @post The given line is written into the log file
//!
static int log_line(const char *line)
{
    int rc = EUCA_ERROR;
    FILE *pFh = NULL;

    if (log_sem) {
        sem_prolaag(log_sem, FALSE);

        if ((pFh = get_file(FALSE)) != NULL) {
            fprintf(pFh, "%s", line);
            fflush(pFh);
            release_file();
            rc = EUCA_OK;
        }

        sem_verhogen(log_sem, FALSE);
    } else {
        if ((pFh = get_file(FALSE)) != NULL) {
            fprintf(pFh, "%s", line);
            fflush(pFh);
            release_file();
            rc = EUCA_OK;
        }
    }

    return (rc);
}
Example #2
0
//!
//! This is the function that ultimately dumps a buffer into a log.
//!
//! @param[in] line the string buffer to log
//!
//! @return EUCA_OK on success or EUCA_ERROR on failure
//!
static int log_line(const char *line)
{
    int rc = EUCA_ERROR;

    if (log_sem)
        sem_prolaag(log_sem, FALSE);

    FILE *file = get_file(FALSE);
    if (file != NULL) {
        fprintf(file, "%s", line);
        fflush(file);
        release_file();
        rc = EUCA_OK;
    }

    if (log_sem)
        sem_verhogen(log_sem, FALSE);

    return rc;
}
Example #3
0
// The semaphore increment (aka lock acquisition) function used throughout.
int sem_p (sem * s)
{
    return sem_prolaag (s, TRUE);
}
Example #4
0
//!
//! The semaphore increment (aka lock acquisition) function used throughout.
//!
//! @param[in] pSem a pointer to the semaphore to acquire
//!
//! @return the result from sem_prolaag()
//!
//! @see sem_prolaag()
//!
int sem_p(sem * pSem)
{
    return (sem_prolaag(pSem, TRUE));
}