chromium/third_party/fontconfig/src/src/fcatomic.c

/*
 * fontconfig/src/fcatomic.c
 *
 * Copyright © 2002 Keith Packard
 *
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is hereby granted without fee, provided that
 * the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name of the author(s) not be used in
 * advertising or publicity pertaining to distribution of the software without
 * specific, written prior permission.  The authors make no
 * representations about the suitability of this software for any purpose.  It
 * is provided "as is" without express or implied warranty.
 *
 * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 */

/*
 * fcatomic.c
 *
 * Lock cache and configuration files for atomic update
 *
 * Uses only regular filesystem calls so it should
 * work even in the absense of functioning file locking
 *
 * On Unix, four files are used:
 *	file	    - the data file accessed by other apps.
 *	new	    - a new version of the data file while it's being written
 *	lck	    - the lock file
 *	tmp	    - a temporary file made unique with mkstemp
 *
 *  Here's how it works:
 *	Create 'tmp' and store our PID in it
 *	Attempt to link it to 'lck'
 *	Unlink 'tmp'
 *	If the link succeeded, the lock is held
 *
 * On Windows, where there are no links, no tmp file is used, and lck
 * is a directory that's mkdir'ed. If the mkdir succeeds, the lock is
 * held.
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "fcint.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <time.h>

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

#ifdef _WIN32
#include <direct.h>
#define mkdir
#endif

#define NEW_NAME
#define LCK_NAME
#define TMP_NAME

FcAtomic *
FcAtomicCreate (const FcChar8   *file)
{}

FcBool
FcAtomicLock (FcAtomic *atomic)
{}

FcChar8 *
FcAtomicNewFile (FcAtomic *atomic)
{}

FcChar8 *
FcAtomicOrigFile (FcAtomic *atomic)
{}

FcBool
FcAtomicReplaceOrig (FcAtomic *atomic)
{}

void
FcAtomicDeleteNew (FcAtomic *atomic)
{}

void
FcAtomicUnlock (FcAtomic *atomic)
{}

void
FcAtomicDestroy (FcAtomic *atomic)
{}
#define __fcatomic__
#include "fcaliastail.h"
#undef __fcatomic__