1
Fork 0

Reformat using the new identifier sorting from rustfmt

This commit is contained in:
Michael Goulet 2024-09-22 19:05:04 -04:00
parent 1173204b36
commit c682aa162b
1455 changed files with 7152 additions and 8384 deletions

View file

@ -22,12 +22,12 @@ pub mod usercalls {
/// Lowest-level interfaces to usercalls and usercall ABI type definitions.
pub mod raw {
pub use crate::sys::abi::usercalls::raw::{
accept_stream, alloc, async_queues, bind_stream, close, connect_stream, do_usercall,
exit, flush, free, insecure_time, launch_thread, read, read_alloc, send, wait, write,
ByteBuffer, Cancel, Error, Fd, FifoDescriptor, Register, RegisterArgument, Result,
Return, ReturnValue, Tcs, Usercall, Usercalls as UsercallNrs, EV_RETURNQ_NOT_EMPTY,
EV_UNPARK, EV_USERCALLQ_NOT_FULL, FD_STDERR, FD_STDIN, FD_STDOUT, RESULT_SUCCESS,
USERCALL_USER_DEFINED, WAIT_INDEFINITE, WAIT_NO,
ByteBuffer, Cancel, EV_RETURNQ_NOT_EMPTY, EV_UNPARK, EV_USERCALLQ_NOT_FULL, Error,
FD_STDERR, FD_STDIN, FD_STDOUT, Fd, FifoDescriptor, RESULT_SUCCESS, Register,
RegisterArgument, Result, Return, ReturnValue, Tcs, USERCALL_USER_DEFINED, Usercall,
Usercalls as UsercallNrs, WAIT_INDEFINITE, WAIT_NO, accept_stream, alloc, async_queues,
bind_stream, close, connect_stream, do_usercall, exit, flush, free, insecure_time,
launch_thread, read, read_alloc, send, wait, write,
};
}
}

View file

@ -1,6 +1,6 @@
// FIXME: This is currently disabled on *BSD.
use super::{sockaddr_un, SocketAddr};
use super::{SocketAddr, sockaddr_un};
use crate::io::{self, IoSlice, IoSliceMut};
use crate::marker::PhantomData;
use crate::mem::zeroed;

View file

@ -12,9 +12,9 @@
))]
use libc::MSG_NOSIGNAL;
use super::{SocketAddr, sockaddr_un};
#[cfg(any(doc, target_os = "android", target_os = "linux"))]
use super::{recv_vectored_with_ancillary_from, send_vectored_with_ancillary_to, SocketAncillary};
use super::{sockaddr_un, SocketAddr};
use super::{SocketAncillary, recv_vectored_with_ancillary_from, send_vectored_with_ancillary_to};
#[cfg(any(doc, target_os = "android", target_os = "linux"))]
use crate::io::{IoSlice, IoSliceMut};
use crate::net::Shutdown;

View file

@ -1,4 +1,4 @@
use super::{sockaddr_un, SocketAddr, UnixStream};
use super::{SocketAddr, UnixStream, sockaddr_un};
use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
use crate::path::Path;
use crate::sys::cvt;

View file

@ -1,3 +1,6 @@
use super::{SocketAddr, sockaddr_un};
#[cfg(any(doc, target_os = "android", target_os = "linux"))]
use super::{SocketAncillary, recv_vectored_with_ancillary_from, send_vectored_with_ancillary_to};
#[cfg(any(
target_os = "android",
target_os = "linux",
@ -8,10 +11,7 @@
target_os = "nto",
target_vendor = "apple",
))]
use super::{peer_cred, UCred};
#[cfg(any(doc, target_os = "android", target_os = "linux"))]
use super::{recv_vectored_with_ancillary_from, send_vectored_with_ancillary_to, SocketAncillary};
use super::{sockaddr_un, SocketAddr};
use super::{UCred, peer_cred};
use crate::fmt;
use crate::io::{self, IoSlice, IoSliceMut};
use crate::net::Shutdown;

View file

@ -38,7 +38,7 @@ pub(super) use self::impl_linux::peer_cred;
#[cfg(any(target_os = "linux", target_os = "android"))]
mod impl_linux {
use libc::{c_void, getsockopt, socklen_t, ucred, SOL_SOCKET, SO_PEERCRED};
use libc::{SO_PEERCRED, SOL_SOCKET, c_void, getsockopt, socklen_t, ucred};
use super::UCred;
use crate::os::unix::io::AsRawFd;
@ -98,7 +98,7 @@ mod impl_bsd {
#[cfg(target_vendor = "apple")]
mod impl_apple {
use libc::{c_void, getpeereid, getsockopt, pid_t, socklen_t, LOCAL_PEERPID, SOL_LOCAL};
use libc::{LOCAL_PEERPID, SOL_LOCAL, c_void, getpeereid, getsockopt, pid_t, socklen_t};
use super::UCred;
use crate::os::unix::io::AsRawFd;

View file

@ -126,42 +126,36 @@ impl From<i32> for Error {
#[stable(feature = "rust1", since = "1.0.0")]
impl core::fmt::Display for Error {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(
f,
"{}",
match self {
Error::NoError => "no error occurred",
Error::BadAlignment => "memory was not properly aligned",
Error::BadAddress => "an invalid address was supplied",
Error::OutOfMemory => "the process or service has run out of memory",
Error::MemoryInUse => "the requested address is in use",
Error::InterruptNotFound =>
"the requested interrupt does not exist on this platform",
Error::InterruptInUse => "the requested interrupt is currently in use",
Error::InvalidString => "the specified string was not formatted correctly",
Error::ServerExists => "a server with that address already exists",
Error::ServerNotFound => "the requetsed server could not be found",
Error::ProcessNotFound => "the target process does not exist",
Error::ProcessNotChild =>
"the requested operation can only be done on child processes",
Error::ProcessTerminated => "the target process has crashed",
Error::Timeout => "the requested operation timed out",
Error::InternalError => "an internal error occurred",
Error::ServerQueueFull => "the server has too many pending messages",
Error::ThreadNotAvailable => "the specified thread does not exist",
Error::UnhandledSyscall => "the kernel did not recognize that syscall",
Error::InvalidSyscall => "the syscall had incorrect parameters",
Error::ShareViolation => "an attempt was made to share memory twice",
Error::InvalidThread => "tried to resume a thread that was not ready",
Error::InvalidPid => "kernel attempted to use a pid that was not valid",
Error::AccessDenied => "no permission to perform the requested operation",
Error::UseBeforeInit => "attempt to use a service before initialization finished",
Error::DoubleFree => "the requested resource was freed twice",
Error::DebugInProgress => "kernel attempted to activate a thread being debugged",
Error::InvalidLimit => "process attempted to adjust an invalid limit",
Error::UnknownError => "an unknown error occurred",
}
)
write!(f, "{}", match self {
Error::NoError => "no error occurred",
Error::BadAlignment => "memory was not properly aligned",
Error::BadAddress => "an invalid address was supplied",
Error::OutOfMemory => "the process or service has run out of memory",
Error::MemoryInUse => "the requested address is in use",
Error::InterruptNotFound => "the requested interrupt does not exist on this platform",
Error::InterruptInUse => "the requested interrupt is currently in use",
Error::InvalidString => "the specified string was not formatted correctly",
Error::ServerExists => "a server with that address already exists",
Error::ServerNotFound => "the requetsed server could not be found",
Error::ProcessNotFound => "the target process does not exist",
Error::ProcessNotChild => "the requested operation can only be done on child processes",
Error::ProcessTerminated => "the target process has crashed",
Error::Timeout => "the requested operation timed out",
Error::InternalError => "an internal error occurred",
Error::ServerQueueFull => "the server has too many pending messages",
Error::ThreadNotAvailable => "the specified thread does not exist",
Error::UnhandledSyscall => "the kernel did not recognize that syscall",
Error::InvalidSyscall => "the syscall had incorrect parameters",
Error::ShareViolation => "an attempt was made to share memory twice",
Error::InvalidThread => "tried to resume a thread that was not ready",
Error::InvalidPid => "kernel attempted to use a pid that was not valid",
Error::AccessDenied => "no permission to perform the requested operation",
Error::UseBeforeInit => "attempt to use a service before initialization finished",
Error::DoubleFree => "the requested resource was freed twice",
Error::DebugInProgress => "kernel attempted to activate a thread being debugged",
Error::InvalidLimit => "process attempted to adjust an invalid limit",
Error::UnknownError => "an unknown error occurred",
})
}
}

View file

@ -19,7 +19,7 @@ pub(crate) use ticktimer::*;
mod ns {
const NAME_MAX_LENGTH: usize = 64;
use crate::os::xous::ffi::{lend_mut, Connection};
use crate::os::xous::ffi::{Connection, lend_mut};
// By making this repr(C), the layout of this struct becomes well-defined
// and no longer shifts around.
// By marking it as `align(4096)` we define that it will be page-aligned,

View file

@ -1,6 +1,6 @@
use core::sync::atomic::{AtomicU32, Ordering};
use crate::os::xous::ffi::{connect, Connection};
use crate::os::xous::ffi::{Connection, connect};
pub(crate) enum SystimeScalar {
GetUtcTimeMs,