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