Ejemplo n.º 1
0
int setComponentLogLevel(const snmp_adm_type_union * param, void *opt)
{
  long component = (long)opt;
  int level_to_set = ReturnLevelAscii(param->string);

  if (level_to_set == -1)
    return -1;

  if (component == COMPONENT_ALL)
    {
      _SetLevelDebug(level_to_set);

      LogChanges("SNMP request changing log level for all components to %s",
                 ReturnLevelInt(level_to_set));
    }
  else
    {
      LogChanges("SNMP request changing log level of %s from %s to %s.",
                 LogComponents[component].comp_name,
                 ReturnLevelInt(LogComponents[component].comp_log_level),
                 ReturnLevelInt(level_to_set));
      LogComponents[component].comp_log_level = level_to_set;
    }

  return 0;
}
Ejemplo n.º 2
0
static void DecrementLevelDebug()
{
  _SetLevelDebug(ReturnLevelDebug() - 1);

  LogChanges("SIGUSR2 Decreasing log level for all components to %s",
             ReturnLevelInt(LogComponents[COMPONENT_ALL].comp_log_level));
}                               /* DecrementLevelDebug */
Ejemplo n.º 3
0
void SetLevelDebug(int level_to_set)
{
  _SetLevelDebug(level_to_set);

  LogChanges("Setting log level for all components to %s",
             ReturnLevelInt(LogComponents[COMPONENT_ALL].comp_log_level));
}
Ejemplo n.º 4
0
int getComponentLogLevel(snmp_adm_type_union * param, void *opt)
{
  long component = (long)opt;

  strcpy(param->string, ReturnLevelInt(LogComponents[component].comp_log_level));
  return 0;
}
Ejemplo n.º 5
0
void InitLogging()
{
  int i;
  char *env_value;
  int newlevel, component, oldlevel;

  /* Initialisation du tableau des familys */
  tab_family[0].num_family = 0;
  tab_family[0].tab_err = (family_error_t *) tab_system_err;
  strcpy(tab_family[0].name_family, "Errors Systeme UNIX");

  for(i = 1; i < MAX_NUM_FAMILY; i++)
    tab_family[i].num_family = UNUSED_SLOT;

  ArmSignal(SIGUSR1, IncrementLevelDebug);
  ArmSignal(SIGUSR2, DecrementLevelDebug);

  for(component = COMPONENT_ALL; component < COMPONENT_COUNT; component++)
    {
      env_value = getenv(LogComponents[component].comp_name);
      if (env_value == NULL)
        continue;
      newlevel = ReturnLevelAscii(env_value);
      if (newlevel == -1) {
        LogCrit(COMPONENT_LOG,
                "Environment variable %s exists, but the value %s is not a"
                " valid log level.",
                LogComponents[component].comp_name, env_value);
        continue;
      }
      oldlevel = LogComponents[component].comp_log_level;
      LogComponents[component].comp_log_level = newlevel;
      LogChanges("Using environment variable to switch log level for %s from "
                 "%s to %s",
                 LogComponents[component].comp_name, ReturnLevelInt(oldlevel),
                 ReturnLevelInt(newlevel));
    }

}                               /* InitLogging */
Ejemplo n.º 6
0
void SetComponentLogLevel(log_components_t component, int level_to_set)
{
  if (component == COMPONENT_ALL)
    {
      SetLevelDebug(level_to_set);
      return;
    }

  if(level_to_set < NIV_NULL)
    level_to_set = NIV_NULL;

  if(level_to_set >= NB_LOG_LEVEL)
    level_to_set = NB_LOG_LEVEL - 1;

  if (LogComponents[component].comp_log_level != level_to_set)
    {
      LogChanges("Changing log level of %s from %s to %s",
                 LogComponents[component].comp_name,
                 ReturnLevelInt(LogComponents[component].comp_log_level),
                 ReturnLevelInt(level_to_set));
      LogComponents[component].comp_log_level = level_to_set;
    }
}
Ejemplo n.º 7
0
/**
 *  Tests about Log streams and special printf functions.
 */
