7ac013de7e
Add a new service option, `rlimit` that allows a given rlimit to be set for a specific service instead of globally. Use the same parsing, now allowing text such as 'cpu' or 'rtprio' instead of relying on the enum value for the `setrlimit` builtin command as well. Bug: 63882119 Bug: 64894637 Test: boot bullhead, run a test app that attempts to set its rtprio to 95, see that the priority set fails normally but passes when `rlimit rtprio 99 99` is used as its service option. See that this fails when `rlimit rtprio 50 50` is used as well. Test: new unit tests Change-Id: I4a13ca20e8529937d8b4bc11718ffaaf77523a52
35 lines
941 B
C++
35 lines
941 B
C++
/*
|
|
* Copyright (C) 2017 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#ifndef _INIT_RLIMIT_PARSER_H
|
|
#define _INIT_RLIMIT_PARSER_H
|
|
|
|
#include <sys/resource.h>
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "result.h"
|
|
|
|
namespace android {
|
|
namespace init {
|
|
|
|
Result<std::pair<int, rlimit>> ParseRlimit(const std::vector<std::string>& args);
|
|
|
|
} // namespace init
|
|
} // namespace android
|
|
|
|
#endif
|