System Call File I/O 함수들
open(2) - 파일을 읽거나 쓰기 위해 열기
open(2) #include #include #include int open(const char *pathname, int flags); int open(const char *pathname, int flags, mode_t mode); 이미 존재하는 파일을 열거..
www.it-note.kr
creat(2) - 파일을 쓰기 전용으로 생성
creat(2) #include #include #include int creat(const char *pathname, mode_t mode); 기존의 파일 또는 새로운 파일을 쓰기 전용으로 open합니다. open(pathname, O_WRON..
www.it-note.kr
close(2) - 열려진 파일을 닫습니다.
close(2) #include int close(int fd); open(2) 또는 creat(2)를 통하여 open한 파일을 닫습니다. 파라미터 fd - open(2) 또는 creat(2)를 통해서 생성한 file descriptor. RETURN 0 - 정상적으로 파..
www.it-note.kr
read(2) - 파일에서 데이터를 읽기
read(2) #include ssize_t read(int fd, void *buf, size_t count); open(2), creat(2), socket(2), accept(2) 등으로 생성한 file descriptor로 부터 데이터를 읽습니다. 파일을 읽으면 읽은 size만..
www.it-note.kr
pread(2) - 지정된 위치에서 파일 읽기
pread(2) #include ssize_t pread(int fd, void *buf, size_t count, off_t offset); 파일의 offset 위치에서 count byte만큼의 파일을 읽어서 buf에 저장합니다. 이 함수는 read(2)함수와 달리 파일..
www.it-note.kr
pwrite(2) - 지정된 위치에 파일 쓰기
pwrite(2) #include ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); 파일의 offset 위치에 buf의 내용을 count byte만큼 쓰기를 합니다. 이 함수는 write(2)함수와 달리 파일..
www.it-note.kr
lseek(2) - file의 읽기/쓰기위한 위치 변경
lseek(2) #include #include off_t lseek(int fd, off_t offset, int whence); read/write할 file의 위치를 이동하거나 현재 파일의 읽거나 쓰기할 위치를 얻는 함수입니다. stdio.h의..
www.it-note.kr
truncate(2) - 파일의 크기를 조정하기
truncate(2) #include #include int truncate(const char *path, off_t length); 쓰기 권한이 있는 path의 파일을 length 길이 만큼의 크기로 변경합니다. length가 파일의 크기보다 작..
www.it-note.kr
ftruncate(2) - 파일의 크기를 조정하기
ftruncate(2) #include #include int ftruncate(int fd, off_t length); 쓰기로 open된 fd에 대해서 파일 크기를 length 길이 만큼의 크기로 변경합니다. length가 파일의 크기보다 작..
www.it-note.kr
sync(2) - 전체 kernel buffer를 동기화 하기
sync(2) #include void sync(void); 모든 kernel buffer의 내용을 disk에 동기화합니다. LINUX에서는 buffer의 내용이 동기화될 때까지 함수의 return을 하지 않기 때문에 함수가 종료되면 동기화가..
www.it-note.kr
fsync(2) - kernel에 buffering된 데이터를 disk로 동기화하기(Meta 정보 포함)
fsync(2) #include int fsync(int fd); write(2)함수를 통하여 쓰기를 하면, OS의 kernel이 buffer에 caching하고 write가 끝났다고 즉시 return합니다. 그러나 OS는 resource를 효율적으로 관리하기..
www.it-note.kr
fdatasync(2) - kernel에 buffering된 데이터를 disk에 동기화 하기(Meta 정보 제외)
fdatasync(2) #include int fdatasync(int fd); write(2)함수를 통하여 쓰기를 하면, OS의 kernel이 buffer에 caching하고 write가 끝났다고 즉시 return합니다. 그러나 OS는 resource를 효율적으로..
www.it-note.kr
'관리 > 자료 구성' 카테고리의 다른 글
Directory 정보 조회 및 관리 Library (0) | 2019.10.10 |
---|---|
File 속성 정보 및 파일 관리 Library (0) | 2019.10.10 |
Stream File I/O Library (0) | 2019.10.10 |
IPC (Inter Process Communication) (0) | 2019.10.04 |
memory 관련 Library (0) | 2019.10.04 |