コード例 #1
0
ファイル: oval_probe.c プロジェクト: bushong1/openscap
static void __init_once(void)
{
#if defined(OSCAP_THREAD_SAFE)
        if (pthread_once(&__oval_probe_init_once, &oval_probe_tblinit) != 0)
                abort();
#else
        if (__oval_probe_init_once == 0) {
                oval_probe_tblinit();
                __oval_probe_init_once = 1;
        }
#endif
        return;
}
コード例 #2
0
static void oval_probe_session_libinit(void)
{
	/* HACK: Make sure S-exps are initialized before we initialize anything else
	 * that uses them. This is needed only if the S-exp library is compiled without
	 * atomic builtins. In that case it uses a fallback locking mechanism that uses
	 * a mutex array which needs to be initialized before S-exp are used and freed
	 * at exit(3). The later is done by registering an atexit(3) function.
	 * The ncache_libinit function also registers an atexit(3) function and we need
	 * to make sure that the S-exps are not deinitialized before the ncache atexit
	 * handler is called.
	 * TODO: Implement SEXP_libinit() and call it from oscap_init()?
	 */
	volatile SEXP_t *exp = SEXP_string_new("magic", 5);
	SEXP_free((SEXP_t *)exp);

        ncache_libinit();
        oval_probe_tblinit();
}