summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain Francoise <romain@orebokech.com>2005-09-14 20:19:39 +0000
committerRomain Francoise <romain@orebokech.com>2005-09-14 20:19:39 +0000
commitccf6179595cfb92daf0406ef5bd8cb722ebcda6c (patch)
treecb38977c0fa6a37ed18eb5824fc299885cf8dc4e
parentc6ea7612a361b2f5104bfb8774d678a77a07f44f (diff)
downloademacs-ccf6179595cfb92daf0406ef5bd8cb722ebcda6c.tar.gz
emacs-ccf6179595cfb92daf0406ef5bd8cb722ebcda6c.tar.bz2
emacs-ccf6179595cfb92daf0406ef5bd8cb722ebcda6c.zip
(write_region_inhibit_fsync): New variable.
(Fwrite_region): Use it to skip call to fsync. (syms_of_fileio): Initialize it.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/fileio.c14
2 files changed, 19 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7ec41e85fe2..e10e4e07c78 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2005-09-14 Romain Francoise <romain@orebokech.com>
+
+ * fileio.c (write_region_inhibit_fsync): New variable.
+ (Fwrite_region): Use it to skip call to fsync.
+ (syms_of_fileio): Initialize it.
+
2005-09-14 Kenichi Handa <handa@m17n.org>
* coding.c (code_convert_region_unwind): Argument format changed.
diff --git a/src/fileio.c b/src/fileio.c
index cd4eaa800fd..70d89331764 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -225,6 +225,11 @@ int vms_stmlf_recfm;
expanding file names. This can be bound to / or \. */
Lisp_Object Vdirectory_sep_char;
+#ifdef HAVE_FSYNC
+/* Nonzero means skip the call to fsync in Fwrite-region. */
+int write_region_inhibit_fsync;
+#endif
+
extern Lisp_Object Vuser_login_name;
#ifdef WINDOWSNT
@@ -5296,7 +5301,7 @@ This does code conversion according to the value of
Disk full in NFS may be reported here. */
/* mib says that closing the file will try to write as fast as NFS can do
it, and that means the fsync here is not crucial for autosave files. */
- if (!auto_saving && fsync (desc) < 0)
+ if (!auto_saving && !write_region_inhibit_fsync && fsync (desc) < 0)
{
/* If fsync fails with EINTR, don't treat that as serious. */
if (errno != EINTR)
@@ -6742,6 +6747,13 @@ shortly after Emacs reads your `.emacs' file, if you have not yet given it
a non-nil value. */);
Vauto_save_list_file_name = Qnil;
+#ifdef HAVE_FSYNC
+ DEFVAR_BOOL ("write-region-inhibit-fsync", &write_region_inhibit_fsync,
+ doc: /* *Non-nil means don't call fsync after saving files.
+Enabling this variable may result in data loss! */);
+ write_region_inhibit_fsync = 0;
+#endif
+
defsubr (&Sfind_file_name_handler);
defsubr (&Sfile_name_directory);
defsubr (&Sfile_name_nondirectory);