OSSP CVS Repository

ossp - Check-in [5988]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 5988
Date: 2008-Feb-21 09:58:44 (local)
2008-Feb-21 08:58:44 (UTC)
User:rse
Branch:
Comment: Port to Win32 API
Tickets:
Inspections:
Files:
ossp-pkg/uuid/ChangeLog      1.152 -> 1.153     4 inserted, 1 deleted
ossp-pkg/uuid/Makefile.in      1.45 -> 1.46     1 inserted, 1 deleted
ossp-pkg/uuid/THANKS      1.13 -> 1.14     2 inserted, 0 deleted
ossp-pkg/uuid/uuid.ac      1.23 -> 1.24     2 inserted, 2 deleted
ossp-pkg/uuid/uuid.c      1.65 -> 1.66     3 inserted, 17 deleted
ossp-pkg/uuid/uuid_prng.c      1.16 -> 1.17     4 inserted, 0 deleted
ossp-pkg/uuid/uuid_time.c      added-> 1.1
ossp-pkg/uuid/uuid_time.h      added-> 1.1

ossp-pkg/uuid/ChangeLog 1.152 -> 1.153

--- ChangeLog    2008/01/10 14:18:46     1.152
+++ ChangeLog    2008/02/21 08:58:44     1.153
@@ -13,6 +13,9 @@
 
   Changes between 1.6.0 and 1.6.1 (19-May-2007 to xx-Jan-2008)
 
+   o Port to Win32 API.
+     [Hiroshi Saito, Wu Yongwei, Ralf S. Engelschall]
+
    o Adjust copyright messages for new year 2008.
      [Ralf S. Engelschall]
    
@@ -23,7 +26,7 @@
      of assigning to bytea->v_len under PostgreSQL >= 8.3
      [Ralf S. Engelschall]
 
-   o Upgrade build environment to GNU libtool 1.5.24
+   o Upgrade build environment to GNU libtool 1.5.26
      [Ralf S. Engelschall]
 
   Changes between 1.5.1 and 1.6.0 (31-Jul-2006 to 19-May-2007)


ossp-pkg/uuid/Makefile.in 1.45 -> 1.46

--- Makefile.in  2008/01/10 14:18:46     1.45
+++ Makefile.in  2008/02/21 08:58:45     1.46
@@ -63,7 +63,7 @@
 PG_CONFIG   = @PG_CONFIG@
 
 LIB_NAME    = libuuid.la
-LIB_OBJS    = uuid.lo uuid_md5.lo uuid_sha1.lo uuid_prng.lo uuid_mac.lo uuid_ui64.lo uuid_ui128.lo uuid_str.lo
+LIB_OBJS    = uuid.lo uuid_md5.lo uuid_sha1.lo uuid_prng.lo uuid_mac.lo uuid_time.lo uuid_ui64.lo uuid_ui128.lo uuid_str.lo
 
 DCE_NAME    = libuuid_dce.la
 DCE_OBJS    = uuid_dce.lo $(LIB_OBJS)


ossp-pkg/uuid/THANKS 1.13 -> 1.14

--- THANKS       2007/01/01 18:39:52     1.13
+++ THANKS       2008/02/21 08:58:45     1.14
@@ -21,7 +21,9 @@
     o  Roman Neuhauser             <neuhauser@sigpipe.cz>
     o  Hrvoje Niksic               <hniksic@xemacs.org>
     o  Piotr Roszatycki            <dexter@debian.org>
+    o  Hiroshi Saito               <z-saito@guitar.ocn.ne.jp>
     o  Michael Schloh              <michael@schloh.com>
     o  Guerry Semones              <guerry@tsunamiresearch.com>
     o  David Wheeler               <david@justatheory.com>
+    o  Wu Yongwei                  <wuyongwei@gmail.com>
 


ossp-pkg/uuid/uuid.ac 1.23 -> 1.24

--- uuid.ac      2008/01/10 14:18:46     1.23
+++ uuid.ac      2008/02/21 08:58:45     1.24
@@ -43,7 +43,7 @@
     AC_CHECK_VA_COPY()
 
     dnl #   check for system headers
