// socket.reef — Unix domain socket server for zygctl communication // // Listens on /var/run/zyginit.sock for commands from zygctl. // Protocol: newline-delimited text commands, JSON responses. // // Commands: // status → list all services and their states // status → status of a single service // start → start a service (transient, not persisted) // stop → stop a service // restart → stop then start // enable → create symlink in enabled.d/ (persisted) // disable → remove symlink from enabled.d/ // list → list all known service definitions const SOCKET_PATH: &str = "/var/run/zyginit.sock"; // Create and bind the Unix domain socket fn create_socket() -> Result { // TODO: implement // 1. socket(AF_UNIX, SOCK_STREAM, 0) // 2. bind() to SOCKET_PATH // 3. listen() // 4. Return fd for poll() Err("not yet implemented") } // Handle a client connection — read command, dispatch, respond fn handle_client(client_fd: i32) -> Result<(), String> { // TODO: implement // 1. Read command line from client // 2. Parse command + args // 3. Dispatch to appropriate handler // 4. Send response (JSON) // 5. Close client fd Err("not yet implemented") }