Commit Graph

2769 Commits

Author SHA1 Message Date
openharmony_ci
fb8c2cd2e9
!4 Add oh user guide
Merge pull request !4 from fangting/master
2023-05-04 06:17:05 +00:00
fangting
fc1d64f943 add oh user guide
Signed-off-by: fangting <fangting12@huawei.com>
2023-05-04 11:58:29 +08:00
openharmony_ci
459543886a
!3 Add README_zh.md
Merge pull request !3 from fangting/master
2023-04-25 03:45:16 +00:00
haotuo
6010ae96b5 Add oh usage guide
Issue:#I6YAO1

Signed-off-by: haotuo <haotuo@huawei.com>
2023-04-25 09:50:00 +08:00
fangting
ca2e912d19 Add README_zh.md
Signed-off-by: fangting <fangting12@huawei.com>
2023-04-24 10:39:40 +08:00
openharmony_ci
e96fa93dc0
!2 Add OAT.xml and README.OpenSource
Merge pull request !2 from fangting/master
2023-04-14 08:10:09 +00:00
fangting
3ddc24a85c Add OAT.xml and README.OpenSource
Signed-off-by: fangting <fangting12@huawei.com>
2023-04-14 14:15:10 +08:00
openharmony_ci
700930ac66
!1 [nix]Add OH support and BUILD.gn for rust nix
Merge pull request !1 from haotuo/master
2023-04-13 11:33:31 +00:00
haotuo
2aa508951b Add OH support and BUILD.gn for build
Issue:https://gitee.com/openharmony/build/issues/I6UFTP

Signed-off-by: haotuo <haotuo@huawei.com>
2023-04-11 17:30:56 +08:00
Alan Somers
1e3f062fd8 (cargo-release) version 0.26.2 2023-01-17 17:09:07 -07:00
bors[bot]
013931b68f
Merge #1974
1974: Prepare release 0.26.2 r=asomers a=asomers

Cherry-pick #1964 .

Co-authored-by: Aaron Drew <aarond10@gmail.com>
Co-authored-by: Alan Somers <asomers@gmail.com>
Co-authored-by: Jonathan <jonathanwoollettlight@gmail.com>
2023-01-17 22:06:13 +00:00
Jonathan
8aa85bbf27 fix: clippy::size_of_ref 2023-01-17 14:54:22 -07:00
Alan Somers
4a83f8b8b5 Drop x86_64-unknown-darwin to Tier 2
And promote aarch64-unknown-darwin to Tier 1.  Because that's what
Cirrus CI is doing.

Fixes #1904
2023-01-17 14:37:53 -07:00
Alan Somers
975a3d5c7c Tidy up the CHANGELOG a bit. 2023-01-17 14:19:16 -07:00
Aaron Drew
6fd7418158 Fix endian swap on SocketAddrV6.
flowinfo and scope_id should not be byte swapped.
2023-01-17 14:16:48 -07:00
Alan Somers
e7a646ddff (cargo-release) version 0.26.1 2022-11-28 23:28:58 -07:00
bors[bot]
749bf755ce
Merge #1821
1821: Fix UB in the SO_TYPE sockopt r=rtzoeller a=asomers

When reading a value into an enum from getsockopt, we must validate it. Failing to do so can lead to UB for example with SOCK_PACKET on Linux.

Perform the validation in GetSockOpt::get.  Currently SockType is the only type that requires validation.

Fixes #1819

Co-authored-by: Alan Somers <asomers@gmail.com>
2022-11-29 06:13:51 +00:00
Alan Somers
8e91b28b64 Fix UB in the SO_TYPE sockopt
When reading a value into an enum from getsockopt, we must validate it.
Failing to do so can lead to UB for example with SOCK_PACKET on Linux.

Perform the validation in GetSockOpt::get.  Currently SockType is the
only type that requires validation.

Fixes #1819
2022-11-28 23:07:54 -07:00
Alan Somers
12fb35434f [skip ci] add a CHANGELOG section for the next release 2022-11-28 23:00:24 -07:00
Alan Somers
e0af65b0a0 (cargo-release) version 0.26.0 2022-11-28 22:56:21 -07:00
bors[bot]
1e0de75f58
Merge #1891
1891: Prepare for release 0.26.0 r=rtzoeller a=asomers



Co-authored-by: Alan Somers <asomers@gmail.com>
2022-11-29 05:31:26 +00:00
Alan Somers
17e56e1f38 Prepare for release 0.26.0 2022-11-28 22:26:33 -07:00
Alan Somers
206556d2e4
Merge pull request #1890 from asomers/old-changelogs
[skip ci] add CHANGELOG entries for old point releases.
2022-11-28 22:23:51 -07:00
Alan Somers
ff219e3c42 [skip ci] add CHANGELOG entries for old point releases.
I opted to preserve explicit entries for backports in both the original
feature release and the backported point release, rather than trying to
pretend that the releases were actually sequential.

