linux-support 0.0.25

Comprehensive Linux support for namespaces, cgroups, processes, scheduling, parsing /proc, parsing /sys, signals, hyper threads, CPUS, NUMA nodes, unusual file descriptors, PCI devices and much, much more
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
// This file is part of linux-support. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-support/master/COPYRIGHT. No part of linux-support, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
// Copyright © 2020 The developers of linux-support. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-support/master/COPYRIGHT.


/// A version 2 non-root cgroup.
///
/// See <https://www.kernel.org/doc/Documentation/cgroup-v2.txt>.
///
/// By convention, a leaf non-root cgroup is called `leaf` but this is not enforced.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum NonRootCgroup
{
	#[allow(missing_docs)]
	ChildOfRoot
	{
		/// Folder name.
		name: CgroupName,
	},
	
	#[allow(missing_docs)]
	ChildOfAChild
	{
		/// Parent.
		parent: Rc<NonRootCgroup>,
		
		/// Folder name.
		name: CgroupName,
	}
}

impl Cgroup for NonRootCgroup
{
	#[inline(always)]
	fn to_path<'b>(&self, mount_point: &'b CgroupMountPoint) -> Cow<'b, Path>
	{
		use self::NonRootCgroup::*;
		
		let path = match self
		{
			&ChildOfRoot { ref name} => RootCgroup.to_owned_path(mount_point).append(name),
			&ChildOfAChild { ref name, ref parent } => parent.to_owned_path(mount_point).append(name),
		};
		Cow::Owned(path)
	}
	
	#[inline(always)]
	fn child(self: Rc<Self>, name: CgroupName) -> Rc<Self>
	{
		Rc::new(NonRootCgroup::ChildOfAChild { parent: self, name })
	}
}

impl NonRootCgroup
{
	/// Name.
	#[inline(always)]
	pub fn name(&self) -> &CgroupName
	{
		use self::NonRootCgroup::*;
		
		match self
		{
			&ChildOfRoot { ref name} => name,
			
			&ChildOfAChild { ref name, .. } => name,
		}
	}
	
	/// Creates, including parent cgroups, if does not already exist.
	///
	/// Short-circuits creation if already exists (to avoid permission failures).
	#[inline(always)]
	pub fn create(&self, mount_point: &CgroupMountPoint) -> io::Result<()>
	{
		let folder_path = self.to_path(mount_point);
		
		if folder_path.exists()
		{
			return Ok(())
		}
		
		create_dir_all(&folder_path)
	}
	
	/// Removes, excluding parent cgroups, if exists.
	///
	/// Short-circuits creation if does not exist (to avoid permission failures).
	pub fn remove(&self, mount_point: &CgroupMountPoint) -> io::Result<()>
	{
		let folder_path = self.to_path(mount_point);
		
		if !folder_path.exists()
		{
			return Ok(())
		}
		
		remove_dir(&folder_path)
	}

	/// Read type.
	#[inline(always)]
	pub fn read_type(&self, mount_point: &CgroupMountPoint) -> io::Result<NonRootCgroupType>
	{
		self.cgroup_type_file_path(mount_point).read_value()
	}
	
	/// Write type.
	#[inline(always)]
	pub fn make_type_threaded(&self, mount_point: &CgroupMountPoint) -> io::Result<()>
	{
		let path = self.cgroup_type_file_path(mount_point);
		path.write_value(b"threaded\n" as &[u8])
	}
	
	/// Freeze the cgroup.
	///
	/// All processes in this and every descendant cgroup, will be stopped not run until the cgroup is be explicitly thawed.
	#[inline(always)]
	pub fn freeze(&self, mount_point: &CgroupMountPoint) -> io::Result<()>
	{
		self.cgroup_freeze_file_path(mount_point).write_value(true)
	}
	
	/// Thaw the cgroup.
	///
	/// All processes in this and every descendant cgroup, will be run again.
	#[inline(always)]
	pub fn thaw(&self, mount_point: &CgroupMountPoint) -> io::Result<()>
	{
		self.cgroup_freeze_file_path(mount_point).write_value(false)
	}
	
	/// Is this cgroup frozen?
	#[inline(always)]
	pub fn is_frozen(&self, mount_point: &CgroupMountPoint) -> io::Result<bool>
	{
		self.cgroup_freeze_file_path(mount_point).read_zero_or_one_bool()
	}

