Skip to content

Commit c9bc6bb

Browse files
author
Tom Cherry
committed
init: add some documentation in service_utils.h
Test: n/a Change-Id: I2a2691a6d1f643e255550498d9871e38f1b51efa
1 parent 180b267 commit c9bc6bb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

init/service_utils.h

Lines changed: 5 additions & 0 deletions
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)