chromium/components/named_system_lock/lock_linux.cc

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/named_system_lock/lock.h"

#include <aio.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>

#include <memory>
#include <string>
#include <utility>

#include "base/files/file.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/time/time.h"

namespace named_system_lock {

// A global preferences lock for Linux implemented with pthread mutexes in
// shared memory. Note that the shared memory region is leaked once per lock
// name for reasons described in the README.md. The size of the leaked region is
// ~40 bytes.
class ScopedLockImpl {};

std::unique_ptr<ScopedLockImpl> ScopedLockImpl::TryCreate(
    const std::string& shared_mem_name,
    base::TimeDelta timeout) {}

ScopedLockImpl::~ScopedLockImpl() {}

ScopedLock::ScopedLock(std::unique_ptr<ScopedLockImpl> impl)
    :{}
ScopedLock::~ScopedLock() = default;

// static
std::unique_ptr<ScopedLock> ScopedLock::Create(const std::string& name,
                                               base::TimeDelta timeout) {}

}  // namespace named_system_lock