Move compat macros in 'lttng/align.h' to a private header
[lttng-ust.git] / include / ust-compat.h
CommitLineData
cd61d9bf
MJ
1/*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2010-2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 */
6
7#ifndef _LTTNG_UST_COMPAT_H
8#define _LTTNG_UST_COMPAT_H
9
10#include <unistd.h>
11#include <limits.h>
12
13#ifdef __FreeBSD__
14#include <machine/param.h>
15#endif
16
17#ifdef _SC_PAGE_SIZE
18#define LTTNG_UST_PAGE_SIZE sysconf(_SC_PAGE_SIZE)
19#elif defined(PAGE_SIZE)
20#define LTTNG_UST_PAGE_SIZE PAGE_SIZE
21#else
22#error "Please add page size detection for your OS."
23#endif
24
25#define LTTNG_UST_PAGE_MASK (~(LTTNG_UST_PAGE_SIZE - 1))
26
27#define __LTTNG_UST_ALIGN_MASK(v, mask) (((v) + (mask)) & ~(mask))
28#define LTTNG_UST_ALIGN(v, align) __LTTNG_UST_ALIGN_MASK(v, (__typeof__(v)) (align) - 1)
29#define LTTNG_UST_PAGE_ALIGN(addr) LTTNG_UST_ALIGN(addr, LTTNG_UST_PAGE_SIZE)
30
31#endif
This page took 0.023091 seconds and 4 git commands to generate.