1#![cfg(feature = "agave-unstable-api")]
2#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]
3pub mod data_budget;
4pub mod deduper;
5pub mod packet;
6pub mod recycled_vec;
7pub mod recycler;
8pub mod sigverify;
9#[cfg(feature = "dev-context-only-utils")]
10pub mod test_tx;
11pub mod thread;
12
13#[macro_use]
14extern crate log;
15
16#[cfg(test)]
17extern crate assert_matches;
18
19#[macro_use]
20extern crate solana_metrics;
21
22#[cfg_attr(feature = "frozen-abi", macro_use)]
23#[cfg(feature = "frozen-abi")]
24extern crate solana_frozen_abi_macro;
25
26fn is_rosetta_emulated() -> bool {
27 #[cfg(target_os = "macos")]
28 {
29 use std::str::FromStr;
30 std::process::Command::new("sysctl")
31 .args(["-in", "sysctl.proc_translated"])
32 .output()
33 .map_err(|_| ())
34 .and_then(|output| String::from_utf8(output.stdout).map_err(|_| ()))
35 .and_then(|stdout| u8::from_str(stdout.trim()).map_err(|_| ()))
36 .map(|enabled| enabled == 1)
37 .unwrap_or(false)
38 }
39 #[cfg(not(target_os = "macos"))]
40 {
41 false
42 }
43}
44
45pub fn report_target_features() {
46 if !is_rosetta_emulated() {
50 #[cfg(all(
51 any(target_arch = "x86", target_arch = "x86_64"),
52 build_target_feature_avx
53 ))]
54 {
55 if is_x86_feature_detected!("avx") {
56 info!("AVX detected");
57 } else {
58 error!(
59 "Incompatible CPU detected: missing AVX support. Please build from source on \
60 the target"
61 );
62 std::process::abort();
63 }
64 }
65
66 #[cfg(all(
67 any(target_arch = "x86", target_arch = "x86_64"),
68 build_target_feature_avx2
69 ))]
70 {
71 if is_x86_feature_detected!("avx2") {
72 info!("AVX2 detected");
73 } else {
74 error!(
75 "Incompatible CPU detected: missing AVX2 support. Please build from source on \
76 the target"
77 );
78 std::process::abort();
79 }
80 }
81 }
82}