"Fossies" - the Fresh Open Source Software Archive

Member "evolution-brutus-1.2.35/server/brutus_eds.c" (13 May 2008, 2219 Bytes) of archive /linux/misc/old/evolution-brutus-1.2.35.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "brutus_eds.c" see the Fossies "Dox" file reference documentation.

    1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
    2 
    3 /*
    4  *    Brutus source file for implementing evolution-data-server helper functions.
    5  *    Copyright (C) 2007 OMC Denmark ApS.
    6  *
    7  *    This program is free software; you can redistribute it and/or modify
    8  *    it under the terms of the GNU General Public License as published by
    9  *    the Free Software Foundation; either version 2 of the License, or
   10  *    (at your option) any later version.
   11  *
   12  *    This program is distributed in the hope that it will be useful,
   13  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
   14  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   15  *    GNU General Public License for more details.
   16  *
   17  *    You should have received a copy of the GNU General Public License
   18  *    along with this program; if not, write to the Free Software
   19  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
   20  */
   21 
   22 #ifdef HAVE_CONFIG_H
   23 #include <config.h>
   24 #endif
   25 
   26 #include <sys/types.h>
   27 #include <sys/stat.h>
   28 #include <sys/file.h>
   29 #include <fcntl.h>
   30 #include <signal.h>
   31 #include <errno.h>
   32 #include <pthread.h>
   33 
   34 #include <glib.h>
   35 #include <glib/gstdio.h>
   36 
   37 #include <session/brutusd.h>
   38 
   39 #include "brutus.h"
   40 #include "brutus_util.h"
   41 #include "brutus_eds.h"
   42 
   43 gboolean
   44 brutus_eds_initialize(void)
   45 {
   46     static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
   47     static gboolean initialized = FALSE;
   48 
   49     pthread_mutex_lock(&mutex);
   50 
   51     if (initialized)
   52         goto out;
   53 
   54     /* Start Brutus Session daemon */
   55     {
   56         int retv = brutus_start_daemon(E_BRUTUS_SESSION_DAEMON);
   57 //      g_usleep(G_USEC_PER_SEC);
   58 
   59         dfmt("\"system(brutusd)\" returned %s", (EXIT_SUCCESS == retv) ? "EXIT_SUCCESS" : "EXIT_FAILURE");
   60         if (EXIT_SUCCESS != retv) {
   61             d("Could not start brutusd");
   62             goto out;
   63         }
   64     }
   65 
   66     /* Start Brutus Keyring daemon */
   67     {
   68         int retv = brutus_start_daemon(E_BRUTUS_KEYRING_DAEMON);
   69 //      g_usleep(G_USEC_PER_SEC);
   70 
   71         dfmt("\"system(brutus-keyringd)\" returned %s", (EXIT_SUCCESS == retv) ? "EXIT_SUCCESS" : "EXIT_FAILURE");
   72         if (EXIT_SUCCESS != retv) {
   73             d("Could not start brutus-keyringd");
   74             goto out;
   75         }
   76     }
   77 
   78     initialized = TRUE;
   79 
   80 out:
   81     pthread_mutex_unlock(&mutex);
   82 
   83     return initialized;
   84 }
   85 
   86