Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

spawnp() problem: creating grandchildren

24 views
Skip to first unread message

Mr. K.V.B.L.

unread,
Apr 18, 2012, 12:40:22 PM4/18/12
to
I have a program called "parent" that calls spawnp(). It starts a program called "child1". "child1" in turn calls spawnp() and attempts to start a program, "child2". This fails however and I don't know why. I only know that child1's spawnp() fails for this:

spawnp() failed with "The value specified for the argument is not correct."

which I left to assume is EINVAL:

<quote>
The value specified for the argument is not correct.

A function was passed incorrect argument values, or an operation was attempted on an object and the operation specified is not supported for that type of object.

An argument value is not valid, out of range, or NULL.

The flags field in the inherit parameter contains an invalid value.
</quote>

I am confused by this blurb in http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=%2Fapis%2Fspawnp.htm

<quote>
If inherit.flags is set to SPAWN_SETPGROUP, the child process group ID is set to the value in inherit.pgroup.

Note: OS/400 does not support the ability to set the process group ID for the child process to a user-specified group ID. This is a deviation from the POSIX standard.
</quote>

I am reading this last bit to mean that you cannot make a program arbitrarily join another process group: you either create a new process group or you become a child, grandchild, etc of a parent process. Maybe I'm not getting the correct meaning from this.

The documentation speaks of children, grandchildren, and so forth, so I believe that what I want to accomplish is possible.

If anyone is interested, I can do into an explanation of why I need this 3-tiered structure in the first place. It all has to do with taking open TCP connections and passing them down the chain to grandchildren processes.

Kelly Beard

iseriesflorida

unread,
Apr 20, 2012, 7:44:06 AM4/20/12
to
On Apr 18, 12:40 pm, "Mr. K.V.B.L." <kenverybigl...@gmail.com> wrote:
> I have a program called "parent" that calls spawnp().  It starts a program called "child1".  "child1" in turn calls spawnp() and attempts to start a program, "child2".  This fails however and I don't know why.  I only know that child1's spawnp() fails for this:
>
> spawnp() failed with "The value specified for the argument is not correct."
>
> which I left to assume is EINVAL:
>
> <quote>
>     The value specified for the argument is not correct.
>
>     A function was passed incorrect argument values, or an operation was attempted on an object and the operation specified is not supported for that type of object.
>
>     An argument value is not valid, out of range, or NULL.
>
>     The flags field in the inherit parameter contains an invalid value.
> </quote>
>
> I am confused by this blurb inhttp://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic...
>
> <quote>
> If inherit.flags is set to SPAWN_SETPGROUP, the child process group ID is set to the value in inherit.pgroup.
>
> Note: OS/400 does not support the ability to set the process group ID for the child process to a user-specified group ID. This is a deviation from the POSIX standard.
> </quote>
>
> I am reading this last bit to mean that you cannot make a program arbitrarily join another process group: you either create a new process group or you become a child, grandchild, etc of a parent process.  Maybe I'm not getting the correct meaning from this.
>
> The documentation speaks of children, grandchildren, and so forth, so I believe that what I want to accomplish is possible.
>
> If anyone is interested, I can do into an explanation of why I need this 3-tiered structure in the first place.  It all has to do with taking open TCP connections and passing them down the chain to grandchildren processes.
>
> Kelly Beard

Is it possible to retrieve what you need at the 2nd level then use it
without going 3 levels deep.
0 new messages