/** * @file private_openat.h * @author Celine Mercier * @date 15 June 2015 * @brief Header file for a replacement function for openat. */ #ifndef PRIVATE_OPENAT_H_ #define PRIVATE_OPENAT_H_ #include #define MAX_PATH_LEN 4096 /** * @brief Replacement function for openat() : open a file relative to a directory file descriptor. * * @param directory_file_descriptor the file descriptor for the directory in which the file should be opened * @param path_name the path name for the file, relative to directory_file_descriptor * @param flags the access modes * * @return the file descriptor of the opened file * * @since June 2015 * @author Celine Mercier (celine.mercier@metabarcoding.org) */ int private_openat(int directory_file_descriptor, const char* path_name, int flags); /** * @brief Replacement function for mkdirat() : create a directory relative to a directory file descriptor. * * @param directory_file_descriptor the file descriptor for the directory in which the directory should be created * @param path_name the path name for the new directory, relative to directory_file_descriptor * @param mode the access mode * * @return the file descriptor of the created directory * * @since June 2015 * @author Celine Mercier (celine.mercier@metabarcoding.org) */ int private_mkdirat(int directory_file_descriptor, const char* path_name, mode_t mode); /** * @brief Replacement function for opendirat() : open a directory relative to a directory file descriptor. * * @param directory_file_descriptor the file descriptor for the directory in which the directory should be opened * @param path_name the path name for the directory to be opened, relative to directory_file_descriptor * * @return the file descriptor of the opened directory * * @since June 2015 * @author Celine Mercier (celine.mercier@metabarcoding.org) */ int private_opendirat(int directory_file_descriptor, const char* path_name); /** * @brief Replacement function for closedirat() : close a directory relative to a directory file descriptor. * * @param directory_file_descriptor the file descriptor for the directory in which the directory should be closed * @param path_name the path name for the directory to be closed, relative to directory_file_descriptor * * @return 0 on success and -1 on error * * @since June 2015 * @author Celine Mercier (celine.mercier@metabarcoding.org) */ int private_closedirat(int directory_file_descriptor, const char* path_name); #endif /* PRIVATEOPENAT_H_ */