Skip to content

procfsutil: simplify HostnameByPid implementation#98

Merged
fanzu8 merged 1 commit intoccfos:mainfrom
ioworker0:main
Jan 7, 2026
Merged

procfsutil: simplify HostnameByPid implementation#98
fanzu8 merged 1 commit intoccfos:mainfrom
ioworker0:main

Conversation

@ioworker0
Copy link
Copy Markdown
Contributor

Replace setns(2) approach with reading /proc//root/proc/sys/kernel/hostname
directly. This is simpler and avoids the need to lock OS thread and switch
namespaces.

Also removes dependency on golang.org/x/sys/unix.

Replace setns(2) approach with reading /proc/<pid>/root/proc/sys/kernel/hostname
directly. This is simpler and avoids the need to lock OS thread and switch
namespaces.

Also removes dependency on golang.org/x/sys/unix.

Signed-off-by: Lance Yang <[email protected]>
@fanzu8 fanzu8 merged commit f864591 into ccfos:main Jan 7, 2026
1 check passed
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.

2 participants