unix: Network entry API#5049
Conversation
89888d3 to
a7783fd
Compare
This comment has been minimized.
This comment has been minimized.
| pub fn getnetbyname(name: *const c_char) -> *mut netent; | ||
| pub fn getnetbyaddr(net: u32, type_: c_int) -> *mut netent; | ||
| pub fn setnetent(stayopen: c_int); | ||
| pub fn endnetent(); |
There was a problem hiding this comment.
I wonder if this had the same situation as setservent/endservent and we might need a test tweak.
cc @jclulow, @pfmooney for confirmation
Line 1173 in a3e451c
https://github.com/illumos/illumos-gate/blob/5425aa59e8fd3834b86390ed6d8a13586c918df9/usr/src/head/netdb.h#L288-L305
There was a problem hiding this comment.
Oh, i see. I thought this was waiting on feedback from jclulow and pfmooney.
I am not sure about this. The workaround you refer to in
Line 1173 in a3e451c
is in fn test_solarish(), so i guess it is no longer relevant since i now limit this to unix/linux_like/linux?
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
|
The tests fails for Android because the symbol How should i handle this situation? Should i move these new symbols to Linux specifically ( I have tried to run the docker tests locally but can't get it to run. It fails on missing Local log |
|
I got the docker test running locally now. The problem was a I will take a closer look at what fails and what works. |
|
I think it should be ok now. The symbols The CI fails for unrelated reasons. It failed for the same reason on the daily run. @rustbot ready |
This comment has been minimized.
This comment has been minimized.
568607a to
ca8b28f
Compare
This comment has been minimized.
This comment has been minimized.
|
|
||
| pub struct netent { | ||
| pub n_name: *mut c_char, | ||
| pub n_aliases: *mut *mut c_char, |
There was a problem hiding this comment.
I haven't searched all the platforms but at least the n_aliases can vary, e.g Cygwin has it as short: https://cygwin.com/git/?p=newlib-cygwin.git;a=blob_plain;f=winsup/cygwin/include/netdb.h;hb=HEAD
You could add it for platforms where you're confident to use.
There was a problem hiding this comment.
I am only confident for Linux. So i moved the struct netent and the related functions into unix/linux_like/linux/mod.rs and checked that the definition is correct for gnu, musl and uclibc.
| pub fn getnetbyname(name: *const c_char) -> *mut netent; | ||
| pub fn getnetbyaddr(net: u32, type_: c_int) -> *mut netent; | ||
| pub fn setnetent(stayopen: c_int); | ||
| pub fn endnetent(); |
This comment has been minimized.
This comment has been minimized.
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@rustbot ready |
Author moved from all Unix to only Linux
(backport <rust-lang#5049>) (cherry picked from commit ae27070)
(backport <rust-lang#5049>) (cherry picked from commit ae27070)
(backport <rust-lang#5049>) (cherry picked from commit ae27070)
Description
Add functions and struct for the "get network entry" API, including the reentrant GNU extension.
Sources
glic/resolv/netdb.h
Checklist
libc-test/semverhave been updated*LASTor*MAXare included (see #3131)cd libc-test && cargo test --target mytarget);especially relevant for platforms that may not be checked in CI
@rustbot label +stable-nominated