void Test1(char *str, char *file)
{
	char tempstr[2048];
	struct display_buffer buffer = { sizeof(tempstr), tmpstr, tmpstr };
	int i;

	SetComponentLogFile(COMPONENT_INIT, "STDOUT");
	LogAlways(COMPONENT_INIT, "%s", "Starting Log Tests");
	LogTest("My PID = %d", getpid());

	LogTest("------------------------------------------------------");
	LogTest("Test conversion of log levels between string and integer");
	for (i = NIV_NULL; i < NB_LOG_LEVEL; i++) {
		int j;
		if (strcmp(tabLogLevel[i].str, ReturnLevelInt(i)) != 0) {
			LogTest(
			     "FAILURE: Log level %d did not convert to %s, it converted to %s",
			     i, tabLogLevel[i].str, ReturnLevelInt(i));
			exit(1);
		}
		j = ReturnLevelAscii(tabLogLevel[i].str);
		if (j != i) {
			LogTest(
			     "FAILURE: Log level %s did not convert to %d, it converted to %d",
			     tabLogLevel[i].str, i, j);
			exit(1);
		}
	}

	LogTest("------------------------------------------------------");

	LogTest("\nTesting possible environment variable");
	LogTest("COMPONENT_MEMCORRUPT debug level is %s",
		ReturnLevelInt(LogComponents[COMPONENT_MEMCORRUPT].
			       comp_log_level));
	LogFullDebug(COMPONENT_MEMCORRUPT,
		     "This should appear if environment is set properly");

	LogTest("------------------------------------------------------");
	LogTest("Send some messages to various files");
	SetComponentLogFile(COMPONENT_DISPATCH, "STDERR");
	LogEvent(COMPONENT_DISPATCH, "This should go to stderr");
	SetComponentLogFile(COMPONENT_DISPATCH, "STDOUT");
	LogEvent(COMPONENT_DISPATCH, "This should go to stdout");
	SetComponentLogFile(COMPONENT_DISPATCH, "SYSLOG");
	LogEvent(COMPONENT_DISPATCH, "This should go to syslog (verf = %s)",
		 str);
	LogTest("About to set %s", file);
	SetComponentLogFile(COMPONENT_DISPATCH, file);
	LogTest("Got it set");
	LogEvent(COMPONENT_DISPATCH, "This should go to %s", file);

	/* Set up for tests that will verify what was actually produced by log
	 * messages. This is used to test log levels and to test the
	 * log_vnsprintf function.
	 */
	/** @todo FSF: this can be done by setting the right header flags and
	 * peeking at the context buffer.
	 */
	SetComponentLogBuffer(COMPONENT_MAIN, &buffer);
	SetComponentLogBuffer(COMPONENT_INIT, &buffer);

	LogTest("------------------------------------------------------");
	LogTest("Test all levels of log filtering");
	SetComponentLogLevel(COMPONENT_MAIN, NIV_NULL);
	TestAlways(true, tempstr, COMPONENT_MAIN, "LogAlways (should print)");
	TestMajor(false, tempstr, COMPONENT_MAIN, "LogMajor (shouldn't print)");
	TestCrit(false, tempstr, COMPONENT_MAIN, "LogCrit (shouldn't print)");
	TestEvent(false, tempstr, COMPONENT_MAIN, "LogEvent (shouldn't print)");
	TestDebug(false, tempstr, COMPONENT_MAIN, "LogDebug (shouldn't print)");
	TestFullDebug(false, tempstr, COMPONENT_MAIN,
		      "LogFullDebug (shouldn't print)");
	SetComponentLogLevel(COMPONENT_MAIN, NIV_MAJOR);
	TestAlways(true, tempstr, COMPONENT_MAIN, "LogAlways (should print)");
	TestMajor(true, tempstr, COMPONENT_MAIN, "LogMajor (should print)");
	TestCrit(false, tempstr, COMPONENT_MAIN, "LogCrit (shouldn't print)");
	TestEvent(false, tempstr, COMPONENT_MAIN, "LogEvent (shouldn't print)");
	TestDebug(false, tempstr, COMPONENT_MAIN, "LogDebug (shouldn't print)");
	TestFullDebug(false, tempstr, COMPONENT_MAIN,
		      "LogFullDebug (shouldn't print)");
	SetComponentLogLevel(COMPONENT_MAIN, NIV_CRIT);
	TestAlways(true, tempstr, COMPONENT_MAIN, "LogAlways (should print)");
	TestMajor(true, tempstr, COMPONENT_MAIN, "LogMajor (should print)");
	TestCrit(true, tempstr, COMPONENT_MAIN, "LogCrit (should print)");
	TestEvent(false, tempstr, COMPONENT_MAIN, "LogEvent (shouldn't print)");
	TestDebug(false, tempstr, COMPONENT_MAIN, "LogDebug (shouldn't print)");
	TestFullDebug(false, tempstr, COMPONENT_MAIN,
		      "LogFullDebug (shouldn't print)");
	SetComponentLogLevel(COMPONENT_MAIN, NIV_EVENT);
	TestAlways(true, tempstr, COMPONENT_MAIN, "LogAlways (should print)");
	TestMajor(true, tempstr, COMPONENT_MAIN, "LogMajor (should print)");
	TestCrit(true, tempstr, COMPONENT_MAIN, "LogCrit (should print)");
	TestEvent(true, tempstr, COMPONENT_MAIN, "LogEvent (should print)");
	TestDebug(false, tempstr, COMPONENT_MAIN, "LogDebug (shouldn't print)");
	TestFullDebug(false, tempstr, COMPONENT_MAIN,
		      "LogFullDebug (shouldn't print)");
	SetComponentLogLevel(COMPONENT_MAIN, NIV_DEBUG);
	TestAlways(true, tempstr, COMPONENT_MAIN, "LogAlways (should print)");
	TestMajor(true, tempstr, COMPONENT_MAIN, "LogMajor (should print)");
	TestCrit(true, tempstr, COMPONENT_MAIN, "LogCrit (should print)");
	TestEvent(true, tempstr, COMPONENT_MAIN, "LogEvent (should print)");
	TestDebug(true, tempstr, COMPONENT_MAIN, "LogDebug (should print)");
	TestFullDebug(false, tempstr, COMPONENT_MAIN,
		      "LogFullDebug (shouldn't print)");
	SetComponentLogLevel(COMPONENT_MAIN, NIV_FULL_DEBUG);
	TestAlways(true, tempstr, COMPONENT_MAIN, "LogAlways (should print)");
	TestMajor(true, tempstr, COMPONENT_MAIN, "LogMajor (should print)");
	TestCrit(true, tempstr, COMPONENT_MAIN, "LogCrit (should print)");
	TestEvent(true, tempstr, COMPONENT_MAIN, "LogEvent (should print)");
	TestDebug(true, tempstr, COMPONENT_MAIN, "LogDebug (should print)");
	TestFullDebug(true, tempstr, COMPONENT_MAIN,
		      "LogFullDebug (should print)");
}
Ejemplo n.º 8
0
/**
 *  Tests about Log streams and special printf functions.
 */
