[Vm-dev] [patch] Use uuidgen(2) API on NetBSD

Aleksej Saushev asau at inbox.ru
Thu Jan 20 01:22:25 UTC 2011


  Hello!

NetBSD has its own UUID API, which is slightly different, see patch below.

There's also no libuuid, all functions are in libc, but I'm not sure
how to fix it with cmake right away. I'm removing "-luuid" flag with
compiler wrapper (we have this kind of functionality in pkgsrc).


Use uuidgen(2) on NetBSD.

--- unix/plugins/UUIDPlugin/sqUnixUUID.c.orig	2009-08-26 22:12:10.000000000 +0400
+++ unix/plugins/UUIDPlugin/sqUnixUUID.c	2011-01-18 01:02:30.000000000 +0300
@@ -1,4 +1,8 @@
 #include "config.h"
+#if defined(__NetBSD__)
+#include <sys/types.h>
+#include <sys/uuid.h>
+#endif
 #include <uuid.h>
 #include "sq.h"
 
@@ -15,7 +19,11 @@
 int MakeUUID(char *location)
 {
   uuid_t uuid;
+#if defined(__NetBSD__)
+  uuidgen(&uuid, 1);
+#else
   uuid_generate(uuid);
+#endif
   memcpy((void *)location, (void *)&uuid, sizeof(uuid));
   return 1;
 }


-- 
HE CE3OH...


More information about the Vm-dev mailing list