컴퓨터 공부/Advanced UNIX System Programming

[5월 8일 3교시] IPC

려리군 2009. 5. 8. 11:41

IPC(프로세스간 통신)


unnamed pipe

커널 메모리를 통해 파이프 통신을 함.

int pipe(int *filedes);

filedes[0] : 읽기 인덱스. filedes[1] : 쓰기 인덱스.


파이프 지원 라이브러리

#include<stdio.h>

FILE *popen(char *command, char *type);

command : 생성할 자식을 위한 shell 명령

type

 "r" : 자식 프로세스로부터 FILE*을 통해 데이터를 얻음.

"w" : 자식 프로세스로부터 FILE*을 통해 데이터를 제공. 

int pclose(FILE *stream);

리턴 : 자식 프로세스의 상태를 얻음.