[patch] Use uuidgen(2) API on NetBSD

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[patch] Use uuidgen(2) API on NetBSD

Aleksej Saushev-2
 
  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...
Reply | Threaded
Open this post in threaded view
|

Re: [patch] Use uuidgen(2) API on NetBSD

David T. Lewis
 
Aleksej, thank you!

I have also added this information to the UUID bug report:
  http://bugs.squeak.org/view.php?id=7358

Dave

On Thu, Jan 20, 2011 at 04:22:25AM +0300, Aleksej Saushev wrote:

>  
>   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...