Skip to contentSkip to conversation

OT: why no file copy() libc/syscall ??

DISCUSSION Davide Rossetti 1 participant 1 message Nov 10, 2003

lore
Share & tools
lore
#0 lore raw

it may be orribly RTFM... but writing a simple framework I realized there is no libc/POSIX/whoknows copy(const char* dest_file_name, const char* src_file_name)

What is the technical reason???

I understand that there may be little space for kernel side optimizations in this area but anyway I'm surprised I have to write

< the bits to clone the metadata of src_file_name on opening dest_file_name > const int BUFSIZE = 1<<12;
char buffer[BUFSIZE];
int nrb;
while((nrb = read(infd, buffer, BUFSIZE) != -1) {
ret = write(outfd, buffer, nrb);
if(ret != nrb) {...}
}

instead of something similar to:
sys_fscopy(...)

regards