apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r106214 - /apr/apr/trunk/CHANGES /apr/apr/trunk/configure.in /apr/apr/trunk/include/apr.h.in /apr/apr/trunk/misc/unix/rand.c
Date Mon, 22 Nov 2004 20:14:26 GMT
Author: pquerna
Date: Mon Nov 22 12:14:25 2004
New Revision: 106214

Modified:
   apr/apr/trunk/CHANGES
   apr/apr/trunk/configure.in
   apr/apr/trunk/include/apr.h.in
   apr/apr/trunk/misc/unix/rand.c
Log:
Use uuid_generate() and uuid_create() for the apr_os_uuid_get() interface
on platforms that support them.

Tested On: Linux 2.6 (libuuid) and FreeBSD 5.2.1 (libc has uuid_create)



Modified: apr/apr/trunk/CHANGES
Url: http://svn.apache.org/viewcvs/apr/apr/trunk/CHANGES?view=diff&rev=106214&p1=apr/apr/trunk/CHANGES&r1=106213&p2=apr/apr/trunk/CHANGES&r2=106214
==============================================================================
--- apr/apr/trunk/CHANGES	(original)
+++ apr/apr/trunk/CHANGES	Mon Nov 22 12:14:25 2004
@@ -5,6 +5,10 @@
      and upgrading it to do SHA-256. Not yet ready for prime time.
      [Ben Laurie]
 
+  *) Added apr_os_uuid_get() support for Linux via libuuid and for modern 
+     BSDs which have uuid_create as part of their libc.
+     [Paul Querna]
+
   *) Added Solaris 10 'Event Ports' as a backend for APR Pollset.  This 
      backend also supports the APR_POLLSET_THREADSAFE flag.
      [Paul Querna]

Modified: apr/apr/trunk/configure.in
Url: http://svn.apache.org/viewcvs/apr/apr/trunk/configure.in?view=diff&rev=106214&p1=apr/apr/trunk/configure.in&r1=106213&p2=apr/apr/trunk/configure.in&r2=106214
==============================================================================
--- apr/apr/trunk/configure.in	(original)
+++ apr/apr/trunk/configure.in	Mon Nov 22 12:14:25 2004
@@ -1790,6 +1790,19 @@
 fi
 
 AC_SUBST(rand)
+
+dnl ----------------------------- Checking for UUID Support 
+echo "${nl}Checking for OS UUID Support..."
+osuuid="0"
+AC_CHECK_FUNCS(uuid_create, [osuuid="1"
+    AC_DEFINE([HAVE_UUID_CREATE], 1, [Define if libc has uuid_create])], [])
+AC_CHECK_LIB(uuid, uuid_generate, 
+    [osuuid="1"
+     APR_ADDTO(LIBS,-luuid)
+     AC_DEFINE([HAVE_LIBUUID], 1, [Define if libuuid is present])], [])
+AC_SUBST(osuuid)
+
+
 dnl ----------------------------- Checking for Time Support 
 echo "${nl}Checking for Time Support..."
 AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,

Modified: apr/apr/trunk/include/apr.h.in
Url: http://svn.apache.org/viewcvs/apr/apr/trunk/include/apr.h.in?view=diff&rev=106214&p1=apr/apr/trunk/include/apr.h.in&r1=106213&p2=apr/apr/trunk/include/apr.h.in&r2=106214
==============================================================================
--- apr/apr/trunk/include/apr.h.in	(original)
+++ apr/apr/trunk/include/apr.h.in	Mon Nov 22 12:14:25 2004
@@ -219,7 +219,7 @@
 #define APR_HAS_USER              1
 #define APR_HAS_LARGE_FILES       @aprlfs@
 #define APR_HAS_XTHREAD_FILES     0
-#define APR_HAS_OS_UUID           0
+#define APR_HAS_OS_UUID           @osuuid@
 
 /* APR sets APR_FILES_AS_SOCKETS to 1 on systems where it is possible
  * to poll on files/pipes.

Modified: apr/apr/trunk/misc/unix/rand.c
Url: http://svn.apache.org/viewcvs/apr/apr/trunk/misc/unix/rand.c?view=diff&rev=106214&p1=apr/apr/trunk/misc/unix/rand.c&r1=106213&p2=apr/apr/trunk/misc/unix/rand.c&r2=106214
==============================================================================
--- apr/apr/trunk/misc/unix/rand.c	(original)
+++ apr/apr/trunk/misc/unix/rand.c	Mon Nov 22 12:14:25 2004
@@ -39,6 +39,37 @@
 #define SHUT_RDWR 2
 #endif
 
+#if HAVE_UUID_CREATE
+
+#include <uuid.h>
+
+APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data)
+{
+    uuid_t g;
+
+    uuid_create(&g, NULL);
+
+    memcpy( (void*)uuid_data, (const void *)&g, sizeof( uuid_t ) );
+
+    return APR_SUCCESS;
+}
+
+#elif HAVE_LIBUUID
+
+#include <uuid/uuid.h>
+
+APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data)
+{
+    uuid_t g;
+
+    uuid_generate(g);
+
+    memcpy((void*)uuid_data, (const void *)g, sizeof( uuid_t ) );
+
+    return APR_SUCCESS;
+}
+#endif 
+
 #if APR_HAS_RANDOM
 
 APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, 

Mime
View raw message