2019-02-28 05:30:15 +03:00
|
|
|
/*
|
2019-06-20 02:58:25 +03:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2019-02-28 05:30:15 +03:00
|
|
|
*
|
2019-06-20 02:58:25 +03:00
|
|
|
* This software may be used and distributed according to the terms of the
|
|
|
|
* GNU General Public License version 2.
|
2019-02-28 05:30:15 +03:00
|
|
|
*/
|
2019-10-11 15:26:59 +03:00
|
|
|
|
2019-02-28 05:30:15 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace folly {
|
|
|
|
class File;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace facebook {
|
|
|
|
namespace eden {
|
|
|
|
|
|
|
|
class PrivHelperServer;
|
|
|
|
class UserInfo;
|
|
|
|
class PrivHelper;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fork a separate privileged helper process, for performing mounts.
|
|
|
|
*
|
|
|
|
* This function should be very early on during program initialization, before
|
|
|
|
* any other threads are forked. After it is called UserInfo::dropPrivileges()
|
|
|
|
* should be called to return the desired user privileges.
|
|
|
|
*/
|
|
|
|
std::unique_ptr<PrivHelper> startPrivHelper(const UserInfo& userInfo);
|
|
|
|
|
2020-05-01 23:59:03 +03:00
|
|
|
#ifndef _WIN32
|
|
|
|
|
2019-02-28 05:30:15 +03:00
|
|
|
/**
|
|
|
|
* Start a privhelper process using a custom PrivHelperServer class.
|
|
|
|
*
|
|
|
|
* This is really only intended for use in unit tests.
|
|
|
|
*/
|
|
|
|
std::unique_ptr<PrivHelper> startPrivHelper(
|
|
|
|
PrivHelperServer* server,
|
|
|
|
const UserInfo& userInfo);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a PrivHelper client object using the specified connection rather than
|
|
|
|
* forking a new privhelper server process.
|
|
|
|
*
|
|
|
|
* This is primarily intended for use in unit tests.
|
|
|
|
*/
|
|
|
|
std::unique_ptr<PrivHelper> createTestPrivHelper(folly::File&& conn);
|
|
|
|
|
2020-05-01 23:59:03 +03:00
|
|
|
#endif // !_WIN32
|
|
|
|
|
2019-02-28 05:30:15 +03:00
|
|
|
} // namespace eden
|
|
|
|
} // namespace facebook
|