리눅스 커널 2.6.9부터 생긴 sendfile 제약 사항에 관한 해석
sendfile system call 이 리눅스 커널 2.6.9 부터 file to file operation을 제한한 상태입니다.
이걸 읽어보면 2.6 커널의 구조로 인한 문제 때문이고, 2.6.17부터는 이를 대체해서 splice system call 을 도입했다고 합니다. 그리고 리누스 토발즈의 언급을 들어 추후 sendfile 을 splice 처럼 재구현할 거라고는 합니다. 그런데 리눅스 커널 지식이 부족하여 아래 부분이 잘 와 닿지가 않네요. ㅜㅠ
For a file-to-file sendfile, you'd need a copy because otherwise the same page would have to be in the pagecache as both a clean page in the source file and a dirty page in the destination file. I don't think the pagecache is built to handle that case at the moment (though of course, this could be changed if there was sufficient motivation).
For a file-to-pipe sendfile, you need a copy regardless because the destination process needs to get a private, writeable copy of the data. Anyway, for most uses of this case we already have mmap.
혹시 sendfile system call 이 file to file 을 제한한 이유를 설명해 주실 수 있는 분 있나요?
댓글 달기