MCPcopy Create free account
hub / github.com/apache/mesos / createFileInfo

Function createFileInfo

src/common/protobuf_utils.cpp:1027–1052  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1025
1026
1027FileInfo createFileInfo(const string& path, const struct stat& s)
1028{
1029 FileInfo file;
1030 file.set_path(path);
1031 file.set_nlink(s.st_nlink);
1032 file.set_size(s.st_size);
1033 file.mutable_mtime()->set_nanoseconds(Seconds((s.st_mtime)).ns());
1034 file.set_mode(s.st_mode);
1035
1036 // NOTE: `getpwuid` and `getgrgid` return `nullptr` on Windows.
1037 passwd* p = getpwuid(s.st_uid);
1038 if (p != nullptr) {
1039 file.set_uid(p->pw_name);
1040 } else {
1041 file.set_uid(stringify(s.st_uid));
1042 }
1043
1044 struct group* g = getgrgid(s.st_gid);
1045 if (g != nullptr) {
1046 file.set_gid(g->gr_name);
1047 } else {
1048 file.set_gid(stringify(s.st_gid));
1049 }
1050
1051 return file;
1052}
1053
1054
1055ContainerID getRootContainerId(const ContainerID& containerId)

Callers 3

foreachFunction · 0.85
TEST_FFunction · 0.85

Calls 5

SecondsClass · 0.85
getpwuidFunction · 0.85
getgrgidFunction · 0.85
nsMethod · 0.80
stringifyFunction · 0.50

Tested by 2

TEST_FFunction · 0.68