Skip to content

Commit f28a604

Browse files
Tom CherryGerrit Code Review
Tom Cherry
authored and
Gerrit Code Review
committed
Merge "init: add some documentation in service_utils.h"
2 parents 9763f21 + c9bc6bb commit f28a604

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

init/service_utils.h

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class Descriptor {
3737
Descriptor(const std::string& name, android::base::unique_fd fd)
3838
: name_(name), fd_(std::move(fd)){};
3939

40+
// Publish() unsets FD_CLOEXEC from the FD and publishes its name via setenv(). It should be
41+
// called when starting a service after fork() and before exec().
4042
void Publish() const;
4143

4244
private:
@@ -53,6 +55,9 @@ struct SocketDescriptor {
5355
std::string context;
5456
bool passcred = false;
5557

58+
// Create() creates the named unix domain socket in /dev/socket and returns a Descriptor object.
59+
// It should be called when starting a service, before calling fork(), such that the socket is
60+
// synchronously created before starting any other services, which may depend on it.
5661
Result<Descriptor> Create(const std::string& global_context) const;
5762
};
5863

0 commit comments

Comments
 (0)