summaryrefslogtreecommitdiff
path: root/innobase/os
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-05-17 01:52:13 +0300
committerunknown <monty@mysql.com>2004-05-17 01:52:13 +0300
commit0eb8474b0e4f4e176bf9505823174d6860c8021c (patch)
treeb9fa88577b516df5fb27de3970ec9eab9aaef532 /innobase/os
parentffd5dab5236de4382654ac15e88878cb2ac4030a (diff)
parentbba41a1cdd6617aa586886a29c02c874122f77df (diff)
downloadmariadb-git-0eb8474b0e4f4e176bf9505823174d6860c8021c.tar.gz
Merge with 4.0.20
BitKeeper/etc/logging_ok: auto-union client/mysql.cc: Auto merged client/mysqltest.c: Auto merged innobase/btr/btr0btr.c: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/dict/dict0load.c: Auto merged innobase/eval/eval0eval.c: Auto merged innobase/ibuf/ibuf0ibuf.c: Auto merged innobase/include/ut0mem.h: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/row/row0ins.c: Auto merged innobase/row/row0mysql.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/row/row0umod.c: Auto merged innobase/row/row0upd.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/ut/ut0dbg.c: Auto merged innobase/ut/ut0mem.c: Auto merged myisam/mi_dynrec.c: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/t/fulltext.test: Auto merged mysql-test/t/rpl_rotate_logs.test: Auto merged scripts/make_binary_distribution.sh: Auto merged sql/ha_innodb.cc: Auto merged sql/item_func.cc: Auto merged sql/slave.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_show.cc: Auto merged innobase/os/os0file.c: Merge with 4.0.20 Ensure that we call F_UNLCK for files on which we call F_WRLCK. This is to ensure that this code will be portable accross most platforms. myisam/ft_boolean_search.c: Merge with 4.0.20 (keep original file) myisam/ft_parser.c: Merge with 4.0.20 (keep original file) myisam/ftdefs.h: Merge with 4.0.20 (keep original file)
Diffstat (limited to 'innobase/os')
-rw-r--r--innobase/os/os0file.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index 79185c30f79..1a158372563 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -387,15 +387,17 @@ os_file_lock(
/*=========*/
/* out: 0 on success */
int fd, /* in: file descriptor */
- const char* name) /* in: file name */
+ const char* name, /* in: file name */
+ uint lock_type) /* in: lock_type */
{
struct flock lk;
- lk.l_type = F_WRLCK;
+ lk.l_type = lock_type;
lk.l_whence = SEEK_SET;
lk.l_start = lk.l_len = 0;
if (fcntl(fd, F_SETLK, &lk) == -1) {
fprintf(stderr,
- "InnoDB: Unable to lock %s", name);
+ "InnoDB: Unable to lock %s with lock %d, error: %d",
+ name, lock_type, errno);
perror (": fcntl");
close(fd);
return(-1);
@@ -862,7 +864,7 @@ try_again:
goto try_again;
}
#ifdef USE_FILE_LOCK
- } else if (os_file_lock(file, name)) {
+ } else if (os_file_lock(file, name, F_WRLCK)) {
*success = FALSE;
file = -1;
#endif
@@ -971,7 +973,7 @@ os_file_create_simple_no_error_handling(
if (file == -1) {
*success = FALSE;
#ifdef USE_FILE_LOCK
- } else if (os_file_lock(file, name)) {
+ } else if (os_file_lock(file, name, F_WRLCK)) {
*success = FALSE;
file = -1;
#endif
@@ -1182,7 +1184,7 @@ try_again:
goto try_again;
}
#ifdef USE_FILE_LOCK
- } else if (os_file_lock(file, name)) {
+ } else if (os_file_lock(file, name, F_WRLCK)) {
*success = FALSE;
file = -1;
#endif
@@ -1383,6 +1385,9 @@ os_file_close(
#else
int ret;
+#ifdef USE_FILE_LOCK
+ (void) os_file_lock(file, "unknown", F_UNLCK);
+#endif
ret = close(file);
if (ret == -1) {
@@ -1419,6 +1424,9 @@ os_file_close_no_error_handling(
#else
int ret;
+#ifdef USE_FILE_LOCK
+ (void) os_file_lock(file, "unknown", F_UNLCK);
+#endif
ret = close(file);
if (ret == -1) {