Enable os.fsync() for Windows, mapping it to MS's _commit() there.  The
docs here are best-guess:  the MS docs I could find weren't clear, and
some even claimed _commit() has no effect on Win32 systems (which is
easily shown to be false just by trying it).
diff --git a/Doc/lib/libos.tex b/Doc/lib/libos.tex
index 07762c6..8437614 100644
--- a/Doc/lib/libos.tex
+++ b/Doc/lib/libos.tex
@@ -449,7 +449,13 @@
 
 \begin{funcdesc}{fsync}{fd}
 Force write of file with filedescriptor \var{fd} to disk.
-Availability: \UNIX.
+
+On Windows this calls the MS \cfunction{_commit()} function.  If you're
+starting with a Python file object \var{f}, first do
+\code{\var{f}.flush()}, and then do \code{os.fsync(\var{f}.fileno()},
+to ensure that all internal buffers associated with \var{f} are written
+to disk.
+Availability: \UNIX, and Windows starting in 2.3.
 \end{funcdesc}
 
 \begin{funcdesc}{ftruncate}{fd, length}
@@ -921,7 +927,7 @@
 \member{st_atime},
 \member{st_mtime},
 \member{st_ctime}.
-More items may be added at the end by some implementations. 
+More items may be added at the end by some implementations.
 The standard module \refmodule{stat}\refstmodindex{stat} defines
 functions and constants that are useful for extracting information
 from a \ctype{stat} structure.
diff --git a/Misc/NEWS b/Misc/NEWS
index 330831d..496ad0b 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -232,6 +232,9 @@
 Windows
 -------
 
+- os.fsync() now exists on Windows, and calls the Microsoft _commit()
+  function.
+
 - New function winsound.MessageBeep() wraps the Win32 API
   MessageBeep().
 
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 86162c2..035bb36 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -112,6 +112,8 @@
 #define HAVE_POPEN      1
 #define HAVE_SYSTEM	1
 #define HAVE_CWAIT	1
+#define HAVE_FSYNC	1
+#define fsync _commit
 #else
 #if defined(PYOS_OS2) && defined(PYCC_GCC) || defined(__VMS)
 /* Everything needed is defined in PC/os2emx/pyconfig.h or vms/pyconfig.h */
@@ -301,7 +303,7 @@
 #	define STRUCT_STAT struct stat
 #endif
 
-#if defined(MAJOR_IN_MKDEV) 
+#if defined(MAJOR_IN_MKDEV)
 #include <sys/mkdev.h>
 #else
 #if defined(MAJOR_IN_SYSMACROS)
@@ -325,7 +327,7 @@
 
 #if defined(__VMS)
 /* add some values to provide a similar environment like POSIX */
-static 
+static
 void
 vms_add_posix_env(PyObject *d)
 {
@@ -516,8 +518,8 @@
 	return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(obj),
 	                             PyUnicode_GET_SIZE(obj));
 	}
-	return PyUnicode_FromEncodedObject(obj, 
-	                                   Py_FileSystemDefaultEncoding, 
+	return PyUnicode_FromEncodedObject(obj,
+	                                   Py_FileSystemDefaultEncoding,
 	                                   "strict");
 }
 
@@ -621,19 +623,19 @@
 }
 
 #ifdef Py_WIN_WIDE_FILENAMES
-static int 
+static int
 unicode_file_names(void)
 {
 	static int canusewide = -1;
 	if (canusewide == -1) {
-		/* As per doc for ::GetVersion(), this is the correct test for 
+		/* As per doc for ::GetVersion(), this is the correct test for
 		   the Windows NT family. */
 		canusewide = (GetVersion() < 0x80000000) ? 1 : 0;
 	}
 	return canusewide;
 }
 #endif
-  
+
 static PyObject *
 posix_1str(PyObject *args, char *format, int (*func)(const char*),
 	   char *wformat, int (*wfunc)(const Py_UNICODE*))
@@ -678,7 +680,7 @@
 }
 
 static PyObject *
-posix_2str(PyObject *args, 
+posix_2str(PyObject *args,
 	   char *format,
 	   int (*func)(const char *, const char *),
 	   char *wformat,
@@ -971,7 +973,7 @@
 }
 
 static PyObject *
-posix_do_stat(PyObject *self, PyObject *args, 
+posix_do_stat(PyObject *self, PyObject *args,
 	      char *format,
 #ifdef __VMS
 	      int (*statfunc)(const char *, STRUCT_STAT *, ...),
@@ -1181,7 +1183,7 @@
 #elif defined(PYOS_OS2) && defined(PYCC_GCC)
 	return posix_1str(args, "et:chdir", _chdir2, NULL, NULL);
 #elif defined(__VMS)
-	return posix_1str(args, "et:chdir", (int (*)(const char *))chdir, 
+	return posix_1str(args, "et:chdir", (int (*)(const char *))chdir,
 			  NULL, NULL);
 #else
 	return posix_1str(args, "et:chdir", chdir, NULL, NULL);
@@ -1314,7 +1316,7 @@
 	Py_BEGIN_ALLOW_THREADS
 	res = lchown(path, (uid_t) uid, (gid_t) gid);
 	Py_END_ALLOW_THREADS
-	if (res < 0) 
+	if (res < 0)
 		return posix_error_with_allocated_filename(path);
 	PyMem_Free(path);
 	Py_INCREF(Py_None);
@@ -1646,7 +1648,7 @@
 			PyObject *w;
 
 			w = PyUnicode_FromEncodedObject(v,
-					Py_FileSystemDefaultEncoding, 
+					Py_FileSystemDefaultEncoding,
 					"strict");
 			if (w != NULL) {
 				Py_DECREF(v);
@@ -1692,7 +1694,7 @@
 		if (PyArg_ParseTuple(args, "U|:_getfullpathname", &po)) {
 			Py_UNICODE woutbuf[MAX_PATH*2];
 			Py_UNICODE *wtemp;
-			if (!GetFullPathNameW(PyUnicode_AS_UNICODE(po), 
+			if (!GetFullPathNameW(PyUnicode_AS_UNICODE(po),
 						sizeof(woutbuf)/sizeof(woutbuf[0]),
 						 woutbuf, &wtemp))
 				return win32_error("GetFullPathName", "");
@@ -3185,7 +3187,7 @@
 /*
  * Variation on os2emx.popen2
  *
- * The result of this function is 2 pipes - the processes stdin, 
+ * The result of this function is 2 pipes - the processes stdin,
  * and stdout+stderr combined as a single pipe.
  */
 
@@ -3519,7 +3521,7 @@
 				}
 			}
 		}
-		     
+
 		/*
 		 * Clean up our localized references for the dictionary keys
 		 * and value since PyDict_SetItem will Py_INCREF any copies
@@ -3936,7 +3938,7 @@
 				s3,
 				cmdstring);
 			/* Not passing CREATE_NEW_CONSOLE has been known to
-			   cause random failures on win9x.  Specifically a 
+			   cause random failures on win9x.  Specifically a
 			   dialog:
 			   "Your program accessed mem currently in use at xxx"
 			   and a hopeful warning about the stability of your