int Test1(char *str, char *file)
{
  char tempstr[2048];
  int  i;

  SetComponentLogFile(COMPONENT_INIT, "STDOUT");
  LogAlways(COMPONENT_INIT, "%s", "Starting Log Tests");
  LogTest("My PID = %d", getpid());

  LogTest("------------------------------------------------------");

  LogTest("Test ERR_DUMMY");
  LogTest("A numerical error : error %%d = %%J%%R, in ERR_DUMMY_2 %%J%%R");
  log_snprintf(tempstr, sizeof(tempstr),
               "A numerical error : error %d = %J%R, in ERR_DUMMY_2 %J%R",
               ERR_SIGACTION, ERR_SYS, ERR_SIGACTION, ERR_DUMMY, ERR_DUMMY_2);
  LogTest("%s", tempstr);
  LogTest("A numerical error : error %d = %J%R, in ERR_DUMMY_1 %J%R",
          ERR_OPEN, ERR_SYS, ERR_OPEN, ERR_DUMMY, ERR_DUMMY_1);

  LogTest("------------------------------------------------------");
  LogTest("Test conversion of log levels between string and integer");
  for (i = NIV_NULL; i < NB_LOG_LEVEL; i++)
    {
      int j;
      if (strcmp(tabLogLevel[i].str, ReturnLevelInt(i)) != 0)
        {
          LogTest("FAILURE: Log level %d did not convert to %s, it converted to %s",
                  i, tabLogLevel[i].str, ReturnLevelInt(i));
          exit(1);
        }
      j = ReturnLevelAscii(tabLogLevel[i].str);
      if (j != i)
        {
          LogTest("FAILURE: Log level %s did not convert to %d, it converted to %d",
                  tabLogLevel[i].str, i, j);
          exit(1);
        }
    }

  LogTest("------------------------------------------------------");

  log_snprintf(tempstr, sizeof(tempstr), "Test log_snprintf");
  LogTest("%s", tempstr);
  LogTest("\nTesting LogError function");
  LogError(COMPONENT_CONFIG, ERR_SYS, ERR_MALLOC, EINVAL);
  LogTest("\nTesting possible environment variable");
  LogTest("COMPONENT_MEMCORRUPT debug level is %s",
          ReturnLevelInt(LogComponents[COMPONENT_MEMCORRUPT].comp_log_level));
  LogFullDebug(COMPONENT_MEMCORRUPT,
               "This should appear if environment is set properly");

  LogTest("------------------------------------------------------");
  LogTest("Send some messages to various files");
  SetComponentLogFile(COMPONENT_DISPATCH, "STDERR");
  LogEvent(COMPONENT_DISPATCH, "This should go to stderr");
  SetComponentLogFile(COMPONENT_DISPATCH, "STDOUT");
  LogEvent(COMPONENT_DISPATCH, "This should go to stdout");
  SetComponentLogFile(COMPONENT_DISPATCH, "SYSLOG");
  LogEvent(COMPONENT_DISPATCH, "This should go to syslog (verf = %s)", str);
  LogTest("About to set %s", file);
  SetComponentLogFile(COMPONENT_DISPATCH, file);
  LogTest("Got it set");
  LogEvent(COMPONENT_DISPATCH, "This should go to %s", file);

  /*
   * Set up for tests that will verify what was actually produced by log messages.
   * This is used to test log levels and to test the log_vnsprintf function.
   */
  SetComponentLogBuffer(COMPONENT_MAIN, tempstr);
  SetComponentLogBuffer(COMPONENT_INIT, tempstr);

#ifdef _SNMP_ADM_ACTIVE
  {
    snmp_adm_type_union param;
    int rc;
    strcpy(param.string, "FAILED");

    LogTest("------------------------------------------------------");
    LogTest("Test SNMP functions");
    SetLevelDebug(NIV_DEBUG);

    rc = getComponentLogLevel(&param, (void *)COMPONENT_ALL);
    LogTest("getComponentLogLevel(&param, (void *)COMPONENT_ALL) rc=%d result=%s",
            rc, param.string);
    if (rc != 0)
    {
      LogTest("FAILURE");
      exit(1);
    }
    strcpy(param.string, "NIV_EVENT");
    rc = setComponentLogLevel(&param, (void *)COMPONENT_MAIN);
    LogTest("setComponentLogLevel(&param, (void *)COMPONENT_MAIN) rc=%d", rc);
    if (rc != 0)
    {
      LogTest("FAILURE");
      exit(1);
    }
    TestAlways    (TRUE,  tempstr, COMPONENT_MAIN, "LogAlways (should print)");
    TestMajor     (TRUE,  tempstr, COMPONENT_MAIN, "LogMajor (should print)");
    TestCrit      (TRUE,  tempstr, COMPONENT_MAIN, "LogCrit (should print)");
    TestEvent     (TRUE,  tempstr, COMPONENT_MAIN, "LogEvent (should print)");
    TestDebug     (FALSE, tempstr, COMPONENT_MAIN, "LogDebug (shouldn't print)");
    TestFullDebug (FALSE, tempstr, COMPONENT_MAIN, "LogFullDebug (shouldn't print)");
    TestAlways    (TRUE,  tempstr, COMPONENT_INIT, "LogAlways (should print)");
    TestMajor     (TRUE,  tempstr, COMPONENT_INIT, "LogMajor (should print)");
    TestCrit      (TRUE,  tempstr, COMPONENT_INIT, "LogCrit (should print)");
    TestEvent     (TRUE,  tempstr, COMPONENT_INIT, "LogEvent (should print)");
    TestDebug     (TRUE,  tempstr, COMPONENT_INIT, "LogDebug (should print)");
    TestFullDebug (FALSE, tempstr, COMPONENT_INIT, "LogFullDebug (shouldn't print)");
  }
#endif /* _SNMP_ADM_ACTIVE */

  LogTest("------------------------------------------------------");
  LogTest("Test all levels of log filtering");
  SetComponentLogLevel(COMPONENT_MAIN, NIV_NULL);
  TestAlways    (TRUE,  tempstr, COMPONENT_MAIN, "LogAlways (should print)");
  TestMajor     (FALSE, tempstr, COMPONENT_MAIN, "LogMajor (shouldn't print)");
  TestCrit      (FALSE, tempstr, COMPONENT_MAIN, "LogCrit (shouldn't print)");
  TestEvent     (FALSE, tempstr, COMPONENT_MAIN, "LogEvent (shouldn't print)");
  TestDebug     (FALSE, tempstr, COMPONENT_MAIN, "LogDebug (shouldn't print)");
  TestFullDebug (FALSE, tempstr, COMPONENT_MAIN, "LogFullDebug (shouldn't print)");
  SetComponentLogLevel(COMPONENT_MAIN, NIV_MAJOR);
  TestAlways    (TRUE,  tempstr, COMPONENT_MAIN, "LogAlways (should print)");
  TestMajor     (TRUE,  tempstr, COMPONENT_MAIN, "LogMajor (should print)");
  TestCrit      (FALSE, tempstr, COMPONENT_MAIN, "LogCrit (shouldn't print)");
  TestEvent     (FALSE, tempstr, COMPONENT_MAIN, "LogEvent (shouldn't print)");
  TestDebug     (FALSE, tempstr, COMPONENT_MAIN, "LogDebug (shouldn't print)");
  TestFullDebug (FALSE, tempstr, COMPONENT_MAIN, "LogFullDebug (shouldn't print)");
  SetComponentLogLevel(COMPONENT_MAIN, NIV_CRIT);
  TestAlways    (TRUE,  tempstr, COMPONENT_MAIN, "LogAlways (should print)");
  TestMajor     (TRUE,  tempstr, COMPONENT_MAIN, "LogMajor (should print)");
  TestCrit      (TRUE,  tempstr, COMPONENT_MAIN, "LogCrit (should print)");
  TestEvent     (FALSE, tempstr, COMPONENT_MAIN, "LogEvent (shouldn't print)");
  TestDebug     (FALSE, tempstr, COMPONENT_MAIN, "LogDebug (shouldn't print)");
  TestFullDebug (FALSE, tempstr, COMPONENT_MAIN, "LogFullDebug (shouldn't print)");
  SetComponentLogLevel(COMPONENT_MAIN, NIV_EVENT);
  TestAlways    (TRUE,  tempstr, COMPONENT_MAIN, "LogAlways (should print)");
  TestMajor     (TRUE,  tempstr, COMPONENT_MAIN, "LogMajor (should print)");
  TestCrit      (TRUE,  tempstr, COMPONENT_MAIN, "LogCrit (should print)");
  TestEvent     (TRUE,  tempstr, COMPONENT_MAIN, "LogEvent (should print)");
  TestDebug     (FALSE, tempstr, COMPONENT_MAIN, "LogDebug (shouldn't print)");
  TestFullDebug (FALSE, tempstr, COMPONENT_MAIN, "LogFullDebug (shouldn't print)");
  SetComponentLogLevel(COMPONENT_MAIN, NIV_DEBUG);
  TestAlways    (TRUE,  tempstr, COMPONENT_MAIN, "LogAlways (should print)");
  TestMajor     (TRUE,  tempstr, COMPONENT_MAIN, "LogMajor (should print)");
  TestCrit      (TRUE,  tempstr, COMPONENT_MAIN, "LogCrit (should print)");
  TestEvent     (TRUE,  tempstr, COMPONENT_MAIN, "LogEvent (should print)");
  TestDebug     (TRUE,  tempstr, COMPONENT_MAIN, "LogDebug (should print)");
  TestFullDebug (FALSE, tempstr, COMPONENT_MAIN, "LogFullDebug (shouldn't print)");
  SetComponentLogLevel(COMPONENT_MAIN, NIV_FULL_DEBUG);
  TestAlways    (TRUE,  tempstr, COMPONENT_MAIN, "LogAlways (should print)");
  TestMajor     (TRUE,  tempstr, COMPONENT_MAIN, "LogMajor (should print)");
  TestCrit      (TRUE,  tempstr, COMPONENT_MAIN, "LogCrit (should print)");
  TestEvent     (TRUE,  tempstr, COMPONENT_MAIN, "LogEvent (should print)");
  TestDebug     (TRUE,  tempstr, COMPONENT_MAIN, "LogDebug (should print)");
  TestFullDebug (TRUE,  tempstr, COMPONENT_MAIN, "LogFullDebug (should print)");
}
void *file_content_gc_thread(void *UnusedArg)
{
  char command[2 * MAXPATHLEN];
  exportlist_t *pexport = NULL;
  int is_hw_reached = FALSE;
  int some_flush_to_do = FALSE;
  unsigned long nb_blocks_to_manage;
  char cache_sub_dir[MAXPATHLEN];
  cache_content_status_t cache_content_status;
  FILE *command_stream = NULL;

  char logfile_arg[MAXPATHLEN];
  char *loglevel_arg;

  SetNameFunction("file_content_gc_thread");

  LogEvent(COMPONENT_MAIN,
           "NFS FILE CONTENT GARBAGE COLLECTION : Starting GC thread");

  if(mark_thread_existing(&gccb) == PAUSE_EXIT)
    {
      /* Oops, that didn't last long... exit. */
      mark_thread_done(&gccb);
      LogDebug(COMPONENT_DISPATCH,
               "NFS FILE CONTENT GARBAGE COLLECTION Thread exiting before initialization");
      return NULL;
    }

  LogDebug(COMPONENT_MAIN,
           "NFS FILE CONTENT GARBAGE COLLECTION : my pthread id is %p",
           (caddr_t) pthread_self());

  while(1)
    {
      /* Sleep until some work is to be done */
      sleep(nfs_param.cache_layers_param.dcgcpol.run_interval);

      if(gccb.tcb_state != STATE_AWAKE)
        {
          while(1)
            {
              P(gccb.tcb_mutex);
              if(gccb.tcb_state == STATE_AWAKE)
                {
                  V(gccb.tcb_mutex);
                  break;
                }
              switch(thread_sm_locked(&gccb))
                {
                  case THREAD_SM_RECHECK:
                    V(gccb.tcb_mutex);
                    continue;

                  case THREAD_SM_BREAK:
                    V(gccb.tcb_mutex);
                    break;

                  case THREAD_SM_EXIT:
                    V(gccb.tcb_mutex);
                    return NULL;
                }
            }
        }

      LogDebug(COMPONENT_MAIN,
               "NFS FILE CONTENT GARBAGE COLLECTION : processing...");
      for(pexport = nfs_param.pexportlist; pexport != NULL; pexport = pexport->next)
        {
          if(pexport->options & EXPORT_OPTION_USE_DATACACHE)
            {
              snprintf(cache_sub_dir, MAXPATHLEN, "%s/export_id=%d",
                       nfs_param.cache_layers_param.cache_content_client_param.cache_dir,
                       0);

              if((cache_content_status = cache_content_check_threshold(cache_sub_dir,
                                                                       nfs_param.
                                                                       cache_layers_param.
                                                                       dcgcpol.lwmark_df,
                                                                       nfs_param.
                                                                       cache_layers_param.
                                                                       dcgcpol.hwmark_df,
                                                                       &is_hw_reached,
                                                                       &nb_blocks_to_manage))
                 == CACHE_CONTENT_SUCCESS)
                {
                  if(is_hw_reached)
                    {
                      LogEvent(COMPONENT_MAIN,
                               "NFS FILE CONTENT GARBAGE COLLECTION : High Water Mark is  reached, %lu blocks to be removed",
                               nb_blocks_to_manage);
                      some_flush_to_do = TRUE;
                      break;
                    }
                  else {
                    LogDebug(COMPONENT_MAIN,
                             "NFS FILE CONTENT GARBAGE COLLECTION : High Water Mark is not reached");
		  }

                  /* Use signal management */
                  if(force_flush_by_signal == TRUE)
                    {
                      some_flush_to_do = TRUE;
                      break;
                    }
                }
            }
        }                       /* for */

      if (strncmp(fcc_log_path, "/dev/null", 9) == 0)
	switch(LogComponents[COMPONENT_CACHE_INODE_GC].comp_log_type)
	  {
	  case FILELOG:
	    strncpy(logfile_arg, LogComponents[COMPONENT_CACHE_INODE_GC].comp_log_file, MAXPATHLEN);
	    break;
	  case SYSLOG:
	    strncpy(logfile_arg, "SYSLOG", MAXPATHLEN);
	    break;
	  case STDERRLOG:
	    strncpy(logfile_arg, "STDERRLOG", MAXPATHLEN);
	    break;
	  case STDOUTLOG:
	    strncpy(logfile_arg, "STDOUTLOG", MAXPATHLEN);
	    break;
	  default:
	    LogCrit(COMPONENT_MAIN,
	            "Could not figure out the proper -L option for emergency cache flush thread.");
	  }
      else
	strncpy(logfile_arg, fcc_log_path, MAXPATHLEN); /* config variable */

      if(fcc_debug_level != -1) /* config variable */
	loglevel_arg = ReturnLevelInt(fcc_debug_level);
      else
	loglevel_arg = ReturnLevelInt(ReturnLevelComponent(COMPONENT_CACHE_INODE_GC));

      snprintf(command, 2 * MAXPATHLEN, "%s -f %s -N %s -L %s",
	       ganesha_exec_path, config_path, loglevel_arg, logfile_arg);
	       
      if(some_flush_to_do)
        strncat(command, " -P 3", 2 * MAXPATHLEN);      /* Sync and erase */
      else
        strncat(command, " -S 3", 2 * MAXPATHLEN);      /* Sync Only */

      if((command_stream = popen(command, "r")) == NULL)
        LogCrit(COMPONENT_MAIN,
                "NFS FILE CONTENT GARBAGE COLLECTION : /!\\ Cannot lauch command %s",
                command);
      else
        LogEvent(COMPONENT_MAIN,
                 "NFS FILE CONTENT GARBAGE COLLECTION : I launched command %s",
                 command);

      pclose(command_stream);
    }
  tcb_remove(&gccb);
}                               /* file_content_gc_thread */