	/// Events.
	#[inline(always)]
	pub fn read_events(&self, mount_point: &CgroupMountPoint) -> Result<EventStatistics, StatisticsParseError>
	{
		EventStatistics::from_file(&self.cgroup_events_file_path(mount_point))
	}

	/// Events file descriptor for epoll.
	///
	/// Caller must close this file descriptor.
	#[inline(always)]
	pub fn events_file_descriptor_for_epoll(&self, mount_point: &CgroupMountPoint) -> io::Result<RawFd>
	{
		let file: File = File::open(self.cgroup_events_file_path(mount_point))?;
		Ok(file.into_raw_fd())
	}
	
	/// Only works if the `cpu` controller is enabled.
	#[inline(always)]
	pub fn read_cpu_weight(&self, mount_point: &CgroupMountPoint) -> io::Result<Option<CpuWeight>>
	{
		self.cpu_weight_file_path(mount_point).read_value_if_exists()
	}
	
	/// Only works if the `cpu` controller is enabled.
	///
	/// Does not check that the `cpu` controller is enabled.
	#[inline(always)]
	pub fn write_cpu_weight(&self, mount_point: &CgroupMountPoint, cpu_weight: CpuWeight) -> io::Result<()>
	{
		self.cpu_weight_file_path(mount_point).write_value(cpu_weight)
	}
	
	/// Only works if the `cpu` controller is enabled.
	///
	/// Prefer the used of `read_cpu_weight().`
	#[inline(always)]
	pub fn read_cpu_weight_nice(&self, mount_point: &CgroupMountPoint) -> io::Result<Option<Nice>>
	{
		self.cpu_weight_nice_file_path(mount_point).read_value_if_exists()
	}
	
	/// Only works if the `cpu` controller is enabled.
	///
	/// Does not check that the `cpu` controller is enabled.
	///
	/// Prefer the used of `write_cpu_weight().`
	#[inline(always)]
	pub fn write_cpu_weight_nice(&self, mount_point: &CgroupMountPoint, nice: Nice) -> io::Result<()>
	{
		self.cpu_weight_nice_file_path(mount_point).write_value(nice)
	}
	
	/// Only works if the `cpu` controller is enabled.
	#[inline(always)]
	pub fn read_cpu_maximum_bandwidth_limit(&self, mount_point: &CgroupMountPoint) -> io::Result<Option<CpuMaximumBandwidthLimit>>
	{
		self.cpu_max_file_path(mount_point).read_value_if_exists()
	}
	
	/// Only works if the `cpu` controller is enabled.
	///
	/// Does not check that the `cpu` controller is enabled.
	#[inline(always)]
	pub fn write_cpu_maximum_bandwidth_limit(&self, mount_point: &CgroupMountPoint, cpu_maximum_bandwidth_limit: CpuMaximumBandwidthLimit) -> io::Result<()>
	{
		self.cpu_max_file_path(mount_point).write_value(cpu_maximum_bandwidth_limit)
	}
	
	/// Only works if the `cpuset` controller is enabled.
	pub fn read_cpuset_hyper_threads(&self, mount_point: &CgroupMountPoint) -> io::Result<Option<HyperThreads>>
	{
		self.cpuset_cpus_file_path(mount_point).read_hyper_thread_or_numa_node_list_if_exists().map(|option| option.map(HyperThreads))
	}
	
	/// Only works if the `cpuset` controller is enabled.
	///
	/// Does a cursory check that the `cpuset` controller is enabled (but is subject to a TOCTOU flaw).
	pub fn write_cpuset_hyper_threads(&self, mount_point: &CgroupMountPoint, hyper_threads: &HyperThreads) -> io::Result<()>
	{
		hyper_threads.set_affinity_list(self.cpuset_cpus_file_path(mount_point))
	}
	
	/// Only works if the `cpuset` controller is enabled.
	pub fn read_cpuset_numa_nodes(&self, mount_point: &CgroupMountPoint) -> io::Result<Option<NumaNodes>>
	{
		self.cpuset_mems_file_path(mount_point).read_hyper_thread_or_numa_node_list_if_exists().map(|option| option.map(NumaNodes))
	}
	
