Esempio n. 1
0
void
que_Put (
  pwr_tStatus *status,
  que_sQue *qp,
  lst_sEntry *lp,
  void *item
)
{
  pwr_dStatus(sts, status, QUE__SUCCESS);

  thread_MutexLock(&qp->mutex);

    lst_InsertPred(NULL, &qp->lh, lp, item);
    thread_CondSignal(&qp->cond);

  thread_MutexUnlock(&qp->mutex);
}
Esempio n. 2
0
ini_sProc *ini_ProcInsert (
  pwr_tStatus	*status,
  ini_sContext	*cp,
  char		*id,
  char		*name,
  int		load,
  int		run,
  char		*file,
  int		prio,
  int		debug,
  char		*arg
)
{
  ini_sProc	*pp;
  char		buf[255];
  char          *s;
  int           ret;
  struct stat   f_stat;

  pwr_dStatus(sts, status, INI__SUCCESS);

  pp = tree_Insert(sts, cp->proc_t, id);
  if (pp == NULL) return NULL;

  if (name != NULL && name[0] != '\0' && strcmp(name, "\"\"")) {
    if (pp->proc.name != NULL) free(pp->proc.name);
    sprintf(buf, name, cp->busid);
    pp->proc.name = strsav(buf);
  }
  if (load != -1) pp->proc.flags.b.load = load != 0;
  if (run != -1) pp->flags.b.run = run != 0;
  if (file != NULL && file[0] != '\0' && strcmp(file, "\"\"")) {
    if (pp->proc.file != NULL) free(pp->proc.file);
      pp->proc.file = strsav(file);
#if defined(OS_LINUX)
      s = getenv("pwr_exe");
      sprintf(buf, "%s/%s", s, file);
      ret = stat(buf, &f_stat);
      if (ret == -1)
      {
        s = getenv("pwrp_exe");
	sprintf(buf, "%s/%s", s, file);
	ret = stat(buf, &f_stat);
	if (ret == -1)
	{
	  pp->flags.b.run  = 0;
	  pp->proc.flags.b.load = 0;
	}
      }
#endif
  }
  if (arg != NULL && arg[0] != '\0' && strcmp(arg, "\"\"")) {
    if (pp->proc.arg != NULL) free(pp->proc.arg);
    pp->proc.arg = strsav(arg);
  }
  if (prio != -1) pp->proc.p_prio = prio;
  if (debug != -1) pp->proc.flags.b.debug = debug != 0;
  if (!lst_IsLinked(NULL, &pp->proc_ll)) {
    lst_InsertPred(NULL, &cp->proc_lh, &pp->proc_ll, pp);
  }

  return pp;
}