diff options
author | monty@hundin.mysql.fi <> | 2002-02-10 20:28:58 +0200 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2002-02-10 20:28:58 +0200 |
commit | cf39ab2ff27061a9f3f1b48ff629e85a1a0f5e8c (patch) | |
tree | d4c27eac4890e83bfe71db7d44e16da83862ea73 /sql/my_lock.c | |
parent | 9ef8d489208a3017cd5d66b32b2321a1cd614894 (diff) | |
download | mariadb-git-cf39ab2ff27061a9f3f1b48ff629e85a1a0f5e8c.tar.gz |
Remove uage of static variable from file locks.
Diffstat (limited to 'sql/my_lock.c')
-rw-r--r-- | sql/my_lock.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/sql/my_lock.c b/sql/my_lock.c index 7025682d40e..647c07a03c3 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) |