projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Force usage of assert() condition when NDEBUG is defined
[lttng-tools.git]
/
src
/
common
/
fd-tracker
/
fd-tracker.c
diff --git
a/src/common/fd-tracker/fd-tracker.c
b/src/common/fd-tracker/fd-tracker.c
index 188abfb6d2792f4f3f2eb9d899e6fb62d784f522..08ecb3cce2cda96ec84d305beb1771222b4840a5 100644
(file)
--- a/
src/common/fd-tracker/fd-tracker.c
+++ b/
src/common/fd-tracker/fd-tracker.c
@@
-232,7
+232,7
@@
static int fs_handle_tracked_suspend(struct fs_handle_tracked *handle)
pthread_mutex_lock(&handle->lock);
lttng_inode_borrow_location(
handle->inode, &node_directory_handle, &path);
pthread_mutex_lock(&handle->lock);
lttng_inode_borrow_location(
handle->inode, &node_directory_handle, &path);
-
assert
(handle->fd >= 0);
+
LTTNG_ASSERT
(handle->fd >= 0);
if (handle->in_use) {
/* This handle can't be suspended as it is currently in use. */
ret = -EAGAIN;
if (handle->in_use) {
/* This handle can't be suspended as it is currently in use. */
ret = -EAGAIN;
@@
-292,8
+292,8
@@
static int fs_handle_tracked_restore(struct fs_handle_tracked *handle)
lttng_inode_borrow_location(
handle->inode, &node_directory_handle, &path);
lttng_inode_borrow_location(
handle->inode, &node_directory_handle, &path);
-
assert
(handle->fd == -1);
-
assert
(path);
+
LTTNG_ASSERT
(handle->fd == -1);
+
LTTNG_ASSERT
(path);
ret = open_from_properties(
node_directory_handle, path, &handle->properties);
if (ret < 0) {
ret = open_from_properties(
node_directory_handle, path, &handle->properties);
if (ret < 0) {
@@
-360,6
+360,7
@@
end:
return ret;
}
return ret;
}
+LTTNG_HIDDEN
struct fd_tracker *fd_tracker_create(const char *unlinked_file_path,
unsigned int capacity)
{
struct fd_tracker *fd_tracker_create(const char *unlinked_file_path,
unsigned int capacity)
{
@@
-405,6
+406,7
@@
error:
return NULL;
}
return NULL;
}
+LTTNG_HIDDEN
void fd_tracker_log(struct fd_tracker *tracker)
{
struct fs_handle_tracked *handle;
void fd_tracker_log(struct fd_tracker *tracker)
{
struct fs_handle_tracked *handle;
@@
-453,10
+455,14
@@
void fd_tracker_log(struct fd_tracker *tracker)
pthread_mutex_unlock(&tracker->lock);
}
pthread_mutex_unlock(&tracker->lock);
}
+LTTNG_HIDDEN
int fd_tracker_destroy(struct fd_tracker *tracker)
{
int ret = 0;
int fd_tracker_destroy(struct fd_tracker *tracker)
{
int ret = 0;
+ if (!tracker) {
+ goto end;
+ }
/*
* Refuse to destroy the tracker as fs_handles may still old
* weak references to the tracker.
/*
* Refuse to destroy the tracker as fs_handles may still old
* weak references to the tracker.
@@
-474,7
+480,7
@@
int fd_tracker_destroy(struct fd_tracker *tracker)
if (tracker->unsuspendable_fds) {
ret = cds_lfht_destroy(tracker->unsuspendable_fds, NULL);
if (tracker->unsuspendable_fds) {
ret = cds_lfht_destroy(tracker->unsuspendable_fds, NULL);
-
assert
(!ret);
+
LTTNG_ASSERT
(!ret);
}
lttng_inode_registry_destroy(tracker->inode_registry);
}
lttng_inode_registry_destroy(tracker->inode_registry);
@@
-485,6
+491,7
@@
end:
return ret;
}
return ret;
}
+LTTNG_HIDDEN
struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker,
struct lttng_directory_handle *directory,
const char *path,
struct fs_handle *fd_tracker_open_fs_handle(struct fd_tracker *tracker,
struct lttng_directory_handle *directory,
const char *path,
@@
-602,6
+609,7
@@
static int fd_tracker_suspend_handles(
return left_to_close ? -EMFILE : 0;
}
return left_to_close ? -EMFILE : 0;
}
+LTTNG_HIDDEN
int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker,
int *out_fds,
const char **names,
int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker,
int *out_fds,
const char **names,
@@
-634,7
+642,7
@@
int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker,
} else {
/*
* There are not enough active suspendable file
} else {
/*
* There are not enough active suspendable file
- * descriptors to open a new fd and still accom
odate
the
+ * descriptors to open a new fd and still accom
modates
the
* tracker's capacity.
*/
WARN("Cannot open unsuspendable fd, too many unsuspendable file descriptors are opened (%u)",
* tracker's capacity.
*/
WARN("Cannot open unsuspendable fd, too many unsuspendable file descriptors are opened (%u)",
@@
-699,6
+707,7
@@
end_free_entries:
goto end_unlock;
}
goto end_unlock;
}
+LTTNG_HIDDEN
int fd_tracker_close_unsuspendable_fd(struct fd_tracker *tracker,
int *fds_in,
unsigned int fd_count,
int fd_tracker_close_unsuspendable_fd(struct fd_tracker *tracker,
int *fds_in,
unsigned int fd_count,
@@
-831,7
+840,7
@@
static int fs_handle_tracked_get_fd(struct fs_handle *_handle)
*/
pthread_mutex_lock(&handle->tracker->lock);
pthread_mutex_lock(&handle->lock);
*/
pthread_mutex_lock(&handle->tracker->lock);
pthread_mutex_lock(&handle->lock);
-
assert
(!handle->in_use);
+
LTTNG_ASSERT
(!handle->in_use);
handle->tracker->stats.uses++;
if (handle->fd >= 0) {
handle->tracker->stats.uses++;
if (handle->fd >= 0) {
@@
-925,7
+934,7
@@
static int fs_handle_tracked_close(struct fs_handle *_handle)
* isn't much the user can do about it.
*/
if (close(handle->fd)) {
* isn't much the user can do about it.
*/
if (close(handle->fd)) {
- PERROR("Failed to close the file descri
t
ptor (%d) of fs handle to %s, close() returned",
+ PERROR("Failed to close the file descriptor (%d) of fs handle to %s, close() returned",
handle->fd, path ? path : "Unknown");
}
handle->fd = -1;
handle->fd, path ? path : "Unknown");
}
handle->fd = -1;
This page took
0.025393 seconds
and
4
git commands to generate.