	/// Only works if the `cpuset` controller is enabled.
	///
	/// Does a cursory check that the `cpuset` controller is enabled (but is subject to a TOCTOU flaw).
	pub fn write_cpuset_numa_nodes(&self, mount_point: &CgroupMountPoint, numa_nodes: &NumaNodes) -> io::Result<()>
	{
		numa_nodes.set_affinity_list(self.cpuset_mems_file_path(mount_point))
	}
	
	/// Only works if the `cpuset` controller is enabled.
	#[inline(always)]
	pub fn read_cpuset_hyper_threads_partition(&self, mount_point: &CgroupMountPoint) -> io::Result<Option<ReadPartition>>
	{
		self.cpuset_cpus_partition_file_path(mount_point).read_value_if_exists()
	}
	
	/// Only works if the `cpuset` controller is enabled.
	///
	/// Setting a cgroup to `Partition::Root` will take the CPUs away from the effective CPUs of the parent cgroup.
	/// Once it is set, this file cannot be reverted back to `Partition::NonRootMember` if there are any child cgroups with cpuset enabled.
	///
	/// A parent partition cannot distribute all its CPUs to its child partitions
	/// There must be at least one cpu left in the parent partition.
	///
	/// There are constraints on where a `Partition::Root` can be set.
	///
	/// It can only be set in a cgroup if all the following conditions are true:-
	///
	/// * The `cpuset.cpus` file is not empty and the list of CPUs are exclusive, ie they are not shared by any of its siblings.
	/// * The parent cgroup is a partition root.
	/// * The `cpuset.cpus` file is also a proper subset of the parent’s `cpuset.cpus.effective`.
	/// * There is no child cgroups with cpuset enabled. This is for eliminating corner cases that have to be handled if such a condition is allowed.
	#[inline(always)]
	pub fn write_cpuset_hyper_threads_partition(&self, mount_point: &CgroupMountPoint, partition: Partition) -> io::Result<()>
	{
		self.cpuset_cpus_partition_file_path(mount_point).write_value(partition)
	}
	
	/// Only works if the `hugetlb` controller is enabled and the page size exists on the architecture.
	#[inline(always)]
	pub fn read_hugetlb_current(&self, mount_point: &CgroupMountPoint, huge_page_size: HugePageSize) -> io::Result<Option<usize>>
	{
		self.hugetlb_current_file_path(mount_point, huge_page_size).read_value_if_exists()
	}
	
	/// Only works if the `hugetlb` controller is enabled and the page size exists on the architecture.
	#[inline(always)]
	pub fn read_hugetlb_maximum(&self, mount_point: &CgroupMountPoint, huge_page_size: HugePageSize) -> io::Result<Option<MaximumNumber<usize>>>
	{
		self.hugetlb_max_file_path(mount_point, huge_page_size).read_value_if_exists()
	}
	
	/// Only works if the `hugetlb` controller is enabled and the page size exists on the architecture.
	#[inline(always)]
	pub fn write_hugetlb_maximum(&self, mount_point: &CgroupMountPoint, huge_page_size: HugePageSize, maximum: MaximumNumber<usize>) -> io::Result<()>
	{
		self.hugetlb_max_file_path(mount_point, huge_page_size).write_value(maximum)
	}
	
	/// Only works if the `hugetlb` controller is enabled and the page size exists on the architecture.
	#[inline(always)]
	pub fn read_hugetlb_reserved_current(&self, mount_point: &CgroupMountPoint, huge_page_size: HugePageSize) -> io::Result<Option<usize>>
	{
		self.hugetlb_rsvd_current_file_path(mount_point, huge_page_size).read_value_if_exists()
	}
	
	/// Only works if the `hugetlb` controller is enabled and the page size exists on the architecture.
	#[inline(always)]
	pub fn read_hugetlb_reserved_maximum(&self, mount_point: &CgroupMountPoint, huge_page_size: HugePageSize) -> io::Result<Option<MaximumNumber<usize>>>
	{
		self.hugetlb_rsvd_max_file_path(mount_point, huge_page_size).read_value_if_exists()
	}
	
	/// Only works if the `hugetlb` controller is enabled and the page size exists on the architecture.
	#[inline(always)]
	pub fn write_hugetlb_reserved_maximum(&self, mount_point: &CgroupMountPoint, huge_page_size: HugePageSize, maximum: MaximumNumber<usize>) -> io::Result<()>
	{
		self.hugetlb_rsvd_max_file_path(mount_point, huge_page_size).write_value(maximum)
	}
	
	/// Only works if the `hugetlb` controller is enabled and the page size exists on the architecture.
	#[inline(always)]
	pub fn read_hugetlb_events(&self, mount_point: &CgroupMountPoint, huge_page_size: HugePageSize) -> Result<HugetlbEventStatistics, StatisticsParseError>
	{
		let path = self.hugetlb_events_file_path(mount_point, huge_page_size);
		HugetlbEventStatistics::from_file(&path)
	}
	
	/// Only works if the `hugetlb` controller is enabled and the page size exists on the architecture.
	#[inline(always)]
	pub fn read_hugetlb_events_local(&self, mount_point: &CgroupMountPoint, huge_page_size: HugePageSize) -> Result<HugetlbEventStatistics, StatisticsParseError>
	{
		let path = self.hugetlb_events_local_file_path(mount_point, huge_page_size);
		HugetlbEventStatistics::from_file(&path)
	}
	
	/// Only works if the `memory` controller is enabled.
	#[inline(always)]
	pub fn read_memory_current(&self, mount_point: &CgroupMountPoint) -> io::Result<Option<u64>>
	{
		self.memory_current_file_path(mount_point).read_value_if_exists()
	}
	
	/// Only works if the `memory` controller is enabled.
	#[inline(always)]
	pub fn read_memory_minimum(&self, mount_point: &CgroupMountPoint) -> io::Result<Option<u64>>
	{
		self.memory_min_file_path(mount_point).read_value_if_exists()
	}
	
	/// Only works if the `memory` controller is enabled.
	///
	/// Does not check that the `memory` controller is enabled.
	#[inline(always)]
	pub fn write_memory_minimum(&self, mount_point: &CgroupMountPoint, minimum: u64) -> io::Result<()>
	{
		self.memory_min_file_path(mount_point).write_value(UnpaddedDecimalInteger(minimum))
	}
	
	/// Only works if the `memory` controller is enabled.
	#[inline(always)]
	pub fn read_memory_low(&self, mount_point: &CgroupMountPoint) -> io::Result<Option<u64>>
	{
		self.memory_low_file_path(mount_point).read_value_if_exists()
	}
	
	/// Only works if the `memory` controller is enabled.
	///
	/// Does not check that the `memory` controller is enabled.
	#[inline(always)]
	pub fn write_memory_low(&self, mount_point: &CgroupMountPoint, low: u64) -> io::Result<()>
	{
		self.memory_low_file_path(mount_point).write_value(UnpaddedDecimalInteger(low))
	}
	
	/// Only works if the `memory` controller is enabled.
	#[inline(always)]
	pub fn read_memory_high(&self, mount_point: &CgroupMountPoint) -> io::Result<Option<MaximumNumber<u64>>>
	{
		self.memory_high_file_path(mount_point).read_value_if_exists()
	}
	
	/// Only works if the `memory` controller is enabled.
	///
	/// Does not check that the `memory` controller is enabled.
	#[inline(always)]
	pub fn write_memory_high(&self, mount_point: &CgroupMountPoint, high: MaximumNumber<u64>) -> io::Result<()>
	{
		self.memory_high_file_path(mount_point).write_value(high)
	}
	
	/// Only works if the `memory` controller is enabled.
	#[inline(always)]
	pub fn read_memory_maximum(&self, mount_point: &CgroupMountPoint) -> io::Result<Option<MaximumNumber<u64>>>
	{
		self.memory_max_file_path(mount_point).read_value_if_exists()
	}
	
	/// Only works if the `memory` controller is enabled.
	///i
	/// Does not check that the `memory` controller is enabled.
	#[inline(always)]
	pub fn write_memory_maximum(&self, mount_point: &CgroupMountPoint, maximum: MaximumNumber<u64>) -> io::Result<()>
	{
		self.memory_max_file_path(mount_point).write_value(maximum)
	}
	
	/// Only works if the `memory` controller is enabled.
	#[inline(always)]
	pub fn read_memory_events(&self, mount_point: &CgroupMountPoint) -> Result<MemoryEventStatistics, StatisticsParseError>
	{
		let path = self.memory_events_file_path(mount_point);
		MemoryEventStatistics::from_file(&path)
	}
	
	/// Only works if the `memory` controller is enabled.
	#[inline(always)]
	pub fn read_memory_events_local(&self, mount_point: &CgroupMountPoint) -> Result<MemoryEventStatistics, StatisticsParseError>
	{
		let path = self.memory_events_local_file_path(mount_point);
		MemoryEventStatistics::from_file(&path)
	}
	
	/// Only works if the `memory` controller is enabled.
	#[inline(always)]
	pub fn read_memory_statistics(&self, mount_point: &CgroupMountPoint) -> Result<MemoryStatistics, StatisticsParseError>
	{
		let path = self.memory_stat_file_path(mount_point);
		MemoryStatistics::from_file(&path)
	}
	
	/// Only works if the `memory` controller is enabled.
	#[inline(always)]
	pub fn read_memory_swap_current(&self, mount_point: &CgroupMountPoint) -> io::Result<Option<u64>>
	{
		self.memory_swap_current_file_path(mount_point).read_value_if_exists()
	}
	
	/// Only works if the `memory` controller is enabled.
	#[inline(always)]
	pub fn read_memory_swap_maximum(&self, mount_point: &CgroupMountPoint) -> io::Result<Option<MaximumNumber<u64>>>
	{
		self.memory_swap_max_file_path(mount_point).read_value_if_exists()
	}
	
	/// Only works if the `memory` controller is enabled.
	///i
	/// Does not check that the `memory` controller is enabled.
	#[inline(always)]
	pub fn write_memory_swap_maximum(&self, mount_point: &CgroupMountPoint, maximum: MaximumNumber<u64>) -> io::Result<()>
	{
		self.memory_swap_max_file_path(mount_point).write_value(maximum)
	}
	
	/// Only works if the `memory` controller is enabled.
	#[inline(always)]
	pub fn read_memory_swap_events(&self, mount_point: &CgroupMountPoint) -> Result<MemorySwapEventStatistics, StatisticsParseError>
	{
		let path = self.memory_swap_events_file_path(mount_point);
		MemorySwapEventStatistics::from_file(&path)
	}
	
	/// Only works if the `pids` controller is enabled.
	#[inline(always)]
	pub fn read_process_identifiers_count_current(&self, mount_point: &CgroupMountPoint) -> io::Result<Option<usize>>
	{
		self.pids_current_file_path(mount_point).read_value_if_exists()
	}
	
	/// Only works if the `pids` controller is enabled.
	#[inline(always)]
	pub fn read_process_identifiers_count_maximum(&self, mount_point: &CgroupMountPoint) -> io::Result<Option<ProcessIdentifiersMaximum>>
	{
		self.pids_max_file_path(mount_point).read_value_if_exists()
	}
	
	/// Only works if the `pids` controller is enabled.
	#[inline(always)]
	pub fn read_process_identifiers_events(&self, mount_point: &CgroupMountPoint) -> Result<ProcessIdentifiersEventStatistics, StatisticsParseError>
	{
		let path = self.pids_events_file_path(mount_point);
		ProcessIdentifiersEventStatistics::from_file(&path)
	}
	
	/// Only works if the `pids` controller is enabled.
	///
	/// Does not check that the `pids` controller is enabled.
	#[inline(always)]
	pub fn write_process_identifiers_count_maximum(&self, mount_point: &CgroupMountPoint, maximum: ProcessIdentifiersMaximum) -> io::Result<()>
	{
		self.pids_max_file_path(mount_point).write_value(maximum)
	}
	
	/// Only works if the `rdma` controller is enabled.
	#[inline(always)]
	pub fn read_rdma_current(&self, mount_point: &CgroupMountPoint) -> Result<RdmaFile, RdmaParseError>
	{
		let file_path = self.rdma_current_file_path(mount_point);
		RdmaFile::from_file(&file_path)
	}
	
	/// Only works if the `rdma` controller is enabled.
	#[inline(always)]
	pub fn read_rdma_maximum(&self, mount_point: &CgroupMountPoint) -> Result<RdmaFile, RdmaParseError>
	{
		let file_path = self.rdma_max_file_path(mount_point);
		RdmaFile::from_file(&file_path)
	}
	
	/// Only works if the `rdma` controller is enabled.
	///i
	/// Does not check that the `rdma` controller is enabled.
	#[inline(always)]
	pub fn write_rdma_maximum(&self, mount_point: &CgroupMountPoint, maximum: &RdmaFile) -> io::Result<()>
	{
		maximum.to_file(&self.rdma_max_file_path(mount_point))
	}
	
