Commit Graph

3077 Commits

Author SHA1 Message Date
jiangcuo
daf156460d
Update linux.rs 2023-12-24 17:01:10 +08:00
Yiming
e73182c441
fix: typo "fr" (#2274) 2023-12-23 03:16:47 +00:00
SteveLauC
2c6bbc44a5
chore: fix wrong changelog of 2270[skip ci] (#2272) 2023-12-22 09:22:31 +08:00
SteveLauC
cc42c028a2
feat: AT_EMPTY_PATH for FreeBSD/Hurd (#2270) 2023-12-19 21:39:53 +00:00
Louis
172ca24d19
Add mkdtemp (#1297) 2023-12-18 07:31:01 +00:00
lauren n. liberda
b9b40776fe
statfs: fixes for s390x+musl (#1835) 2023-12-16 06:16:56 +00:00
Alan Somers
5102376164
Add the ListenQLimit sockopt (SO_LISTENQLIMIT) (#2263) 2023-12-16 03:59:07 +00:00
Alan Somers
7c3d84beb7
Use the latest libc release (#2265)
It looks like the libc team cut a release just after @devnexen's last
PR.  Switch to it.  That makes it easier for downstream crates to use a
git dependency on Nix.
2023-12-15 00:33:57 +00:00
SteveLauC
88c73492f6
docs: add hurd to tier 3 in README (#2256) 2023-12-11 22:29:46 +00:00
SteveLauC
c0d8ad4df4
refactor: move tests to the test dir (#2257)
* refactor: move tests to the test dir

* try fixing it

* try fixing it

* fix Redox and FreeBSD

* document it
2023-12-11 22:29:22 +00:00
SteveLauC
26b070a058
test: enable test_aio_suspend on both Linux and macOS (#2262) 2023-12-11 17:45:33 +00:00
David CARLIER
8db07014f4
sys::mman adding MMAP_TRYFIXED for netbsdlike platforms. (#2260) 2023-12-11 08:29:06 +00:00
David CARLIER
43505e0c86
sys::eventfd enabled for FreeBSD. (#2259)
* sys::eventfd enabled for FreeBSD.

* CHANGELOG entry
2023-12-10 06:20:12 +00:00
Jonathan Woollett-Light
9113d606be
feat: EventFd type (#1945) 2023-12-10 02:56:43 +00:00
SteveLauC
1c189d99bc
feat: Add associated constants UTIME_OMIT UTIME_NOW to TimeSpec (#1879)
* feat: support UTIME_NOW & UTIME_OMIT

* fmt

* fmt

* linux x32 type cast

* fmt
2023-12-10 00:27:36 +00:00
SteveLauC
d518abd5e8
feat: reboot(2) for OpenBSD/NetBSD (#2251) 2023-12-09 16:20:11 +00:00
sgasse
a09971fd10
Fix setting sockopt::IpMulticastTtl (#2072)
* Fix the value of optlen as passed to libc::setsockopt

Ever since the sockopt macro was written in
979faf0976 we've been passing the wrong
size for u8 and usize sockopts.

* Add tests for sockopt::IpMulticastTtl #2073

On Linux and Android, sockopt::IpMulticastTtl can be set for both IPv4
and IPv6 sockets, but not on FreeBSD.

---------

Co-authored-by: Alan Somers <asomers@gmail.com>
Co-authored-by: Simon B. Gasse <sgasse@users.noreply.github.com>
2023-12-09 16:18:22 +00:00
SteveLauC
6961f0fabd
refactor: cfg for test/* (#2230)
* refactor: cfg for test/*

* one more netbsdlike

* more cfg
2023-12-09 16:15:41 +00:00
David CARLIER
2ab5558e08
fix, mostly, solaris build. (#2248)
With few exceptions as newer interfaces like preadv/pwritev unsupported
only on solaris.
2023-12-08 19:29:11 +00:00
SteveLauC
c9dfad9004
docs: document that we should use libc from git repo when under dev (#2246)
* docs: document that we should use libc from git repo when under dev

* try fix diff

* try fix diff

* respond to review
2023-12-08 18:52:05 +00:00
SteveLauC
8708d5b3b7
refactor: some clippy warnings (#2250) 2023-12-08 18:51:50 +00:00
Samuel Thibault
a90b4b215f
Add GNU/Hurd support (#2131) 2023-12-08 18:51:35 +00:00
David CARLIER
b763d7355a
sys::memfd additional flags related to the hugetlb filesystem support. (#2252) 2023-12-06 08:43:36 +00:00
David CARLIER
da451400ea
sys::sendfile adding solaris' sendfilev wrapper proposal. (#2207) 2023-12-04 06:28:48 +00:00
David CARLIER
3a20eef318
FreeBSD's rfork wrapper proposal (#2121) 2023-12-04 06:24:21 +00:00
sgasse
75bddf255a
Add Ipv6MulticastHops as socket option (#2234) (#2234)
Co-authored-by: Simon B. Gasse <sgasse@users.noreply.github.com>
2023-12-04 02:43:07 +00:00
SteveLauC
8d656e32f6
feat: MapFlags::map_hugetlb_with_size_log2 for Android/Fuchsia (#2245)
* feat: MapFlags::map_hugetlb_with_size_log2 for Android/Fuchsia

* fmt Cargo.toml

* changelog
2023-12-04 00:11:56 +00:00
Alan Somers
cb56e89aab
Ensure all tests use unique IP ports (#2196) 2023-12-03 23:02:26 +00:00
Daniil Bondarev
db5353cae0
Added TcpFastOpenConnect sockopt (#2247)
From [tcp](https://man7.org/linux/man-pages/man7/tcp.7.html) man page:
```
TCP_FASTOPEN_CONNECT (since Linux 4.11)
       This option enables an alternative way to perform Fast
       Open on the active side (client).  When this option is
       enabled, connect(2) would behave differently depending on
       if a Fast Open cookie is available for the destination.

       If a cookie is not available (i.e. first contact to the
       destination), connect(2) behaves as usual by sending a SYN
       immediately, except the SYN would include an empty Fast
       Open cookie option to solicit a cookie.

       If a cookie is available, connect(2) would return 0
       immediately but the SYN transmission is deferred.  A
       subsequent write(2) or sendmsg(2) would trigger a SYN with
       data plus cookie in the Fast Open option.  In other words,
       the actual connect operation is deferred until data is
       supplied.

       Note: While this option is designed for convenience,
       enabling it does change the behaviors and certain system
       calls might set different errno values.  With cookie
       present, write(2) or sendmsg(2) must be called right after
       connect(2) in order to send out SYN+data to complete 3WHS
       and establish connection.  Calling read(2) right after
       connect(2) without write(2) will cause the blocking socket
       to be blocked forever.

       The application should either set TCP_FASTOPEN_CONNECT
       socket option before write(2) or sendmsg(2), or call
       write(2) or sendmsg(2) with MSG_FASTOPEN flag directly,
       instead of both on the same connection.

       Here is the typical call flow with this new option:

           s = socket();
           setsockopt(s, IPPROTO_TCP, TCP_FASTOPEN_CONNECT, 1, ...);
           connect(s);
           write(s); /* write() should always follow connect()
                      * in order to trigger SYN to go out. */
           read(s)/write(s);
           /* ... */
           close(s);
```
2023-12-03 23:01:28 +00:00
Chris
9b39cf9f0e
Added Flock object for automatic unlock on drop. (#2170)
* Added  object for automatic unlock on drop.

* Added appropriate changelog file.

* Fixed doc error on `Flock`.

* Requested changes to make `fcntl::flock` private and OwnedFd instead of RawFd.

* Indent fix.

* Removed doc links to private item, updated imports.

* More import fixes.

* Format changes.

* Remove unused import for redox.

* Added `Flockable` trait per discussions, added tests for `Flock`.

* Simplified flock error conditionals.

* Added missing cfg flags for `Flockable`.

* Added missing cfg flags for impl of `Flockable` on `File`.

* Update src/fcntl.rs

Co-authored-by: SteveLauC <stevelauc@outlook.com>

* Updated `Flockable` comment per suggestion.

* Finalized `FlockArg` as enum and removed TODO accordingly, removed flock wrapper entirely.

* Implemented `Flockable` for `OwnedFd` as well.

* Fixed linting error.

* Updated changelog accordingly.

* Corrected errno logic in `Flock::lock`.

* Properly dropped inner type for `Flock`.

* Replaced `ManuallyDrop` with `Option` as inner `Flock` type to avoid double-free.

* Fixed linting errors.

* Removed unnecessary cfg condition, updated documentation.

* Modified Flock behavior for drop() and unlock().

* Reverted changes to original `flock()` and `FlockArg` for deprecation period, added EINVAL case if the unlock operation is given to `Flock::lock()`.

* Refactored `Flock` to wrap T directly and avoid a double-free after `unlock()` is used.

* Fixed linting errors.

* More linting fixes.

* Fixed example code for `Flock::unlock()`.

* Made requested changes.

* Removed duplicate import.

* Format change.

---------

Co-authored-by: SteveLauC <stevelauc@outlook.com>
2023-12-03 03:06:23 +00:00
David CARLIER
2ad5573b9e
sys::socket fixes for haiku, illumos's cfg to solarish compound. (#2242) 2023-12-02 22:05:29 +00:00
Daniil Bondarev
3b1ae36c26
Added IpBindAddressNoPort sockopt (#2244)
From [man page](https://man7.org/linux/man-pages/man7/ip.7.html):
```
IP_BIND_ADDRESS_NO_PORT (since Linux 4.2)
       Inform the kernel to not reserve an ephemeral port when
       using bind(2) with a port number of 0.  The port will
       later be automatically chosen at connect(2) time, in a way
       that allows sharing a source port as long as the 4-tuple
       is unique.
```
2023-12-02 22:01:43 +00:00
SteveLauC
a4e0c9544c
feat: ControlMessageOwned::{Ipv4RecvIf,Ipv4RecvDstAddr} for DragonFlyBSD (#2240)
* feat: Enable ControlMessageOwned::{Ipv4RecvIf,Ipv4RecvDstAddr} for DragonFlyBSD

* fix DrafonFlyBSD

* fix Linux

* fix cfg
2023-12-02 17:10:19 +00:00
SteveLauC
e95162f288
refactor: enable most macOS funcs for apple_targets (#2241)
* refactor: enable most macOS funcs for apple_targets

* respond to review

* respond to review
2023-12-02 17:10:04 +00:00
SteveLauC
83dfd90741
refactor: apply the netbsdlike alias for src/* (#2231)
* refactor: apply the netbsdlike alias for src/*

* remove openbsd
2023-12-01 00:04:01 +00:00
SteveLauC
0bb23ca24d
Revert "more cfg alias targets (#2236)" (#2237)
This reverts commit e13a18275e.
2023-12-01 00:00:41 +00:00
Jan Adä
e13a18275e
more cfg alias targets (#2236) 2023-11-30 06:49:56 +00:00
SteveLauC
39ad47bc80
refactor: remove the l4re target (#2228) 2023-11-27 00:51:38 +00:00
SteveLauC
1bd6b90fd2
refactor: cfg for sys/time.rs (#2229)
* refactor: cfg for sys/time.rs

* fmt
2023-11-27 00:15:39 +00:00
SteveLauC
2f810decd2
refactor: cfg for fcntl/fetures/ifaddrs/lib/poll/sched/time (#2215)
* refactor: cfg for fcntl/fetures/ifaddrs/lib/poll/sched/time

* revert the wrong change
2023-11-27 00:15:06 +00:00
Jan Adä
e411540aeb
netbsdlike (#2226) 2023-11-26 23:32:57 +00:00
SteveLauC
4e5f08972d
refactor: cfg for socket/sockopt.rs (#2225) 2023-11-26 16:11:09 +00:00
SteveLauC
51adb3023c
refactor: cfg for socket/mod.rs (#2224) 2023-11-26 16:03:06 +00:00
SteveLauC
974740f16c
refactor: cfg for socket/addr.rs (#2223) 2023-11-26 15:57:45 +00:00
SteveLauC
89aa05e086
refactor: cfg for ioctl/* & ptrace/* (#2222) 2023-11-26 15:49:18 +00:00
SteveLauC
fefed8eab4
refactor: cfg for unistd.rs (#2216) 2023-11-26 15:48:26 +00:00
SteveLauC
39dfa2bb58
refactor: cfg for mount/* & if_.rs (#2217) 2023-11-26 15:39:26 +00:00
SteveLauC
8cc58e7655
refactor: cfg for dir/env/errno (#2214) 2023-11-26 15:38:02 +00:00
SteveLauC
2563d24f3e
refactor: cfg for termios.rs (#2220) 2023-11-26 15:29:36 +00:00
SteveLauC
ab1d1beb31
refactor: cfg for time/uio/wait (#2221) 2023-11-26 15:26:05 +00:00