V3FIT
Macros | Functions
copy_file.c File Reference

Functions to fast copy files. More...

#include <sys/errno.h>
#include <fcntl.h>
#include <sys/sendfile.h>
#include <sys/stat.h>

Go to the source code of this file.

Macros

#define COPYFILE_ALL   0
 Flag to copy the enture file.
 

Functions

size_t copyfile (const char *src, const char *dest, const int unused_1, const int unused_2)
 Copy a file from the source to the destination. More...
 
int copy_file_c (const char *src, const char *dest)
 Copy a file from the source to the destination. More...
 

Detailed Description

Functions to fast copy files.

MPI and calls to fork do not mix well. In place of slow copies this makes Kernel function calls to the OS fast copy systems by passing a fork to the cp command.

Definition in file copy_file.c.

Function Documentation

◆ copy_file_c()

int copy_file_c ( const char *  src,
const char *  dest 
)

Copy a file from the source to the destination.

Copy file returns the error status. Check errno to see the error that occurred.

Parameters
[in]srcPath to the source file to copy.
[in]destPath to the destination file to copy.
Returns
Error code.

Definition at line 69 of file copy_file.c.

◆ copyfile()

size_t copyfile ( const char *  src,
const char *  dest,
const int  unused_1,
const int  unused_2 
)

Copy a file from the source to the destination.

Linux does not define the copyfile function. Define one using the sendfile(2) function.

Parameters
[in]srcPath to the source file to copy.
[in]destPath to the destination file to copy.
[in]unused_1Unused argument.
[in]unused_2Unused argument.
Returns
Error status.

Definition at line 35 of file copy_file.c.