*/
/* forward declarations, see below ... */
-static void frsh_scheduler_signal_handler(int signum, siginfo_t *siginfo,
- void *cntx);
static void frsh_qres_cleanup_wrapper();
int frsh_aquosa_init()
{
- struct sigaction frsh_scheduler_signal_action;
-
/* check FRSH is not already initialized */
- if (frsh_initialized)
+ /*if (frsh_initialized)
PERROR_AND_RETURN(FRSH_ERR_SYSTEM_ALREADY_INITIALIZED,
- "can't initialize the systema again (frsh_init already called)");
+ "can't initialize the systema again (frsh_init already called)");
+ */
/* check if the name service is available and ty to start it if not */
- if (frsh_service_th_init(&frsh_service_th_pid) != FRSH_NO_ERROR)
- PERROR_AND_RETURN(FRSH_ERR_INTERNAL_ERROR,
- "can't find nor start the FRSH service thread");
/* (try to) initialize the AQuoSA Framework */
if (qres_init() != QOS_OK || qsup_init() != QOS_OK)
- PERROR_AND_RETURN(FRSH_ERR_INTERNAL_ERROR,
- "can't initialize AQuoSA framework");
- /* setup the default scheduler signal handling behaviour */
- frsh_scheduler_signal_action.sa_sigaction = frsh_scheduler_signal_handler;
- pthread_sigmask(0, NULL, &frsh_scheduler_signal_action.sa_mask);
- sigaddset(&frsh_scheduler_signal_action.sa_mask, FRSH_SCHEDULER_SIGNAL); /* blocked by default */
- pthread_sigmask(SIG_SETMASK, &frsh_scheduler_signal_action.sa_mask, NULL);
- frsh_scheduler_signal_action.sa_flags = SA_SIGINFO | SA_RESTART;
- if (sigaction(FRSH_SCHEDULER_SIGNAL, &frsh_scheduler_signal_action, NULL) < 0)
- PERROR_AND_RETURN(FRSH_ERR_INTERNAL_ERROR,
- "can't setup the signal handler for thread creation");
+ PERROR_AND_RETURN(FRSH_ERR_INTERNAL_ERROR);
/* install the cleanup function of th AQuoSA framework as an exit
* handler function (quite futile but, for now, it's sufficent) */
if (atexit(frsh_qres_cleanup_wrapper))
- PERROR_AND_RETURN(FRSH_ERR_INTERNAL_ERROR,
- "can't install AQuoSA cleanup handler");
- /* initialize the synchronization object repository */
- if (!synchobj_repo_init())
- PERROR_AND_RETURN(FRSH_ERR_INTERNAL_ERROR,
- "can't initialize the synchronization objects");
- /* FRSH in now initialized so that any subsequent
- * call to this function within the same process will fail */
- frsh_initialized = 1;
+ PERROR_AND_RETURN(FRSH_ERR_INTERNAL_ERROR);
return FRSH_NO_ERROR;
}
-/*
- * default signal handler for the FRSH_SCHEDULER_SIGNAL
- *
- * As default behaviour this function is installed as signal handler (with
- * sa_sigaction field in the stucture) and the signal is blocked.
- *
- * The handler does nothing for now, but may be useful in future
- */
-static void frsh_scheduler_signal_handler(int signum, siginfo_t *siginfo, void *cntx) {
- if (signum != FRSH_SCHEDULER_SIGNAL)
- PERROR_AND_EXIT(FRSH_ERR_INTERNAL_ERROR,
- "wrong signal received while witing for FRSH_SCHEDULER_SIGNAL");
-}
-
/*
* installed as an exit handler (with 'atexit()') by the initialization
* code... For now it only calls the cleanup function of the AQuoSA