-    AC_CHECK_HEADERS(sys/types.h sys/param.h sys/time.h sys/socket.h sys/sockio.h sys/ioctl.h)
+    AC_CHECK_HEADERS(sys/types.h sys/param.h sys/time.h sys/socket.h sys/sockio.h sys/ioctl.h sys/select.h)
     AC_CHECK_HEADERS(netdb.h ifaddrs.h net/if.h net/if_dl.h net/if_arp.h netinet/in.h arpa/inet.h,,,
 [[
 #if HAVE_SYS_TYPES_H
@@ -58,7 +58,7 @@
 ]])
 
     dnl #   check for functions
-    AC_CHECK_FUNCS(getifaddrs nanosleep)
+    AC_CHECK_FUNCS(getifaddrs nanosleep Sleep)
 
     dnl #   check size of built-in types
     AC_CHECK_TYPES([long long, long double])


ossp-pkg/uuid/uuid.c 1.65 -> 1.66

--- uuid.c       2008/01/10 14:18:46     1.65
+++ uuid.c       2008/02/21 08:58:45     1.66
@@ -49,6 +49,7 @@
 #include "uuid_sha1.h"
 #include "uuid_prng.h"
 #include "uuid_mac.h"
+#include "uuid_time.h"
 #include "uuid_ui64.h"
 #include "uuid_ui128.h"
 #include "uuid_str.h"
