Skip to content

Add process devices#836

Merged
vinc merged 14 commits into
trunkfrom
feature/proc-devices
May 10, 2026
Merged

Add process devices#836
vinc merged 14 commits into
trunkfrom
feature/proc-devices

Conversation

@vinc
Copy link
Copy Markdown
Owner

@vinc vinc commented Apr 21, 2026

Add process device files to change process data from userspace:

  • /dev/proc/id to get the PID
  • /dev/proc/dir to get or set the current dir
  • /dev/proc/env to get or set env vars
  • /dev/proc/user to get the current user

@vinc
Copy link
Copy Markdown
Owner Author

vinc commented Apr 21, 2026

We can't use print to change the current dir in the shell as it's an external program, but an echo builtin will do:

~
> echo /tmp => /dev/proc/dir

/tmp
> echo $dir
/tmp

The variable to get the current dir in the shell changed from $DIR to $dir as it is a shell variable and not an environmental variable.

@vinc
Copy link
Copy Markdown
Owner Author

vinc commented Apr 21, 2026

I removed env and replaced it by a new option --env for the shell builtin set:

> read /dev/proc/env
HOME = "/usr/vinc"
USER = "vinc"

> echo TEST=42 => /dev/proc/env

> read /dev/proc/env
HOME = "/usr/vinc"
TEST = "42"
USER = "vinc"

> date
2026-04-21 19:44:24 +0000

> set --env TZ 7200

> read /dev/proc/env
HOME = "/usr/vinc"
TEST = "42"
TZ   = "7200"
USER = "vinc"

> date
2026-04-21 21:44:43 +0200

@vinc
Copy link
Copy Markdown
Owner Author

vinc commented Apr 22, 2026

TODO:

  • How to unset an env var?
  • How to login from userspace?
  • How to keep $dir up to date in the shell?
  • Replace print program with a shell builtin?

@vinc vinc marked this pull request as ready for review May 10, 2026 10:29
@vinc vinc merged commit 50e9b55 into trunk May 10, 2026
1 check passed
@vinc vinc deleted the feature/proc-devices branch May 10, 2026 10:33
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