[libvirt] [PATCH 02/14] Add virFileLock and virFileUnlock APIs

Eric Blake eblake at redhat.com
Fri Jul 8 22:14:02 UTC 2011


On 07/07/2011 08:17 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Add some simple wrappers around the fcntl() discretionary file
> locking capability.
> 
> * src/util/util.c, src/util/util.h, src/libvirt_private.syms: Add
>   virFileLock and virFileUnlock APIs
> ---
>  src/libvirt_private.syms |    2 ++
>  src/util/util.c          |   33 +++++++++++++++++++++++++++++++++
>  src/util/util.h          |    3 +++
>  3 files changed, 38 insertions(+), 0 deletions(-)
> 
>  
> +
> +int virFileLock(int fd, bool shared, off_t start, off_t len)
> +{
> +    struct flock fl = {
> +        .l_type = shared ? F_RDLCK : F_WRLCK,
> +        .l_whence = SEEK_SET,
> +        .l_start = start,
> +        .l_len = len,
> +    };

This won't compile on mingw.  We need to either make a no-op stub, or
figure out how to do rudimentary file locking on mingw, or get gnulib to
figure it out (probably the first option is easiest for now).

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110708/c98e7c9d/attachment-0001.sig>


More information about the libvir-list mailing list