Also, remove some empty subsections from the file.
2022-11-28 22:18:29 -07:00
Alan Somers
eabcb486e5
Merge pull request #1888 from asomers/0.26.0-CHANGELOG
[skip ci] fix CHANGELOG formatting
2022-11-28 21:56:53 -07:00
Alan Somers
345fd36f17 [skip ci] fix CHANGELOG formatting 2022-11-28 21:35:45 -07:00
bors[bot]
5db5581e70
Merge #1788
1788: Workaround XNU bug in getifaddrs netmasks r=asomers a=roblabla

Fixes #1709 

Co-authored-by: roblabla <unfiltered@roblab.la>
Co-authored-by: Alan Somers <asomers@gmail.com>
2022-11-29 04:11:50 +00:00
Alan Somers
9e6951fd16
Elaborate CHANGELOG entry for PR #1788 2022-11-28 21:01:57 -07:00
bors[bot]
be578c6c75
Merge #1885
1885: Update to memoffset 0.7 r=asomers a=sdroege



Co-authored-by: Sebastian Dröge <sebastian@centricular.com>
2022-11-29 03:58:29 +00:00
bors[bot]
2866bdef39
Merge #1877
1877: PollFd utility functions r=asomers a=JonathanWoollett-Light

Adds `poll::PollFd::any()` and `poll::PollFd::all()` functions which returns if any/all of the events of interest occurred in the last call to `poll` or `ppoll`.

Consider the case:
```rust
let (first_fd, second_fd) = /* ... */;
let mut poll_fds = [
    poll::PollFd::new(interrupt_fd, poll::PollFlags::POLLIN),
    poll::PollFd::new(transfer_fd, poll::PollFlags::POLLIN),
];
let _ = poll::poll(&mut poll_fds, -1)?;

let first = poll_fds[0].revents()? != poll::PollFlags::empty();
let second = poll_fds[1].revents()? != poll::PollFlags::empty();;

if first { /* ... */ }
if second { /* ... */ }
```
which can now be reduced:
```rust
let (first_fd, second_fd) = /* ... */;
let mut poll_fds = [
    poll::PollFd::new(interrupt_fd, poll::PollFlags::POLLIN),
    poll::PollFd::new(transfer_fd, poll::PollFlags::POLLIN),
];
let _ = poll::poll(&mut poll_fds, -1)?;

let first = poll_fds[0].any()?;
let second = poll_fds[1].any()?;

if first { /* ... */ }
if second { /* ... */ }
```

Co-authored-by: Jonathan <jonathanwoollettlight@gmail.com>
2022-11-29 03:03:51 +00:00
Jonathan
92dd754759 PollFd utility functions 2022-11-29 01:41:31 +00:00
bors[bot]
89699b1d7f
Merge #1886
1886: Update use of libc::timespec to prepare for future libc version r=asomers a=wesleywiser

In a future release of the `libc` crate, `libc::timespec` will contain private padding fields on `*-linux-musl` targets and so the struct will no longer be able to be created using the literal initialization syntax.

Update places where `libc::timespec` is created to first zero initialize the value and then update the `tv_sec` and `tv_nsec` fields manually. Many of these places are in `const fn`s so a helper function `zero_init_timespec()` is introduced to help with this as `std::mem::MaybeUninit::zeroed()` is not a `const` function.

Some matches on `libc::timespec` are also updated to include a trailing `..` pattern which works when `libc::timespec` has additional, private fields as well as when it does not (like for
`x86_64-unknown-linux-gnu`).

See also https://github.com/rust-lang/libc/pull/2088

Co-authored-by: Wesley Wiser <wesleywiser@microsoft.com>
2022-11-28 20:20:35 +00:00
Wesley Wiser
006fc6f797 Update use of libc::timespec to prepare for future libc version
In a future release of the `libc` crate, `libc::timespec` will contain
private padding fields on `*-linux-musl` targets and so the struct will
no longer be able to be created using the literal initialization syntax.

Update places where `libc::timespec` is created to first zero initialize
the value and then update the `tv_sec` and `tv_nsec` fields manually.
Many of these places are in `const fn`s so a helper function
`zero_init_timespec()` is introduced to help with this as
`std::mem::MaybeUninit::zeroed()` is not a `const` function.

Some matches on `libc::timespec` are also updated to include a trailing
`..` pattern which works when `libc::timespec` has additional, private
fields as well as when it does not (like for
`x86_64-unknown-linux-gnu`).
2022-11-28 14:31:36 -05:00
Sebastian Dröge
e0bfc3a404 Update to memoffset 0.7 2022-11-28 10:53:49 +02:00
bors[bot]
33a4d495d9
Merge #1865
1865: Add IpMtu sockopt r=asomers a=ShadowJonathan

