"Fossies" - the Fresh Open Source Software archive 
Member "evolution-brutus-1.2.35/server/brutus_eds.c" of archive evolution-brutus-1.2.35.tar.gz:
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Brutus source file for implementing evolution-data-server helper functions.
* Copyright (C) 2007 OMC Denmark ApS.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#include <pthread.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <session/brutusd.h>
#include "brutus.h"
#include "brutus_util.h"
#include "brutus_eds.h"
gboolean
brutus_eds_initialize(void)
{
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static gboolean initialized = FALSE;
pthread_mutex_lock(&mutex);
if (initialized)
goto out;
/* Start Brutus Session daemon */
{
int retv = brutus_start_daemon(E_BRUTUS_SESSION_DAEMON);
// g_usleep(G_USEC_PER_SEC);
dfmt("\"system(brutusd)\" returned %s", (EXIT_SUCCESS == retv) ? "EXIT_SUCCESS" : "EXIT_FAILURE");
if (EXIT_SUCCESS != retv) {
d("Could not start brutusd");
goto out;
}
}
/* Start Brutus Keyring daemon */
{
int retv = brutus_start_daemon(E_BRUTUS_KEYRING_DAEMON);
// g_usleep(G_USEC_PER_SEC);
dfmt("\"system(brutus-keyringd)\" returned %s", (EXIT_SUCCESS == retv) ? "EXIT_SUCCESS" : "EXIT_FAILURE");
if (EXIT_SUCCESS != retv) {
d("Could not start brutus-keyringd");
goto out;
}
}
initialized = TRUE;
out:
pthread_mutex_unlock(&mutex);
return initialized;
}