blob: e68c3904337f6f96f92f7c2af0d8f366174f6cbb [file] [log] [blame]
// Copyright 2019 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
#include <base/files/scoped_file.h>
#include <base/macros.h>
#include <base/optional.h>
namespace base {
class FilePath;
namespace kerberos {
// Reads the whole contents of the file descriptor |fd| into the returned
// string. If fd is a blocking pipe this call will block until the pipe is
// closed. Returns nullopt if the pipe could not be read or some limit was
// exceeded (see code).
base::Optional<std::string> ReadPipeToString(int fd);
// Creates a non-blocking pipe and writes the given string to it. |str| must be
// small enough to fit into the pipe buffer. Returns base::ScopedFD() on error.
base::ScopedFD WriteStringToPipe(const std::string& str);
} // namespace kerberos