1 // Copyright 2019 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef SANDBOXED_API_SANDBOX2_UTIL_MAPS_PARSER_H_ 16 #define SANDBOXED_API_SANDBOX2_UTIL_MAPS_PARSER_H_ 17 18 #include <cstdint> 19 #include <string> 20 #include <vector> 21 22 #include "absl/status/statusor.h" 23 24 namespace sandbox2 { 25 26 struct MapsEntry { 27 uint64_t start; 28 uint64_t end; 29 bool is_readable; 30 bool is_writable; 31 bool is_executable; 32 bool is_shared; 33 uint64_t pgoff; 34 int major; 35 int minor; 36 uint64_t inode; 37 std::string path; 38 }; 39 40 absl::StatusOr<std::vector<MapsEntry>> ParseProcMaps( 41 const std::string& contents); 42 43 } // namespace sandbox2 44 45 #endif // SANDBOXED_API_SANDBOX2_UTIL_MAPS_PARSER_H_ 46