| 2844 | |
| 2845 | |
| 2846 | Try<vector<Entry>> list( |
| 2847 | const string& hierarchy, |
| 2848 | const string& cgroup) |
| 2849 | { |
| 2850 | Try<string> read = cgroups::read(hierarchy, cgroup, "devices.list"); |
| 2851 | |
| 2852 | if (read.isError()) { |
| 2853 | return Error("Failed to read from 'devices.list': " + read.error()); |
| 2854 | } |
| 2855 | |
| 2856 | vector<Entry> entries; |
| 2857 | |
| 2858 | foreach (const string& s, strings::tokenize(read.get(), "\n")) { |
| 2859 | Try<Entry> entry = Entry::parse(s); |
| 2860 | |
| 2861 | if (entry.isError()) { |
| 2862 | return Error("Failed to parse device entry '" + s + "'" |
| 2863 | " from 'devices.list': " + entry.error()); |
| 2864 | } |
| 2865 | |
| 2866 | entries.push_back(entry.get()); |
| 2867 | } |
| 2868 | |
| 2869 | return entries; |
| 2870 | } |
| 2871 | |
| 2872 | |
| 2873 | Try<Nothing> allow( |