summaryrefslogtreecommitdiff
path: root/innobase/os
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-01-15 14:09:45 +0200
committerunknown <monty@mysql.com>2005-01-15 14:09:45 +0200
commit0cbd58c52b3810da467ec04e5d578ce3c845f125 (patch)
treee8856cd37d5a43bd18c06a8834fbfff83c0f4998 /innobase/os
parent5168d25f3509cd205b3db8222446b16d34c45781 (diff)
parent193eae3bece02daa473f0e264d235ea3e407a88d (diff)
downloadmariadb-git-0cbd58c52b3810da467ec04e5d578ce3c845f125.tar.gz
Merge with 4.1
BitKeeper/etc/ignore: auto-union Build-tools/Do-compile: Auto merged client/mysqladmin.cc: Auto merged heap/hp_create.c: Auto merged heap/hp_write.c: Auto merged include/my_sys.h: Auto merged innobase/data/data0type.c: Auto merged innobase/include/row0mysql.h: Auto merged innobase/os/os0file.c: Auto merged innobase/rem/rem0cmp.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/srv/srv0start.c: Auto merged mysql-test/r/ctype_latin1_de.result: Auto merged mysql-test/r/ctype_tis620.result: Auto merged mysql-test/r/ctype_ucs.result: Auto merged mysql-test/r/ctype_ujis.result: Auto merged mysql-test/r/ctype_utf8.result: Auto merged mysql-test/r/func_gconcat.result: Auto merged mysql-test/r/func_sapdb.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/r/type_float.result.es: Auto merged mysql-test/r/type_float.result: Auto merged mysql-test/r/type_timestamp.result: Auto merged mysql-test/t/ctype_ucs.test: Auto merged mysql-test/t/func_sapdb.test: Auto merged mysql-test/t/show_check.test: Auto merged mysql-test/t/type_float.test: Auto merged mysql-test/t/type_timestamp.test: Auto merged mysys/mf_iocache.c: Auto merged ndb/src/kernel/vm/Configuration.cpp: Auto merged scripts/mysql_install_db.sh: Auto merged sql/field.cc: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/item_sum.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged strings/ctype-big5.c: Auto merged strings/ctype-bin.c: Auto merged strings/ctype-czech.c: Auto merged strings/ctype-gbk.c: Auto merged strings/ctype-latin1.c: Auto merged strings/ctype-mb.c: Auto merged strings/ctype-simple.c: Auto merged strings/ctype-sjis.c: Auto merged strings/ctype-tis620.c: Auto merged strings/ctype-uca.c: Auto merged strings/ctype-ucs2.c: Auto merged strings/ctype-utf8.c: Auto merged strings/ctype-win1250ch.c: Auto merged configure.in: Use local values mysql-test/r/ps_1general.result: Update results mysql-test/t/func_gconcat.test: no changes mysql-test/t/ps_1general.test: Use local code ndb/src/common/util/version.c: Use local code sql/filesort.cc: Empty line changes sql/ha_heap.cc: Merge sql/item_timefunc.cc: Keep local code sql/mysql_priv.h: Update to 5.0 sql/sql_show.cc: Hand merge support-files/mysql.spec.sh: No changes
Diffstat (limited to 'innobase/os')
-rw-r--r--innobase/os/os0file.c48
1 files changed, 33 insertions, 15 deletions
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index cb9801cbc9a..64d80350275 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -490,7 +490,7 @@ os_io_init_simple(void)
}
}
-#ifndef UNIV_HOTBACKUP
+#if !defined(UNIV_HOTBACKUP) && !defined(__NETWARE__)
/*************************************************************************
Creates a temporary file. This function is defined in ha_innodb.cc. */
@@ -498,7 +498,7 @@ int
innobase_mysql_tmpfile(void);
/*========================*/
/* out: temporary file descriptor, or < 0 on error */
-#endif /* !UNIV_HOTBACKUP */
+#endif /* !UNIV_HOTBACKUP && !__NETWARE__ */
/***************************************************************************
Creates a temporary file. */
@@ -508,9 +508,12 @@ os_file_create_tmpfile(void)
/*========================*/
/* out: temporary file handle, or NULL on error */
{
+#ifdef __NETWARE__
+ FILE* file = tmpfile();
+#else /* __NETWARE__ */
FILE* file = NULL;
int fd = -1;
-#ifdef UNIV_HOTBACKUP
+# ifdef UNIV_HOTBACKUP
int tries;
for (tries = 10; tries--; ) {
char* name = tempnam(fil_path_to_mysql_datadir, "ib");
@@ -519,15 +522,15 @@ os_file_create_tmpfile(void)
}
fd = open(name,
-# ifdef __WIN__
+# ifdef __WIN__
O_SEQUENTIAL | O_SHORT_LIVED | O_TEMPORARY |
-# endif /* __WIN__ */
+# endif /* __WIN__ */
O_CREAT | O_EXCL | O_RDWR,
S_IREAD | S_IWRITE);
if (fd >= 0) {
-# ifndef __WIN__
+# ifndef __WIN__
unlink(name);
-# endif /* !__WIN__ */
+# endif /* !__WIN__ */
free(name);
break;
}
@@ -538,22 +541,25 @@ os_file_create_tmpfile(void)
name);
free(name);
}
-#else /* UNIV_HOTBACKUP */
+# else /* UNIV_HOTBACKUP */
fd = innobase_mysql_tmpfile();
-#endif /* UNIV_HOTBACKUP */
+# endif /* UNIV_HOTBACKUP */
if (fd >= 0) {
file = fdopen(fd, "w+b");
}
+#endif /* __NETWARE__ */
if (!file) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Error: unable to create temporary file;"
" errno: %d\n", errno);
+#ifndef __NETWARE__
if (fd >= 0) {
close(fd);
}
+#endif /* !__NETWARE__ */
}
return(file);
@@ -1767,19 +1773,31 @@ os_file_flush(
#else
int ret;
-#if defined(HAVE_DARWIN_THREADS) && defined(F_FULLFSYNC)
+#if defined(HAVE_DARWIN_THREADS)
+# ifndef F_FULLFSYNC
+ /* The following definition is from the Mac OS X 10.3 <sys/fcntl.h> */
+# define F_FULLFSYNC 51 /* fsync + ask the drive to flush to the media */
+# elif F_FULLFSYNC != 51
+# error "F_FULLFSYNC != 51: ABI incompatibility with Mac OS X 10.3"
+# endif
/* Apple has disabled fsync() for internal disk drives in OS X. That
caused corruption for a user when he tested a power outage. Let us in
OS X use a nonstandard flush method recommended by an Apple
engineer. */
- ret = fcntl(file, F_FULLFSYNC, NULL);
-
- if (ret) {
- /* If we are not on a file system that supports this, then
- fall back to a plain fsync. */
+ if (!srv_have_fullfsync) {
+ /* If we are not on an operating system that supports this,
+ then fall back to a plain fsync. */
ret = fsync(file);
+ } else {
+ ret = fcntl(file, F_FULLFSYNC, NULL);
+
+ if (ret) {
+ /* If we are not on a file system that supports this,
+ then fall back to a plain fsync. */
+ ret = fsync(file);
+ }
}
#elif HAVE_FDATASYNC
ret = fdatasync(file);