blob: 341ff8ce81d134e1eb8ddedb1c80da367b700196 [file] [log] [blame]
Avi Drissman69b874f2022-09-15 19:11:141// Copyright 2019 The Chromium Authors
Sergey Ulanov7de7e9f2019-03-09 00:41:022// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef SQL_VFS_WRAPPER_FUCHSIA_H_
6#define SQL_VFS_WRAPPER_FUCHSIA_H_
7
8#include "third_party/sqlite/sqlite3.h"
9
10namespace sql {
11
12// Fuchsia doesn't provide a file locking mechanism like flock(). These
13// functions are used to simulate file locking. On Fuchsia profile directories
14// are not expected to be shared with other processes and therefore only one
15// browser process may access sqlite files. These functions are designed to
16// handle the case when the same sqlite database is open more than once from the
17// same browser process. In most cases databases do not need to be open more
18// than once, i.e. contention is expected to be rare, so the main goal of the
19// design is simplicity and not performance. The manager maintains a list of all
Bryant Chandler41d66e782022-02-16 15:44:0120// currently locked files.
21int Lock(sqlite3_file* sqlite_file, int file_lock);
22int Unlock(sqlite3_file* sqlite_file, int file_lock);
23int CheckReservedLock(sqlite3_file* sqlite_file, int* result);
Sergey Ulanov7de7e9f2019-03-09 00:41:0224
25} // namespace sql
26
Bryant Chandler41d66e782022-02-16 15:44:0127#endif // SQL_VFS_WRAPPER_FUCHSIA_H_