Cast uuid_create parameter
[lttng-ust.git] / liblttng-ust / lttng-ust-uuid.h
CommitLineData
7e50e956
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 *
7 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
9 *
10 * Permission is hereby granted to use or copy this program
11 * for any purpose, provided the above notices are retained on all copies.
12 * Permission to modify the code and to distribute modified code is granted,
13 * provided the above notices are retained, and a notice that the code was
14 * modified is included with the above copyright notice.
15 */
16
17#include <config.h>
18#include <lttng/ust-events.h> /* For LTTNG_UST_UUID_LEN */
19/*
20 * Includes final \0.
21 */
22#define LTTNG_UST_UUID_STR_LEN 37
23
2fb16746 24#ifdef LTTNG_UST_HAVE_LIBUUID
7e50e956
MD
25#include <uuid/uuid.h>
26
7e50e956
MD
27static inline
28int lttng_ust_uuid_generate(unsigned char *uuid_out)
29{
30 uuid_generate(uuid_out);
31 return 0;
32}
33
34#elif defined(LTTNG_UST_HAVE_LIBC_UUID)
35#include <uuid.h>
36#include <stdint.h>
37
38static inline
39int lttng_ust_uuid_generate(unsigned char *uuid_out)
40{
41 uint32_t status;
42
09e681db 43 uuid_create((char *) uuid_out, &status);
7e50e956
MD
44 if (status == uuid_s_ok)
45 return 0;
46 else
47 return -1;
48}
49
50#else
51#error "LTTng-UST needs to have a UUID generator configured."
52#endif
53
54#endif /* _LTTNG_UST_UUID_H */
This page took 0.024113 seconds and 4 git commands to generate.