Resolves https://github.com/nix-rust/nix/issues/1864

Co-authored-by: Jonathan de Jong <jonathandejong02@gmail.com>
2022-11-25 22:35:51 +00:00
bors[bot]
acd01d7634
Merge #1883
1883: Clippy cleanup with the latest nightly. r=rtzoeller a=asomers



Co-authored-by: Alan Somers <asomers@gmail.com>
2022-11-25 17:14:59 +00:00
Alan Somers
0ae109ddad Clippy cleanup with the latest nightly. 2022-11-25 08:27:55 -07:00
Jonathan de Jong
e9f07eea61 add IpMtu sockopt 2022-11-23 10:48:48 +00:00
bors[bot]
a75a3494ce
Merge #1848
1848: SockProtocol::Raw = libc::IPPROTO_RAW for raw sockets r=asomers a=StackOverflowExcept1on

Hey, I wanna to make call like `socket(af_type, SOCK_RAW, IPPROTO_RAW)` but currently there is no way to do it with rust
aad12a0011/sendip.c (L143)

Update: Feel free to add `#[cfg]` attribute if I made mistakes that might cause errors on some platforms

Co-authored-by: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com>
2022-11-21 18:35:42 +00:00
bors[bot]
852219119e
Merge #1880
1880: Use the new UnixAddr::new_unnamed in the unit tests r=rtzoeller a=asomers

Use it in the from_sockaddr_un_abstract_unnamed test.  That test and this method were introduced by PRs #1871 and #1857, which crossed each other.

Co-authored-by: Alan Somers <asomers@gmail.com>
2022-11-21 18:22:08 +00:00
Alan Somers
59c21f772a Use the new UnixAddr::new_unnamed in the unit tests
Use it in the from_sockaddr_un_abstract_unnamed test.  That test and
this method were introduced by PRs #1871 and #1857, which crossed each
other.
2022-11-21 11:15:55 -07:00
StackOverflowExcept1on
38597988f4
Added SockProtocol::Raw = libc::IPPROTO_RAW for raw sockets 2022-11-21 21:13:59 +03:00
bors[bot]
79f04fb3a3
Merge #1857
1857: Add better support for unnamed unix socket addrs r=asomers a=stevenengler

This adds the following 2 functions/methods: `UnixAddr::new_unnamed` and `UnixAddr::is_unnamed`.

Closes #1585

unix(7) on Linux:

> unnamed: A stream socket that has not been bound to a pathname using bind(2) has no name. Likewise, the two sockets created by socketpair(2) are unnamed. When the address of an unnamed socket is returned, its length is `sizeof(sa_family_t)`, and `sun_path` should not be inspected.

**Edit:** This currently isn't working on BSD, but I see why. Will fix it shortly.

Co-authored-by: Steven Engler <opara@cs.georgetown.edu>
2022-11-21 17:45:29 +00:00
bors[bot]
9ea1493a81
Merge #1871
1871: Fix using SockaddrStorage to store Unix domain addresses on Linux r=rtzoeller a=asomers

Since it has variable length, the user of a sockaddr_un must keep track of its true length.  On the BSDs, this is handled by the builtin sun_len field.  But on Linux-like operating systems it isn't.  Fix this bug by explicitly tracking it for SockaddrStorage just like we already do for UnixAddr.

Fixes #1866

Co-authored-by: Alan Somers <asomers@gmail.com>
2022-11-21 17:26:56 +00:00
Steven Engler
f6a22198a4 fixup! Added better support for unnamed unix socket addrs
Removed test assertion
2022-11-21 12:11:50 -05:00
Steven Engler
500baa1633 fixup! Added better support for unnamed unix socket addrs
Changelog
2022-11-21 12:10:40 -05:00
Steven Engler
49bab984ee fixup! Added better support for unnamed unix socket addrs
Make Linux-only
2022-11-21 12:03:11 -05:00
Steven Engler
8884ea38ec Added better support for unnamed unix socket addrs 2022-11-21 12:03:11 -05:00
bors[bot]
8d279853dc
Merge #1873
1873: mmap non-zero length r=asomers a=JonathanWoollett-Light

When calling [`mmap`](https://man7.org/linux/man-pages/man2/mmap.2.html) the passed length needs to be greater than zero, else an  error is returned:

> EINVAL (since Linux 2.6.12) length was 0.

By specifying the argument as `std::num::NonZeroUsize` we eliminate this error case.

Co-authored-by: Jonathan <jonathanwoollettlight@gmail.com>
2022-11-21 16:55:58 +00:00
Jonathan
63c56263fb mmap non-zero length 2022-11-20 22:53:40 +00:00