goto exit_set_signal_handler;
}
- the_page_size = sysconf(_SC_PAGESIZE);
+ the_page_size = sysconf(_SC_PAGE_SIZE);
if (the_page_size < 0) {
- PERROR("sysconf _SC_PAGESIZE");
+ PERROR("sysconf _SC_PAGE_SIZE");
the_page_size = LONG_MAX;
WARN("Fallback page size to %ld", the_page_size);
}
#include "defaults.h"
#include "macros.h"
-#include "align.h"
#include "error.h"
static int pthread_attr_init_done;
static pthread_attr_t tattr;
+static size_t get_page_size(void)
+{
+ const long ret = sysconf(_SC_PAGE_SIZE);
+
+ if (ret < 0) {
+ /*
+ * Fatal error since there is no safe way to recover from this.
+ */
+ PERROR("Failed to get system page size using sysconf(_SC_PAGE_SIZE)");
+ abort();
+ }
+
+ return (size_t) ret;
+}
+
size_t default_get_channel_subbuf_size(void)
{
- return max(_DEFAULT_CHANNEL_SUBBUF_SIZE, PAGE_SIZE);
+ return max(_DEFAULT_CHANNEL_SUBBUF_SIZE, get_page_size());
}
size_t default_get_metadata_subbuf_size(void)
{
- return max(DEFAULT_METADATA_SUBBUF_SIZE, PAGE_SIZE);
+ return max(DEFAULT_METADATA_SUBBUF_SIZE, get_page_size());
}
size_t default_get_kernel_channel_subbuf_size(void)
{
- return max(DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE, PAGE_SIZE);
+ return max(DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE, get_page_size());
}
size_t default_get_ust_pid_channel_subbuf_size(void)
{
- return max(DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE, PAGE_SIZE);
+ return max(DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE, get_page_size());
}
size_t default_get_ust_uid_channel_subbuf_size(void)
{
- return max(DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE, PAGE_SIZE);
+ return max(DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE, get_page_size());
}
pthread_attr_t *default_pthread_attr(void)
.name = TEST_CHANNEL_NAME,
.enabled = 1,
.attr.overwrite = -1,
- .attr.subbuf_size = sysconf(_SC_PAGESIZE) * 8,
+ .attr.subbuf_size = sysconf(_SC_PAGE_SIZE) * 8,
.attr.num_subbuf = 8,
.attr.output = LTTNG_EVENT_MMAP,
};
* time.
*/
rotation_status = lttng_rotation_schedule_size_threshold_set_threshold(
- rotation_schedule, sysconf(_SC_PAGESIZE) * 4096);
+ rotation_schedule, sysconf(_SC_PAGE_SIZE) * 4096);
if (rotation_status != LTTNG_ROTATION_STATUS_OK) {
fail("Failed to set size threshold of session rotation schedule");
ret = -1;