This is my take on it. I am not an expert. Nor do I have access to the
actual source code. I don't believe that tcsh will do what you want. My
reasoning is below.

In order to run a process in the same address space, the code must use the
spawn() function. I base this assertion on
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/BPXZB1C0/2.209 ,
point #8 in the Usage Notes. This talks about the _BPX_SHAREAS environment
variable. This environment variable is not mentioned anywhere in the
documentation of tcsh.

I note that the description of the fork() function does not mention
_BPX_SHAREAS at all. I therefore conclude that a fork() will always result
in a new address space.

I note that the description of the execve() function says: "The current
process image is replaced with a new process image for the executable file
to be run." That is, the old execution state ceases to exist. So if the
tcsh did an execve() without the fork() in order to run in the same address
space, the shell would exit after the command because the shell would have
ceased to exist. In my mind, doing a exec() is much like doing an XCTL. You
don't return from whence you came.

I notice that on this page:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/BPXZA5C0/TCSHBUINONit
states: "When a command to be executed is found not to be a built-in
command the tcsh shell attempts to execute the command via execve."

Taking these things together, I have come to the conclusion that the tcsh
shell _most likely_ invokes non-builtin commands in the original UNIX way.
That is doing a fork() followed by an exec(). This removes the possibility
of running cozsftp in the same physical address space as the shell.

Any particular reason you wan to use tcsh? I'm just curious because I've
never read anything nice about it.



On Mon, Dec 30, 2013 at 7:19 AM, Mark Jacobs <mark.jac...@custserv.com>wrote:

> I was trying to execute a batch cozsftp command using tcsh as the shell,
> and my dataset allocation (to send a file to an sftp server) kept on
> failing, either with an unable to stat DD, or when I attempted to allocate
> the dynamically allocate the dataset, that allocation failed due to it
> being already allocated elsewhere.
>
> Eventually I realized that the cozsftp command was being executed in
> another address space, but I was unable to figure out how to get tcsh to
> execute that command in the original address space.
>
> I eventually gave up and used the /bin/sh shell to run the batch job.
>
> Is there a magic spell to use with tcsh to have the cozsftp command
> execute in the same address space?
>
> --
> Mark Jacobs
> Time Customer Service
> Tampa, FL
> ----
>
> The quiet ones are the ones that change the universe...
> The loud ones only take the credit.
>
> Londo Mollari - Babylon 5
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>



-- 
This is clearly another case of too many mad scientists, and not enough
hunchbacks.

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to