summaryrefslogtreecommitdiff
path: root/mysys/my_lock.c
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.fi>2001-03-06 15:24:08 +0200
committerunknown <monty@donna.mysql.fi>2001-03-06 15:24:08 +0200
commit869c89feaaf82d0f44b2a48db0099aae87b4732f (patch)
tree54c7bf220f9e21e9f04e2ff2e8a018cf4e33e837 /mysys/my_lock.c
parentec5e2f589f09e9c261487a577dcddef3cdb994a5 (diff)
downloadmariadb-git-869c89feaaf82d0f44b2a48db0099aae87b4732f.tar.gz
Merged some functions and removed some unused client functions.
Remember UNION for ALTER TABLE Added test for if we are supporting transactions. Don't allow REPLACE to replace a row when we have generated an auto_increment key Fixed bug when using BLOB keys Fixed bug in SET @variable=user. Docs/manual.texi: Added some examples and moved the Error access denied section to the error section. client/mysqltest.c: Changed to use the new mysql_send_query() include/mysql.h: Changed mysql_reap_query() to mysql_send_query(). libmysql/libmysql.c: Changed mysql_reap_query() to mysql_send_query() Merged some functions and removed some unused functions. mysql-test/r/bdb.result: New test case mysql-test/r/distinct.result: New test case mysql-test/r/key.result: New test case mysql-test/r/merge.result: New test case mysql-test/r/replace.result: New test case mysql-test/t/bdb.test: New test case mysql-test/t/key.test: New test case mysql-test/t/merge.test: New test case mysql-test/t/replace.test: New test case mysys/my_lock.c: Moved global lock variable to static sql-bench/test-insert.sh: Added test case for index-read only sql/field.h: Fixed that one can optimize ORDER BY with ISAM and GEMINI sql/ha_berkeley.cc: Added type casts needed for Windows sql/ha_innobase.cc: Removed reference to manual from comment. sql/ha_myisammrg.cc: Remember UNION for ALTER TABLE sql/ha_myisammrg.h: Remember UNION for ALTER TABLE sql/handler.cc: Added test for if we are supporting transactions. Don't allow REPLACE to replace a row when we have generated an auto_increment key. sql/handler.h: Remember UNION for ALTER TABLE sql/key.cc: Fixed bug when using BLOB keys sql/mysql_priv.h: Added new variables sql/mysqld.cc: Added new variables sql/opt_range.cc: Fixed problem with BLOB keys sql/opt_sum.cc: Fix for BLOB keys sql/sql_class.cc: Added test if we need to init/clean transaction variables sql/sql_insert.cc: Fix for REPLACE and auto_increment keys sql/sql_parse.cc: Fixed bug in max_user_connections sql/sql_select.cc: Fixed problem with key on BLOB sql/sql_yacc.yy: Fixed bug in SET @variable=user. sql/table.cc: Fixed problem with keys on BLOB
Diffstat (limited to 'mysys/my_lock.c')
-rw-r--r--mysys/my_lock.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/mysys/my_lock.c b/mysys/my_lock.c
index 6486e07834b..a3508018837 100644
--- a/mysys/my_lock.c
+++ b/mysys/my_lock.c
@@ -33,12 +33,6 @@
#include <os2emx.h>
#endif
-#ifndef __EMX__
-#ifdef HAVE_FCNTL
-static struct flock lock; /* Must be static for sun-sparc */
-#endif
-#endif
-
/* Lock a part of a file */
int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
@@ -124,29 +118,32 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
}
#else
#if defined(HAVE_FCNTL)
- lock.l_type= (short) locktype;
- lock.l_whence=0L;
- lock.l_start=(long) start;
- lock.l_len=(long) length;
- if (MyFlags & MY_DONT_WAIT)
{
- if (fcntl(fd,F_SETLK,&lock) != -1) /* Check if we can lock */
- DBUG_RETURN(0); /* Ok, file locked */
- DBUG_PRINT("info",("Was locked, trying with alarm"));
- ALARM_INIT;
- while ((value=fcntl(fd,F_SETLKW,&lock)) && ! ALARM_TEST &&
- errno == EINTR)
- { /* Setup again so we don`t miss it */
- ALARM_REINIT;
+ struct flock lock;
+ lock.l_type= (short) locktype;
+ lock.l_whence=0L;
+ lock.l_start=(long) start;
+ lock.l_len=(long) length;
+ if (MyFlags & MY_DONT_WAIT)
+ {
+ if (fcntl(fd,F_SETLK,&lock) != -1) /* Check if we can lock */
+ DBUG_RETURN(0); /* Ok, file locked */
+ DBUG_PRINT("info",("Was locked, trying with alarm"));
+ ALARM_INIT;
+ while ((value=fcntl(fd,F_SETLKW,&lock)) && ! ALARM_TEST &&
+ errno == EINTR)
+ { /* Setup again so we don`t miss it */
+ ALARM_REINIT;
+ }
+ ALARM_END;
+ if (value != -1)
+ DBUG_RETURN(0);
+ if (errno == EINTR)
+ errno=EAGAIN;
}
- ALARM_END;
- if (value != -1)
+ else if (fcntl(fd,F_SETLKW,&lock) != -1) /* Wait until a lock */
DBUG_RETURN(0);
- if (errno == EINTR)
- errno=EAGAIN;
}
- else if (fcntl(fd,F_SETLKW,&lock) != -1) /* Wait until a lock */
- DBUG_RETURN(0);
#else
if (MyFlags & MY_SEEK_NOT_DONE)
VOID(my_seek(fd,start,MY_SEEK_SET,MYF(MyFlags & ~MY_SEEK_NOT_DONE)));