summaryrefslogtreecommitdiff
path: root/src/os_windows
diff options
context:
space:
mode:
Diffstat (limited to 'src/os_windows')
-rw-r--r--src/os_windows/ce_ctime.c6
-rw-r--r--src/os_windows/ce_freopen.c52
-rw-r--r--src/os_windows/ce_gmtime.c58
-rw-r--r--src/os_windows/ce_localtime.c44
-rw-r--r--src/os_windows/ce_mktime.c257
-rw-r--r--src/os_windows/ce_remove.c26
-rw-r--r--src/os_windows/ce_util_sig.c35
-rw-r--r--src/os_windows/os_abs.c2
-rw-r--r--src/os_windows/os_clock.c4
-rw-r--r--src/os_windows/os_config.c2
-rw-r--r--src/os_windows/os_cpu.c2
-rw-r--r--src/os_windows/os_dir.c2
-rw-r--r--src/os_windows/os_errno.c2
-rw-r--r--src/os_windows/os_fid.c8
-rw-r--r--src/os_windows/os_flock.c2
-rw-r--r--src/os_windows/os_fsync.c2
-rw-r--r--src/os_windows/os_getenv.c2
-rw-r--r--src/os_windows/os_handle.c2
-rw-r--r--src/os_windows/os_map.c22
-rw-r--r--src/os_windows/os_mkdir.c2
-rw-r--r--src/os_windows/os_open.c2
-rw-r--r--src/os_windows/os_rename.c2
-rw-r--r--src/os_windows/os_rmdir.c42
-rw-r--r--src/os_windows/os_rw.c2
-rw-r--r--src/os_windows/os_seek.c2
-rw-r--r--src/os_windows/os_stat.c2
-rw-r--r--src/os_windows/os_truncate.c9
-rw-r--r--src/os_windows/os_unlink.c2
-rw-r--r--src/os_windows/os_yield.c2
29 files changed, 562 insertions, 35 deletions
diff --git a/src/os_windows/ce_ctime.c b/src/os_windows/ce_ctime.c
index e8ae76aa..d4e6a4fc 100644
--- a/src/os_windows/ce_ctime.c
+++ b/src/os_windows/ce_ctime.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -25,8 +25,8 @@ __os_ctime(tod, time_buf)
__int64 i64_tod;
struct _FILETIME file_tod, file_loc;
struct _SYSTEMTIME sys_loc;
-static const __int64 SECS_BETWEEN_EPOCHS = 11644473600;
-static const __int64 SECS_TO_100NS = 10000000; /* 10^7 */
+ static const __int64 SECS_BETWEEN_EPOCHS = 11644473600;
+ static const __int64 SECS_TO_100NS = 10000000; /* 10^7 */
strcpy(time_buf, "Thu Jan 01 00:00:00 1970");
time_buf[CTIME_BUFLEN - 1] = '\0';
diff --git a/src/os_windows/ce_freopen.c b/src/os_windows/ce_freopen.c
new file mode 100644
index 00000000..331450d0
--- /dev/null
+++ b/src/os_windows/ce_freopen.c
@@ -0,0 +1,52 @@
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 2001, 2015 Oracle and/or its affiliates. All rights reserved.
+ *
+ * $Id$
+ */
+
+#include "db_config.h"
+
+#include "db_int.h"
+
+/*
+ * __ce_freopen --
+ * Reopen a stream on WinCE.
+ *
+ * PUBLIC: #ifdef DB_WINCE
+ * PUBLIC: FILE * __ce_freopen
+ * PUBLIC: __P((const char *, const char *, FILE *));
+ * PUBLIC: #endif
+ */
+FILE *
+__ce_freopen(path, mode, stream)
+ const char *path, *mode;
+ FILE *stream;
+{
+ size_t lenm, lenp;
+ wchar_t *wpath, *wmode;
+ FILE *handle;
+
+ wpath = NULL;
+ wmode = NULL;
+ handle = NULL;
+ lenp = strlen(path) + 1;
+ lenm = strlen(mode) + 1;
+
+ if (__os_malloc(NULL, lenp * sizeof(wchar_t), &wpath) != 0 ||
+ __os_malloc(NULL, lenm * sizeof(wchar_t), &wmode) != 0)
+ goto err;
+
+ if (mbstowcs(wpath, path, lenp) != lenp ||
+ mbstowcs(wmode, mode, lenm) != lenm)
+ goto err;
+
+ handle = _wfreopen(wpath, wmode, stream);
+err:
+ if (wpath != NULL)
+ __os_free(NULL, wpath);
+ if (wmode != NULL)
+ __os_free(NULL, wmode);
+ return handle;
+}
diff --git a/src/os_windows/ce_gmtime.c b/src/os_windows/ce_gmtime.c
new file mode 100644
index 00000000..55605c89
--- /dev/null
+++ b/src/os_windows/ce_gmtime.c
@@ -0,0 +1,58 @@
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
+ *
+ * $Id$
+ */
+
+#include "db_config.h"
+
+#include "db_int.h"
+
+/*
+ * __ce_gmtime --
+ * gmtime implementation on WinCE.
+ *
+ * PUBLIC: #ifdef DB_WINCE
+ * PUBLIC: struct tm * __ce_gmtime __P((const time_t *));
+ * PUBLIC: #endif
+ */
+
+struct tm *
+__ce_gmtime(timer)
+ const time_t *timer;
+{
+ static struct tm br_time;
+ struct tm *timep;
+ time_t ti;
+ unsigned long dayclock, dayno;
+ int year;
+
+ timep = &br_time;
+ ti = *timer;
+ dayclock = (unsigned long)ti % SECSPERDAY;
+ dayno = (unsigned long)ti / SECSPERDAY;
+ year = TM_YEAR_EPOCH;
+
+ timep->tm_sec = dayclock % 60;
+ timep->tm_min = (dayclock % 3600) / 60;
+ timep->tm_hour = dayclock / 3600;
+ /* day 0 was a thursday */
+ timep->tm_wday = (dayno + 4) % 7;
+ while (dayno >= year_lengths[isleap(year)]) {
+ dayno -= year_lengths[isleap(year)];
+ year++;
+ }
+ timep->tm_year = year - TM_YEAR_BASE;
+ timep->tm_yday = dayno;
+ timep->tm_mon = 0;
+ while (dayno >= mon_lengths[isleap(year)][timep->tm_mon]) {
+ dayno -= mon_lengths[isleap(year)][timep->tm_mon];
+ timep->tm_mon++;
+ }
+ timep->tm_mday = dayno + 1;
+ timep->tm_isdst = 0;
+
+ return timep;
+}
diff --git a/src/os_windows/ce_localtime.c b/src/os_windows/ce_localtime.c
new file mode 100644
index 00000000..23c53bed
--- /dev/null
+++ b/src/os_windows/ce_localtime.c
@@ -0,0 +1,44 @@
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
+ *
+ * $Id$
+ */
+
+#include "db_config.h"
+
+#include "db_int.h"
+
+/*
+ * __ce_localtime --
+ * localtime implementation on WinCE.
+ *
+ * PUBLIC: #ifdef DB_WINCE
+ * PUBLIC: struct tm * localtime __P((const time_t *));
+ * PUBLIC: #endif
+ */
+struct tm *
+localtime(t)
+ const time_t *t;
+{
+ static struct tm y;
+ FILETIME uTm, lTm;
+ SYSTEMTIME pTm;
+ int64_t t64;
+
+ t64 = *t;
+ t64 = (t64 + 11644473600)*10000000;
+ uTm.dwLowDateTime = (DWORD)(t64 & 0xFFFFFFFF);
+ uTm.dwHighDateTime= (DWORD)(t64 >> 32);
+ FileTimeToLocalFileTime(&uTm,&lTm);
+ FileTimeToSystemTime(&lTm,&pTm);
+ y.tm_year = pTm.wYear - 1900;
+ y.tm_mon = pTm.wMonth - 1;
+ y.tm_wday = pTm.wDayOfWeek;
+ y.tm_mday = pTm.wDay;
+ y.tm_hour = pTm.wHour;
+ y.tm_min = pTm.wMinute;
+ y.tm_sec = pTm.wSecond;
+ return &y;
+}
diff --git a/src/os_windows/ce_mktime.c b/src/os_windows/ce_mktime.c
new file mode 100644
index 00000000..0d3a0906
--- /dev/null
+++ b/src/os_windows/ce_mktime.c
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 1987, 1989 Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Arthur David Olson of the National Cancer Institute.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS 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 REGENTS OR 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. */
+
+/*static char *sccsid = "from: @(#)ctime.c 5.26 (Berkeley) 2/23/91";*/
+
+/*
+ * This implementation of mktime is lifted straight from the NetBSD (BSD 4.4)
+ * version. I modified it slightly to divorce it from the internals of the
+ * ctime library. Thus this version can't use details of the internal
+ * timezone state file to figure out strange unnormalized struct tm values,
+ * as might result from someone doing date math on the tm struct then passing
+ * it to mktime.
+ *
+ * It just does as well as it can at normalizing the tm input, then does a
+ * binary search of the time space using the system's localtime() function.
+ *
+ * The original binary search was defective in that it didn't consider the
+ * setting of tm_isdst when comparing tm values, causing the search to be
+ * flubbed for times near the dst/standard time changeover. The original
+ * code seems to make up for this by grubbing through the timezone info
+ * whenever the binary search barfed. Since I don't have that luxury in
+ * portable code, I have to take care of tm_isdst in the comparison routine.
+ * This requires knowing how many minutes offset dst is from standard time.
+ *
+ * So, if you live somewhere in the world where dst is not 60 minutes offset,
+ * and your vendor doesn't supply mktime(), you'll have to edit this variable
+ * by hand. Sorry about that.
+ */
+
+#include "db_config.h"
+
+#include "db_int.h"
+
+#undef DSTMINUTES
+#define DSTMINUTES 60
+
+#undef FALSE
+#undef TRUE
+#define FALSE 0
+#define TRUE 1
+
+/*
+** Adapted from code provided by Robert Elz, who writes:
+** The "best" way to do mktime I think is based on an idea of Bob
+** Kridle's (so its said...) from a long time ago. (mtxinu!kridle now).
+** It does a binary search of the time_t space. Since time_t's are
+** just 32 bits, its a max of 32 iterations (even at 64 bits it
+** would still be very reasonable).
+*/
+
+#undef WRONG
+#define WRONG (-1)
+
+const unsigned int mon_lengths[2][MONSPERYEAR] = {
+ { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
+ { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
+};
+const unsigned int year_lengths[2] = {
+ DAYSPERNYEAR, DAYSPERLYEAR
+};
+
+static void
+normalize(tensptr, unitsptr, base)
+ int base, *tensptr, *unitsptr;
+{
+ if (*unitsptr >= base) {
+ *tensptr += *unitsptr / base;
+ *unitsptr %= base;
+ } else if (*unitsptr < 0) {
+ --*tensptr;
+ *unitsptr += base;
+ if (*unitsptr < 0) {
+ *tensptr -= 1 + (-*unitsptr) / base;
+ *unitsptr = base - (-*unitsptr) % base;
+ }
+ }
+}
+
+static struct tm *
+mkdst(tmp)
+ struct tm * tmp;
+{
+ /* jds */
+ static struct tm tmbuf;
+
+ tmbuf = *tmp;
+ tmbuf.tm_isdst = 1;
+ tmbuf.tm_min += DSTMINUTES;
+ normalize(&tmbuf.tm_hour, &tmbuf.tm_min, MINSPERHOUR);
+ return &tmbuf;
+}
+
+static int
+tmcomp(atmp, btmp)
+ register struct tm *atmp, *btmp;
+{
+ register int result;
+
+ /* compare down to the same day */
+ if ((result = (atmp->tm_year - btmp->tm_year)) == 0 &&
+ (result = (atmp->tm_mon - btmp->tm_mon)) == 0)
+ result = (atmp->tm_mday - btmp->tm_mday);
+
+ if (result != 0)
+ return result;
+
+ /* get rid of one-sided dst bias */
+ if (atmp->tm_isdst == 1 && !btmp->tm_isdst)
+ btmp = mkdst(btmp);
+ else if (btmp->tm_isdst == 1 && !atmp->tm_isdst)
+ atmp = mkdst(atmp);
+
+ /* compare the rest of the way */
+ if ((result = (atmp->tm_hour - btmp->tm_hour)) == 0 &&
+ (result = (atmp->tm_min - btmp->tm_min)) == 0)
+ result = atmp->tm_sec - btmp->tm_sec;
+
+ return result;
+}
+
+static time_t
+time2(tmp, okayp, usezn)
+ struct tm *tmp;
+ int *okayp, usezn;
+{
+ register int bits, dir, i, saved_seconds;
+ time_t t;
+ struct tm yourtm, mytm;
+
+ *okayp = FALSE;
+ yourtm = *tmp;
+ if (yourtm.tm_sec >= SECSPERMIN + 2 || yourtm.tm_sec < 0)
+ normalize(&yourtm.tm_min, &yourtm.tm_sec, SECSPERMIN);
+ normalize(&yourtm.tm_hour, &yourtm.tm_min, MINSPERHOUR);
+ normalize(&yourtm.tm_mday, &yourtm.tm_hour, HOURSPERDAY);
+ normalize(&yourtm.tm_year, &yourtm.tm_mon, MONSPERYEAR);
+ while (yourtm.tm_mday <= 0) {
+ --yourtm.tm_year;
+ yourtm.tm_mday +=
+ year_lengths[isleap(yourtm.tm_year + TM_YEAR_BASE)];
+ }
+ for ( ; ; ) {
+ i = mon_lengths[isleap(yourtm.tm_year +
+ TM_YEAR_BASE)][yourtm.tm_mon];
+ if (yourtm.tm_mday <= i)
+ break;
+ yourtm.tm_mday -= i;
+ if (++yourtm.tm_mon >= MONSPERYEAR) {
+ yourtm.tm_mon = 0;
+ ++yourtm.tm_year;
+ }
+ }
+ saved_seconds = yourtm.tm_sec;
+ yourtm.tm_sec = 0;
+ /*
+ ** Calculate the number of magnitude bits in a time_t
+ ** (this works regardless of whether time_t is
+ ** signed or unsigned, though lint complains if unsigned).
+ */
+ for (bits = 0, t = 1; t > 0; ++bits, t <<= 1)
+ ;
+ /*
+ ** If time_t is signed, then 0 is the median value,
+ ** if time_t is unsigned, then 1 << bits is median.
+ */
+ t = (t < 0) ? 0 : ((time_t) 1 << bits);
+ for ( ; ; ) {
+ if (usezn)
+ mytm = *localtime(&t);
+ else
+ mytm = *gmtime(&t);
+ dir = tmcomp(&mytm, &yourtm);
+ if (dir != 0) {
+ if (bits-- < 0)
+ return WRONG;
+ if (bits < 0)
+ --t;
+ else if (dir > 0)
+ t -= (time_t) 1 << bits;
+ else t += (time_t) 1 << bits;
+ continue;
+ }
+ if (yourtm.tm_isdst < 0 || mytm.tm_isdst == yourtm.tm_isdst)
+ break;
+
+ return WRONG;
+ }
+ t += saved_seconds;
+ if (usezn)
+ *tmp = *localtime(&t);
+ else
+ *tmp = *gmtime(&t);
+ *okayp = TRUE;
+ return t;
+}
+
+static time_t
+time1(tmp)
+ struct tm * tmp;
+{
+ register time_t t;
+ int okay;
+
+ if (tmp->tm_isdst > 1)
+ tmp->tm_isdst = 1;
+ t = time2(tmp, &okay, 1);
+ if (okay || tmp->tm_isdst < 0)
+ return t;
+
+ return WRONG;
+}
+
+/*
+ * mktime --
+ *
+ * PUBLIC: #ifdef DB_WINCE
+ * PUBLIC: time_t __ce_mktime __P((struct tm *));
+ * PUBLIC: #endif
+ */
+time_t
+__ce_mktime(tmp)
+ struct tm * tmp;
+{
+ return time1(tmp);
+}
diff --git a/src/os_windows/ce_remove.c b/src/os_windows/ce_remove.c
new file mode 100644
index 00000000..f955f3b4
--- /dev/null
+++ b/src/os_windows/ce_remove.c
@@ -0,0 +1,26 @@
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
+ *
+ * $Id$
+ */
+
+#include "db_config.h"
+
+#include "db_int.h"
+
+/*
+ * remove implementation on WinCE.
+ *
+ * PUBLIC: #ifdef DB_WINCE
+ * PUBLIC: int __ce_remove __P((const char *path));
+ * PUBLIC: #endif
+ */
+
+int
+__ce_remove(path)
+ const char *path;
+{
+ return __os_unlink(NULL, path, 0);
+}
diff --git a/src/os_windows/ce_util_sig.c b/src/os_windows/ce_util_sig.c
new file mode 100644
index 00000000..11fb4ad7
--- /dev/null
+++ b/src/os_windows/ce_util_sig.c
@@ -0,0 +1,35 @@
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
+ *
+ * $Id$
+ */
+
+#include "db_config.h"
+
+#include "db_int.h"
+
+/*
+ * The stub functions for signal handling.
+ * WinCE does not support signal handling, so we just define stub functions to
+ * avoid linkage errors for utilities build.
+ */
+
+void
+__db_util_siginit()
+{
+ return;
+}
+
+int
+__db_util_interrupted()
+{
+ return (0);
+}
+
+void
+__db_util_sigresend()
+{
+ return;
+}
diff --git a/src/os_windows/os_abs.c b/src/os_windows/os_abs.c
index e769ab2c..f9be934e 100644
--- a/src/os_windows/os_abs.c
+++ b/src/os_windows/os_abs.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_clock.c b/src/os_windows/os_clock.c
index e548729b..80a96785 100644
--- a/src/os_windows/os_clock.c
+++ b/src/os_windows/os_clock.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -16,7 +16,7 @@
*/
void
__os_gettime(env, tp, monotonic)
- ENV *env;
+ const ENV *env;
db_timespec *tp;
int monotonic;
{
diff --git a/src/os_windows/os_config.c b/src/os_windows/os_config.c
index 4250dbd4..c4b61700 100644
--- a/src/os_windows/os_config.c
+++ b/src/os_windows/os_config.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1999, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_cpu.c b/src/os_windows/os_cpu.c
index 0922071f..41004753 100644
--- a/src/os_windows/os_cpu.c
+++ b/src/os_windows/os_cpu.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_dir.c b/src/os_windows/os_dir.c
index 31d364d7..4065d182 100644
--- a/src/os_windows/os_dir.c
+++ b/src/os_windows/os_dir.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_errno.c b/src/os_windows/os_errno.c
index ba8ec359..a8c35480 100644
--- a/src/os_windows/os_errno.c
+++ b/src/os_windows/os_errno.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1999, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_fid.c b/src/os_windows/os_fid.c
index f2d190b1..bfd4182c 100644
--- a/src/os_windows/os_fid.c
+++ b/src/os_windows/os_fid.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -118,12 +118,12 @@ __os_fileid(env, fname, unique_okay, fidp)
DB_GLOBAL(fid_serial) = (u_int32_t)pid;
} else
DB_GLOBAL(fid_serial) += 100000;
-
+ tmp = (u_int32_t)DB_GLOBAL(fid_serial);
} else {
tmp = (u_int32_t)fi.dwVolumeSerialNumber;
- for (p = (u_int8_t *)&tmp, i = sizeof(u_int32_t); i > 0; --i)
- *fidp++ = *p++;
}
+ for (p = (u_int8_t *)&tmp, i = sizeof(u_int32_t); i > 0; --i)
+ *fidp++ = *p++;
return (0);
}
diff --git a/src/os_windows/os_flock.c b/src/os_windows/os_flock.c
index cb3e4986..9dcd1e81 100644
--- a/src/os_windows/os_flock.c
+++ b/src/os_windows/os_flock.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_fsync.c b/src/os_windows/os_fsync.c
index 8824aac1..5194c00b 100644
--- a/src/os_windows/os_fsync.c
+++ b/src/os_windows/os_fsync.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_getenv.c b/src/os_windows/os_getenv.c
index aad59d01..0ac1db0a 100644
--- a/src/os_windows/os_getenv.c
+++ b/src/os_windows/os_getenv.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_handle.c b/src/os_windows/os_handle.c
index e6edc3ef..65809017 100644
--- a/src/os_windows/os_handle.c
+++ b/src/os_windows/os_handle.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1998, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_map.c b/src/os_windows/os_map.c
index 8f646d68..eefa3e8b 100644
--- a/src/os_windows/os_map.c
+++ b/src/os_windows/os_map.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -105,9 +105,12 @@ __os_detach(env, infop, destroy)
int destroy;
{
DB_ENV *dbenv;
+ REGION *rp;
int ret, t_ret;
dbenv = env->dbenv;
+ rp = infop->rp;
+ ret = 0;
if (infop->wnt_handle != NULL) {
(void)CloseHandle(infop->wnt_handle);
@@ -120,10 +123,19 @@ __os_detach(env, infop, destroy)
return (ret);
}
- ret = !UnmapViewOfFile(infop->addr) ? __os_get_syserr() : 0;
- if (ret != 0) {
- __db_syserr(env, ret, DB_STR("0007", "UnmapViewOfFile"));
- ret = __os_posix_err(ret);
+ if (F_ISSET(env, ENV_FORCESYNCENV))
+ if (!FlushViewOfFile(infop->addr, rp->max)) {
+ ret = __os_get_syserr();
+ __db_syserr(env, ret, DB_STR("0249",
+ "FlushViewOfFile failed on closing environment"));
+ ret = __os_posix_err(ret);
+ }
+
+ t_ret = !UnmapViewOfFile(infop->addr) ? __os_get_syserr() : 0;
+ if (t_ret != 0) {
+ __db_syserr(env, t_ret, DB_STR("0007", "UnmapViewOfFile"));
+ if (ret == 0)
+ ret = __os_posix_err(t_ret);
}
if (!F_ISSET(env, ENV_SYSTEM_MEM) && destroy &&
diff --git a/src/os_windows/os_mkdir.c b/src/os_windows/os_mkdir.c
index b87f3f9d..7ad7eed2 100644
--- a/src/os_windows/os_mkdir.c
+++ b/src/os_windows/os_mkdir.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_open.c b/src/os_windows/os_open.c
index 44f2faf3..bc715a96 100644
--- a/src/os_windows/os_open.c
+++ b/src/os_windows/os_open.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_rename.c b/src/os_windows/os_rename.c
index 791f53a5..d70f20ca 100644
--- a/src/os_windows/os_rename.c
+++ b/src/os_windows/os_rename.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_rmdir.c b/src/os_windows/os_rmdir.c
new file mode 100644
index 00000000..18090f09
--- /dev/null
+++ b/src/os_windows/os_rmdir.c
@@ -0,0 +1,42 @@
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
+ *
+ * $Id$
+ */
+
+#include "db_config.h"
+
+#include "db_int.h"
+
+/*
+ * __os_rmdir --
+ * Remove a directory.
+ */
+int
+__os_rmdir(env, name)
+ ENV *env;
+ const char *name;
+{
+ DB_ENV *dbenv;
+ _TCHAR *tname;
+ int ret;
+
+ dbenv = env == NULL ? NULL : env->dbenv;
+
+ if (dbenv != NULL &&
+ FLD_ISSET(dbenv->verbose, DB_VERB_FILEOPS | DB_VERB_FILEOPS_ALL))
+ __db_msg(env, DB_STR_A("0240", "fileops: rmdir %s",
+ "%s"), name);
+
+ TO_TSTRING(env, name, tname, ret);
+ if (ret != 0)
+ return (ret);
+ RETRY_CHK(!RemoveDirectory(tname), ret);
+ FREE_STRING(env, tname);
+ if (ret != 0)
+ return (__os_posix_err(ret));
+
+ return (ret);
+}
diff --git a/src/os_windows/os_rw.c b/src/os_windows/os_rw.c
index e64a7d08..20644e6e 100644
--- a/src/os_windows/os_rw.c
+++ b/src/os_windows/os_rw.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_seek.c b/src/os_windows/os_seek.c
index 7632c15d..613e4a7c 100644
--- a/src/os_windows/os_seek.c
+++ b/src/os_windows/os_seek.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_stat.c b/src/os_windows/os_stat.c
index 11248886..5c3a0fcc 100644
--- a/src/os_windows/os_stat.c
+++ b/src/os_windows/os_stat.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_truncate.c b/src/os_windows/os_truncate.c
index fcbb37b2..d1150c85 100644
--- a/src/os_windows/os_truncate.c
+++ b/src/os_windows/os_truncate.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 2004, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
@@ -15,11 +15,12 @@
* Truncate the file.
*/
int
-__os_truncate(env, fhp, pgno, pgsize)
+__os_truncate(env, fhp, pgno, pgsize, relative)
ENV *env;
DB_FH *fhp;
db_pgno_t pgno;
u_int32_t pgsize;
+ off_t relative;
{
/* Yes, this really is how Microsoft have designed their API */
union {
@@ -34,7 +35,7 @@ __os_truncate(env, fhp, pgno, pgsize)
int ret;
dbenv = env == NULL ? NULL : env->dbenv;
- offset = (off_t)pgsize * pgno;
+ offset = (off_t)pgsize * pgno + relative;
ret = 0;
if (dbenv != NULL &&
@@ -84,7 +85,7 @@ __os_truncate(env, fhp, pgno, pgsize)
* We can't switch to SetFilePointerEx, which knows about 64-bit
* offsets, because it isn't supported on Win9x/ME.
*/
- RETRY_CHK((off.bigint = (__int64)pgsize * pgno,
+ RETRY_CHK((off.bigint = (__int64)pgsize * pgno + relative,
(SetFilePointer(fhp->trunc_handle, off.low, &off.high, FILE_BEGIN)
== INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) ||
!SetEndOfFile(fhp->trunc_handle)), ret);
diff --git a/src/os_windows/os_unlink.c b/src/os_windows/os_unlink.c
index 6a0a6572..5c63a5e6 100644
--- a/src/os_windows/os_unlink.c
+++ b/src/os_windows/os_unlink.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/
diff --git a/src/os_windows/os_yield.c b/src/os_windows/os_yield.c
index 0d32ef69..bf326ee2 100644
--- a/src/os_windows/os_yield.c
+++ b/src/os_windows/os_yield.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015 Oracle and/or its affiliates. All rights reserved.
*
* $Id$
*/