	#[inline(always)]
	fn cgroup_events_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "cgroup.events")
	}
	
	#[inline(always)]
	fn cgroup_freeze_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "cgroup.freeze")
	}
	
	#[inline(always)]
	fn cgroup_type_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "cgroup.type")
	}

	#[inline(always)]
	fn cpu_weight_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "cpu.weight")
	}

	#[inline(always)]
	fn cpu_weight_nice_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "cpu.weight.nice")
	}

	#[inline(always)]
	fn cpu_max_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "cpu.max")
	}
	
	#[inline(always)]
	fn cpuset_cpus_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "cpuset.cpus")
	}
	
	#[inline(always)]
	fn cpuset_cpus_partition_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "cpuset.cpus.partition")
	}
	
	#[inline(always)]
	fn cpuset_mems_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "cpuset.mems")
	}
	
	#[inline(always)]
	fn hugetlb_current_file_path(&self, mount_point: &CgroupMountPoint, huge_page_size: HugePageSize) -> PathBuf
	{
		self.hugetlb_file_path(mount_point, huge_page_size, "current")
	}
	
	#[inline(always)]
	fn hugetlb_events_file_path(&self, mount_point: &CgroupMountPoint, huge_page_size: HugePageSize) -> PathBuf
	{
		self.hugetlb_file_path(mount_point, huge_page_size, "events")
	}
	
	#[inline(always)]
	fn hugetlb_events_local_file_path(&self, mount_point: &CgroupMountPoint, huge_page_size: HugePageSize) -> PathBuf
	{
		self.hugetlb_file_path(mount_point, huge_page_size, "events.local")
	}
	
	#[inline(always)]
	fn hugetlb_max_file_path(&self, mount_point: &CgroupMountPoint, huge_page_size: HugePageSize) -> PathBuf
	{
		self.hugetlb_file_path(mount_point, huge_page_size, "max")
	}
	
	#[inline(always)]
	fn hugetlb_rsvd_current_file_path(&self, mount_point: &CgroupMountPoint, huge_page_size: HugePageSize) -> PathBuf
	{
		self.hugetlb_file_path(mount_point, huge_page_size, "rsvd.current")
	}
	
	#[inline(always)]
	fn hugetlb_rsvd_max_file_path(&self, mount_point: &CgroupMountPoint, huge_page_size: HugePageSize) -> PathBuf
	{
		self.hugetlb_file_path(mount_point, huge_page_size, "rsvd.max")
	}
	
	#[inline(always)]
	fn hugetlb_file_path(&self, mount_point: &CgroupMountPoint, huge_page_size: HugePageSize, file_extension: &str) -> PathBuf
	{
		self.file_path(mount_point, &format!("hugetlb.{}.{}", huge_page_size.cgroup_file_name_fragment(), file_extension))
	}
	
	#[inline(always)]
	fn memory_current_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "memory.current")
	}
	
	#[inline(always)]
	fn memory_min_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "memory.min")
	}
	
	#[inline(always)]
	fn memory_low_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "memory.low")
	}
	
	#[inline(always)]
	fn memory_high_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "memory.high")
	}
	
	#[inline(always)]
	fn memory_max_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "memory.max")
	}
	
	#[inline(always)]
	fn memory_events_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "memory.events")
	}
	
	#[inline(always)]
	fn memory_events_local_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "memory.events.local")
	}
	
	#[inline(always)]
	fn memory_stat_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "memory.stat")
	}
	
	#[inline(always)]
	fn memory_swap_current_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "memory.swap.current")
	}
	
	#[inline(always)]
	fn memory_swap_max_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "memory.swap.max")
	}
	
	#[inline(always)]
	fn memory_swap_events_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "memory.swap.events")
	}
	
	#[inline(always)]
	fn pids_current_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "pids.current")
	}

	#[inline(always)]
	fn pids_events_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "pids.events")
	}

	#[inline(always)]
	fn pids_max_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "pids.max")
	}

	#[inline(always)]
	fn rdma_max_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "rdma.max")
	}
	
	#[inline(always)]
	fn rdma_current_file_path(&self, mount_point: &CgroupMountPoint) -> PathBuf
	{
		self.file_path(mount_point, "rdma.current")
	}

	#[inline(always)]
	fn file_path(&self, mount_point: &CgroupMountPoint, file_name: &str) -> PathBuf
	{
		self.to_path(mount_point).to_path_buf().append(file_name)
	}
}