openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/systemd/1_242+AUTOINC+db2e367bfc-r0/git/src/journal/journal-file.c
int journal_file_set_offline(JournalFile* f, bool wait)
{
    bool restarted;
    int r;

    assert(f);

    if (!f->writable)
        return -EPERM;

    if (f->fd < 0 || !f->header)
        return -EINVAL;

    /* An offlining journal is implicitly online and may modify
     * f->header->state, we must also join any potentially lingering offline
     * thread when not online. */
    if (!journal_file_is_offlining(f) && f->header->state != STATE_ONLINE)
        return journal_file_set_offline_thread_join(f);

    /* Restart an in-flight offline thread and wait if needed, or join a
     * lingering done one. */
    restarted = journal_file_set_offline_try_restart(f);
    if ((restarted && wait) || !restarted)
    {
        r = journal_file_set_offline_thread_join(f);
        if (r < 0)
            return r;
    }

    if (restarted)
        return 0;

    /* Initiate a new offline. */
    f->offline_state = OFFLINE_SYNCING;

    if (wait) /* Without using a thread if waiting. */
        journal_file_set_offline_internal(f);
    else
    {
        sigset_t ss, saved_ss;
        int k;

        assert_se(sigfillset(&ss) >= 0);
        /* Don't block SIGBUS since the offlining thread accesses a memory
         * mapped file. Asynchronous SIGBUS signals can safely be handled by
         * either thread. */
        assert_se(sigdelset(&ss, SIGBUS) >= 0);

        r = pthread_sigmask(SIG_BLOCK, &ss, &saved_ss);
        if (r > 0)
            return -r;

        r = pthread_create(&f->offline_thread, NULL,
                           journal_file_set_offline_thread, f);

        k = pthread_sigmask(SIG_SETMASK, &saved_ss, NULL);
        if (r > 0)
        {
            f->offline_state = OFFLINE_JOINED;
            return -r;
        }
        if (k > 0)
            return -k;
    }

    return 0;
}
/* Sets a journal offline.
 *
 * If wait is false then an offline is dispatched in a separate thread for a
 * subsequent journal_file_set_offline() or journal_file_set_online() of the
 * same journal to synchronize with.
 *
 * If wait is true, then either an existing offline thread will be restarted
 * and joined, or if none exists the offline is simply performed in this
 * context without involving another thread.
 */
Sets a journal offline.
If wait is false then an offline is dispatched in a separate thread for a
subsequent journal_file_set_offline() or journal_file_set_online() of the
same journal to synchronize with.

If wait is true, then either an existing offline thread will be restarted
and joined, or if none exists the offline is simply performed in this
context without involving another thread.
Sets a journal offline . If wait is false then an offline is dispatched in a separate thread for a subsequent journal_file_set_offline () or journal_file_set_online () of the same journal to synchronize with . If wait is true then either an existing offline thread will be restarted and joined or if none exists the offline is simply performed in this context without involving another thread .
int journal_file_set_offline(JournalFile* f, bool wait)
{
    bool restarted;
    int r;
    assert(f);
    if (!f->writable)
        return -EPERM;
    if (f->fd < 0 || !f->header)
        return -EINVAL;
    if (!journal_file_is_offlining(f) && f->header->state != STATE_ONLINE)
        return journal_file_set_offline_thread_join(f);
    restarted = journal_file_set_offline_try_restart(f);
    if ((restarted && wait) || !restarted)
    {
        r = journal_file_set_offline_thread_join(f);
        if (r < 0)
            return r;
    }
    if (restarted)
        return 0;
    f->offline_state = OFFLINE_SYNCING;
    if (wait) 
        journal_file_set_offline_internal(f);
    else
    {
        sigset_t ss, saved_ss;
        int k;
        assert_se(sigfillset(&ss) >= 0);
        assert_se(sigdelset(&ss, SIGBUS) >= 0);
        r = pthread_sigmask(SIG_BLOCK, &ss, &saved_ss);
        if (r > 0)
            return -r;
        r = pthread_create(&f->offline_thread, NULL,
                           journal_file_set_offline_thread, f);
        k = pthread_sigmask(SIG_SETMASK, &saved_ss, NULL);
        if (r > 0)
        {
            f->offline_state = OFFLINE_JOINED;
            return -r;
        }
        if (k > 0)
            return -k;
    }
    return 0;
}
int journal_file_set_offline ( JournalFile * f , bool wait ) { bool restarted ; int r ; assert ( f ) ; if ( ! f -> writable ) return - EPERM ; if ( f -> fd < 0 || ! f -> header ) return - EINVAL ; if ( ! journal_file_is_offlining ( f ) && f -> header -> state != STATE_ONLINE ) return journal_file_set_offline_thread_join ( f ) ; restarted = journal_file_set_offline_try_restart ( f ) ; if ( ( restarted && wait ) || ! restarted ) { r = journal_file_set_offline_thread_join ( f ) ; if ( r < 0 ) return r ; } if ( restarted ) return 0 ; f -> offline_state = OFFLINE_SYNCING ; if ( wait ) journal_file_set_offline_internal ( f ) ; else { sigset_t ss , saved_ss ; int k ; assert_se ( sigfillset ( & ss ) >= 0 ) ; assert_se ( sigdelset ( & ss , SIGBUS ) >= 0 ) ; r = pthread_sigmask ( SIG_BLOCK , & ss , & saved_ss ) ; if ( r > 0 ) return - r ; r = pthread_create ( & f -> offline_thread , NULL , journal_file_set_offline_thread , f ) ; k = pthread_sigmask ( SIG_SETMASK , & saved_ss , NULL ) ; if ( r > 0 ) { f -> offline_state = OFFLINE_JOINED ; return - r ; } if ( k > 0 ) return - k ; } return 0 ; }
Sets a journal offline.
Sets a journal offline .
/* An offlining journal is implicitly online and may modify
     * f->header->state, we must also join any potentially lingering offline
     * thread when not online. */ /* Restart an in-flight offline thread and wait if needed, or join a
     * lingering done one. */ /* Initiate a new offline. */ /* Without using a thread if waiting. */ /* Don't block SIGBUS since the offlining thread accesses a memory
         * mapped file. Asynchronous SIGBUS signals can safely be handled by
         * either thread. */