-
Notifications
You must be signed in to change notification settings - Fork 130
feat(sys/kernel): add hostname and domainname #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(sys/kernel): add hostname and domainname #363
Conversation
f35035e to
f233ee7
Compare
|
@eminence Hey would it be possible to get a review on this PR? I was needing hostname and domain for a project I'm working on. |
|
Sure thing, I'll try to take a look this weekend |
eminence
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general looks fine, but two small comments:
- Do we really need these two examples? They're not really doing much.
- Can you add a
cfgcheck in the new tests so that they won't set a hostname unless some feature flag is enabled? In general I don't want changes to be made to the running system (and these tests probably require root to run successfully?)
procfs/src/sys/kernel/mod.rs
Outdated
| let test_domain = String::from("test-host"); | ||
|
|
||
| let test_domain = "test.local".to_string(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of these variables is not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch think I copy pasted something and wasn't paying attention. 😓
Add
sys/kernel/hostnameandsys/kernel/domainnamesupport.Added a new line check on hostname & domainname which are used as a terminator like sysctl. Without the new line terminator trying to clear the values does not work. For example writing
""to domainname is ignored, but writing"\n"does clear the domainname.Related docs: https://man7.org/linux/man-pages/man5/proc_sys_kernel.5.html