filelock-darwin.cpp revision c7945191b700920f0ab9b951ce92cc69cb48ffb4
/* $Id$ */
/** @file
* InnoTek Portable Runtime - File Locking, POSIX.
*/
/*
* Copyright (C) 2006 InnoTek Systemberatung GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP RTLOGGROUP_FILE
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
{
/* Check arguments. */
if (fLock & ~RTFILE_LOCK_MASK)
{
return VERR_INVALID_PARAMETER;
}
/*
* Validate offset.
*/
&& ( (offLock >> 32) != 0
|| (cbLock >> 32) != 0
{
return VERR_NOT_SUPPORTED;
}
/* Prepare flock structure. */
return VINF_SUCCESS;
return VERR_FILE_LOCK_VIOLATION;
return RTErrConvertFromErrno(iErr);
}
{
/** @todo We never returns VERR_FILE_NOT_LOCKED for now. */
}
{
/*
* Validate offset.
*/
&& ( (offLock >> 32) != 0
|| (cbLock >> 32) != 0
{
return VERR_NOT_SUPPORTED;
}
/* Prepare flock structure. */
return VINF_SUCCESS;
/* @todo check error codes for non existing lock. */
return VERR_FILE_LOCK_VIOLATION;
return RTErrConvertFromErrno(iErr);
}