chromium/third_party/crashpad/crashpad/util/file/file_io_posix.cc

// Copyright 2014 The Crashpad Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "util/file/file_io.h"

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

#include <algorithm>
#include <limits>

#include "base/check_op.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "base/posix/eintr_wrapper.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "util/misc/random_string.h"

namespace crashpad {

namespace {

struct ReadTraits {};

struct WriteTraits {};

template <typename Traits>
FileOperationResult ReadOrWrite(int fd,
                                typename Traits::BufferType buffer,
                                size_t size) {}

FileHandle OpenFileForOutput(int rdwr_or_wronly,
                             const base::FilePath& path,
                             FileWriteMode mode,
                             FilePermissions permissions) {}
}  // namespace

namespace internal {

FileOperationResult NativeWriteFile(FileHandle file,
                                    const void* buffer,
                                    size_t size) {}

}  // namespace internal

FileOperationResult ReadFile(FileHandle file, void* buffer, size_t size) {}

FileHandle OpenFileForRead(const base::FilePath& path) {}

FileHandle OpenFileForWrite(const base::FilePath& path,
                            FileWriteMode mode,
                            FilePermissions permissions) {}

FileHandle OpenFileForReadAndWrite(const base::FilePath& path,
                                   FileWriteMode mode,
                                   FilePermissions permissions) {}

FileHandle LoggingOpenFileForRead(const base::FilePath& path) {}

FileHandle LoggingOpenFileForWrite(const base::FilePath& path,
                                   FileWriteMode mode,
                                   FilePermissions permissions) {}

#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
FileHandle LoggingOpenMemoryFileForReadAndWrite(const base::FilePath& name) {}
#endif

FileHandle LoggingOpenFileForReadAndWrite(const base::FilePath& path,
                                          FileWriteMode mode,
                                          FilePermissions permissions) {}

#if CRASHPAD_FLOCK_ALWAYS_SUPPORTED

FileLockingResult LoggingLockFile(FileHandle file,
                                  FileLocking locking,
                                  FileLockingBlocking blocking) {}

bool LoggingUnlockFile(FileHandle file) {}

#endif  // CRASHPAD_FLOCK_ALWAYS_SUPPORTED

FileOffset LoggingSeekFile(FileHandle file, FileOffset offset, int whence) {}

bool LoggingTruncateFile(FileHandle file) {}

bool LoggingCloseFile(FileHandle file) {}

FileOffset LoggingFileSizeByHandle(FileHandle file) {}

FileHandle StdioFileHandle(StdioStream stdio_stream) {}

}  // namespace crashpad