fixed replacement *at functions and made get_full_path() function public

This commit is contained in:
Celine Mercier
2015-06-23 17:55:00 +02:00
parent e6e68786f7
commit 0a78a786c1
2 changed files with 79 additions and 97 deletions

View File

@ -2,7 +2,7 @@
* @file private_openat.h
* @author Celine Mercier
* @date 15 June 2015
* @brief Header file for a replacement function for openat.
* @brief Header file for the replacement *at function.
*/
#ifndef PRIVATE_OPENAT_H_
@ -15,6 +15,31 @@
#define MAX_PATH_LEN 4096
/**
* Internal function getting the full path of a file or a directory from its
* path relative to a directory file descriptor.
*
*
* @warning The returned pointer has to be freed by the caller.
*
* @param directory_file_descriptor the file descriptor for the directory to which
* path_name is relative
* @param path_name the path name for the file or directory, relative to directory_file_descriptor
*
* @return a pointer to the full path
* @retvalue <full_path> if everything is ok
* @retvalue NULL if an error occurs
*
* ###Error values
* - OBIDMS_MEMORY_ERROR : something wrong occurred during memory allocation.
* - OBIDMS_LONG_NAME_ERROR : the database name exceeds the limit.
*
* @since June 2015
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
char* get_full_path(int directory_file_descriptor, const char* path_name);
/**
* @brief Replacement function for openat() : open a file relative to a directory file descriptor.
*
@ -56,21 +81,7 @@ int private_mkdirat(int directory_file_descriptor, const char* path_name, mode_t
* @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);
DIR* private_opendirat(int directory_file_descriptor, const char* path_name);
#endif /* PRIVATEOPENAT_H_ */