X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;ds=sidebyside;f=liblttng-ust%2Flttng-ust-uuid.h;fp=liblttng-ust%2Flttng-ust-uuid.h;h=1027acbee9f67579839e39c4e3e1ee5f0c6b393e;hb=f194f3b00d042154c35f1f9ec262e25f2cd83b8a;hp=0000000000000000000000000000000000000000;hpb=67107619135ff344f0de2783ec2d48e558deaf9a;p=lttng-ust.git diff --git a/liblttng-ust/lttng-ust-uuid.h b/liblttng-ust/lttng-ust-uuid.h new file mode 100644 index 00000000..1027acbe --- /dev/null +++ b/liblttng-ust/lttng-ust-uuid.h @@ -0,0 +1,54 @@ +#ifndef _LTTNG_UST_UUID_H +#define _LTTNG_UST_UUID_H + +/* + * Copyright (C) 2011 Mathieu Desnoyers + * + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + * + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + */ + +#include +#include /* For LTTNG_UST_UUID_LEN */ +/* + * Includes final \0. + */ +#define LTTNG_UST_UUID_STR_LEN 37 + +#include + +#ifdef LTTNG_UST_HAVE_LIBUUID +static inline +int lttng_ust_uuid_generate(unsigned char *uuid_out) +{ + uuid_generate(uuid_out); + return 0; +} + +#elif defined(LTTNG_UST_HAVE_LIBC_UUID) +#include +#include + +static inline +int lttng_ust_uuid_generate(unsigned char *uuid_out) +{ + uint32_t status; + + uuid_create(uuid_out, &status); + if (status == uuid_s_ok) + return 0; + else + return -1; +} + +#else +#error "LTTng-UST needs to have a UUID generator configured." +#endif + +#endif /* _LTTNG_UST_UUID_H */