You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@locus.apache.org on 2000/12/04 05:21:43 UTC
cvs commit: apr/file_io/win32 flock.c
wrowe 00/12/03 20:21:43
Modified: . aprlib.dsp
Added: file_io/win32 flock.c
Log:
Win32 flock arrives
Revision Changes Path
1.49 +10 -5 apr/aprlib.dsp
Index: aprlib.dsp
===================================================================
RCS file: /home/cvs/apr/aprlib.dsp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- aprlib.dsp 2000/11/16 20:43:40 1.48
+++ aprlib.dsp 2000/12/04 04:21:43 1.49
@@ -26,7 +26,6 @@
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
-RSC=rc.exe
!IF "$(CFG)" == "aprlib - Win32 Release"
@@ -40,11 +39,12 @@
# PROP Output_Dir "LibR"
# PROP Intermediate_Dir "LibR"
# PROP Target_Dir ""
+RSC=rc.exe
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409
-# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
@@ -65,11 +65,12 @@
# PROP Intermediate_Dir "LibD"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
+RSC=rc.exe
+# ADD BASE RSC /l 0x409
+# ADD RSC /l 0x409
# ADD BASE CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409
-# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
@@ -225,6 +226,10 @@
# Begin Source File
SOURCE=.\file_io\win32\filestat.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\file_io\win32\flock.c
# End Source File
# Begin Source File
1.1 apr/file_io/win32/flock.c
Index: flock.c
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "fileio.h"
apr_status_t apr_lock_file(apr_file_t *thefile, int type)
{
OVERLAPPED offset;
DWORD flags, len = 0xffffffff;
flags = ((type & APR_FLOCK_NONBLOCK) ? LOCKFILE_FAIL_IMMEDIATELY : 0)
+ (((type & APR_FLOCK_TYPEMASK) == APR_FLOCK_SHARED)
? 0 : LOCKFILE_EXCLUSIVE_LOCK);
memset (&offset, 0, sizeof(offset));
/* Syntax is correct, len is passed for LengthLow and LengthHigh*/
if (!LockFileEx(thefile->filehand, flags, 0, len, len, &offset))
return apr_get_os_error();
return APR_SUCCESS;
}
apr_status_t apr_unlock_file(apr_file_t *thefile)
{
OVERLAPPED offset;
DWORD len = 0xffffffff;
memset (&offset, 0, sizeof(offset));
/* Syntax is correct, len is passed for LengthLow and LengthHigh*/
if (!UnlockFileEx(thefile->filehand, 0, len, len, &offset))
return apr_get_os_error();
return APR_SUCCESS;
}