Commit Graph

1336 Commits

Author SHA1 Message Date
Alex Saveau dfbdf3c300 Add method to know when buffer will be refilled (#524)
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2023-02-03 14:40:21 -08:00
Dan Gohman 5f3a7598d6 chore: Release rustix version 0.36.7 2023-01-18 11:07:35 -08:00
Dan Gohman cfad01449f Fix compilation on armv7-unknown-freebsd (#518)
* Fix compilation on armv7-unknown-freebsd

Use `time_t::MAX` to avoid depending on the relationship between
`time_t` and `c_long`.

* Silence the deprecation warning about `time_t`.
2023-01-17 12:40:15 -08:00
Dan Gohman fa90377478 Remove FreeBSD 12 from CI. (#517)
FreeBSD 12 has been failing in CI like this:

```
...
[5/5] Extracting curl-7.87.0: .......... done
curl https://sh.rustup.rs -sSf --output rustup.sh
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

Exit status: 60
```

The FreeBSD 13 run still works, so switch to just testing on
FreeBSD 13.
2023-01-17 12:40:15 -08:00
Alex Saveau 2bc2229509 Simplify RawDir iteration (#515)
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2023-01-17 12:40:15 -08:00
Wilfred Hughes 7fc2e48730 Fix typo in README.md (#516) 2023-01-17 12:40:15 -08:00
Dan Gohman 442220d8ee Sync with io-lifetimes' build.rs changes (#511)
As a counterpart to https://github.com/sunfishcode/io-lifetimes/pull/58,
port the changes from io-lifetimes' build.rs to rustix.
2023-01-17 12:40:15 -08:00
Alex Saveau c9fb537048 Add mount syscall (#494)
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2023-01-17 12:40:15 -08:00
Alex Saveau dfcc45d79e Fix Fuchsia target (#504)
* Fix Fuchsia target

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

* Update main.yml

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2023-01-17 12:40:15 -08:00
Alex Saveau 8ba48ca279 Fix docs typo (#498) 2023-01-17 12:40:15 -08:00
Dan Gohman 3548e93dfa chore: Release rustix version 0.36.6 2022-12-26 21:03:56 -08:00
Dan Gohman 54d04c9bc8 Support preadv2 and pwritev2 on all non-glibc Linux ABIs. (#489)
Use `libc::syscall` on ABIs where libc doesn't have bindings for
`preadv2` and `pwritev2`.
2022-12-26 20:56:54 -08:00
Alex Saveau 0b844fc778 Fix another UB in raw dir (#474)
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-12-13 10:40:42 -08:00
Dan Gohman 5225e27a1f Add From impls for SocketAddrAny. (#482)
This allows more convenient construction of `SocketAddrAny` values.
2022-12-13 10:27:53 -08:00
Dan Gohman 1f2532f93d Add doc aliases for seek, tell, and chownat. (#481)
* Add doc aliases for `seek`, `tell`, and `chownat`.

* Add a mention of `socket_with` in `socket`'s documentation.

* Fix a broken doc comment link.
2022-12-13 10:27:34 -08:00
Dan Gohman 3502eb064b Fix the custom definition of Timespec to implement Copy. (#484) 2022-12-13 10:25:25 -08:00
Dan Gohman 5c23ff6773 Pin CI to Ubuntu 20.04 until #483 is sorted out. 2022-12-13 08:46:14 -08:00
Dan Gohman adfe93d115 Add --features=all-apis to the Cirrus CI config.
This enables testing for all the API modules, such as fs, net, process,
and all the rest.
2022-12-05 13:38:44 -08:00
Alan Somers 282dffc589 Future-proof for FreeBSD 12 (#469)
FreeBSD 12 changes the dirent structure, among other things.  libc
currently binds a FreeBSD 11 ABI, but that will change some day.  Tweak
rustix's dirent initialization code to work with either FreeBSD 11 or
12.
2022-12-03 09:36:21 -08:00
Dan Gohman 4e2599b729 Run the tests on Rust 1.48, and check compilation of tests and examples on more targets (#465)
* Fix the tests to run on 1.48.

This puts the benchmarks behind a `criterion` cfg, so add
`--cfg=criterion` to RUSTFLAGS when running cargo bench.

An MSRV of 1.48 enables us to support users such as async-io, which also
has an MSRV of 1.48.

* Add a rust-version field.

This prints a warning under Rust 1.48, but only when rustix is the
top-level build; when rustix is a dependency, it doesn't warn, so this
seems ok.
2022-12-01 11:42:09 -08:00
Dan Gohman 815104341c Don't check the errno value from isatty. (#468)
We don't actually do anything different for different errno values,
other than panic on unknown ones, and that isn't that isn't adding
much value compared to the cost of being an extra surprise when
porting to new OS's.

Fixes #467.
2022-12-01 11:03:27 -08:00
John Nunley 849d1832e5 Deduplicate the "context" set of structures (#466)
* Deduplicate the "context" set of structures
2022-11-30 08:10:50 -08:00
Alex Saveau 2aff00c77e Fix UB due to misaligned RawDir pointer (#464)
* Fix UB due to misaligned RawDir pointer

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

* Add alignment and stack tests to RawDir

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-11-29 17:05:39 -08:00
Dan Gohman 60b84026d7 Make the "param" module depend on the "fs" module.
In some configurations, the param module needs to open /proc/self/auxv,
and it needs the fs API to do that, so make the param module depend on
the fs module.

Also, disable the init_from_proc_self_auxv code on mustang, which
doesn't need it.
2022-11-28 12:36:15 -08:00
Dan Gohman d85c50603b Enable rustix::termios::isatty on wasm32-wasi. 2022-11-28 08:58:36 -08:00
Dan Gohman ef9a77313a Tidy up uses. 2022-11-28 08:58:36 -08:00
Dan Gohman 8fca74091c Tidy up cfgs. 2022-11-28 08:58:36 -08:00
Dan Gohman f6f44b7b05 Implement unshare. (#461)
Fixes #452.
2022-11-28 08:52:24 -08:00
Alex Saveau b5c2ea7127 Add zero-compromise directory iteration (#457)
* Add zero-compromise directory iteration

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

* Address review feedback

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

* Vastly simplify file_name calculation and remove pointer manipulation BS, yielding a 2x instruction count reduction

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

* Implement docs changes I mentioned

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

* Fix debug impl

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

* Support libc backend

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

* Clarify portability of fixed-sized buffers

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

* Turns out from_ptr is faster, oh well

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

* Make cookie a u64

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

* Fix cfgs

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-11-23 15:42:07 -08:00
Dan Gohman 2aa66b2435 chore: Release rustix version 0.36.3 2022-11-22 10:39:10 -08:00
Dan Gohman 28d40939ca Minor formatting cleanups. (#459) 2022-11-21 11:18:59 -08:00
Dan Gohman c7146a721e Fix compilation with --no-default-features. (#454)
Move `fcntl_getfd`, `fcntl_setfd`, and `fcntl_dupfd_cloexec` out of
the `fs` module and into the `io` module, since they're not specific
to files, directories or memfd. This allows them to be used with the
"fs" feature is not enabled.

Also, add public aliases for then in `fs`, for compatibility, and to
have a place where all `fcntl` function are present.

And add a CI check for --no-default-features with no API features.

Fixes #453.
2022-11-21 10:56:46 -08:00
Dan Gohman d6164939a7 Fix a few clippy lints. (#458)
Fix a few minor clippy lints, and add clippy overrides for warnings that
we can't easily fix due to our MSRV, or due to our support of multiple targets.
2022-11-21 08:30:40 -08:00
Alex Saveau 74c56f3e70 Fix clippy lint (#455)
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-11-21 06:51:33 -08:00
Dan Gohman fefe0652d7 chore: Release rustix version 0.36.2 2022-11-18 08:26:52 -08:00
Dan Gohman 8b5196283a Fix test compilation when "threads" or "procfs" aren't enabled. 2022-11-18 08:19:32 -08:00
Dan Gohman 2fc4f1be16 Disable the internal fs module when the "fs" feature isn't enabled. (#449)
Rustix no longer has anything in the tree that needs the `fs` module
when the public "fs" feature isn't enabled, so make the `fd` module
conditional on `cfg(feature = "fs")`.
2022-11-16 12:19:50 -08:00
Alex Saveau 663a74364a Use stdlib with_c_str implementation (#448) 2022-11-16 12:19:21 -08:00
Dan Gohman 2a2ef7e1c8 Remove the uid/gid checks from the procfs code entirely. (#450)
As a followup to #444, remove the uid/gid checks from the procfs code
entirely. Procfs files can have their owner changed to root:root under
`PR_SET_DUMPABLE`, and root can be remapped to nobody by user
namespaces.

This check wasn't guarding against a known problem, and it's complex
to make sure it doesn't spuriously fail under any vald configuration,
so just remove it.
2022-11-15 16:21:16 -08:00
Dan Gohman 19af9c3943 Update to actions/cache@v3. 2022-11-15 14:17:13 -08:00
Dan Gohman 962ec8ab9a Change the procfs code to be tolerate of files being owned by root:root. (#444)
When a process is marked as non-dumpable, Linux changes the permissions
of the files under /proc/<pid> as owned by root:root. Relax the procfs
code, including removing use of `O_NOATIME`, so that it works on files
owned by `root:root`.

Fixes #441.
2022-11-15 10:32:38 -08:00
niluxv 701cd6392c Fix compilation on macos without std (#442) 2022-11-14 06:28:37 -08:00
Dan Gohman b116f6d749 Temporarily disable the async-std, tokio, mio, and socket2 impls. (#443)
Temporarily disable io-lifetimes impls for third-party crates which don't
yet have have trait impls for the I/O safety traits.
2022-11-14 06:27:26 -08:00
Dan Gohman 812364ace3 Update to actions/checkout@v3. 2022-11-13 07:23:30 -08:00
Dan Gohman bf60c1099d chore: Release rustix version 0.36.1 2022-11-07 17:39:57 -08:00
Dan Gohman 12dd67ff6a Enable the "close" feature for io-lifetimes. (#440)
* Enable the "close" feature for io-lifetimes.

This follows up on #422, but enables "close" on the regular dependency
too, and not just the dev-dependency.

* Temporarily disable the backends no-libc test.
2022-11-07 17:39:05 -08:00
Dan Gohman e15a462fd3 chore: Release rustix version 0.36.0 2022-11-07 10:15:58 -08:00
Dan Gohman aac5e72ba2 Update to io-lifetimes 1.0. 2022-11-07 09:51:08 -08:00
Dan Gohman dd139fbfaa Update dependency versions. (#438)
Update the github action to node16. And update to memoffset 0.7.1 and
criterion 0.4.
2022-11-07 09:00:19 -08:00
niluxv 70b6814802 Use platform independent IpAddr and SocketAddr (#433)
Update `src/net/ip.rs` and `src/net/addr.rs` to use the new std code,
making these structures platform independent.

Doesn't include the new Debug/Display formatting code for these
structures, although that could have been added now that it doesn't
depend on std anymore.
2022-11-07 08:25:20 -08:00