On Tue, 27 Oct 2020 11:17:24 -0500, Kirk Wolf wrote:
>
>_BPX_SHAREAS won't have any effect on bash, since what _BPX_SHARE does is
>to tell spawn() to "local spawn" the new child process to the same address
>space. It doesn't change how fork() works, which is what bash uses.
>/bin/sh uses spawn() in some places instead of fork()/exec(), which is why
>_BPX_SHAREAS affects it.
>
There's also posix_spawn(), inconvenient because it may scramble file
descriptors
and it may be implemented as a wrapper for fork() with performance costs.
https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn.html#tag_16_371
>The impact of using local spawn() is more than just performance: local
>spawning child processes allows them to use DDs that are allocated in the
>parent. This is very nice if you are local-spawning /bin/sh in a batch
>job step, since the commands that you then run from the script can use the
>DDs allocated in the job step.
>
That sounds like EXEC PGM=BPXBATSL which I understand has some
privilege entanglements. I've heard Co:Z does better.
>The "set -o pipecurrent" setting in
>/bin/sh extends the cases where spawn is used and can assist with this.
>
That might gain performance at the expense of execution environment
isolation, sometimes desirable.
>There's nothing to how spawn() and _BPX_SHAREAS work that isn't documented
>fully by IBM, except for exactly all the rules for when /bin/sh does a
>spawn(). bash should be changed to use spawn, but since the semantics
>are much different than fork()/exec(), this would be very difficult. This
>is a pity, since otherwise I would really like to use it with our Co:Z
>Unix/batch integration tools.
>
>PS> There's nothing wrong with using bash as your interactive shell and
>/bin/sh as a magic line in selected scripts and in batch.
>
Ubuntu uses (formerly?) /bin/dash, touted as bare minimum POSIX, for
improved performance of system startup and of system(). But dash
lacks command line editing which POSIX requires. I tried compiling dash
with linedit(?) but it bloated to the size of bash. I never tried stripping
the executable.
The bash forum is rife with requests, "Please, please add just this one
little bashism. It's extremely useful!" Ob. Camel's Nose.
Thanks,
gil
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN