Fix: liblttng-ust-fork Makefile flags mismatch
[lttng-ust.git] / liblttng-ust / lttng-ust-uuid.h
CommitLineData
19d8b1b3
MD
1#ifndef _LTTNG_UST_UUID_H
2#define _LTTNG_UST_UUID_H
3
4/*
5 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 *
d2428e87
MD
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
19d8b1b3 13 *
d2428e87
MD
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
19d8b1b3
MD
24 */
25
26#include <config.h>
27#include <lttng/ust-events.h> /* For LTTNG_UST_UUID_LEN */
28/*
29 * Includes final \0.
30 */
31#define LTTNG_UST_UUID_STR_LEN 37
32
21bc53bb 33#ifdef LTTNG_UST_HAVE_LIBUUID
19d8b1b3
MD
34#include <uuid/uuid.h>
35
19d8b1b3
MD
36static inline
37int lttng_ust_uuid_generate(unsigned char *uuid_out)
38{
39 uuid_generate(uuid_out);
40 return 0;
41}
42
43#elif defined(LTTNG_UST_HAVE_LIBC_UUID)
44#include <uuid.h>
45#include <stdint.h>
46
47static inline
48int lttng_ust_uuid_generate(unsigned char *uuid_out)
49{
50 uint32_t status;
51
8536db0b 52 uuid_create((uuid_t *) uuid_out, &status);
19d8b1b3
MD
53 if (status == uuid_s_ok)
54 return 0;
55 else
56 return -1;
57}
58
59#else
60#error "LTTng-UST needs to have a UUID generator configured."
61#endif
62
63#endif /* _LTTNG_UST_UUID_H */
This page took 0.02561 seconds and 4 git commands to generate.