You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bj...@locus.apache.org on 2000/12/04 07:00:36 UTC
cvs commit: apr/include apr_errno.h
bjh 00/12/03 22:00:36
Modified: file_io/os2 Makefile.in
include apr_errno.h
Added: file_io/os2 flock.c
Log:
Add file locking for OS/2
Revision Changes Path
1.17 +1 -0 apr/file_io/os2/Makefile.in
Index: Makefile.in
===================================================================
RCS file: /home/cvs/apr/file_io/os2/Makefile.in,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- Makefile.in 2000/11/15 16:06:04 1.16
+++ Makefile.in 2000/12/04 06:00:35 1.17
@@ -19,6 +19,7 @@
pipe.o \
readwrite.o \
seek.o \
+ flock.o \
maperrorcode.o
.c.o:
1.1 apr/file_io/os2/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)
{
FILELOCK lockrange = { 0, 0x7fffffff };
ULONG rc;
rc = DosSetFileLocks(thefile->filedes, NULL, &lockrange,
(type & APR_FLOCK_NONBLOCK) ? 0 : (ULONG)-1,
(type & APR_FLOCK_TYPEMASK) == APR_FLOCK_SHARED);
return APR_FROM_OS_ERROR(rc);
}
apr_status_t apr_unlock_file(apr_file_t *thefile)
{
FILELOCK unlockrange = { 0, 0x7fffffff };
ULONG rc;
rc = DosSetFileLocks(thefile->filedes, &unlockrange, NULL, 0, 0);
return APR_FROM_OS_ERROR(rc);
}
1.47 +2 -1 apr/include/apr_errno.h
Index: apr_errno.h
===================================================================
RCS file: /home/cvs/apr/include/apr_errno.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- apr_errno.h 2000/12/04 05:40:25 1.46
+++ apr_errno.h 2000/12/04 06:00:36 1.47
@@ -438,7 +438,8 @@
|| (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
|| (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \
- || (s) == APR_OS_START_SYSERR + SOCEWOULDBLOCK)
+ || (s) == APR_OS_START_SYSERR + SOCEWOULDBLOCK \
+ || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION)
#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \
|| (s) == APR_OS_START_SYSERR + SOCEINTR)
#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \