Lines Matching +full:translate +full:- +full:errno
7 // http://www.apache.org/licenses/LICENSE-2.0
27 #include <errno.h>
123 size_t len = path->size(); in CanonicalizePath()
128 path->resize(len); in CanonicalizePath()
140 // WARNING: this function is performance-critical; please benchmark in CanonicalizePath()
181 dst = components[component_count - 1]; in CanonicalizePath()
183 --component_count; in CanonicalizePath()
213 *len = dst - start - 1; in CanonicalizePath()
243 case '-': in IsKnownShellSafeCharacter()
280 result->append(input); in GetShellEscapedString()
287 result->push_back(kQuote); in GetShellEscapedString()
293 result->append(span_begin, it); in GetShellEscapedString()
294 result->append(kEscapeSequence); in GetShellEscapedString()
298 result->append(span_begin, input.end()); in GetShellEscapedString()
299 result->push_back(kQuote); in GetShellEscapedString()
306 result->append(input); in GetWin32EscapedString()
313 result->push_back(kQuote); in GetWin32EscapedString()
323 result->append(span_begin, it); in GetWin32EscapedString()
324 result->append(consecutive_backslash_count + 1, kBackslash); in GetWin32EscapedString()
333 result->append(span_begin, input.end()); in GetWin32EscapedString()
334 result->append(consecutive_backslash_count, kBackslash); in GetWin32EscapedString()
335 result->push_back(kQuote); in GetWin32EscapedString()
342 err->clear(); in ReadFile()
346 err->assign(GetLastErrorString()); in ReadFile()
347 return -ENOENT; in ReadFile()
354 err->assign(GetLastErrorString()); in ReadFile()
355 contents->clear(); in ReadFile()
357 return -EIO; in ReadFile()
361 contents->append(buf, len); in ReadFile()
368 err->assign(strerror(errno)); in ReadFile()
369 return -errno; in ReadFile()
374 err->assign(strerror(errno)); in ReadFile()
376 return -errno; in ReadFile()
380 contents->reserve(st.st_size + 1); in ReadFile()
385 contents->append(buf, len); in ReadFile()
388 err->assign(strerror(errno)); // XXX errno? in ReadFile()
389 contents->clear(); in ReadFile()
391 return -errno; in ReadFile()
478 // isalpha() is locale-dependent. in islatinalpha()
498 // Skip everything up to and including the next [a-zA-Z]. in StripAnsiEscapeCodes()
534 if (pieces[i] == "-") { in parse()
550 vector<StringPiece>(&pieces[6], &pieces[optionalStart - 1]); in parse()
556 string translate(string& path) const { in translate() function
611 string newPath = mp.translate(subsys->second.name); in ParseMountInfo()
642 return -1; in ParseCPUFromCGroup()
643 std::pair<int64_t, bool> quota = readCount(cpu->second + "/cpu.cfs_quota_us"); in ParseCPUFromCGroup()
644 if (!quota.second || quota.first == -1) in ParseCPUFromCGroup()
645 return -1; in ParseCPUFromCGroup()
647 readCount(cpu->second + "/cpu.cfs_period_us"); in ParseCPUFromCGroup()
649 return -1; in ParseCPUFromCGroup()
671 if (info->Relationship == RelationProcessorCore && in GetProcessorCount()
672 info->Processor.GroupCount == 1) { in GetProcessorCount()
673 for (KAFFINITY core_mask = info->Processor.GroupMask[0].Mask; in GetProcessorCount()
678 i += info->Size; in GetProcessorCount()
691 …// https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-jobobject_cpu_rate_control_in… in GetProcessorCount()
701 int cgroupCount = -1; in GetProcessorCount()
702 int schedCount = -1; in GetProcessorCount()
708 // active, see https://github.com/ninja-build/ninja/issues/1278 in GetProcessorCount()
712 if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, sizeof(mask), in GetProcessorCount()
733 static double previous_load = -0.0; in CalculateProcessorLoad()
735 uint64_t idle_ticks_since_last_time = idle_ticks - previous_idle_ticks; in CalculateProcessorLoad()
736 uint64_t total_ticks_since_last_time = total_ticks - previous_total_ticks; in CalculateProcessorLoad()
748 double load_since_last_call = 1.0 - idle_to_total_ratio; in CalculateProcessorLoad()
789 posix_compatible_load = -0.0; in GetLoadAverage()
796 return -0.0f; in GetLoadAverage()
802 return -0.0f; in GetLoadAverage()
812 return -0.0f; in GetLoadAverage()
817 return -0.0f; in GetLoadAverage()
825 return -0.0f; in GetLoadAverage()
841 size_t elide_size = (width - kMargin) / 2; in ElideMiddle()
844 + result.substr(result.size() - elide_size, elide_size); in ElideMiddle()
858 // Both truncate() and _chsize() return 0 on success and set errno and return in Truncate()
859 // -1 on failure. in Truncate()
861 *err = strerror(errno); in Truncate()