@@ -873,11 +874,6 @@
 static uuid_rc_t uuid_make_v1(uuid_t *uuid, unsigned int mode, va_list ap)
 {
     struct timeval time_now;
-#ifdef HAVE_NANOSLEEP
-    struct timespec ts;
-#else
-    struct timeval tv;
-#endif
     ui64_t t;
     ui64_t offset;
     ui64_t ov;
@@ -890,7 +886,7 @@
     /* determine current system time and sequence counter */
     for (;;) {
         /* determine current system time */
-        if (gettimeofday(&time_now, NULL) == -1)
+        if (time_gettimeofday(&time_now, NULL) == -1)
             return UUID_RC_SYS;
 
         /* check whether system time changed since last retrieve */
@@ -910,17 +906,7 @@
 
         /* stall the UUID generation until the system clock (which
            has a gettimeofday(2) resolution of 1us) catches up */
-#ifdef HAVE_NANOSLEEP
-        /* sleep for 500ns (1/2us) */
-        ts.tv_sec  = 0;
-        ts.tv_nsec = 500;
-        nanosleep(&ts, NULL);
-#else
-        /* sleep for 1000ns (1us) */
-        tv.tv_sec  = 0;
-        tv.tv_usec = 1;
-        select(0, NULL, NULL, NULL, &tv);
-#endif
+        time_usleep(1);
     }
 
     /* convert from timeval (sec,usec) to OSSP ui64 (100*nsec) format */


ossp-pkg/uuid/uuid_prng.c 1.16 -> 1.17

--- uuid_prng.c  2008/01/10 14:18:47     1.16
+++ uuid_prng.c  2008/02/21 08:58:45     1.17
@@ -50,7 +50,9 @@
 
 prng_rc_t prng_create(prng_t **prng)
 {
+#if !defined(WIN32)
     int fd = -1;
+#endif
     struct timeval tv;
     pid_t pid;
     unsigned int i;
@@ -65,12 +67,14 @@
 
     /* try to open the system PRNG device */
     (*prng)->dev = -1;
+#if !defined(WIN32)
     if ((fd = open("/dev/urandom", O_RDONLY)) == -1)
         fd = open("/dev/random", O_RDONLY|O_NONBLOCK);
     if (fd != -1) {
         (void)fcntl(fd, F_SETFD, FD_CLOEXEC);
         (*prng)->dev = fd;
     }
+#endif
 
     /* initialize MD5 engine */
     if (md5_create(&((*prng)->md5)) != MD5_RC_OK) {


ossp-pkg/uuid/uuid_time.c -> 1.1

*** /dev/null    Tue Apr 30 12:22:11 2024
--- -    Tue Apr 30 12:23:51 2024
***************
*** 0 ****
--- 1,114 ----
+ /*
+ **  OSSP uuid - Universally Unique Identifier
+ **  Copyright (c) 2004-2008 Ralf S. Engelschall <rse@engelschall.com>
+ **  Copyright (c) 2004-2008 The OSSP Project <http://www.ossp.org/>
+ **
+ **  This file is part of OSSP uuid, a library for the generation
+ **  of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  uuid_time.c: Time Management
+ */
+ 
+ /* own headers (part (1/2) */
+ #include "uuid_ac.h"
+ 
+ /* system headers */
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <time.h>
+ #ifdef HAVE_SYS_TIME_H
+ #include <sys/time.h>
+ #endif
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+ #ifdef HAVE_SYS_SELECT_H
+ #include <sys/select.h>
+ #endif
+ 
+ /* own headers (part (1/2) */
+ #include "uuid_time.h"
+ 
+ /* POSIX gettimeofday(2) abstraction */
+ int time_gettimeofday(struct timeval *tv, struct timezone *tz)
+ {
+ #if defined(WIN32)
+     /* Windows emulation */
+     FILETIME ft;
+     LARGE_INTEGER li;
+     __int64 t;
+     static int tzflag;
+ 
+ #if !defined(__GNUC__)
+ #define EPOCHFILETIME 116444736000000000i64
+ #else
+ #define EPOCHFILETIME 116444736000000000LL
+ #endif
+     if (tv != NULL) {
+         GetSystemTimeAsFileTime(&ft);
+         li.LowPart  = ft.dwLowDateTime;
+         li.HighPart = ft.dwHighDateTime;
+         t  = li.QuadPart;
+         t -= EPOCHFILETIME;
+         t /= 10;
+         tv->tv_sec  = (long)(t / 1000000);
+         tv->tv_usec = (long)(t % 1000000);
+     }
+     if (tz != NULL) {
+         if (!tzflag) {
+             _tzset();
+             tzflag++;
+         }
+         tz->tz_minuteswest = _timezone / 60;
+         tz->tz_dsttime = _daylight;
+     }
+     return 0;
+ #else
+     /* POSIX pass-through */
+     return gettimeofday(tv, tz);
+ #endif
+ }
+ 
+ /* BSD usleep(3) abstraction */
+ int time_usleep(long usec)
+ {
+ #if defined(WIN32) && defined(HAVE_SLEEP)
+     /* Win32 newer Sleep(3) variant */
+     Sleep(usec / 1000);
+ #elif defined(WIN32)
+     /* Win32 older _sleep(3) variant */
+     _sleep(usec / 1000);
+ #elif defined(HAVE_NANOSLEEP)
+     /* POSIX newer nanosleep(3) variant */
+     struct timespec ts;
+     ts.tv_sec  = 0;
+     ts.tv_nsec = 1000 * usec;
+     nanosleep(&ts, NULL);
+ #else
+     /* POSIX older select(2) variant */
+     struct timeval tv;
+     tv.tv_sec  = 0;
+     tv.tv_usec = usec;
+     select(0, NULL, NULL, NULL, &tv);
+ #endif
+     return 0;
+ }
+ 


ossp-pkg/uuid/uuid_time.h -> 1.1

*** /dev/null    Tue Apr 30 12:22:11 2024
--- -    Tue Apr 30 12:23:51 2024
***************
*** 0 ****
--- 1,56 ----
+ /*
+ **  OSSP uuid - Universally Unique Identifier
+ **  Copyright (c) 2004-2008 Ralf S. Engelschall <rse@engelschall.com>
+ **  Copyright (c) 2004-2008 The OSSP Project <http://www.ossp.org/>
+ **
+ **  This file is part of OSSP uuid, a library for the generation
+ **  of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  uuid_time.h: Time Management API
+ */
+ 
+ #ifndef __UUID_TIME_H__
+ #define __UUID_TIME_H__
+ 
+ #include "uuid_ac.h"
+ 
+ #if defined(WIN32)
+ #define WIN32_LEAN_AND_MEAN
+ #include <windows.h>
+ #endif
+ #include <time.h>
+ #ifdef HAVE_SYS_TIME_H
+ #include <sys/time.h>
+ #endif
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+ 
+ #if defined(WIN32)
+ struct timeval  { long tv_sec; long tv_usec; };
+ struct timezone { int tz_minuteswest; int tz_dsttime; };
+ #endif
+ 
+ extern int time_gettimeofday(struct timeval *, struct timezone *);
+ extern int time_usleep(long usec);
+ 
+ #endif /* __UUID_TIME_H__ */
+ 

CVSTrac 2.0.1