copy file via system calls