реклама на сайте
подробности

 
 
> процесс init-respawning too fast: disabled for 5
romez777
сообщение Oct 14 2005, 04:14
Сообщение #1


Местный
***

Группа: Свой
Сообщений: 292
Регистрация: 9-11-04
Пользователь №: 1 077



Приветствую.

Экспериментурую со своим самописным сетевым демоном. Организовал запуск демона средствами процесса init, в /etc/inittab добавил запись:

d:345:respawn:/path/to/my/daemon -d

Периодически в логи сыпятся сообщения:
Id "d" respawning too fast: disabled for 5 minutes

Как я догадываюсь, что-то не так с моим приложением smile.gif Хотя при этом он успешно работает.

Вот как я создаю демона:

Код
/* closeall() - close all FDs >= specified value */
void closeall(int fd)
{
 int fdlimit = sysconf(_SC_OPEN_MAX);
 while ( fd < fdlimit )
  close(fd++);
}

/* daemon() - detach process from user and disappear into the background */
int daemon(int nochdir, int noclose)
{
 switch ( fork() )
 {
     case 0:
       break;
     case -1:
       return -1;
     default:
       exit(0);  /* exit the original process */
 }

 /* create new session not having controlling terminal */
 if (setsid() < 0)    /* shoudn't fail */
    return -1;

 /* now we aren't session group leader, so never gain controlling terminal */
 switch ( fork() )
 {
    case 0:
      break;
    case -1:
      return -1;
    default:
      exit(0);
 }

 /* here run the child */
 if ( !nochdir )
  chdir("/");

 if ( !noclose ) {
  closeall(0);
  open("/dev/null", O_RDWR);
  dup(0); dup(0);
 }

 return 0;
}

...

int main(void)
{
  .....
     if ( daemon(0, 0) < 0 ) {
           perror("daemon");
           exit(2);
     }

     process();     /* run main process */

     return 0;
}


На что стоит еще обратить внимание?
Спасибо.
Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 21st July 2025 - 08:04
Рейтинг@Mail.ru


Страница сгенерированна за 0.01342 секунд с 7
ELECTRONIX ©2004-2016