'waitpid'에 해당되는 글 1건

  1. 2010.01.11 fork-exec 종료시 리턴값
Linux2010. 1. 11. 09:42
fork-exec로 실행한 프로그램의 리턴값을 받는 방법이다.
예를 들어 mount를 쉘에서 실행하고 그 결과값을 받고 싶을때 사용한다.

#include <sys/types.h>
#include <sys/wait.h>

WEXITSTATUS
(status)
    returns the exit status of the child. This consists of the least significant 16-8 bits of the status argument that the child specified in a call to exit() or _exit() or as the argument for a return statement in main(). This macro should only be employed if WIFEXITED returned true.

[링크 : http://linux.die.net/man/2/waitpid]

[링크 : http://www.joinc.co.kr/modules/moniwiki/wiki.php/man/2/waitpid]
Posted by 구차니