Skip to content

Network entry API#5049

Open
Rawk wants to merge 3 commits into
rust-lang:mainfrom
Rawk:unix-network-entry
Open

Network entry API#5049
Rawk wants to merge 3 commits into
rust-lang:mainfrom
Rawk:unix-network-entry

Conversation

@Rawk
Copy link
Copy Markdown

@Rawk Rawk commented Apr 10, 2026

Description

Add functions and struct for the "get network entry" API, including the reentrant GNU extension.

Sources

glic/resolv/netdb.h

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot label +stable-nominated

@rustbot rustbot added S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Apr 10, 2026
@Rawk Rawk force-pushed the unix-network-entry branch from 89888d3 to a7783fd Compare April 10, 2026 10:52
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 11, 2026

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.

Copy link
Copy Markdown
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also it'd be great if could prefer rebase over merge and squash commits into one.

View changes since this review

Comment thread src/unix/mod.rs
Comment on lines +210 to +213
n_name: *mut c_char,
n_aliases: *mut *mut c_char,
n_addrtype: c_int,
n_net: u32,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these should be pub.

Comment thread libc-test/semver/unix.txt
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also add getnetbyname and getnetbyaddr

Comment thread src/unix/mod.rs
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();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this had the same situation as setservent/endservent and we might need a test tweak.
cc @jclulow, @pfmooney for confirmation

"setservent" | "endservent" => true,

https://github.com/illumos/illumos-gate/blob/5425aa59e8fd3834b86390ed6d8a13586c918df9/usr/src/head/netdb.h#L288-L305

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 17, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants