commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
0ab5cc22ed224d0fabf6e901b0d0a58ea494357a | John Nunley | 2024-07-21T01:41:50 | bugfix: Bound channel elements per iteration
At the moment, the channel implentation processes as many channel
elements as possible every time "process_events" is called. However,
in multithreaded cases this can cause the loop to be stuck in the
"process_events" section of a channel forever. If one thread keeps
sendin... | diff --git a/src/sources/channel.rs b/src/sources/channel.rs
index c48f70e..9127596 100644
--- a/src/sources/channel.rs
+++ b/src/sources/channel.rs
@@ -8,6 +8,7 @@
//! A synchronous version of the channel is provided by [`sync_channel`], in which
//! the [`SyncSender`] will block when the channel is full.
+use std... | 1 | 91 | 13 |
3ef1bf27644ede62899eccb3c6dbf39b9f4c3fd0 | Josh McKinney | 2024-06-21T09:21:04 | chore: use tracing instead of log crate | diff --git a/Cargo.toml b/Cargo.toml
index 648bbaa..97803b3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,11 +22,11 @@ codecov = { repository = "Smithay/calloop" }
async-task = { version = "4.4.0", optional = true }
bitflags = "2.4"
futures-io = { version = "0.3.5", optional = true }
-log = "0.4"
pin-utils = { ve... | 7 | 43 | 48 |
082dee395d583b3d57a507cd3a4a564a76e80978 | John Nunley | 2024-05-30T01:56:15 | bugfix: Replace thiserror with manual impls
This commit removes the heavy thiserror dependency by replacing its
automatically generated implementations with manually written ones. Hopefully
the newly written implementations are identical to the previous ones, but just
in case I've marked this as a breaking change. ... | diff --git a/Cargo.toml b/Cargo.toml
index 160f78b..25e7bf7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,7 +27,6 @@ pin-utils = { version = "0.1.0", optional = true }
polling = "3.0.0"
slab = "0.4.8"
rustix = { version = "0.38", default-features = false, features = ["event", "fs", "pipe", "std"] }
-thiserror = "1... | 6 | 127 | 21 |
b4cc2c96aea71a95daf0f7e4cece045bfce9a6ad | John Nunley | 2024-05-19T21:21:54 | tests: Avoid free-ing a random FD in OwnedFd drop
In the insert_bad_source test, we drop the FD "420", which doesn't exist.
Previously the error was ignored, but in the latest nightly it now aborts the
program. This commit fixes this by leaking the bad "OwnedFd" instead of leaving
it to be dropped.
Signed-off-by: Joh... | diff --git a/src/loop_logic.rs b/src/loop_logic.rs
index 1b24681..a4e8908 100644
--- a/src/loop_logic.rs
+++ b/src/loop_logic.rs
@@ -1153,10 +1153,21 @@ mod tests {
#[cfg(unix)]
#[test]
fn insert_bad_source() {
- use std::os::unix::io::FromRawFd;
+ use std::mem::ManuallyDrop;
+ use s... | 1 | 13 | 2 |
bd93e5761339e87fb10bb6ef609e028237d261a2 | John Nunley | 2024-05-19T17:59:22 | chore: Fix nightly clippy warning
Signed-off-by: John Nunley <dev@notgull.net> | diff --git a/src/sources/futures.rs b/src/sources/futures.rs
index 65e3fc3..0bf7c55 100644
--- a/src/sources/futures.rs
+++ b/src/sources/futures.rs
@@ -111,9 +111,9 @@ impl<T> Scheduler<T> {
/// Sends the given future to the executor associated to this scheduler
///
/// Returns an error if the the execu... | 1 | 2 | 2 |
9abedf12787a82dfbd48be6aaaa7cb2b9086d549 | Ian Douglas Scott | 2024-01-29T23:41:22 | executor: Fix issue when task is scheduled within event callback
I believe this should be overall more correct. Previously, if the
callback taken by `process_events` scheduled a task, `process_events`
could exit with the readiness of `self.ping` cleared, but `notified` set
to `true`. In which case, future calls to `sc... | diff --git a/src/sources/futures.rs b/src/sources/futures.rs
index 3a56e00..65e3fc3 100644
--- a/src/sources/futures.rs
+++ b/src/sources/futures.rs
@@ -296,9 +296,6 @@ impl<T> EventSource for Executor<T> {
{
let state = &self.state;
- // Set to the unnotified state.
- state.sender.notifie... | 1 | 3 | 3 |
a2a4f9159ffe0700ccacd97e1a6634275fef229e | John Nunley | 2024-01-14T04:55:12 | docs: Add signals feature to docs.rs
Closes #164
Signed-off-by: John Nunley <dev@notgull.net> | diff --git a/Cargo.toml b/Cargo.toml
index 00f691b..07b8a3c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -41,7 +41,7 @@ nightly_coverage = []
signals = ["nix"]
[package.metadata.docs.rs]
-features = ["block_on", "executor"]
+features = ["block_on", "executor", "signals"]
rustdoc-args = ["--cfg", "docsrs"]
[[test... | 1 | 1 | 1 |
e4c8c5c6d41545fddacfceb1627188be6f228c57 | i509VCB | 2023-12-21T05:04:46 | fix borrow error when scheduling future inside an executor's callback | diff --git a/src/sources/futures.rs b/src/sources/futures.rs
index 0207dc8..3a56e00 100644
--- a/src/sources/futures.rs
+++ b/src/sources/futures.rs
@@ -329,6 +329,9 @@ impl<T> EventSource for Executor<T> {
_ => unreachable!(),
};
+ // Drop ... | 1 | 3 | 0 |
b55175c126aa031152488d02dac2d42a4342c092 | Victoria Brekenfeld | 2023-10-09T20:42:50 | deps: Fix compiling with minimal versions | diff --git a/Cargo.toml b/Cargo.toml
index ca71b9d..c9fb4d6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -28,7 +28,7 @@ pin-utils = { version = "0.1.0", optional = true }
polling = "3.0.0"
rustix = { version = "0.38", default-features = false, features = ["event", "fs", "pipe", "std"] }
slab = "0.4.8"
-thiserror = "1... | 1 | 1 | 1 |
92b42b1765b5a3cec97d4aeb5aad3d96c961eaf4 | Elinor Berger | 2023-09-24T11:06:30 | Add some trace logging to the event loop | diff --git a/src/loop_logic.rs b/src/loop_logic.rs
index 66166d4..621c627 100644
--- a/src/loop_logic.rs
+++ b/src/loop_logic.rs
@@ -12,6 +12,8 @@ use std::future::Future;
use slab::Slab;
+use log::trace;
+
use crate::sources::{Dispatcher, EventSource, Idle, IdleDispatcher};
use crate::sys::{Notifier, PollEvent}... | 2 | 31 | 0 |
2feb1cff926cdb77f5ae894034715e4fe40abf2b | Kirill Chibisov | 2023-09-16T19:04:35 | Fix coverage testing on the CI
The way coverage is enabled/disabled was changed upstream.
Links: https://github.com/rust-lang/rust/pull/114656 | diff --git a/src/error.rs b/src/error.rs
index 4191bfc..7a6001b 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -67,7 +67,7 @@ pub struct InsertError<T> {
}
impl<T> Debug for InsertError<T> {
- #[cfg_attr(feature = "nightly_coverage", no_coverage)]
+ #[cfg_attr(feature = "nightly_coverage", coverage(off))]
... | 8 | 16 | 16 |
9999520b971860f19be32efba92845824e105f41 | John Nunley | 2023-09-10T18:00:34 | Update for new polling breaking changes (#141)
* Update for new polling breaking changes
* Update for polling v3.0.0
Signed-off-by: John Nunley <dev@notgull.net>
* Silence clippy
Signed-off-by: John Nunley <dev@notgull.net>
* Fix book compilation
Signed-off-by: John Nunley <dev@notgull.net>
* Add ... | diff --git a/Cargo.toml b/Cargo.toml
index 7ca6b08..d859094 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,7 +26,7 @@ io-lifetimes = "1.0.3"
log = "0.4"
nix = { version = "0.26", default-features = false, features = ["signal"], optional = true }
pin-utils = { version = "0.1.0", optional = true }
-polling = "2.6.0"
... | 6 | 208 | 53 |
fd50f59758394b480574e8497059b96dff24341d | Elinor Berger | 2023-08-26T09:19:53 | clippy fixes | diff --git a/src/sources/generic.rs b/src/sources/generic.rs
index 3bfe2a8..e4828d1 100644
--- a/src/sources/generic.rs
+++ b/src/sources/generic.rs
@@ -105,7 +105,7 @@ impl<F: AsFd> Generic<F, std::io::Error> {
interest,
mode,
token: None,
- _error_type: PhantomData::d... | 1 | 2 | 2 |
88ebccaa732f0a7ad8c225754220a7f111884430 | dAxpeDDa | 2023-06-05T11:31:52 | Raise minimum `bitflags` version to v1.2 | diff --git a/Cargo.toml b/Cargo.toml
index a6524de..7e4ebe9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,6 +19,7 @@ members = [ "doc" ]
codecov = { repository = "Smithay/calloop" }
[dependencies]
+bitflags = "1.2"
io-lifetimes = "1.0.3"
log = "0.4"
nix = { version = "0.26", default-features = false, features ... | 1 | 1 | 0 |
0ba3f1e24417fdb07960e609cb65ed9b04a19c47 | John Nunley | 2023-04-27T14:54:13 | Replace futures-util with async-task (#124)
* Replace futures-util with async-task
* Fix soundness mistakes
* fmt all
* Fix failing tests
* Make sure schedule is Send+Sync
I keep forgetting that mpsc::Sender is Send but !Sync. Wrapping it in a
mutex fixes that, at the cost of some overhead. Consider sw... | diff --git a/Cargo.toml b/Cargo.toml
index 3056a65..a6524de 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,19 +22,19 @@ codecov = { repository = "Smithay/calloop" }
io-lifetimes = "1.0.3"
log = "0.4"
nix = { version = "0.26", default-features = false, features = ["event", "fs", "signal", "socket", "time"] }
-future... | 2 | 268 | 57 |
6cff3e46979eb780917d9a3d9b8edac803d19c77 | Ian Douglas Scott | 2022-12-16T22:01:32 | Take `F: AsFd` generic in methods of `Poll` | diff --git a/src/sources/generic.rs b/src/sources/generic.rs
index 4b5a46d..8f534b3 100644
--- a/src/sources/generic.rs
+++ b/src/sources/generic.rs
@@ -122,7 +122,7 @@ where
fn register(&mut self, poll: &mut Poll, token_factory: &mut TokenFactory) -> crate::Result<()> {
let token = token_factory.token();... | 2 | 23 | 18 |
804c1c9c2bfd3291a3437fd197f4964e7abf7471 | Ian Douglas Scott | 2022-12-16T03:10:39 | Use `io-lifetimes` types in API, instead of `RawFd`
Operating on `RawFd`s is unsafe, so this should be changed. Though some
uses will be cleaner once `nix` is updated for IO safety (which seems
to be ongoing, but complicated).
The `Rc<RefCell<IoDispatcher>>` in `Async` is somewhat awkward here. For
now `Dispatcher` s... | diff --git a/Cargo.toml b/Cargo.toml
index 3dc8e66..faca930 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,6 +19,7 @@ members = [ "doc" ]
codecov = { repository = "Smithay/calloop" }
[dependencies]
+io-lifetimes = "1.0.3"
log = "0.4"
nix = { version = "0.26", default-features = false, features = ["event", "fs", ... | 11 | 153 | 118 |
a5baafd2c4bf9218b78df1da7507055a7735050e | Ian Douglas Scott | 2022-12-22T19:51:32 | Bump `nix` to 0.26.0 | diff --git a/Cargo.toml b/Cargo.toml
index 9bdbe68..a8a151c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,7 @@ codecov = { repository = "Smithay/calloop" }
[dependencies]
log = "0.4"
-nix = { version = "0.24", default-features = false, features = ["event", "fs", "signal", "socket", "time"] }
+nix = { versio... | 1 | 1 | 1 |
80819fa45ab0c5956d5196d3c9d5a811a6c8cfa4 | Kirill Chibisov | 2022-11-26T20:57:33 | Fix calloop double borrows take two
This is a follow up to 1787237a21aa0eb44676f255dfa26e5a2a74b5df
given that one source could be removed from another we can't
operate on keys. | diff --git a/src/loop_logic.rs b/src/loop_logic.rs
index b58e51d..33beb84 100644
--- a/src/loop_logic.rs
+++ b/src/loop_logic.rs
@@ -365,24 +365,16 @@ impl<'l, Data> EventLoop<'l, Data> {
}
fn invoke_pre_run(&self, data: &mut Data) -> crate::Result<()> {
- let keys = self
+ let sources = self
... | 1 | 8 | 23 |
0b1a8637f5766df454c33fbbaa6eed7a59eb87e8 | Elinor Berger | 2022-11-08T19:32:29 | clippy fixes | diff --git a/src/loop_logic.rs b/src/loop_logic.rs
index b773c13..f2e94ef 100644
--- a/src/loop_logic.rs
+++ b/src/loop_logic.rs
@@ -24,7 +24,7 @@ slotmap::new_key_type! {
/// a [`Dispatcher`] is registered. You can use it to [disable](LoopHandle#method.disable),
/// [enable](LoopHandle#method.enable), [update`](Loop... | 3 | 8 | 8 |
52daa0b548653b18d82fcbaca493eefc9f3fb648 | Victor Berger | 2022-08-26T09:22:37 | clippy fixes | diff --git a/src/loop_logic.rs b/src/loop_logic.rs
index 177414d..f9720f4 100644
--- a/src/loop_logic.rs
+++ b/src/loop_logic.rs
@@ -24,7 +24,7 @@ slotmap::new_key_type! {
/// a [`Dispatcher`] is registered. You can use it to [disable](LoopHandle#method.disable),
/// [enable](LoopHandle#method.enable), [update`](Loop... | 3 | 3 | 3 |
e7cba58edd8b2c5b660f5777f4d40660e449ea86 | Jason Heeris | 2022-07-26T03:12:38 | Use pipe fds in insert_source_no_interest test instead of stdin.
Fixes #96 where this test would fail when stdin is closed (eg. by redirecting
from /dev/null). | diff --git a/src/loop_logic.rs b/src/loop_logic.rs
index c97aae9..177414d 100644
--- a/src/loop_logic.rs
+++ b/src/loop_logic.rs
@@ -568,12 +568,28 @@ mod tests {
#[test]
fn insert_source_no_interest() {
+ use nix::unistd::{close, pipe};
+
+ // Create a pipe to get an arbitrary fd.
+ le... | 1 | 21 | 5 |
a0cbcfc7b3270816019aac721848fbf06083321f | Ryan Zoeller | 2022-04-23T01:30:41 | Update nix to 0.24, limit features
This reduces clean build time slightly. | diff --git a/Cargo.toml b/Cargo.toml
index 2deb2d6..2b4098f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,7 @@ codecov = { repository = "Smithay/calloop" }
[dependencies]
log = "0.4"
-nix = "0.23"
+nix = { version = "0.24", default-features = false, features = ["event", "fs", "signal", "socket", "time"] }
... | 1 | 1 | 1 |
889fa5c52fbf09f8505b1c7b54ea4710c2285ccf | Victor Berger | 2022-03-22T13:59:30 | more async IO tests & coverage adjustments | diff --git a/src/io.rs b/src/io.rs
index 14ef6d6..6505982 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -38,6 +38,7 @@ pub struct Async<'l, F: AsRawFd> {
old_flags: OFlag,
}
+#[cfg(not(tarpaulin_include))]
impl<'l, F: AsRawFd + std::fmt::Debug> std::fmt::Debug for Async<'l, F> {
fn fmt(&self, f: &mut std::fmt... | 3 | 106 | 0 |
310407ced2e4069dbe430e22392a6145333903af | Jason Heeris | 2022-03-19T11:53:20 | Add a combining operator (bit-or) for the PostAction enum. | diff --git a/src/sources/mod.rs b/src/sources/mod.rs
index 299b6e2..57d40d1 100644
--- a/src/sources/mod.rs
+++ b/src/sources/mod.rs
@@ -1,5 +1,6 @@
use std::{
cell::{Ref, RefCell, RefMut},
+ ops::{BitOr, BitOrAssign},
rc::Rc,
};
@@ -18,8 +19,19 @@ pub mod timer;
pub mod transient;
/// Possible act... | 1 | 131 | 2 |
00763bd0a4d36d0cd4580675ab76ea7e82df127f | Jason Heeris | 2022-03-07T11:28:13 | Fix some markdown errors in the API documentation. | diff --git a/src/macros.rs b/src/macros.rs
index a74e268..2be0631 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -1,7 +1,9 @@
//! Macros for helping with common operations in Calloop.
/// Register a set of event sources. Effectively calls
-/// [`EventSource::register()`] for all the sources provided. Usage:
+///... | 4 | 19 | 7 |
4c3d00b06f6778004e82cbb166804c82c286d395 | Jason Heeris | 2022-03-06T15:21:32 | Add passthrough implementations for EventSource for Box<T> and &mut T.
This allows some control over the memory placement of event sources without
the need to change the code that uses the trait. | diff --git a/src/sources/mod.rs b/src/sources/mod.rs
index 1500dd5..572b2c4 100644
--- a/src/sources/mod.rs
+++ b/src/sources/mod.rs
@@ -144,6 +144,109 @@ pub trait EventSource {
}
}
+/// Blanket implementation for boxed event sources. [`EventSource`] is not an
+/// object safe trait, so this does not include t... | 1 | 198 | 0 |
6af19368c91517b86df3ee25d0d9c5a6f40b7cea | Kirill Chibisov | 2022-03-04T14:32:51 | Fix timerfd panic when using `Duration::ZERO`
This makes timerfd use minimal timer resolution when `Duration::ZERO`
is being used. | diff --git a/src/sources/timer/mod.rs b/src/sources/timer/mod.rs
index 1d5bdc4..7fa170c 100644
--- a/src/sources/timer/mod.rs
+++ b/src/sources/timer/mod.rs
@@ -346,6 +346,26 @@ mod tests {
assert!(fired);
}
+ #[test]
+ fn instant_timer() {
+ let mut event_loop = crate::EventLoop::try_new()... | 2 | 32 | 2 |
e987a4cb1fcd899dbf8f475b9cdc24c5371e4def | Jason Heeris | 2022-02-28T07:45:03 | Added TransientSource tests. | diff --git a/src/sources/transient.rs b/src/sources/transient.rs
index ea24e4a..60b60d3 100644
--- a/src/sources/transient.rs
+++ b/src/sources/transient.rs
@@ -262,3 +262,411 @@ impl<T: crate::EventSource> crate::EventSource for TransientSource<T> {
Ok(())
}
}
+
+#[cfg(test)]
+mod test {
+ use super:... | 1 | 408 | 0 |
432627bb8b94eaed5f15a5f8e5938d41bb4dbc4f | Jason Heeris | 2022-02-28T05:20:06 | Add an event source wrapper to automatically remove sources from the loop.
Some event sources will return PostAction::Remove after they have finished
processing events. The TransientSource type can wrap such sources and
automatically unregister and drop them when this happens. It will also handle
disabling or reregist... | diff --git a/src/sources/mod.rs b/src/sources/mod.rs
index bad5760..1500dd5 100644
--- a/src/sources/mod.rs
+++ b/src/sources/mod.rs
@@ -15,6 +15,7 @@ pub mod ping;
#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))]
pub mod signals;
pub mod timer;
+pub mod transient;
/// Possible actions that can be requested to ... | 2 | 265 | 0 |
f07649334f2d5bb60c61fed6a29621857da4a9ab | Jason Heeris | 2022-03-04T00:27:12 | Add some registration macros to help with composite sources. | diff --git a/src/lib.rs b/src/lib.rs
index ae53195..f9506e1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -154,4 +154,5 @@ pub use error::{Error, InsertError, Result};
pub mod io;
mod loop_logic;
+mod macros;
mod sources;
diff --git a/src/macros.rs b/src/macros.rs
new file mode 100644
index 0000000..a74e268
--- /dev... | 2 | 212 | 0 |
d8a1936f207ceff098f7750e1fa15f9d2c3f16bd | Jason Heeris | 2022-02-22T18:45:07 | Prevent dangling pointers being left in the system's polling mechanim and reduce the amount of unsafe code in the library (#76)
* Prevent dangling pointers being left in the system's polling mechanism and
reduce the amount of unsafe code in the library.
Previously, dropping a source without unregistering it risked... | diff --git a/Cargo.toml b/Cargo.toml
index 63b2d59..2deb2d6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,6 +21,7 @@ futures-util = { version = "0.3.5", optional = true, default-features = false, f
futures-io = { version = "0.3.5", optional = true }
slotmap = "1.0"
thiserror = "1.0"
+vec_map = "0.8.2"
[dev-depe... | 6 | 184 | 98 |
47997d4d923bca06d8c203617b1978700c42778f | Kirill Chibisov | 2022-02-17T18:31:14 | Use platform specific error type | diff --git a/src/sources/timer/mod.rs b/src/sources/timer/mod.rs
index 8599a3b..1d5bdc4 100644
--- a/src/sources/timer/mod.rs
+++ b/src/sources/timer/mod.rs
@@ -14,11 +14,6 @@ use std::time::{Duration, Instant};
use crate::{EventSource, Poll, PostAction, Readiness, Token, TokenFactory};
-#[cfg(target_os = "linux")... | 3 | 45 | 42 |
e082cc114ac3f1c378691887b1df6ce7c3a27428 | Victor Berger | 2022-02-06T11:14:17 | docs: enable cargo feature indications on docs.rs | diff --git a/Cargo.toml b/Cargo.toml
index 787ecb5..63b2d59 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -30,6 +30,7 @@ executor = ["futures-util"]
[package.metadata.docs.rs]
all-features = true
+rustdoc-args = ["--cfg", "docsrs"]
[[test]]
name = "signals"
diff --git a/src/io.rs b/src/io.rs
index f24a887..15b37e... | 4 | 6 | 0 |
e5f4524ea4e88dd50adbe64cead0e0a0be9e3d88 | hafeoz | 2022-02-05T16:03:08 | Fix typo | diff --git a/src/sys/mod.rs b/src/sys/mod.rs
index d4fd66f..655378d 100644
--- a/src/sys/mod.rs
+++ b/src/sys/mod.rs
@@ -44,7 +44,7 @@ pub enum Mode {
/// Edge-triggering
///
/// This FD will report events only when it *gains* one of the requested interests.
- /// it must thus be fully processed befor... | 1 | 1 | 1 |
aea65c7e7fdf1bad18bb7cf08c5296c98bce4409 | Victor Berger | 2022-02-05T10:40:47 | Add timer example | diff --git a/examples/timer.rs b/examples/timer.rs
new file mode 100644
index 0000000..e214db1
--- /dev/null
+++ b/examples/timer.rs
@@ -0,0 +1,76 @@
+use calloop::{timer::Timer, EventLoop, LoopSignal};
+
+fn main() {
+ // Create the event loop. The loop is parameterised by the kind of shared
+ // data you want t... | 1 | 76 | 0 |
edbb907747c39c257376d4dcc91881abe1043ebf | i509VCB | 2022-02-04T22:58:29 | Don't rely on SockFlag::SOCK_NOBLOCK for change_interests
macOS does not have SOCK_NOBLOCK, so instead specify `MSG_DONTWAIT` in recv instead of read | diff --git a/src/loop_logic.rs b/src/loop_logic.rs
index f987275..8e2f0a2 100644
--- a/src/loop_logic.rs
+++ b/src/loop_logic.rs
@@ -697,18 +697,15 @@ mod tests {
#[test]
fn change_interests() {
- use nix::sys::socket::{socketpair, AddressFamily, SockFlag, SockType};
- use nix::unistd::{read, ... | 1 | 4 | 7 |
aa1e55f1e8dd472332d3da815bd1f3c2babf5c6a | Victor Berger | 2022-02-04T17:33:13 | Fix leak in timer sources | diff --git a/src/sources/timer.rs b/src/sources/timer.rs
index 6f7c8ba..848ccd6 100644
--- a/src/sources/timer.rs
+++ b/src/sources/timer.rs
@@ -280,7 +280,7 @@ impl<T> std::cmp::Eq for TimeoutData<T> {}
struct TimerScheduler {
current_deadline: Arc<Mutex<Option<Instant>>>,
kill_switch: Arc<AtomicBool>,
- ... | 1 | 7 | 4 |
1dc9ec876b866f8b2ee508488af6ddf8335165b5 | Victor Berger | 2021-12-27T05:49:35 | Clippy fixes | diff --git a/src/io.rs b/src/io.rs
index d0d6be6..88fb607 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -415,7 +415,7 @@ mod tests {
let mut buf = [0; 12];
let mut ioslices = buf
.chunks_mut(2)
- .map(|chunk| std::io::IoSliceMut::new(chunk))
+ ... | 1 | 2 | 2 |
fd573133967ef92ddf8007ef5d54521a57964447 | Victor Berger | 2021-12-27T05:31:59 | Update nix to 0.23 | diff --git a/Cargo.toml b/Cargo.toml
index 163642b..7bc1152 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,7 @@ codecov = { repository = "Smithay/calloop" }
[dependencies]
log = "0.4"
-nix = "0.22"
+nix = "0.23"
futures-util = { version = "0.3.5", optional = true, default-features = false, features = ["std"... | 2 | 3 | 3 |
bdba49d457b91efbf78a20e01cbd3d2302cb820c | Victor Berger | 2021-06-15T21:36:10 | Some more tests | diff --git a/src/io.rs b/src/io.rs
index 85db92a..11347e3 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -328,13 +328,12 @@ impl<'l, F: AsRawFd + io::Write> AsyncWrite for Async<'l, F> {
}
}
-#[cfg(all(test, feature = "executor"))]
+#[cfg(all(test, feature = "executor", feature = "futures-io"))]
mod tests {
us... | 3 | 74 | 20 |
32dc6e8e41044e84cd31f3f9fc3f260ede91964f | Christian Duerr | 2021-04-17T01:31:04 | Bump nix to 0.20.0 | diff --git a/Cargo.toml b/Cargo.toml
index 610f107..2a02b13 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,7 @@ codecov = { repository = "Smithay/calloop" }
[dependencies]
log = "0.4"
-nix = "0.19"
+nix = "0.20"
futures-util = { version = "0.3.5", optional = true, default-features = false, features = ["std"... | 1 | 1 | 1 |
5cb659dd99d722ed46bb93c594cc3a50203a5827 | Victor Berger | 2021-02-08T14:22:17 | COrrectly process all events in executor | diff --git a/src/sources/futures.rs b/src/sources/futures.rs
index 3a617c5..f6a7740 100644
--- a/src/sources/futures.rs
+++ b/src/sources/futures.rs
@@ -88,6 +88,9 @@ pub fn executor<T>() -> std::io::Result<(Executor<T>, Scheduler<T>)> {
))
}
+const TOK_NEW: u32 = 1;
+const TOK_READY: u32 = 1;
+
impl<T> EventS... | 1 | 47 | 12 |
d78c65b9e866ae84a9a2bfaf7f3c0acdf270d42d | Christian Duerr | 2021-01-30T21:58:56 | Update nix dependency to 0.19 | diff --git a/Cargo.toml b/Cargo.toml
index 75ccd49..b987ca0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,7 @@ codecov = { repository = "Smithay/calloop" }
[dependencies]
log = "0.4"
-nix = "0.18"
+nix = "0.19"
futures-util = { version = "0.3.5", optional = true, default-features = false, features = ["std"... | 1 | 1 | 1 |
017e0cf5018d8778656cc6bbb0fbf8d6bde8c152 | Victor Berger | 2020-12-29T15:16:58 | Build all features doc in docs.rs | diff --git a/Cargo.toml b/Cargo.toml
index 746c01c..75ccd49 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "calloop"
-version = "0.7.0"
+version = "0.7.1"
authors = ["Victor Berger <victor.berger@m4x.org>"]
documentation = "https://docs.rs/calloop/"
repository = "https://github.com/Smith... | 1 | 4 | 1 |
61d307c40ab83cc01557a70fcc3ac8506aa9edd0 | Victor Berger | 2020-10-09T16:30:53 | Review docs | diff --git a/src/io.rs b/src/io.rs
index d5001ae..2a47215 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -1,3 +1,11 @@
+//! Adapters for async IO objects
+//!
+//! This module mainly hosts the [`Async`] adapter for making IO objects async with readiness
+//! monitoring backed by an [`EventLoop`](crate::EventLoop). See [`Loo... | 11 | 146 | 73 |
eefe4b62a99bf672e0aa3581e6fb047b60edfe36 | Victor Berger | 2020-07-27T14:33:59 | Fix tarpaulin attributes | diff --git a/src/loop_logic.rs b/src/loop_logic.rs
index c02a408..fb7e290 100644
--- a/src/loop_logic.rs
+++ b/src/loop_logic.rs
@@ -27,7 +27,7 @@ pub struct LoopHandle<Data> {
inner: Rc<LoopInner<Data>>,
}
-#[cfg_attr(tarpaulin, skip)]
+#[cfg(not(tarpaulin_include))]
impl<Data> Clone for LoopHandle<Data> {
... | 3 | 6 | 6 |
d4569ac5d0ffd4b38081e016bc749b9e4ad0bfd2 | François Laignel | 2020-05-08T17:37:22 | Rename ErasedIdle as CancellableIdle | diff --git a/src/sources/mod.rs b/src/sources/mod.rs
index c7e9af1..d64acea 100644
--- a/src/sources/mod.rs
+++ b/src/sources/mod.rs
@@ -168,7 +168,7 @@ pub struct Source<S: EventSource> {
/// This handle allows you to cancel the callback. Dropping
/// it will *not* cancel it.
pub struct Idle {
- pub(crate) callb... | 1 | 3 | 3 |
29a7a3ae2de4cf40a6cd9bbab1e100726499dc05 | Victor Berger | 2020-05-02T11:05:03 | Remove travis badge from Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index 3d83761..c587333 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,6 @@ edition = "2018"
readme = "README.md"
[badges]
-travis-ci = { repository = "Smithay/calloop" }
codecov = { repository = "Smithay/calloop" }
[dependencies] | 1 | 0 | 1 |
99279cc75a7b735c4086101e7a17c0d7b7abe377 | Victor Berger | 2020-04-20T18:11:49 | Doc typos | diff --git a/src/lib.rs b/src/lib.rs
index 5f58f23..76d7f10 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,7 +1,7 @@
//! Calloop, a Callback-based Event Loop
//!
//! This crate provides an `EventLoop` type, which is a small abstraction
-//! over an `mio`-based event loop. The main difference between this crate
+//! ... | 2 | 2 | 2 |
3195fe12c691f04193a9792b02d328c84c005c1d | Victor Berger | 2020-04-20T10:48:28 | tarpaulin: don't track trivial impls | diff --git a/src/loop_logic.rs b/src/loop_logic.rs
index 848401e..9989f8b 100644
--- a/src/loop_logic.rs
+++ b/src/loop_logic.rs
@@ -27,6 +27,7 @@ pub struct LoopHandle<Data> {
inner: Rc<LoopInner<Data>>,
}
+#[cfg_attr(tarpaulin, skip)]
impl<Data> Clone for LoopHandle<Data> {
fn clone(&self) -> LoopHandle... | 2 | 4 | 0 |
ed380ad4c3faeaae30092b40b33036e1b2294841 | Victor Berger | 2020-04-20T10:47:55 | Remove unused ErasedList | diff --git a/src/list.rs b/src/list.rs
index 918d9aa..9375b4e 100644
--- a/src/list.rs
+++ b/src/list.rs
@@ -46,15 +46,3 @@ impl<Data> SourceList<Data> {
::std::mem::replace(&mut self.sources[token.id as usize], None)
}
}
-
-pub(crate) trait ErasedList {
- // this returs a value for the same reason as... | 1 | 0 | 12 |
7aa6c13d80d7cb122f606b85288dc04a47873e04 | Victor Berger | 2020-04-20T06:46:13 | Even more tests | diff --git a/src/loop_logic.rs b/src/loop_logic.rs
index 9db1f00..848401e 100644
--- a/src/loop_logic.rs
+++ b/src/loop_logic.rs
@@ -364,7 +364,7 @@ impl LoopSignal {
mod tests {
use std::time::Duration;
- use crate::{Interest, Mode};
+ use crate::{generic::Generic, sources::ping::*, Interest, Mode, Poll,... | 2 | 217 | 4 |
80509dceb2bad6b7acf50affd8c6ee710e84378d | Victor Berger | 2020-04-20T06:32:15 | Update documentation | diff --git a/src/lib.rs b/src/lib.rs
index 2f4fd8d..5f58f23 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -16,7 +16,7 @@
//!
//! ## How to use it
//!
-//! ```no_run
+//! ```
//! extern crate calloop;
//!
//! use std::time::Duration;
@@ -39,21 +39,22 @@
//! //
//! // The `&mut shared_data` is a mut... | 2 | 12 | 12 |
638ef8a2388b2b5ecd349b6cf8dda976a95a7b82 | Victor Berger | 2020-04-20T06:31:55 | More tests | diff --git a/src/loop_logic.rs b/src/loop_logic.rs
index eb168a9..9db1f00 100644
--- a/src/loop_logic.rs
+++ b/src/loop_logic.rs
@@ -73,15 +73,13 @@ impl<Data: 'static> LoopHandle<Data> {
)));
let token = sources.add_source(dispatcher);
- if let Err(error) = sources
+ let ret = sources... | 1 | 68 | 11 |
0a0453ed269703249904042e1ac5e9be76fe6600 | Victor Berger | 2020-04-11T18:01:10 | Clippy fixes | diff --git a/src/list.rs b/src/list.rs
index f8cb8c4..2e9c38e 100644
--- a/src/list.rs
+++ b/src/list.rs
@@ -51,7 +51,7 @@ impl<Data> SourceList<Data> {
}
pub(crate) fn all(&self) -> Vec<Rc<RefCell<dyn EventDispatcher<Data>>>> {
- self.sources.iter().flat_map(|x| x).cloned().collect()
+ self.s... | 3 | 12 | 4 |
ff5d383b838110815b7e403960e88f3fe68b7d17 | Kai Mast | 2020-03-12T21:13:35 | Bump mio version | diff --git a/Cargo.toml b/Cargo.toml
index edd63e6..090138a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,7 +15,7 @@ travis-ci = { repository = "Smithay/calloop" }
codecov = { repository = "Smithay/calloop" }
[dependencies]
-mio = { version = "=0.7.0-alpha.1", features = ["os-poll", "os-util"] }
+mio = { version ... | 1 | 1 | 1 |
401de4a3bcec6fab86508cb439859047b3d42e73 | Victor Berger | 2020-01-15T15:03:55 | timer: reboustify timer scheduling
Always recompute the timer scheduling when a timeout
is added or removed, and correctly disarm the timer
when there is no timeout left. | diff --git a/src/sources/timer.rs b/src/sources/timer.rs
index 544a041..7092007 100644
--- a/src/sources/timer.rs
+++ b/src/sources/timer.rs
@@ -150,19 +150,31 @@ impl<Data, T, F: FnMut((T, TimerHandle<T>), &mut Data)> EventDispatcher<Data>
fn ready(&mut self, _event: Option<&MioEvent>, data: &mut Data) {
... | 1 | 36 | 15 |
1fc2294be98ba6b9b8b739c4197bf867c34290e7 | Victor Berger | 2020-01-10T22:26:08 | timer: add cancel_all_timeouts() | diff --git a/src/sources/timer.rs b/src/sources/timer.rs
index 7d10715..544a041 100644
--- a/src/sources/timer.rs
+++ b/src/sources/timer.rs
@@ -97,6 +97,13 @@ impl<T> TimerHandle<T> {
pub fn cancel_timeout(&self, timeout: &Timeout) -> Option<T> {
self.inner.lock().unwrap().cancel(timeout)
}
+
+ /... | 1 | 11 | 0 |
cafbd8e39db0c59ca6d6d392d4d10048a0b906a8 | Victor Berger | 2020-01-10T11:17:28 | Add some more tests
And ignore trivial Clone impls from coverage. | diff --git a/src/loop_logic.rs b/src/loop_logic.rs
index 6176ed5..914ffbf 100644
--- a/src/loop_logic.rs
+++ b/src/loop_logic.rs
@@ -339,4 +339,52 @@ mod tests {
// the test should return
event_loop.run(None, &mut (), |_| {}).unwrap();
}
+
+ #[test]
+ fn insert_remove() {
+ use crate... | 3 | 174 | 5 |
1a3c99548df76086e852474417b51108b4eb4251 | Christian Duerr | 2019-06-13T17:39:20 | Fix formatting issues | diff --git a/src/sources/channel.rs b/src/sources/channel.rs
index a350279..7c72270 100644
--- a/src/sources/channel.rs
+++ b/src/sources/channel.rs
@@ -153,7 +153,8 @@ mod tests {
Event::Closed => {
got.1 = true;
}
- }).map_err(Into::<io::Error>::into)
... | 4 | 16 | 8 |
39430829f1ebaa5b46fbe356d9b556add0d27cc2 | Christian Duerr | 2019-06-13T15:53:09 | Update to nix 0.14.1 | diff --git a/Cargo.toml b/Cargo.toml
index 6b4c3a3..0b14c29 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,7 @@ mio-extras = "2.0"
lazycell = "=1.0.0"
[target.'cfg(unix)'.dependencies]
-nix = "0.13"
+nix = "0.14.1"
[[test]]
name = "signals" | 1 | 1 | 1 |
e74f8565bd5691a442a63f009ac26d7d5d7ea5e4 | Victor Berger | 2018-10-02T10:29:34 | cargo fmt | diff --git a/src/sources/timer.rs b/src/sources/timer.rs
index f694040..4ffc693 100644
--- a/src/sources/timer.rs
+++ b/src/sources/timer.rs
@@ -90,10 +90,7 @@ impl<T> TimerHandle<T> {
/// This method can fail if the timer already has too many pending timeouts, currently
/// capacity is `2^16`.
pub fn ad... | 1 | 8 | 25 |
621c31c25e0b9d99e8e10660eab44543edbcbfb9 | Victor Berger | 2018-09-24T21:53:44 | tests: fix lazycel to =1.0.0
Higher versions don't build with rust 1.21.0 | diff --git a/Cargo.toml b/Cargo.toml
index 98da63d..e01da66 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,6 +16,9 @@ codecov = { repository = "Smithay/calloop" }
mio = "0.6"
mio-more = "0.1"
+[dev-dependencies]
+lazycell = "=1.0.0"
+
[target.'cfg(unix)'.dependencies]
nix = "0.11" | 1 | 3 | 0 |
beeee758d5fe5bf46e2b55e880107d64d232eca1 | Victor Berger | 2018-09-24T21:49:09 | cargo fmt | diff --git a/src/sources/channel.rs b/src/sources/channel.rs
index d62fef3..4507829 100644
--- a/src/sources/channel.rs
+++ b/src/sources/channel.rs
@@ -153,8 +153,7 @@ mod tests {
Event::Closed => {
got.1 = true;
}
- })
- .unwrap();
+ ... | 4 | 8 | 16 |
1f89bdfe81019727905ce7c1d3ed056d1ccc755d | Victor Berger | 2018-09-10T12:01:45 | Introduce wakeup and run/stop mechanisms.
This introduces an `EventLoop::run()` method as a shorthand for looping
between dispatching events and running a user callback.
To accompany it, this also adds the `LoopSignal` struct, which gives the
capability to wakeup and stop the event loop from anywhere (it is Send+Sync... | diff --git a/src/lib.rs b/src/lib.rs
index af3580d..512ebcd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -84,7 +84,7 @@ extern crate mio_more;
#[cfg(unix)]
extern crate nix;
-pub use self::loop_logic::{EventLoop, LoopHandle};
+pub use self::loop_logic::{EventLoop, LoopHandle, LoopSignal};
pub use self::sources::*;
... | 2 | 123 | 8 |
1422cb7646c0aa3d0bf28ca7e3dd8dbcdcc5c7a5 | Victor Berger | 2018-08-29T10:01:03 | Timer event sources | diff --git a/src/sources/mod.rs b/src/sources/mod.rs
index 85a2638..a372885 100644
--- a/src/sources/mod.rs
+++ b/src/sources/mod.rs
@@ -10,6 +10,7 @@ pub mod channel;
pub mod generic;
#[cfg(unix)]
pub mod signals;
+pub mod timer;
/// Trait representing a source that can be inserted into an EventLoop
///
diff --... | 3 | 335 | 1 |
d76828410940fe8f940806478cb82284a35e58b7 | Victor Berger | 2018-08-29T08:43:18 | Fix typo doc comment | diff --git a/src/sources/channel.rs b/src/sources/channel.rs
index 551284e..634ae16 100644
--- a/src/sources/channel.rs
+++ b/src/sources/channel.rs
@@ -6,7 +6,7 @@
//! one event per message.
//!
//! This implementation is based on
-//! [`mio_more::channels`](https://docs.rs/mio-more/*/mio_more/channel/index.html).
... | 1 | 1 | 1 |
fc0cd3f9cd3dbb95cf3cc3217c9cc7774789eba8 | Victor Berger | 2018-08-29T08:34:48 | Fix signal::Event #[derive()] | diff --git a/src/sources/signals.rs b/src/sources/signals.rs
index 39e0953..c3cade2 100644
--- a/src/sources/signals.rs
+++ b/src/sources/signals.rs
@@ -26,7 +26,7 @@ use nix::sys::signalfd::{SfdFlags, SignalFd};
use {EventDispatcher, EventSource};
/// An event generated by the signal event source
-/// #[derive(Cop... | 1 | 1 | 1 |
7bb475131094c33144ed4f255fa6d11087bf8419 | Victor Berger | 2018-08-28T11:38:44 | tests: more signal tests | diff --git a/tests/signals.rs b/tests/signals.rs
index a9003d4..2a5646c 100644
--- a/tests/signals.rs
+++ b/tests/signals.rs
@@ -3,7 +3,11 @@
#[cfg(unix)]
fn main() {
- self::test::single_usr1();
+ for test in self::test::TESTS {
+ test();
+ // reset the signal mask between tests
+ self::... | 1 | 82 | 3 |
9d6f386a35ce9cbcf50faf2779f9b7aef0c7e23b | Victor Berger | 2018-08-26T11:13:48 | sources: add signals source | diff --git a/Cargo.toml b/Cargo.toml
index 703937a..eb04fec 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,10 +6,18 @@ documentation = "https://docs.rs/calloop/"
repository = "https://github.com/Smithay/calloop"
license = "MIT"
description = "A callback-based event loop"
+autotests = false
[badges]
travis-ci = {... | 5 | 280 | 1 |
9e9c4b1bce6aee35312c46dc4db70d7199bb23ca | Victor Berger | 2018-08-26T10:56:16 | sources: more explicit comments about dropping | diff --git a/src/sources/mod.rs b/src/sources/mod.rs
index 597fef7..883d2f2 100644
--- a/src/sources/mod.rs
+++ b/src/sources/mod.rs
@@ -46,7 +46,9 @@ pub trait EventDispatcher {
/// depending on the source kind that will be provided by the `Deref`
/// implementation of this struct to the evented object.
///
-/// Dr... | 1 | 3 | 1 |
0a8414e883b0057fc29e58b187dbdcf52cc117aa | Victor Berger | 2018-08-24T16:32:50 | tests: idle dispatch | diff --git a/src/loop_logic.rs b/src/loop_logic.rs
index 8173701..1e0a321 100644
--- a/src/loop_logic.rs
+++ b/src/loop_logic.rs
@@ -137,3 +137,46 @@ impl EventLoop {
Ok(())
}
}
+
+#[cfg(test)]
+mod tests {
+ use std::cell::Cell;
+ use std::rc::Rc;
+ use std::time::Duration;
+
+ use super::Ev... | 1 | 43 | 0 |
d714dc9af046c594c961a9b14e45014bc6fef8b8 | Victor Berger | 2018-08-24T16:26:23 | cargo fmt | diff --git a/src/lib.rs b/src/lib.rs
index cf5eb8f..e12085f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,35 +1,35 @@
//! Calloop, a Callback-based Event Loop
-//!
+//!
//! This crate provides an `EventLoop` type, which is a small abstraction
//! over an `mio`-based event loop. The main difference between this cra... | 3 | 34 | 30 |
6940b565d62bec2b41d4e99fe8199393efca913b | Georg Semmler | 2025-12-16T18:01:10 | Exclude a script file from the published package (#88)
During a dependency review we noticed that the xattr crate includes a ci script file. This file is not required for building xattr as depndency. The script file might at some point become problematic. As of now they prevent any downstream user from enabling the `[... | diff --git a/Cargo.toml b/Cargo.toml
index 7db57899..cb47d743 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,6 +9,7 @@ documentation = "https://docs.rs/xattr"
repository = "https://github.com/Stebalien/xattr"
keywords = ["xattr", "filesystem", "unix"]
license = "MIT OR Apache-2.0"
+include = ["README.md", "LICENSE-*... | 1 | 1 | 0 |
3e1914f5dac41437db1fed74f6284fd84cb26b26 | Steven Allen | 2025-09-21T02:51:53 | chore: release 1.6.1 | diff --git a/Cargo.toml b/Cargo.toml
index c73facfa..7db57899 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "xattr"
edition = "2021"
-version = "1.6.0"
+version = "1.6.1"
authors = ["Steven Allen <steven@stebalien.com>"]
description = "unix extended filesystem attributes" | 1 | 1 | 1 |
8b183b3580c466d4b035f330671eba50ae8161e3 | Steven Allen | 2025-09-21T02:31:33 | test: test listing more than 4096 bytes of extended attributes
fixes #84 | diff --git a/tests/main.rs b/tests/main.rs
index 16e2742e..697ae7da 100644
--- a/tests/main.rs
+++ b/tests/main.rs
@@ -2,7 +2,7 @@ use std::collections::BTreeSet;
use std::ffi::OsStr;
use xattr::FileExt;
-use tempfile::{tempfile, NamedTempFile};
+use tempfile::{tempfile, tempfile_in, NamedTempFile};
#[test]
#[c... | 1 | 32 | 1 |
df9ee49ef08bbbf2ed76928fa659341147bc818b | Steven Allen | 2025-09-21T02:06:34 | fix: freebsd's xattr returns the number of bytes read
On linux, the xattr API returns the ERANGE if the result doesn't fit. On
FreeBSD, it returns the number of bytes read.
Previously, this wasn't an obvious issue because we always checked the
size before we read the attribute. It was still incorrect, but would
have ... | diff --git a/src/sys/bsd.rs b/src/sys/bsd.rs
index 6e772fa4..60c99b8f 100644
--- a/src/sys/bsd.rs
+++ b/src/sys/bsd.rs
@@ -56,13 +56,18 @@ fn allocate_loop<F: Fn(*mut c_void, size_t) -> libc::ssize_t>(f: F) -> io::Resul
|buf| unsafe {
let (ptr, len) = slice_parts(buf);
let new_len = c... | 2 | 17 | 7 |
99b48d89c8f7ad5f3cf679d2e05222ac35b9805f | Steven Allen | 2025-09-21T01:35:08 | chore: fix unused imports | diff --git a/src/sys/bsd.rs b/src/sys/bsd.rs
index 13aab758..6e772fa4 100644
--- a/src/sys/bsd.rs
+++ b/src/sys/bsd.rs
@@ -2,7 +2,7 @@
use libc::{c_int, c_void, size_t, EPERM};
use std::ffi::{CString, OsStr, OsString};
-use std::mem::{self, MaybeUninit};
+use std::mem::MaybeUninit;
use std::os::unix::ffi::{OsStrEx... | 2 | 1 | 2 |
bb2d06eec1a5fa997d12b437328ad8d479dc6175 | Steven Allen | 2025-09-21T01:27:51 | chore: release 1.6.0 | diff --git a/Cargo.toml b/Cargo.toml
index 28fe1e9f..c73facfa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "xattr"
edition = "2021"
-version = "1.5.1"
+version = "1.6.0"
authors = ["Steven Allen <steven@stebalien.com>"]
description = "unix extended filesystem attributes" | 1 | 1 | 1 |
0e2bc6e6e356398713bbc87180eb08a27441894f | Steven Allen | 2025-09-21T01:27:24 | refactor: remove manual clone impl (#82)
It's ancient history. | diff --git a/src/sys/bsd.rs b/src/sys/bsd.rs
index fa4eb85b..13aab758 100644
--- a/src/sys/bsd.rs
+++ b/src/sys/bsd.rs
@@ -67,35 +67,13 @@ fn allocate_loop<F: Fn(*mut c_void, size_t) -> libc::ssize_t>(f: F) -> io::Resul
}
/// An iterator over a set of extended attributes names.
-#[derive(Default)]
+#[derive(Default... | 2 | 2 | 40 |
eca400bd922be366ef0d9c2abc93d63ebca80c6d | Steven Allen | 2025-09-21T00:56:01 | refactor: cleanup bsd code (#81)
1. Prefer `extend_from_slice` where possible.
2. Avoid calling `as_bytes` where possible.
3. Use the the question mark operator where possible. | diff --git a/src/sys/bsd.rs b/src/sys/bsd.rs
index 41c0e79a..fa4eb85b 100644
--- a/src/sys/bsd.rs
+++ b/src/sys/bsd.rs
@@ -179,11 +179,12 @@ fn name_to_ns(name: &OsStr) -> io::Result<(c_int, CString)> {
}
fn prefix_namespace(attr: &OsStr, ns: c_int) -> OsString {
- let nsname = EXTATTR_NAMESPACE_NAMES[ns as usiz... | 1 | 9 | 18 |
03d129a897524b338f3e93c95e1a22fe56af3d08 | Steven Allen | 2025-09-21T00:46:14 | feat: use a larger buffer when reading attributes (#80)
The code is somewhat nasty, but I'm trying to abstract over different
platforms and multiple calling conventions...
fixes #79 | diff --git a/src/sys/bsd.rs b/src/sys/bsd.rs
index c74a1caa..41c0e79a 100644
--- a/src/sys/bsd.rs
+++ b/src/sys/bsd.rs
@@ -2,12 +2,12 @@
use libc::{c_int, c_void, size_t, EPERM};
use std::ffi::{CString, OsStr, OsString};
-use std::io;
-use std::mem;
+use std::mem::{self, MaybeUninit};
use std::os::unix::ffi::{OsSt... | 3 | 95 | 108 |
1ec2f591a860e8c54c89ae44795ec85b4ada4f99 | Steven Allen | 2025-09-20T22:00:36 | feat: guess the max xattr size once (#77)
Instead of always allocating in a loop, guess that the extended
attribute value is less than 256 bytes and try once.
- In the best case when extended attributes are small, this will save us
a syscall.
- In the worst case when they're larger than 256 bytes, we'll make 3
syscal... | diff --git a/src/util.rs b/src/util.rs
index e578cc03..7174a244 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -15,6 +15,23 @@ pub fn allocate_loop<E, F: FnMut(&mut [u8]) -> Result<usize, E>>(mut f: F) -> io
where
io::Error: From<E>,
{
+ // Try assuming the variable is less than 256. We do this on the stack an... | 1 | 17 | 0 |
47dbda862e505d5c4ab21f9693bca459493e0330 | Steven Allen | 2025-06-25T14:18:23 | chore: release 1.5.1 | diff --git a/Cargo.toml b/Cargo.toml
index 0724375a..28fe1e9f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "xattr"
edition = "2021"
-version = "1.5.0"
+version = "1.5.1"
authors = ["Steven Allen <steven@stebalien.com>"]
description = "unix extended filesystem attributes" | 1 | 1 | 1 |
c296d8c7f2e864d4d0bd75dac05c58f5a1c55d8c | Steven Allen | 2025-06-25T14:11:46 | Fix license specifier
"/" is ambiguous, this should always have been OR.
fixes #74 | diff --git a/Cargo.toml b/Cargo.toml
index be258f84..0724375a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,7 +8,7 @@ description = "unix extended filesystem attributes"
documentation = "https://docs.rs/xattr"
repository = "https://github.com/Stebalien/xattr"
keywords = ["xattr", "filesystem", "unix"]
-license = "M... | 1 | 1 | 1 |
d7b586858707c7d13084f29d60a9214fd203b24c | Steven Allen | 2025-03-06T18:53:37 | release v1.5.0 | diff --git a/Cargo.toml b/Cargo.toml
index ce76f06f..be258f84 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "xattr"
edition = "2021"
-version = "1.4.0"
+version = "1.5.0"
authors = ["Steven Allen <steven@stebalien.com>"]
description = "unix extended filesystem attributes" | 1 | 1 | 1 |
d9b16234f4bc645217dc6ed493befe31b022010f | Steven Allen | 2025-03-06T18:53:02 | update rustix to 1.0.0 (#71) | diff --git a/Cargo.toml b/Cargo.toml
index 4feb0675..ce76f06f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,20 +20,13 @@ default = ["unsupported"]
# platforms. This would make sense if you absolutely need xattr support.
unsupported = []
-[dependencies.rustix]
-version = "0.38.34"
+[target.'cfg(any(target_os = "an... | 5 | 15 | 33 |
5ec2da4c1af9e2fb624e264281479b80ed64b041 | Steven Allen | 2025-01-06T16:51:33 | Fix debug format test on systems with selinux (#69)
Instead of checking for an expected value, we check that the returned
value contains the information we expect. Otherwise, additional
properties (like selinux properties) will break the test.
fixes #68 | diff --git a/tests/main.rs b/tests/main.rs
index 09ade19e..8d344cba 100644
--- a/tests/main.rs
+++ b/tests/main.rs
@@ -88,20 +88,33 @@ fn test_missing() {
#[test]
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "macos"))]
fn test_debug() {
+ use std::os::unix::ffi::OsStrExt;
+
// Only works... | 1 | 17 | 4 |
8e556daa6ab20fdeda23ccdbdf23c14b714bcf1c | Steven Allen | 2025-01-05T17:57:47 | Release 1.4.0
- Update the minimum rustix version.
- Add gnu/hurd support.
- Implement `Default` for `XAttrs`.
- Implement `Debug` for `XAttrs`. | diff --git a/Cargo.toml b/Cargo.toml
index 13776da3..4feb0675 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "xattr"
edition = "2021"
-version = "1.3.1"
+version = "1.4.0"
authors = ["Steven Allen <steven@stebalien.com>"]
description = "unix extended filesystem attributes" | 1 | 1 | 1 |
f0588d99e6b0f99d632b533a838319a8b9792bb6 | Steven Allen | 2025-01-05T17:53:20 | Implement Debug for XAttrs (#66)
This implementation allocates and likely doesn't need to but... it's for
debugging and it means I have to write/maintain less code which is
especially important as this code runs on many platforms that don't get
extensively tested.
fixes #62 | diff --git a/src/lib.rs b/src/lib.rs
index d15f1a53..e9aa173c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -32,9 +32,9 @@ mod util;
use std::ffi::OsStr;
use std::fs::File;
-use std::io;
use std::os::unix::io::{AsRawFd, BorrowedFd};
use std::path::Path;
+use std::{fmt, io};
pub use error::UnsupportedPlatformErro... | 3 | 37 | 2 |
ccd5a1cdc16c8c71d4ee9316a6bf1bcccaf19447 | Steven Allen | 2025-01-05T17:23:29 | Implement Default for XAttrs structs (#65)
This is convenient in cases where you sometimes need to list the
attributes, and sometimes don't (requiring ether a dance with `Option`
or the ability to construct an empty XAttrs).
At the same time, make the "unsupported" XAttrs act like it's empty
instead of panicing. | diff --git a/src/sys/bsd.rs b/src/sys/bsd.rs
index c0ae63fe..3361de2b 100644
--- a/src/sys/bsd.rs
+++ b/src/sys/bsd.rs
@@ -44,6 +44,7 @@ fn slice_parts(buf: &mut [u8]) -> (*mut c_void, size_t) {
}
/// An iterator over a set of extended attributes names.
+#[derive(Default)]
pub struct XAttrs {
user_attrs: Box<... | 3 | 5 | 3 |
5b3a2846c9ef38709fc585f98a27b79c74ce08ae | Steven Allen | 2025-01-05T17:14:44 | Reformat all with rust-analyzer (#64)
`cargo fmt` says this is all fine but rustfmt doesn't. I don't feel like
fighting with it, so I'm just accepting the new format. | diff --git a/src/sys/bsd.rs b/src/sys/bsd.rs
index f1014da0..c0ae63fe 100644
--- a/src/sys/bsd.rs
+++ b/src/sys/bsd.rs
@@ -1,21 +1,18 @@
//! FreeBSD and NetBSD xattr support.
+use libc::{c_int, c_void, size_t, EPERM};
use std::ffi::{CString, OsStr, OsString};
use std::io;
use std::mem;
use std::os::unix::ffi::{O... | 2 | 49 | 40 |
c62bb265e036e89afbddb3d141c8c91895bf430d | Samuel Thibault | 2024-06-10T23:02:00 | Add GNU/Hurd support (#60) | diff --git a/src/sys/mod.rs b/src/sys/mod.rs
index 4a171b78..a1d6ceb4 100644
--- a/src/sys/mod.rs
+++ b/src/sys/mod.rs
@@ -29,6 +29,6 @@ macro_rules! platforms {
}
platforms! {
- "android"; "linux"; "macos" => linux_macos,
+ "android"; "linux"; "macos"; "hurd" => linux_macos,
"freebsd"; "netbsd" => bsd
... | 1 | 1 | 1 |
b92dbc9530542e2481483893a75fc3269d65c959 | Steven Allen | 2024-05-10T19:21:28 | chore: update rustix (#59)
fixes #57 | diff --git a/Cargo.toml b/Cargo.toml
index 17d960e2..13776da3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,7 @@ default = ["unsupported"]
unsupported = []
[dependencies.rustix]
-version = "0.38.29"
+version = "0.38.34"
default-features = false
features = ["fs", "std"] | 1 | 1 | 1 |
d41316a862ec1823514eb9ae1ab1382a63adc0a4 | Tom Mulcahy | 2024-05-10T19:17:10 | Add deref test (#58) | diff --git a/tests/main.rs b/tests/main.rs
index 81f45b28..d6650da3 100644
--- a/tests/main.rs
+++ b/tests/main.rs
@@ -112,3 +112,44 @@ fn test_multi() {
}
assert!(items.is_empty());
}
+
+// Tests the deref API variants - regression test for
+// https://github.com/Stebalien/xattr/issues/57
+#[test]
+#[cfg(an... | 1 | 41 | 0 |
16ceafd4c00c84fc0fb92d4a355f8fe57c102652 | Steven Allen | 2024-01-15T02:56:39 | Release v1.3.1 | diff --git a/Cargo.toml b/Cargo.toml
index f2b89931..17d960e2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "xattr"
edition = "2021"
-version = "1.3.0"
+version = "1.3.1"
authors = ["Steven Allen <steven@stebalien.com>"]
description = "unix extended filesystem attributes" | 1 | 1 | 1 |
babf3919afe34a1890a04abc93741d453ab5ddd5 | Steven Allen | 2024-01-15T02:56:26 | fix: restore deref behavior for get_path (#56)
Got dropped when I merged the last PR. | diff --git a/src/sys/linux_macos.rs b/src/sys/linux_macos.rs
index 122029e0..4f1a0c14 100644
--- a/src/sys/linux_macos.rs
+++ b/src/sys/linux_macos.rs
@@ -106,7 +106,8 @@ pub fn get_path(path: &Path, name: &OsStr, deref: bool) -> io::Result<Vec<u8>> {
let name = name.into_c_str()?;
allocate_loop(|buf| {
- ... | 1 | 2 | 1 |
c6a9b1a6fa8d908a08eda0121d9665b63dcad450 | Steven Allen | 2024-01-15T02:50:01 | Release v1.3.0
Removes dependency on libc for macos. | diff --git a/Cargo.toml b/Cargo.toml
index 358b9c04..f2b89931 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "xattr"
edition = "2021"
-version = "1.2.0"
+version = "1.3.0"
authors = ["Steven Allen <steven@stebalien.com>"]
description = "unix extended filesystem attributes" | 1 | 1 | 1 |
85ebb7e56bf67548e0d1db981df898f59937070c | Steven Allen | 2024-01-15T02:37:01 | Remove libc dependency on macos (#54)
Now that https://github.com/bytecodealliance/rustix/issues/957 is fixed,
we can drop the libc dependency for macos. | diff --git a/Cargo.toml b/Cargo.toml
index 29015726..358b9c04 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,7 +21,7 @@ default = ["unsupported"]
unsupported = []
[dependencies.rustix]
-version = "0.38.28"
+version = "0.38.29"
default-features = false
features = ["fs", "std"]
@@ -31,7 +31,7 @@ version = "0.4.1... | 2 | 3 | 28 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.