refactor: deconsolidate redox.patch into individual patches
The 556MB monolithic redox.patch was impossible to manage, unreviewable, blocked GitHub pushes, and could only grow. This commit: - Moves all 64 absorbed patches from absorbed/ to active use in base/ - Removes the absorbed/ directory (consolidation history is now PATCH-HISTORY.md) - Removes the redox.patch symlink from recipes/core/base/ - Fixes all recipe symlinks to point to active patches (not absorbed/) - Patches are now individually wired, reviewable, and independently rebasable The redox.patch mega-file is no longer needed — individual patches are applied directly from the recipe.toml patches list.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
diff --git a/init/src/main.rs b/init/src/main.rs
|
||||
index 5682cf44..4501cf61 100644
|
||||
--- a/init/src/main.rs
|
||||
+++ b/init/src/main.rs
|
||||
@@ -178,7 +178,15 @@ fn main() {
|
||||
libredox::call::setrens(0, 0).expect("init: failed to enter null namespace");
|
||||
|
||||
loop {
|
||||
+ // Process any pending jobs whose dependencies may now be satisfied.
|
||||
+ scheduler.step(&mut unit_store, &mut init_config);
|
||||
+
|
||||
+ // Non-blocking wait: WNOHANG = 1. Reap any exited children without
|
||||
+ // blocking, then loop back to process any newly-unblocked pending jobs.
|
||||
let mut status = 0;
|
||||
- libredox::call::waitpid(0, &mut status, 0).unwrap();
|
||||
+ match libredox::call::waitpid(0, &mut status, 1) {
|
||||
+ Ok(_pid) => {}
|
||||
+ Err(err) => eprintln!("init: waitpid error: {err}"),
|
||||
+ }
|
||||
}
|
||||
}
|
||||
+1
-14
@@ -2,7 +2,7 @@ diff --git a/Cargo.toml b/Cargo.toml
|
||||
index 9e776232..380f8d85 100644
|
||||
--- a/Cargo.toml
|
||||
+++ b/Cargo.toml
|
||||
@@ -66,6 +66,22 @@ members = [
|
||||
@@ -67,6 +67,22 @@ members = [
|
||||
"drivers/usb/xhcid",
|
||||
"drivers/usb/usbctl",
|
||||
"drivers/usb/usbhubd",
|
||||
@@ -25,19 +25,6 @@ index 9e776232..380f8d85 100644
|
||||
]
|
||||
|
||||
# Bootstrap needs it's own profile configuration
|
||||
diff --git a/bootstrap/Cargo.toml b/bootstrap/Cargo.toml
|
||||
index 82120c21..be1f8326 100644
|
||||
--- a/bootstrap/Cargo.toml
|
||||
+++ b/bootstrap/Cargo.toml
|
||||
@@ -6,6 +6,8 @@ authors = ["4lDO2 <4lDO2@protonmail.com>"]
|
||||
edition = "2024"
|
||||
license = "MIT"
|
||||
|
||||
+[workspace]
|
||||
+
|
||||
[dependencies]
|
||||
hashbrown = { version = "0.15", default-features = false, features = [
|
||||
"inline-more",
|
||||
diff --git a/drivers/acpi-resource/Cargo.toml b/drivers/acpi-resource/Cargo.toml
|
||||
new file mode 100644
|
||||
index 00000000..f30c6d02
|
||||
@@ -0,0 +1,153 @@
|
||||
diff --git a/ipcd/src/uds/stream.rs b/ipcd/src/uds/stream.rs
|
||||
index 81c846fd..d55d2bb7 100644
|
||||
--- a/ipcd/src/uds/stream.rs
|
||||
+++ b/ipcd/src/uds/stream.rs
|
||||
@@ -180,7 +180,7 @@ pub struct Socket {
|
||||
options: HashSet<i32>,
|
||||
flags: usize,
|
||||
state: State,
|
||||
- awaiting: VecDeque<usize>,
|
||||
+ awaiting: VecDeque<(usize, ucred)>,
|
||||
connection: Option<Connection>,
|
||||
issued_token: Option<u64>,
|
||||
ucred: ucred,
|
||||
@@ -241,6 +241,7 @@ impl Socket {
|
||||
&mut self,
|
||||
primary_id: usize,
|
||||
awaiting_client_id: usize,
|
||||
+ client_ucred: ucred,
|
||||
ctx: &CallerCtx,
|
||||
) -> Result<Self> {
|
||||
if !self.is_listening() {
|
||||
@@ -250,15 +251,17 @@ impl Socket {
|
||||
);
|
||||
return Err(Error::new(EINVAL));
|
||||
}
|
||||
- Ok(Self::new(
|
||||
+ Ok(Self {
|
||||
primary_id,
|
||||
- self.path.clone(),
|
||||
- State::Established,
|
||||
- self.options.clone(),
|
||||
- self.flags,
|
||||
- Some(Connection::new(awaiting_client_id)),
|
||||
- ctx,
|
||||
- ))
|
||||
+ path: self.path.clone(),
|
||||
+ state: State::Established,
|
||||
+ options: self.options.clone(),
|
||||
+ flags: self.flags,
|
||||
+ awaiting: VecDeque::new(),
|
||||
+ connection: Some(Connection::new(awaiting_client_id)),
|
||||
+ issued_token: None,
|
||||
+ ucred: client_ucred,
|
||||
+ })
|
||||
}
|
||||
|
||||
fn establish(&mut self, new_socket: &mut Self, peer: usize) -> Result<()> {
|
||||
@@ -286,7 +289,7 @@ impl Socket {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
- fn connect(&mut self, other: &mut Socket) -> Result<()> {
|
||||
+ fn connect(&mut self, other: &mut Socket, client_ucred: ucred) -> Result<()> {
|
||||
match self.state {
|
||||
State::Unbound | State::Bound => {
|
||||
// If the socket is unbound or bound, wait for the listener to start listening.
|
||||
@@ -302,12 +305,12 @@ impl Socket {
|
||||
}
|
||||
_ => return Err(Error::new(ECONNREFUSED)),
|
||||
}
|
||||
- self.connect_unchecked(other);
|
||||
+ self.connect_unchecked(other, client_ucred);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
- fn connect_unchecked(&mut self, other: &mut Socket) {
|
||||
- self.awaiting.push_back(other.primary_id);
|
||||
+ fn connect_unchecked(&mut self, other: &mut Socket, client_ucred: ucred) {
|
||||
+ self.awaiting.push_back((other.primary_id, client_ucred));
|
||||
other.state = State::Connecting;
|
||||
other.connection = Some(Connection::new(self.primary_id));
|
||||
}
|
||||
@@ -495,7 +498,7 @@ impl<'sock> UdsStreamScheme<'sock> {
|
||||
};
|
||||
match verb {
|
||||
SocketCall::Bind => self.handle_bind(id, &payload),
|
||||
- SocketCall::Connect => self.handle_connect(id, &payload),
|
||||
+ SocketCall::Connect => self.handle_connect(id, &payload, ctx),
|
||||
SocketCall::SetSockOpt => self.handle_setsockopt(
|
||||
id,
|
||||
*metadata.get(1).ok_or(Error::new(EINVAL))? as i32,
|
||||
@@ -588,7 +591,7 @@ impl<'sock> UdsStreamScheme<'sock> {
|
||||
// and changes its own state to `Established`.
|
||||
//
|
||||
// After these three phases, the socket connection is considered established.
|
||||
- fn handle_connect(&mut self, id: usize, token_buf: &[u8]) -> Result<usize> {
|
||||
+ fn handle_connect(&mut self, id: usize, token_buf: &[u8], ctx: &CallerCtx) -> Result<usize> {
|
||||
let token = read_num::<u64>(token_buf)?;
|
||||
let (listener_id, connecting_res) = {
|
||||
let listener_rc = self
|
||||
@@ -633,7 +636,8 @@ impl<'sock> UdsStreamScheme<'sock> {
|
||||
}
|
||||
|
||||
// Phase 2: listener is now listening
|
||||
- listener.connect(&mut client)?;
|
||||
+ let client_ucred = ucred { pid: ctx.pid as _, uid: ctx.uid as _, gid: ctx.gid as _ };
|
||||
+ listener.connect(&mut client, client_ucred)?;
|
||||
|
||||
(listener_id, connecting_res)
|
||||
};
|
||||
@@ -873,6 +877,7 @@ impl<'sock> UdsStreamScheme<'sock> {
|
||||
&mut self,
|
||||
listener_socket: &mut Socket,
|
||||
client_id: usize,
|
||||
+ client_ucred: ucred,
|
||||
ctx: &CallerCtx,
|
||||
) -> Result<Option<OpenResult>> {
|
||||
let (new_id, new) = {
|
||||
@@ -880,7 +885,7 @@ impl<'sock> UdsStreamScheme<'sock> {
|
||||
return Ok(None); // Client socket has been closed, nothing to accept
|
||||
};
|
||||
let new_id = self.next_id;
|
||||
- let mut new = listener_socket.accept(new_id, client_id, ctx)?;
|
||||
+ let mut new = listener_socket.accept(new_id, client_id, client_ucred, ctx)?;
|
||||
|
||||
let mut client_socket = client_rc.borrow_mut();
|
||||
client_socket.establish(&mut new, listener_socket.primary_id)?;
|
||||
@@ -912,14 +917,14 @@ impl<'sock> UdsStreamScheme<'sock> {
|
||||
}
|
||||
loop {
|
||||
// Try to accept a waiting connection
|
||||
- let Some(client_id) = socket.awaiting.pop_front() else {
|
||||
+ let Some((client_id, client_ucred)) = socket.awaiting.pop_front() else {
|
||||
if flags & O_NONBLOCK == O_NONBLOCK {
|
||||
return Err(Error::new(EAGAIN));
|
||||
} else {
|
||||
return Err(Error::new(EWOULDBLOCK));
|
||||
}
|
||||
};
|
||||
- return match self.accept_connection(socket, client_id, ctx) {
|
||||
+ return match self.accept_connection(socket, client_id, client_ucred, ctx) {
|
||||
Ok(conn) => Ok(conn),
|
||||
Err(Error { errno: EAGAIN }) => continue,
|
||||
Err(e) => Err(e),
|
||||
@@ -991,7 +996,8 @@ impl<'sock> UdsStreamScheme<'sock> {
|
||||
);
|
||||
return Err(Error::new(EPIPE));
|
||||
}
|
||||
- socket.connect_unchecked(&mut new);
|
||||
+ let pair_ucred = ucred { pid: ctx.pid as _, uid: ctx.uid as _, gid: ctx.gid as _ };
|
||||
+ socket.connect_unchecked(&mut new, pair_ucred);
|
||||
}
|
||||
|
||||
// smoltcp sends writeable whenever a listener gets a
|
||||
@@ -1186,7 +1192,7 @@ impl<'sock> UdsStreamScheme<'sock> {
|
||||
}
|
||||
|
||||
// Notify all waiting clients about listener closure
|
||||
- for client_id in &socket.awaiting {
|
||||
+ for (client_id, _) in &socket.awaiting {
|
||||
if let Ok(client_rc) = self.get_socket(*client_id) {
|
||||
{
|
||||
let mut client = client_rc.borrow_mut();
|
||||
@@ -0,0 +1,11 @@
|
||||
diff --git a/init/src/scheduler.rs b/init/src/scheduler.rs
|
||||
--- a/init/src/scheduler.rs
|
||||
+++ b/init/src/scheduler.rs
|
||||
@@ -63,6 +63,7 @@
|
||||
match job.kind {
|
||||
JobKind::Start => {
|
||||
let unit = unit_store.unit_mut(&job.unit);
|
||||
+ eprintln!("init: DBG job={}", job.unit.0);
|
||||
|
||||
for dep in &unit.info.requires_weak {
|
||||
for pending_job in &self.pending {
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P0-bootstrap-workspace-fix.patch
|
||||
@@ -1,43 +0,0 @@
|
||||
diff --git a/daemon/src/lib.rs b/daemon/src/lib.rs
|
||||
index 9f507221..c57d91dc 100644
|
||||
--- a/daemon/src/lib.rs
|
||||
+++ b/daemon/src/lib.rs
|
||||
@@ -11,12 +11,23 @@ use redox_scheme::Socket;
|
||||
use redox_scheme::scheme::{SchemeAsync, SchemeSync};
|
||||
|
||||
unsafe fn get_fd(var: &str) -> RawFd {
|
||||
- let fd: RawFd = std::env::var(var).unwrap().parse().unwrap();
|
||||
+ let fd: RawFd = match std::env::var(var)
|
||||
+ .map_err(|e| eprintln!("daemon: env var {var} not set: {e}"))
|
||||
+ .ok()
|
||||
+ .and_then(|val| {
|
||||
+ val.parse()
|
||||
+ .map_err(|e| eprintln!("daemon: failed to parse {var} as fd: {e}"))
|
||||
+ .ok()
|
||||
+ }) {
|
||||
+ Some(fd) => fd,
|
||||
+ None => return -1,
|
||||
+ };
|
||||
if unsafe { libc::fcntl(fd, libc::F_SETFD, libc::FD_CLOEXEC) } == -1 {
|
||||
- panic!(
|
||||
+ eprintln!(
|
||||
"daemon: failed to set CLOEXEC flag for {var} fd: {}",
|
||||
io::Error::last_os_error()
|
||||
);
|
||||
+ return -1;
|
||||
}
|
||||
fd
|
||||
}
|
||||
@@ -51,7 +62,11 @@ impl Daemon {
|
||||
|
||||
/// Notify the process that the daemon is ready to accept requests.
|
||||
pub fn ready(mut self) {
|
||||
- self.write_pipe.write_all(&[0]).unwrap();
|
||||
+ if let Err(err) = self.write_pipe.write_all(&[0]) {
|
||||
+ if err.kind() != io::ErrorKind::BrokenPipe {
|
||||
+ eprintln!("daemon::ready write failed: {err}");
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
/// Executes `Command` as a child process.
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P0-daemon-fix-init-notify-unwrap.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P0-dhcpd-auto-iface.patch
|
||||
@@ -1,12 +0,0 @@
|
||||
diff --git a/Cargo.toml b/Cargo.toml
|
||||
index 9e776232..acdb1c97 100644
|
||||
--- a/Cargo.toml
|
||||
+++ b/Cargo.toml
|
||||
@@ -2,6 +2,7 @@
|
||||
resolver = "2"
|
||||
members = [
|
||||
"audiod",
|
||||
+ "bootstrap",
|
||||
"config",
|
||||
"daemon",
|
||||
"dhcpd",
|
||||
@@ -0,0 +1 @@
|
||||
../../../local/patches/base/P0-workspace-add-bootstrap.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-ac97d-ihdad-main.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-acpi-defer-aml.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-acpi-i2c-resources.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-acpid-core-refactor.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-boot-logging.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-boot-runtime-fixes.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-daemon-hardening.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-daemon-ready-graceful.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-hwd-misc.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-ihdad-device-refactor.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-ihdad-hda-stream.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-init-acpid-wiring.patch
|
||||
@@ -1,45 +0,0 @@
|
||||
diff --git a/init.initfs.d/40_pcid.service b/init.initfs.d/40_pcid.service
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/init.initfs.d/40_pcid.service
|
||||
@@ -0,0 +1,7 @@
|
||||
+[unit]
|
||||
+description = "PCI daemon"
|
||||
+requires_weak = ["41_acpid.service"]
|
||||
+
|
||||
+[service]
|
||||
+cmd = "pcid"
|
||||
+type = "notify"
|
||||
diff --git a/init.initfs.d/40_drivers.target b/init.initfs.d/40_drivers.target
|
||||
--- a/init.initfs.d/40_drivers.target
|
||||
+++ b/init.initfs.d/40_drivers.target
|
||||
@@ -3,6 +3,7 @@ description = "Initfs drivers"
|
||||
requires_weak = [
|
||||
"10_lived.service",
|
||||
"20_graphics.target",
|
||||
+ "40_pcid.service",
|
||||
"40_ps2d.service",
|
||||
"40_bcm2835-sdhcid.service",
|
||||
"40_hwd.service",
|
||||
diff --git a/init.initfs.d/40_hwd.service b/init.initfs.d/40_hwd.service
|
||||
--- a/init.initfs.d/40_hwd.service
|
||||
+++ b/init.initfs.d/40_hwd.service
|
||||
@@ -1,6 +1,6 @@
|
||||
[unit]
|
||||
description = "Hardware manager"
|
||||
-requires_weak = ["10_inputd.service", "10_lived.service", "20_graphics.target", "41_acpid.service"]
|
||||
+requires_weak = ["10_inputd.service", "10_lived.service", "20_graphics.target", "40_pcid.service", "41_acpid.service"]
|
||||
|
||||
[service]
|
||||
cmd = "hwd"
|
||||
diff --git a/init.initfs.d/40_pcid-spawner-initfs.service b/init.initfs.d/40_pcid-spawner-initfs.service
|
||||
--- a/init.initfs.d/40_pcid-spawner-initfs.service
|
||||
+++ b/init.initfs.d/40_pcid-spawner-initfs.service
|
||||
@@ -1,6 +1,6 @@
|
||||
[unit]
|
||||
description = "PCI driver spawner"
|
||||
-requires_weak = ["10_inputd.service", "20_graphics.target", "40_hwd.service"]
|
||||
+requires_weak = ["10_inputd.service", "20_graphics.target", "40_pcid.service"]
|
||||
|
||||
[service]
|
||||
cmd = "pcid-spawner"
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-ixgbed-error-handling.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-misc-daemon-fixes.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-network-driver-mains.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-network-error-handling.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-pcid-cfg-access.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-pcid-driver-interface.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-ps2d-improvements.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-storage-driver-mains.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-storage-error-handling.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-usb-pm-and-drivers.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-virtio-core-vbox.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P2-xhcid-remaining.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P3-acpi-power-dmi.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P3-acpi-wave12-hardening.patch
|
||||
@@ -1 +0,0 @@
|
||||
../../../local/patches/base/P3-pcid-aer-scheme.patch
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user