Пример #1
0
/**
 * Set last CORE error
 *
 * @param __text - description of error
 */
void
core_set_last_error (char *__text, ...)
{
  static char buf[4096];
  PACK_ARGS (__text, buf, 4096);
  strcpy (core_error, buf);
}
Пример #2
0
/**
 * Set status in find results' window
 *
 * @param __res_wnd - window with results
 * @param __format - format of state
 */
static void
set_status (action_find_res_wnd_t *__res_wnd, const wchar_t *__format, ...)
{
  wchar_t buf[1024];

  PACK_ARGS(__format, buf, BUF_LEN (buf));

  w_text_set (__res_wnd->status, buf);
}
Пример #3
0
/**
 * Starts a cold unmap thread which on every
 * cold interval unamps cold sets.
 * @arg config The configuration
 * @arg mgr The manager to use
 * @arg should_run Pointer to an integer that is set to 0 to
 * indicate the thread should exit.
 * @arg t The output thread
 * @return 1 if the thread was started
 */
int start_cold_unmap_thread(hlld_config *config, hlld_setmgr *mgr, int *should_run, pthread_t *t) {
    // Return if we are not scheduled
    if(config->cold_interval <= 0) {
        return 0;
    }

    // Start thread
    background_thread_args *args;
    PACK_ARGS();
    pthread_create(t, NULL, unmap_thread_main, args);
    return 1;
}
Пример #4
0
/**
 * Starts a flushing thread which on every
 * configured flush interval, flushes all the filters.
 * @arg config The configuration
 * @arg mgr The filter manager to use
 * @arg should_run Pointer to an integer that is set to 0 to
 * indicate the thread should exit.
 * @arg t The output thread
 * @return 1 if the thread was started
 */
int start_flush_thread(bloom_config *config, bloom_filtmgr *mgr, int *should_run, pthread_t *t) {
    // Return if we are not scheduled
    if(config->flush_interval <= 0) {
        return 0;
    }

    // Start thread
    background_thread_args *args;
    PACK_ARGS();
    pthread_create(t, NULL, flush_thread_main, args);
    return 1;
}
Пример #5
0
/**
 * Launch command
 *
 * @params __args - arguments
 * @return zero on success, non-zero otherwise
 */
int
sys_launch (const char *__args, ...)
{
  char buf[65536], dummy[65536];
  int ret;

  PACK_ARGS (__args, dummy, 65535);
  snprintf (buf, BUF_SIZE (buf), "%s > /dev/null 2>&1", dummy);

  ret = system (buf);
  if (WIFSIGNALED (ret) && (WTERMSIG (ret) == SIGINT ||
      WTERMSIG (ret) == SIGQUIT))
    {
      core_kill_process (0, WTERMSIG (ret));
    }

  return 0;
}