From 1b9ffcec7463bc767e55ddfddc77f8daea5f1c13 Mon Sep 17 00:00:00 2001 From: Langston Barrett Date: Wed, 12 Apr 2023 11:40:16 -0400 Subject: [PATCH] LibAFL: LLMP manager docstring cleanup (#1208) --- libafl/src/events/llmp.rs | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/libafl/src/events/llmp.rs b/libafl/src/events/llmp.rs index 89ae844363..0c589e139f 100644 --- a/libafl/src/events/llmp.rs +++ b/libafl/src/events/llmp.rs @@ -89,7 +89,7 @@ where SP: ShMemProvider + 'static, MT: Monitor, { - /// Create an even broker from a raw broker. + /// Create an event broker from a raw broker. pub fn new(llmp: llmp::LlmpBroker, monitor: MT) -> Result { Ok(Self { monitor, @@ -100,7 +100,8 @@ where }) } - /// Create llmp on a port + /// Create an LLMP broker on a port. + /// /// The port must not be bound yet to have a broker. #[cfg(feature = "std")] pub fn on_port(shmem_provider: SP, monitor: MT, port: u16) -> Result { @@ -118,7 +119,7 @@ where self.llmp.set_exit_cleanly_after(n_clients); } - /// Connect to an llmp broker on the givien address + /// Connect to an LLMP broker on the given address #[cfg(feature = "std")] pub fn connect_b2b(&mut self, addr: A) -> Result<(), Error> where @@ -308,14 +309,14 @@ where S: UsesInput, SP: ShMemProvider + 'static, { - /// The llmp client for inter process communication + /// The LLMP client for inter process communication llmp: LlmpClient, /// The custom buf handler custom_buf_handlers: Vec>>, #[cfg(feature = "llmp_compression")] compressor: GzipCompressor, /// The configuration defines this specific fuzzer. - /// A node will not re-use the observer values sent over `LLMP` + /// A node will not re-use the observer values sent over LLMP /// from nodes with other configurations. configuration: EventConfig, phantom: PhantomData, @@ -355,7 +356,7 @@ where S: UsesInput + HasExecutions + HasClientPerfMonitor, SP: ShMemProvider + 'static, { - /// Create a manager from a raw llmp client + /// Create a manager from a raw LLMP client pub fn new(llmp: LlmpClient, configuration: EventConfig) -> Result { Ok(Self { llmp, @@ -367,9 +368,10 @@ where }) } - /// Create llmp on a port - /// If the port is not yet bound, it will act as broker - /// Else, it will act as client. + /// Create an LLMP event manager on a port + /// + /// If the port is not yet bound, it will act as a broker; otherwise, it + /// will act as a client. #[cfg(feature = "std")] pub fn on_port( shmem_provider: SP, @@ -386,7 +388,8 @@ where }) } - /// If a client respawns, it may reuse the existing connection, previously stored by [`LlmpClient::to_env()`]. + /// If a client respawns, it may reuse the existing connection, previously + /// stored by [`LlmpClient::to_env()`]. #[cfg(feature = "std")] pub fn existing_client_from_env( shmem_provider: SP, @@ -403,7 +406,7 @@ where }) } - /// Describe the client event mgr's llmp parts in a restorable fashion + /// Describe the client event manager's LLMP parts in a restorable fashion pub fn describe(&self) -> Result { self.llmp.describe() } @@ -424,7 +427,8 @@ where }) } - /// Write the config for a client [`EventManager`] to env vars, a new client can reattach using [`LlmpEventManager::existing_client_from_env()`]. + /// Write the config for a client [`EventManager`] to env vars, a new + /// client can reattach using [`LlmpEventManager::existing_client_from_env()`]. #[cfg(feature = "std")] pub fn to_env(&self, env_name: &str) { self.llmp.to_env(env_name).unwrap(); @@ -556,8 +560,8 @@ where S: UsesInput, SP: ShMemProvider, { - /// The llmp client needs to wait until a broker mapped all pages, before shutting down. - /// Otherwise, the OS may already have removed the shared maps, + /// The LLMP client needs to wait until a broker has mapped all pages before shutting down. + /// Otherwise, the OS may already have removed the shared maps. fn await_restart_safe(&mut self) { // wait until we can drop the message safely. self.llmp.await_safe_to_unmap_blocking(); @@ -659,7 +663,7 @@ where SP: ShMemProvider + 'static, //CE: CustomEvent, { - /// The embedded llmp event manager + /// The embedded LLMP event manager llmp_mgr: LlmpEventManager, /// The staterestorer to serialize the state for the next runner staterestorer: StateRestorer, @@ -827,7 +831,7 @@ pub enum ManagerKind { Any, /// A client, getting messages from a local broker. Client { - /// The cpu core id of this client + /// The CPU core ID of this client cpu_core: Option, }, /// A [`llmp::LlmpBroker`], forwarding the packets of local clients. @@ -965,7 +969,7 @@ where )?; broker_things(event_broker, self.remote_broker_addr)?; - unreachable!("The broker may never return normally, only on Errors or when shutting down."); + unreachable!("The broker may never return normally, only on errors or when shutting down."); } ManagerKind::Client { cpu_core } => { // We are a client