Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Anyone familiar with auto-fu.zsh project?



On 13 Jun 2018, at 05:48, Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
>But how to run a binary without forking first? I would have to be
>`exec getppid`.

As far as i understand it:

  % echo $$; ( ./getppid 1; ./getppid 2 )
  29746 30173 29746

echo $$     -> main shell
(           -> fork() to sub-shell; new PID, so the PPID is the main shell
./getppid 1 -> fork() and exec(); new PID, so the PPID is the sub-shell
./getppid 2 -> sub-shell is about to finish, so fork()ing again is unnecessary;
               exec() directly instead. getppid assumes the PID of the
               sub-shell, so the PPID remains the main shell

On 13 Jun 2018, at 05:48, Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
>Procfs is nice but lives in a word of cats, echos, ls -l – I mean,
>it's a world of text, files and symlinks. IMO it is good to allow
>users cat etc. it from interactive command line, but for short
>programs, it's like taking away coherency from them, they have to open
>a channel for this file tree, I feel this is unstable.

They wouldn't have to do anything, the script would do it for them. In any case,
if procfs is good enough to implement ps, pgrep, top, &c., on Linux and Solaris,
i bet it's probably good enough for this

dana



Messages sorted by: Reverse Date, Date, Thread, Author