return ret;
}
+LTTNG_HIDDEN
struct fd_tracker *fd_tracker_create(const char *unlinked_file_path,
unsigned int capacity)
{
return NULL;
}
+LTTNG_HIDDEN
void fd_tracker_log(struct fd_tracker *tracker)
{
struct fs_handle_tracked *handle;
pthread_mutex_unlock(&tracker->lock);
}
+LTTNG_HIDDEN
int fd_tracker_destroy(struct fd_tracker *tracker)
{
int ret = 0;
return ret;
}
+LTTNG_HIDDEN
struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker,
struct lttng_directory_handle *directory,
const char *path,
return left_to_close ? -EMFILE : 0;
}
+LTTNG_HIDDEN
int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker,
int *out_fds,
const char **names,
goto end_unlock;
}
+LTTNG_HIDDEN
int fd_tracker_close_unsuspendable_fd(struct fd_tracker *tracker,
int *fds_in,
unsigned int fd_count,
#define FD_TRACKER_H
#include <common/compat/directory-handle.h>
+#include <common/macros.h>
#include <stdint.h>
#include <sys/types.h>
* under which unlinked files will be stored for as long as a reference to them
* is held.
*/
+LTTNG_HIDDEN
struct fd_tracker *fd_tracker_create(const char *unlinked_file_path,
unsigned int capacity);
/* Returns an error if file descriptors are leaked. */
+LTTNG_HIDDEN
int fd_tracker_destroy(struct fd_tracker *tracker);
/*
* (e.g. truncation) may react differently than if the file descriptor was kept
* open.
*/
+LTTNG_HIDDEN
struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker,
struct lttng_directory_handle *directory,
const char *path,
* - EMFILE: too many unsuspendable fds are opened and the tracker can't
* accomodate the request for a new unsuspendable entry.
*/
+LTTNG_HIDDEN
int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker,
int *out_fds,
const char **names,
* Closed fds are set to -1 in the fds array which, in the event of an error,
* allows the user to know which file descriptors are no longer being tracked.
*/
+LTTNG_HIDDEN
int fd_tracker_close_unsuspendable_fd(struct fd_tracker *tracker,
int *fds,
unsigned int fd_count,
/*
* Log the contents of the fd_tracker.
*/
+LTTNG_HIDDEN
void fd_tracker_log(struct fd_tracker *tracker);
/*
* Returns the fd on success, otherwise a negative value may be returned
* if the restoration of the fd failed.
*/
+LTTNG_HIDDEN
int fs_handle_get_fd(struct fs_handle *handle);
/*
* Used by the application to signify that it is no longer using the
* underlying fd and that it may be suspended.
*/
+LTTNG_HIDDEN
void fs_handle_put_fd(struct fs_handle *handle);
/*
* Returns 0 on success, otherwise a negative value will be returned
* if the operation failed.
*/
+LTTNG_HIDDEN
int fs_handle_unlink(struct fs_handle *handle);
/*
* Frees the handle and discards the underlying fd.
*/
+LTTNG_HIDDEN
int fs_handle_close(struct fs_handle *handle);
#endif /* FD_TRACKER_H */
urcu_ref_get(&inode->ref);
}
-struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create(
+LTTNG_HIDDEN struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create(
const char *path)
{
struct lttng_unlinked_file_pool *pool = zmalloc(sizeof(*pool));
return NULL;
}
-void lttng_unlinked_file_pool_destroy(
+LTTNG_HIDDEN void lttng_unlinked_file_pool_destroy(
struct lttng_unlinked_file_pool *pool)
{
if (!pool) {
free(pool);
}
-void lttng_inode_put(struct lttng_inode *inode)
+LTTNG_HIDDEN void lttng_inode_put(struct lttng_inode *inode)
{
urcu_ref_put(&inode->ref, lttng_inode_release);
}
-struct lttng_directory_handle *lttng_inode_get_location_directory_handle(
+LTTNG_HIDDEN struct lttng_directory_handle *
+lttng_inode_get_location_directory_handle(
struct lttng_inode *inode)
{
if (inode->location.directory_handle) {
return inode->location.directory_handle;
}
-void lttng_inode_borrow_location(struct lttng_inode *inode,
+LTTNG_HIDDEN void lttng_inode_borrow_location(struct lttng_inode *inode,
const struct lttng_directory_handle **out_directory_handle,
const char **out_path)
{
}
}
-int lttng_inode_rename(
+LTTNG_HIDDEN int lttng_inode_rename(
struct lttng_inode *inode,
struct lttng_directory_handle *old_directory_handle,
const char *old_path,
return ret;
}
-int lttng_inode_unlink(struct lttng_inode *inode)
+LTTNG_HIDDEN int lttng_inode_unlink(struct lttng_inode *inode)
{
int ret = 0;
return inode;
}
-struct lttng_inode_registry *lttng_inode_registry_create(void)
+LTTNG_HIDDEN struct lttng_inode_registry *lttng_inode_registry_create(void)
{
struct lttng_inode_registry *registry = zmalloc(sizeof(*registry));
return NULL;
}
-void lttng_inode_registry_destroy(struct lttng_inode_registry *registry)
+LTTNG_HIDDEN void lttng_inode_registry_destroy(
+ struct lttng_inode_registry *registry)
{
if (!registry) {
return;
free(registry);
}
-struct lttng_inode *lttng_inode_registry_get_inode(
+LTTNG_HIDDEN struct lttng_inode *lttng_inode_registry_get_inode(
struct lttng_inode_registry *registry,
struct lttng_directory_handle *handle,
const char *path,
* by the fd-tracker. Users of the fd-tracker should account for this extra
* file descriptor.
*/
+LTTNG_HIDDEN
struct lttng_unlinked_file_pool *lttng_unlinked_file_pool_create(
const char *path);
+LTTNG_HIDDEN
void lttng_unlinked_file_pool_destroy(
struct lttng_unlinked_file_pool *pool);
/* The inode registry is protected by the fd-tracker's lock. */
+LTTNG_HIDDEN
struct lttng_inode_registry *lttng_inode_registry_create(void);
+LTTNG_HIDDEN
struct lttng_inode *lttng_inode_registry_get_inode(
struct lttng_inode_registry *registry,
struct lttng_directory_handle *handle,
int fd,
struct lttng_unlinked_file_pool *pool);
+LTTNG_HIDDEN
void lttng_inode_registry_destroy(struct lttng_inode_registry *registry);
+LTTNG_HIDDEN
void lttng_inode_borrow_location(struct lttng_inode *inode,
const struct lttng_directory_handle **out_directory_handle,
const char **out_path);
/* Returns a new reference to the inode's location directory handle. */
+LTTNG_HIDDEN
struct lttng_directory_handle *lttng_inode_get_location_directory_handle(
struct lttng_inode *inode);
+LTTNG_HIDDEN
int lttng_inode_rename(struct lttng_inode *inode,
struct lttng_directory_handle *old_directory_handle,
const char *old_path,
const char *new_path,
bool overwrite);
+LTTNG_HIDDEN
int lttng_inode_unlink(struct lttng_inode *inode);
+LTTNG_HIDDEN
void lttng_inode_put(struct lttng_inode *inode);
#endif /* FD_TRACKER_INODE_H */