Home | History | Annotate | Download | only in init

Lines Matching defs:args

132 static void ExpandArgs(const std::vector<std::string>& args, std::vector<char*>* strs) {
134 expanded_args.resize(args.size());
135 strs->push_back(const_cast<char*>(args[0].c_str()));
136 for (std::size_t i = 1; i < args.size(); ++i) {
137 if (!expand_props(args[i], &expanded_args[i])) {
138 LOG(FATAL) << args[0] << ": cannot expand '" << args[i] << "'";
153 Service::Service(const std::string& name, const std::vector<std::string>& args)
168 args_(args) {
175 const std::vector<std::string>& args)
192 args_(args) {
331 bool Service::ParseCapabilities(const std::vector<std::string>& args, std::string* err) {
344 for (size_t i = 1; i < args.size(); i++) {
345 const std::string& arg = args[i];
361 bool Service::ParseClass(const std::vector<std::string>& args, std::string* err) {
362 classnames_ = std::set<std::string>(args.begin() + 1, args.end());
366 bool Service::ParseConsole(const std::vector<std::string>& args, std::string* err) {
368 console_ = args.size() > 1 ? "/dev/" + args[1] : "";
372 bool Service::ParseCritical(const std::vector<std::string>& args, std::string* err) {
377 bool Service::ParseDisabled(const std::vector<std::string>& args, std::string* err) {
383 bool Service::ParseGroup(const std::vector<std::string>& args, std::string* err) {
384 gid_ = decode_uid(args[1].c_str());
385 for (std::size_t n = 2; n < args.size(); n++) {
386 supp_gids_.emplace_back(decode_uid(args[n].c_str()));
391 bool Service::ParsePriority(const std::vector<std::string>& args, std::string* err) {
393 if (!ParseInt(args[1], &priority_,
403 bool Service::ParseIoprio(const std::vector<std::string>& args, std::string* err) {
404 if (!ParseInt(args[2], &ioprio_pri_, 0, 7)) {
409 if (args[1] == "rt") {
411 } else if (args[1] == "be") {
413 } else if (args[1] == "idle") {
423 bool Service::ParseKeycodes(const std::vector<std::string>& args, std::string* err) {
424 for (std::size_t i = 1; i < args.size(); i++) {
426 if (ParseInt(args[i], &code)) {
429 LOG(WARNING) << "ignoring invalid keycode: " << args[i];
435 bool Service::ParseOneshot(const std::vector<std::string>& args, std::string* err) {
440 bool Service::ParseOnrestart(const std::vector<std::string>& args, std::string* err) {
441 std::vector<std::string> str_args(args.begin() + 1, args.end());
446 bool Service::ParseNamespace(const std::vector<std::string>& args, std::string* err) {
447 for (size_t i = 1; i < args.size(); i++) {
448 if (args[i] == "pid") {
452 } else if (args[i] == "mnt") {
462 bool Service::ParseOomScoreAdjust(const std::vector<std::string>& args, std::string* err) {
463 if (!ParseInt(args[1], &oom_score_adjust_, -1000, 1000)) {
470 bool Service::ParseSeclabel(const std::vector<std::string>& args, std::string* err) {
471 seclabel_ = args[1];
475 bool Service::ParseSetenv(const std::vector<std::string>& args, std::string* err) {
476 envvars_.emplace_back(args[1], args[2]);
481 bool Service::AddDescriptor(const std::vector<std::string>& args, std::string* err) {
482 int perm = args.size() > 3 ? std::strtoul(args[3].c_str(), 0, 8) : -1;
483 uid_t uid = args.size() > 4 ? decode_uid(args[4].c_str()) : 0;
484 gid_t gid = args.size() > 5 ? decode_uid(args[5].c_str()) : 0;
485 std::string context = args.size() > 6 ? args[6] : "";
487 auto descriptor = std::make_unique<T>(args[1], args[2], uid, gid, perm, context);
494 *err = "duplicate descriptor " + args[1] + " " + args[2];
503 bool Service::ParseSocket(const std::vector<std::string>& args, std::string* err) {
504 if (args[2] != "dgram" && args[2] != "stream" && args[2] != "seqpacket") {
508 return AddDescriptor<SocketInfo>(args, err);
512 bool Service::ParseFile(const std::vector<std::string>& args, std::string* err) {
513 if (args[2] != "r" && args[2] != "w" && args[2] != "rw") {
517 if ((args[1][0] != '/') || (args[1].find("../") != std::string::npos)) {
521 return AddDescriptor<FileInfo>(args, err);
524 bool Service::ParseUser(const std::vector<std::string>& args, std::string* err) {
525 uid_ = decode_uid(args[1].c_str());
529 bool Service::ParseWritepid(const std::vector<std::string>& args, std::string* err) {
530 writepid_files_.assign(args.begin() + 1, args.end());
572 bool Service::ParseLine(const std::vector<std::string>& args, std::string* err) {
573 if (args.empty()) {
579 auto parser = parser_map.FindFunction(args[0], args.size() - 1, err);
585 return (this->*parser)(args, err);
886 bool ServiceManager::Exec(const std::vector<std::string>& args) {
887 Service* svc = MakeExecOneshotService(args);
915 Service* ServiceManager::MakeExecOneshotService(const std::vector<std::string>& args) {
916 // Parse the arguments: exec [SECLABEL [UID [GID]*] --] COMMAND ARGS...
919 for (std::size_t i = 1; i < args.size(); ++i) {
920 if (args[i] == "--") {
930 if (command_arg >= args.size()) {
934 std::vector<std::string> str_args(args.begin() + command_arg, args.end());
943 if (command_arg > 2 && args[1] != "-") {
944 seclabel = args[1];
948 uid = decode_uid(args[2].c_str());
953 gid = decode_uid(args[3].c_str());
956 supp_gids.push_back(decode_uid(args[4 + i].c_str()));
1100 bool ServiceParser::ParseSection(const std::vector<std::string>& args,
1102 if (args.size() < 3) {
1107 const std::string& name = args[1];
1113 std::vector<std::string> str_args(args.begin() + 2, args.end());
1118 bool ServiceParser::ParseLineSection(const std::vector<std::string>& args,
1121 return service_ ? service_->ParseLine(args, err) : false;