2 * fontconfig/doc/fcatomic.fncs
4 * Copyright © 2003 Keith Packard
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of Keith Packard not be used in
11 * advertising or publicity pertaining to distribution of the software without
12 * specific, written prior permission. Keith Packard makes no
13 * representations about the suitability of this software for any purpose. It
14 * is provided "as is" without express or implied warranty.
16 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 * PERFORMANCE OF THIS SOFTWARE.
27 @TYPE1@ const FcChar8 * @ARG1@ file
28 @PURPOSE@ create an FcAtomic object
30 Creates a data structure containing data needed to control access to <parameter>file</parameter>.
31 Writing is done to a separate file. Once that file is complete, the original
32 configuration file is atomically replaced so that reading process always see
33 a consistent and complete file without the need to lock for reading.
38 @TYPE1@ FcAtomic * @ARG1@ atomic
41 Attempts to lock the file referenced by <parameter>atomic</parameter>.
42 Returns FcFalse if the file is already locked, else returns FcTrue and
43 leaves the file locked.
47 @FUNC@ FcAtomicNewFile
48 @TYPE1@ FcAtomic * @ARG1@ atomic
49 @PURPOSE@ return new temporary file name
51 Returns the filename for writing a new version of the file referenced
52 by <parameter>atomic</parameter>.
56 @FUNC@ FcAtomicOrigFile
57 @TYPE1@ FcAtomic * @ARG1@ atomic
58 @PURPOSE@ return original file name
60 Returns the file refernced by <parameter>atomic</parameter>.
64 @FUNC@ FcAtomicReplaceOrig
65 @TYPE1@ FcAtomic * @ARG1@ atomic
66 @PURPOSE@ replace original with new
68 Replaces the original file referenced by <parameter>atomic</parameter> with
69 the new file. Returns FcFalse if the file cannot be replaced due to
70 permission issues in the filesystem. Otherwise returns FcTrue.
74 @FUNC@ FcAtomicDeleteNew
75 @TYPE1@ FcAtomic * @ARG1@ atomic
76 @PURPOSE@ delete new file
78 Deletes the new file. Used in error recovery to back out changes.
83 @TYPE1@ FcAtomic * @ARG1@ atomic
84 @PURPOSE@ unlock a file
90 @FUNC@ FcAtomicDestroy
91 @TYPE1@ FcAtomic * @ARG1@ atomic
92 @PURPOSE@ destroy an FcAtomic object
94 Destroys <parameter>atomic</parameter>.