Lines Matching refs:args
54 Result<void> ServiceParser::ParseCapabilities(std::vector<std::string>&& args) { in ParseCapabilities() argument
67 for (size_t i = 1; i < args.size(); i++) { in ParseCapabilities()
68 const std::string& arg = args[i]; in ParseCapabilities()
82 Result<void> ServiceParser::ParseClass(std::vector<std::string>&& args) { in ParseClass() argument
83 service_->classnames_ = std::set<std::string>(args.begin() + 1, args.end()); in ParseClass()
87 Result<void> ServiceParser::ParseConsole(std::vector<std::string>&& args) { in ParseConsole() argument
92 service_->proc_attr_.console = args.size() > 1 ? "/dev/" + args[1] : ""; in ParseConsole()
96 Result<void> ServiceParser::ParseCritical(std::vector<std::string>&& args) { in ParseCritical() argument
100 for (auto it = args.begin() + 1; it != args.end(); ++it) { in ParseCritical()
134 Result<void> ServiceParser::ParseDisabled(std::vector<std::string>&& args) { in ParseDisabled() argument
140 Result<void> ServiceParser::ParseEnterNamespace(std::vector<std::string>&& args) { in ParseEnterNamespace() argument
141 if (args[1] != "net") { in ParseEnterNamespace()
150 service_->namespaces_.namespaces_to_enter.emplace_back(CLONE_NEWNET, std::move(args[2])); in ParseEnterNamespace()
154 Result<void> ServiceParser::ParseGentleKill(std::vector<std::string>&& args) { in ParseGentleKill() argument
159 Result<void> ServiceParser::ParseGroup(std::vector<std::string>&& args) { in ParseGroup() argument
160 auto gid = DecodeUid(args[1]); in ParseGroup()
162 return Error() << "Unable to decode GID for '" << args[1] << "': " << gid.error(); in ParseGroup()
166 for (std::size_t n = 2; n < args.size(); n++) { in ParseGroup()
167 gid = DecodeUid(args[n]); in ParseGroup()
169 return Error() << "Unable to decode GID for '" << args[n] << "': " << gid.error(); in ParseGroup()
176 Result<void> ServiceParser::ParsePriority(std::vector<std::string>&& args) { in ParsePriority() argument
178 if (!ParseInt(args[1], &service_->proc_attr_.priority, in ParsePriority()
187 Result<void> ServiceParser::ParseInterface(std::vector<std::string>&& args) { in ParseInterface() argument
188 const std::string& interface_name = args[1]; in ParseInterface()
189 const std::string& instance_name = args[2]; in ParseInterface()
222 Result<void> ServiceParser::ParseIoprio(std::vector<std::string>&& args) { in ParseIoprio() argument
223 if (!ParseInt(args[2], &service_->proc_attr_.ioprio_pri, 0, 7)) { in ParseIoprio()
227 if (args[1] == "rt") { in ParseIoprio()
229 } else if (args[1] == "be") { in ParseIoprio()
231 } else if (args[1] == "idle") { in ParseIoprio()
240 Result<void> ServiceParser::ParseKeycodes(std::vector<std::string>&& args) { in ParseKeycodes() argument
241 auto it = args.begin() + 1; in ParseKeycodes()
242 if (args.size() == 2 && StartsWith(args[1], "$")) { in ParseKeycodes()
243 auto expanded = ExpandProps(args[1]); in ParseKeycodes()
254 args = Split(*expanded, ","); in ParseKeycodes()
255 it = args.begin(); in ParseKeycodes()
258 for (; it != args.end(); ++it) { in ParseKeycodes()
274 Result<void> ServiceParser::ParseOneshot(std::vector<std::string>&& args) { in ParseOneshot() argument
279 Result<void> ServiceParser::ParseOnrestart(std::vector<std::string>&& args) { in ParseOnrestart() argument
280 args.erase(args.begin()); in ParseOnrestart()
282 if (auto result = service_->onrestart_.AddCommand(std::move(args), line); !result.ok()) { in ParseOnrestart()
288 Result<void> ServiceParser::ParseNamespace(std::vector<std::string>&& args) { in ParseNamespace() argument
289 for (size_t i = 1; i < args.size(); i++) { in ParseNamespace()
290 if (args[i] == "pid") { in ParseNamespace()
294 } else if (args[i] == "mnt") { in ParseNamespace()
303 Result<void> ServiceParser::ParseOomScoreAdjust(std::vector<std::string>&& args) { in ParseOomScoreAdjust() argument
304 if (!ParseInt(args[1], &service_->oom_score_adjust_, MIN_OOM_SCORE_ADJUST, in ParseOomScoreAdjust()
312 Result<void> ServiceParser::ParseOverride(std::vector<std::string>&& args) { in ParseOverride() argument
317 Result<void> ServiceParser::ParseMemcgSwappiness(std::vector<std::string>&& args) { in ParseMemcgSwappiness() argument
318 if (!ParseInt(args[1], &service_->swappiness_, 0)) { in ParseMemcgSwappiness()
324 Result<void> ServiceParser::ParseMemcgLimitInBytes(std::vector<std::string>&& args) { in ParseMemcgLimitInBytes() argument
325 if (!ParseInt(args[1], &service_->limit_in_bytes_, 0)) { in ParseMemcgLimitInBytes()
331 Result<void> ServiceParser::ParseMemcgLimitPercent(std::vector<std::string>&& args) { in ParseMemcgLimitPercent() argument
332 if (!ParseInt(args[1], &service_->limit_percent_, 0)) { in ParseMemcgLimitPercent()
338 Result<void> ServiceParser::ParseMemcgLimitProperty(std::vector<std::string>&& args) { in ParseMemcgLimitProperty() argument
339 service_->limit_property_ = std::move(args[1]); in ParseMemcgLimitProperty()
343 Result<void> ServiceParser::ParseMemcgSoftLimitInBytes(std::vector<std::string>&& args) { in ParseMemcgSoftLimitInBytes() argument
344 if (!ParseInt(args[1], &service_->soft_limit_in_bytes_, 0)) { in ParseMemcgSoftLimitInBytes()
350 Result<void> ServiceParser::ParseProcessRlimit(std::vector<std::string>&& args) { in ParseProcessRlimit() argument
351 auto rlimit = ParseRlimit(args); in ParseProcessRlimit()
358 Result<void> ServiceParser::ParseRebootOnFailure(std::vector<std::string>&& args) { in ParseRebootOnFailure() argument
362 if (!StartsWith(args[1], "shutdown") && !StartsWith(args[1], "reboot")) { in ParseRebootOnFailure()
366 service_->on_failure_reboot_target_ = std::move(args[1]); in ParseRebootOnFailure()
370 Result<void> ServiceParser::ParseRestartPeriod(std::vector<std::string>&& args) { in ParseRestartPeriod() argument
372 if (!ParseInt(args[1], &period, 5)) { in ParseRestartPeriod()
379 Result<void> ServiceParser::ParseSeclabel(std::vector<std::string>&& args) { in ParseSeclabel() argument
380 service_->seclabel_ = std::move(args[1]); in ParseSeclabel()
384 Result<void> ServiceParser::ParseSigstop(std::vector<std::string>&& args) { in ParseSigstop() argument
389 Result<void> ServiceParser::ParseSetenv(std::vector<std::string>&& args) { in ParseSetenv() argument
390 service_->environment_vars_.emplace_back(std::move(args[1]), std::move(args[2])); in ParseSetenv()
394 Result<void> ServiceParser::ParseShutdown(std::vector<std::string>&& args) { in ParseShutdown() argument
395 if (args[1] == "critical") { in ParseShutdown()
402 Result<void> ServiceParser::ParseTaskProfiles(std::vector<std::string>&& args) { in ParseTaskProfiles() argument
403 args.erase(args.begin()); in ParseTaskProfiles()
405 service_->task_profiles_ = std::move(args); in ParseTaskProfiles()
409 std::make_move_iterator(args.begin()), in ParseTaskProfiles()
410 std::make_move_iterator(args.end())); in ParseTaskProfiles()
411 args.clear(); in ParseTaskProfiles()
416 Result<void> ServiceParser::ParseTimeoutPeriod(std::vector<std::string>&& args) { in ParseTimeoutPeriod() argument
418 if (!ParseInt(args[1], &period, 1)) { in ParseTimeoutPeriod()
426 Result<void> ServiceParser::ParseSocket(std::vector<std::string>&& args) { in ParseSocket() argument
428 socket.name = std::move(args[1]); in ParseSocket()
430 auto types = Split(args[2], "+"); in ParseSocket()
455 socket.perm = strtol(args[3].c_str(), &end, 8); in ParseSocket()
457 return ErrnoError() << "Unable to parse permissions '" << args[3] << "'"; in ParseSocket()
459 if (end == args[3].c_str() || *end != '\0') { in ParseSocket()
461 return ErrnoError() << "Unable to parse permissions '" << args[3] << "'"; in ParseSocket()
464 if (args.size() > 4) { in ParseSocket()
465 auto uid = DecodeUid(args[4]); in ParseSocket()
467 return Error() << "Unable to find UID for '" << args[4] << "': " << uid.error(); in ParseSocket()
472 if (args.size() > 5) { in ParseSocket()
473 auto gid = DecodeUid(args[5]); in ParseSocket()
475 return Error() << "Unable to find GID for '" << args[5] << "': " << gid.error(); in ParseSocket()
480 socket.context = args.size() > 6 ? args[6] : ""; in ParseSocket()
494 Result<void> ServiceParser::ParseStdioToKmsg(std::vector<std::string>&& args) { in ParseStdioToKmsg() argument
503 Result<void> ServiceParser::ParseFile(std::vector<std::string>&& args) { in ParseFile() argument
504 if (args[2] != "r" && args[2] != "w" && args[2] != "rw") { in ParseFile()
509 file.type = args[2]; in ParseFile()
511 auto file_name = ExpandProps(args[1]); in ParseFile()
532 Result<void> ServiceParser::ParseUser(std::vector<std::string>&& args) { in ParseUser() argument
533 auto uid = DecodeUid(args[1]); in ParseUser()
535 return Error() << "Unable to find UID for '" << args[1] << "': " << uid.error(); in ParseUser()
558 Result<void> ServiceParser::ParseWritepid(std::vector<std::string>&& args) { in ParseWritepid() argument
559 args.erase(args.begin()); in ParseWritepid()
561 for (auto iter = args.begin(); iter != args.end();) { in ParseWritepid()
567 iter = args.erase(iter); in ParseWritepid()
572 service_->writepid_files_ = std::move(args); in ParseWritepid()
576 Result<void> ServiceParser::ParseUpdatable(std::vector<std::string>&& args) { in ParseUpdatable() argument
628 Result<void> ServiceParser::ParseSection(std::vector<std::string>&& args, in ParseSection() argument
630 if (args.size() < 3) { in ParseSection()
634 const std::string& name = args[1]; in ParseSection()
646 std::vector<std::string> str_args(args.begin() + 2, args.end()); in ParseSection()
663 Result<void> ServiceParser::ParseLineSection(std::vector<std::string>&& args, int line) { in ParseLineSection() argument
668 auto parser = GetParserMap().Find(args); in ParseLineSection()
672 return std::invoke(*parser, this, std::move(args)); in ParseLineSection()