Skip to content

feat(nx-rt-core): answer where the console can be reached - #170

Merged
LNSD merged 1 commit into
mainfrom
lnsd/gethostid
Aug 17, 2026
Merged

LNSD merged 1 commit into
mainfrom
lnsd/gethostid

Conversation

@LNSD

@LNSD LNSD commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

A program that tells a host how to reach it has to know its own address, and the network-interface service is what answers. Asking needs the service-manager session a process gets exactly one of, which is why the symbol sits at the runtime rather than beside the socket driver.

  • gethostid opens a nifm:u session, asks for the current address, and closes it again: the answer changes whenever the console joins or leaves a network, so there is nothing worth keeping between calls
  • Which command opens the general-service sub-interface follows the running firmware, renumbered in HOS 3.0.0, and the firmware version is held here
  • Every failure answers with the loopback address rather than reporting, because the C signature has no way to say "no answer" and a caller asking where it can be reached is better served by the address that always works
  • It sits with the other network-interface work under use_nx_sys_net rather than with the resolver overrides it neighbours upstream: it asks nifm, not sfdnsres, and that option already carries the dependency
  • gethostname is left to libnx, whose body calls gethostid and so reaches this through the alias

A program that tells a host how to reach it has to know its own address, and the network-interface service is what answers. Asking needs the service-manager session a process gets exactly one of, which is why the symbol sits at the runtime rather than beside the socket driver.

- `gethostid` opens a `nifm:u` session, asks for the current address, and closes it again: the answer changes whenever the console joins or leaves a network, so there is nothing worth keeping between calls
- Which command opens the general-service sub-interface follows the running firmware, renumbered in HOS 3.0.0, and the firmware version is held here
- Every failure answers with the loopback address rather than reporting, because the C signature has no way to say "no answer" and a caller asking where it can be reached is better served by the address that always works
- It sits with the other network-interface work under `use_nx_sys_net` rather than with the resolver overrides it neighbours upstream: it asks `nifm`, not `sfdnsres`, and that option already carries the dependency
- `gethostname` is left to libnx, whose body calls `gethostid` and so reaches this through the alias

Signed-off-by: Lorenzo Delgado <lnsdev@proton.me>
@LNSD
LNSD added this pull request to the merge queue Aug 17, 2026
Merged via the queue into main with commit b281329 Aug 17, 2026
4 checks passed
@LNSD
LNSD deleted the lnsd/gethostid branch August 17, 2026 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant