Computers/Linux System Programming

ch13. Daemon process

emzei 2013. 6. 16. 11:03

*_* ★ --- 수업시간엔 독립형 디몬만!


[디몬 코딩 수칙]

1) umask 호출 ---- 파일 모드 생성 마스크를 0 으로 설정

2) fork 호출 뒤, 부모 프로세스 종료(exit)

3) setsid 호출하여 새로운 세션 생성

4) (opt) 현재 작업 디렉토리를 루트로 변경

5) 필요하지 않은 파일 디스크립터 전부 close

6) 표준입출력,오류 출력의 라이브러리 루틴을 무효화 ~ /dev/null 에 대해 오픈

7) SIGHUP 무시


 

 

[디몬 프로세스 특징]

1. ctrl terminal 없음

2. ppid=1, sid=1 설정

3. -D 옵션을 가짐


 *비교) 백그라운드 프로세스 

    1. ctrl terminal 있음

    2. ppid와 sid가 다를 수 있음

    3. 실행 시 & 붙임



[오류 기록]

  openlog

#include<syslog.h>

 void openlog(const char *ident, int option, int facility);

 

 syslog

#include<syslog.h>

 void syslog(int priority, const char *format...);


 closelog

#include<syslog.h>

 void closelog(void);


 sestlogmask

#include<syslog.h>

 int setlogmask(int maskpri);

(ret)  이전 로그 우선순위 마스크 값


'Computers > Linux System Programming' 카테고리의 다른 글

ch11. Threads  (0) 2013.06.16
ch10. signal  (0) 2013.05.20
+ ch9. ( addition) process relationship  (0) 2013.05.20
ch9. process relationship  (0) 2013.05.20
ch8. process control  (0) 2013.04.28