tests: compile some tools/tests as C++
[lttng-tools.git] / tests / utils / utils.h
CommitLineData
0458ed8c 1/*
9d16b343 2 * Copyright (C) 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
0458ed8c 3 *
9d16b343 4 * SPDX-License-Identifier: LGPL-2.1-only
0458ed8c 5 *
0458ed8c
JG
6 */
7
8#ifndef TEST_UTILS_H
9#define TEST_UTILS_H
10
729c1fec
SM
11#if defined(__cplusplus)
12extern "C" {
13#endif
14
d23253ae
FD
15#if !defined(__GLIBC__) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE))
16
17/*
18 * Version using XSI strerror_r.
19 */
0c818c97
SM
20#define PERROR_NO_LOGGER(msg, args...) \
21 do { \
22 char _perror_buf[200]; \
23 strerror_r(errno, _perror_buf, sizeof(_perror_buf)); \
24 fprintf(stderr, msg ": %s\n", ##args, _perror_buf); \
d23253ae
FD
25 } while (0);
26#else
27/*
28 * Version using GNU strerror_r, for linux with appropriate defines.
29 */
0c818c97
SM
30#define PERROR_NO_LOGGER(msg, args...) \
31 do { \
32 char *_perror_buf; \
33 char _perror_tmp[200]; \
34 _perror_buf = strerror_r( \
35 errno, _perror_tmp, sizeof(_perror_tmp)); \
36 fprintf(stderr, msg ": %s\n", ##args, _perror_buf); \
d23253ae
FD
37 } while (0);
38#endif
39
0458ed8c 40int usleep_safe(useconds_t usec);
b2047add
FD
41int create_file(const char *path);
42int wait_on_file(const char *path);
0458ed8c 43
729c1fec
SM
44#if defined(__cplusplus)
45}
46#endif
47
0458ed8c 48#endif /* TEST_UTILS_H */
This page took 0.035161 seconds and 4 git commands to generate.