Re: [9fans] Backgrounding a task
“window -m cmd” will run the command in the same namespace, forked, but in new window. “-m” is for “mount”, an alternative way of communication with the window system to /dev/wctl which is default. Yaroslav Kolomiiets 7 жовт. 2017 р. о 15:21 Chris McGee пише: Thanks for the tip! I'll give that a try. Chris З мобільного > On Oct 7, 2017, at 12:04 AM, Skip Tavakkolian > wrote: > > Spitballing here: in the new window do something like > > cat /proc/123/ns | rc > > Or first massage the ns then generate an output for rc. > >> On Fri, Oct 6, 2017, 4:34 PM Chris McGee wrote: >> Hi All, >> >> When I'm using Unix, there's a workflow that I use for long running commands >> that I'm hoping to find the equivalent in the Plan 9 way of doing things. >> >> I will occasionally run a command, realize that it will take a long time to >> complete. I don't want to kill it. I'll just Ctrl-Z and bg to put it into >> the background using the shell. It's almost as if I had run it with '&' in >> the first place. I can then run other commands in the same working >> directory, environment and shell history. >> >> Is there an equivalent to this workflow in Plan 9? >> >> I realize that the whole job control system dates back to old single session >> terminals, which isn't a problem with Rio where you can draw new windows at >> will. Initially I thought, that you just drag that window to a corner >> somewhere and let it complete. But, if I draw a new window it won't be in >> the same working directory, have the same environment and namespace. Maybe >> there is a way to create a window that inherits these from an existing >> process? >> >> Chris
Re: [9fans] Backgrounding a task
Thanks, I was thinking more about the case where I didn't know ahead of time that the command would take a long time. I have a sequence of steps I do in Unix to background the task using job control in the shell. I wasn't sure if there is some kind of plan 9 equivalent to the workflow, even if it is done in a different way. So far, it looks like the closest equivalent is to draw a new window and inherit the namespace of the original one by reading the namespace from the proc. I wonder if there could be a Rio gesture to draw a new window inheriting the namespace of the window I pick by clicking. Chris > On Oct 23, 2017, at 12:20 PM, Yaroslav Kolomiiets wrote: > > “window -m cmd” will run the command in the same namespace, forked, but in > new window. > > “-m” is for “mount”, an alternative way of communication with the window > system to /dev/wctl which is default. > > Yaroslav Kolomiiets > > 7 жовт. 2017 р. о 15:21 Chris McGee пише: > > Thanks for the tip! I'll give that a try. > > Chris > > > > З мобільного >> On Oct 7, 2017, at 12:04 AM, Skip Tavakkolian >> wrote: >> >> Spitballing here: in the new window do something like >> >> cat /proc/123/ns | rc >> >> Or first massage the ns then generate an output for rc. >> >>> On Fri, Oct 6, 2017, 4:34 PM Chris McGee wrote: >>> Hi All, >>> >>> When I'm using Unix, there's a workflow that I use for long running >>> commands that I'm hoping to find the equivalent in the Plan 9 way of doing >>> things. >>> >>> I will occasionally run a command, realize that it will take a long time to >>> complete. I don't want to kill it. I'll just Ctrl-Z and bg to put it into >>> the background using the shell. It's almost as if I had run it with '&' in >>> the first place. I can then run other commands in the same working >>> directory, environment and shell history. >>> >>> Is there an equivalent to this workflow in Plan 9? >>> >>> I realize that the whole job control system dates back to old single >>> session terminals, which isn't a problem with Rio where you can draw new >>> windows at will. Initially I thought, that you just drag that window to a >>> corner somewhere and let it complete. But, if I draw a new window it won't >>> be in the same working directory, have the same environment and namespace. >>> Maybe there is a way to create a window that inherits these from an >>> existing process? >>> >>> Chris
Re: [9fans] Backgrounding a task
> So far, it looks like the closest equivalent is to draw a new window > and inherit the namespace of the original one by reading the namespace > from the proc. The problem with /proc/$pid/ns is entries that can't be "replayed". For example, the following command will not work: mount -b '#|/data' /mnt Nor does it provide any real indication as to what exactly is hooked up to the other end of the 9P pipe. > I wonder if there could be a Rio gesture to draw a new window > inheriting the namespace of the window I pick by clicking. Rio can't access the namespaces of the processes running in its windows. The -m option to window(1) works by rforking a new process with the RFNAMEG flag set and then doing the appropriate mounting and binding to create and use a new rio window. Some months ago I played with the idea of adding support for an "nsjoin" command to the /proc/$pid/ctl file. This allowed you to join the namespace of another process a little something like this: term% ps | grep plumber alex6700:00 0:00 864K Preadplumber alex6710:00 0:00 864K Rendez plumber term% echo nsjoin 670 >/proc/$pid/ctl term% Subsequent changes to the namespace would affect the plumber. If you wanted a copy, just do 'rfork n' after joining the namespace. Of course, a lot of the isolation that per-process namespaces give you is suddenly undone by the introduction of this facility. At this point I'm not entirely convinced that it's worth the trouble. -- Cheers, Alex Musolino