/rust/registry/src/index.crates.io-6f17d22bba15001f/rustix-0.37.13/src/param/auxv.rs
Line | Count | Source (jump to first uncovered line) |
1 | | use crate::backend; |
2 | | #[cfg(any( |
3 | | linux_raw, |
4 | | all( |
5 | | libc, |
6 | | any( |
7 | | all(target_os = "android", target_pointer_width = "64"), |
8 | | target_os = "linux", |
9 | | ) |
10 | | ) |
11 | | ))] |
12 | | use crate::ffi::CStr; |
13 | | |
14 | | /// `sysconf(_SC_PAGESIZE)`—Returns the process' page size. |
15 | | /// |
16 | | /// Also known as `getpagesize`. |
17 | | /// |
18 | | /// # References |
19 | | /// - [POSIX] |
20 | | /// - [Linux `sysconf`] |
21 | | /// - [Linux `getpagesize`] |
22 | | /// |
23 | | /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html |
24 | | /// [Linux `sysconf`]: https://man7.org/linux/man-pages/man3/sysconf.3.html |
25 | | /// [Linux `getpagesize`]: https://man7.org/linux/man-pages/man2/getpagesize.2.html |
26 | | #[inline] |
27 | | #[doc(alias = "_SC_PAGESIZE")] |
28 | | #[doc(alias = "_SC_PAGE_SIZE")] |
29 | | #[doc(alias = "getpagesize")] |
30 | 0 | pub fn page_size() -> usize { |
31 | 0 | backend::param::auxv::page_size() |
32 | 0 | } Unexecuted instantiation: rustix::param::auxv::page_size Unexecuted instantiation: rustix::param::auxv::page_size Unexecuted instantiation: rustix::param::auxv::page_size Unexecuted instantiation: rustix::param::auxv::page_size |
33 | | |
34 | | /// `sysconf(_SC_CLK_TCK)`—Returns the process' clock ticks per second. |
35 | | /// |
36 | | /// # References |
37 | | /// - [POSIX] |
38 | | /// - [Linux] |
39 | | /// |
40 | | /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html |
41 | | /// [Linux]: https://man7.org/linux/man-pages/man3/sysconf.3.html |
42 | | #[cfg(not(target_os = "wasi"))] |
43 | | #[inline] |
44 | | #[doc(alias = "_SC_CLK_TCK")] |
45 | 0 | pub fn clock_ticks_per_second() -> u64 { |
46 | 0 | backend::param::auxv::clock_ticks_per_second() |
47 | 0 | } |
48 | | |
49 | | /// `(getauxval(AT_HWCAP), getauxval(AT_HWCAP2)`—Returns the Linux "hwcap" |
50 | | /// data. |
51 | | /// |
52 | | /// Return the Linux `AT_HWCAP` and `AT_HWCAP2` values passed to the |
53 | | /// current process. Returns 0 for each value if it is not available. |
54 | | /// |
55 | | /// # References |
56 | | /// - [Linux] |
57 | | /// |
58 | | /// [Linux]: https://man7.org/linux/man-pages/man3/getauxval.3.html |
59 | | #[cfg(any( |
60 | | linux_raw, |
61 | | all( |
62 | | libc, |
63 | | any( |
64 | | all(target_os = "android", target_pointer_width = "64"), |
65 | | target_os = "linux", |
66 | | ) |
67 | | ) |
68 | | ))] |
69 | | #[inline] |
70 | 0 | pub fn linux_hwcap() -> (usize, usize) { |
71 | 0 | backend::param::auxv::linux_hwcap() |
72 | 0 | } |
73 | | |
74 | | /// `getauxval(AT_EXECFN)`—Returns the Linux "execfn" string. |
75 | | /// |
76 | | /// Return the string that Linux has recorded as the filesystem path to the |
77 | | /// executable. Returns an empty string if the string is not available. |
78 | | /// |
79 | | /// # References |
80 | | /// - [Linux] |
81 | | /// |
82 | | /// [Linux]: https://man7.org/linux/man-pages/man3/getauxval.3.html |
83 | | #[cfg(any( |
84 | | linux_raw, |
85 | | all( |
86 | | libc, |
87 | | any( |
88 | | all(target_os = "android", target_pointer_width = "64"), |
89 | | target_os = "linux", |
90 | | ) |
91 | | ) |
92 | | ))] |
93 | | #[inline] |
94 | 0 | pub fn linux_execfn() -> &'static CStr { |
95 | 0 | backend::param::auxv::linux_execfn() |
96 | 0 | } |