summaryrefslogtreecommitdiff
path: root/sql/my_lock.c
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-02-11 13:48:59 +0200
committerunknown <monty@hundin.mysql.fi>2002-02-11 13:48:59 +0200
commita68e9ccd2d25a4dc309a5df2c0b3693cc6e682b3 (patch)
treeada172b5dc5dccd546e301548aac618812e19814 /sql/my_lock.c
parent4e97f5c3e207ddbfbc26b21bf05053ca20f9ba91 (diff)
parent7a93e9bed192f3f1bfeaaf315abafe0391f74e82 (diff)
downloadmariadb-git-a68e9ccd2d25a4dc309a5df2c0b3693cc6e682b3.tar.gz
merge with 3.23.48
BUILD/FINISH.sh: Auto merged BUILD/SETUP.sh: Auto merged BUILD/compile-alpha: Auto merged BUILD/compile-pentium-gcov: Auto merged BUILD/compile-pentium-gprof: Auto merged BUILD/compile-pentium: Auto merged BitKeeper/deleted/.del-my_new.cc: Delete: mysys/my_new.cc Build-tools/Do-compile: Auto merged acconfig.h: Auto merged acinclude.m4: Auto merged Docs/manual.texi: Auto merged bdb/dist/configure.in: Auto merged client/Makefile.am: Auto merged innobase/btr/btr0cur.c: Auto merged innobase/buf/buf0lru.c: Auto merged innobase/dict/dict0crea.c: Auto merged innobase/fil/fil0fil.c: Auto merged innobase/include/srv0srv.h: Auto merged innobase/rem/rem0cmp.c: Auto merged innobase/srv/srv0srv.c: Auto merged innobase/srv/srv0start.c: Auto merged innobase/trx/trx0purge.c: Auto merged myisam/myisampack.c: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/t/join.test: Auto merged mysys/Makefile.am: Auto merged scripts/Makefile.am: Auto merged sql/ha_innodb.h: Auto merged sql/handler.cc: Auto merged sql/my_lock.c: Auto merged sql/mysqld.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged support-files/my-huge.cnf.sh: Auto merged support-files/my-large.cnf.sh: Auto merged support-files/my-medium.cnf.sh: Auto merged support-files/my-small.cnf.sh: Auto merged configure.in: merge innobase/row/row0mysql.c: merge innobase/trx/trx0trx.c: merge mysql-test/r/innodb.result: merge mysql-test/r/join.result: merge sql/ha_innodb.cc: merge sql/slave.cc: merge
Diffstat (limited to 'sql/my_lock.c')
-rw-r--r--sql/my_lock.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/sql/my_lock.c b/sql/my_lock.c
index 9b4ac502e57..4d451fcff22 100644
--- a/sql/my_lock.c
+++ b/sql/my_lock.c
@@ -26,10 +26,6 @@
#include <thr_alarm.h>
#include <errno.h>
-#ifdef HAVE_FCNTL
-static struct flock lock; /* Must be static for sun-sparc */
-#endif
-
/* Lock a part of a file */
int my_lock(File fd,int locktype,my_off_t start,my_off_t length,myf MyFlags)
@@ -37,24 +33,25 @@ int my_lock(File fd,int locktype,my_off_t start,my_off_t length,myf MyFlags)
thr_alarm_t alarmed;
ALARM alarm_buff;
uint wait_for_alarm;
+ struct flock m_lock;
DBUG_ENTER("my_lock");
DBUG_PRINT("my",("Fd: %d Op: %d start: %ld Length: %ld MyFlags: %d",
fd,locktype,(ulong) start,(ulong) length,MyFlags));
if (my_disable_locking)
DBUG_RETURN(0); /* purecov: inspected */
- lock.l_type=(short) locktype;
- lock.l_whence=0L;
- lock.l_start=(long) start;
- lock.l_len=(long) length;
+ m_lock.l_type=(short) locktype;
+ m_lock.l_whence=0L;
+ m_lock.l_start=(long) start;
+ m_lock.l_len=(long) length;
wait_for_alarm=(MyFlags & MY_DONT_WAIT ? MY_HOW_OFTEN_TO_ALARM :
(uint) 12*60*60);
- if (fcntl(fd,F_SETLK,&lock) != -1) /* Check if we can lock */
+ if (fcntl(fd,F_SETLK,&m_lock) != -1) /* Check if we can lock */
DBUG_RETURN(0); /* Ok, file locked */
DBUG_PRINT("info",("Was locked, trying with alarm"));
if (!thr_alarm(&alarmed,wait_for_alarm,&alarm_buff))
{
int value;
- while ((value=fcntl(fd,F_SETLKW,&lock)) && !thr_got_alarm(&alarmed) &&
+ while ((value=fcntl(fd,F_SETLKW,&m_lock)) && !thr_got_alarm(&alarmed) &&
errno == EINTR) ;
thr_end_alarm(&alarmed);
if (value != -1)